Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I see solaris (I'm using developer preview 2) has an md5sum command, but it's not very friendly. it is upset up dirnames (simple error) and will not recurse.
I have tried args and am hitting my head against a brick wall, these are my attempts so far:
1) build a list of files with
find /store/data
This will print a list of files to be hashed
2) pass it through xargs to md5sum
find /store/data | xargs md5sum | tee sums
the tee sums on the end is just so that it prints to screen and a log file to be used later, at least that is the intention
The main problem I am having is that there are whitespaces in the filenames, and the -0 (or --null) of xargs is not implemented in solaris, nor is the -print0 of find.
on directories and files without spaces, it works, but parses by space (and hence breaks up) when a filename or dir has a space. Also, because of filename problems, the listing is halted only a few files into the process, yet without "xargs md5sum", the whole list of all files is processed
find /store/data -type f -exec xargs md5sum {} + | tee sums
just doesn't work, it seems xargs is now having a problem with "max arglist" being greater than 2048 characters.
Now that can't be referring to the length of filenames, even with burried directories, I can't see a filename length of 2K characters! LOL
Also, I should point out, there are about 22000 files that this needs to process, is that the problem?
This is the error I am receiving:
Code:
dave@solaris:~# find /solaraid/TB2 -type f -exec xargs md5sum {} +
xargs: a single arg was greater than the max arglist size of 2048 characters
xargs: a single arg was greater than the max arglist size of 2048 characters
xargs: a single arg was greater than the max arglist size of 2048 characters
dave@solaris:~#
and considering it's 22000 files, I am only getting this error 3 times. And when passed to the file (as in: | tee sums), the file is empty
My mistake, a cut and paste error, this is really what I wanted to suggest:
Code:
find /store/data -type f -exec md5sum {} + | tee sums
No problems, if I had a little better grasp of the ins and outs of unix commands I could have spotted it myself anyway, but then I wouldn't have posted here asking for help ;-P
I have just been reading over the find/exec command operation, and with the appended '+'...
Am I reading this correctly?
Quote:
-exec command {} +
This variant of the -exec option runs the specified command on
the selected files, but the command line is built by appending
each selected file name at the end; the total number of invoca-
tions of the command will be much less than the number of
matched files. The command line is built in much the same way
that xargs builds its command lines. Only one instance of '{}'
is allowed within the command. The command is executed in the
starting directory.
Does this mean that all the file names are concatenated to a command line and passed to the md5sum? That os the way I am reading it, and to make it more interesting, that males a command line of over 2,000,000 characters!
That's pretty impressive!
Ahh, re-reading it on preview...
"the total number of invocations of the command will be much less than the number of matched files."
So, it might call the md5sum application 100 or 1000 times, but not the full 22,000 times (the number of files)? or is it called just once?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.