Alexander Stecker wrote: > Roland Mainz schrieb: > > Richard Lowe wrote: > >> Alexander Stecker <alexander.stecker at kollerbeck.de> writes: > >>> Bart Smaalders schrieb: > >>>> Alexander Stecker wrote: > >>>>> Bart Smaalders schrieb: > >>>>>> Alexander Stecker wrote: > > [snip] > >>>>> as at solstice:/usr/bin$ md5sum /usr/bin/sum /usr/gnu/bin/sum > >>>>> 18f3d84bdbfde9c6c3d36a5ad4d8bfbf /usr/bin/sum > >>>>> db6538ef7a5436a08fa87a450ac5a4d0 /usr/gnu/bin/sum > >>>>> as at solstice:/usr/bin$ uname -a > >>>>> SunOS solstice 5.11 snv_75 i86pc i386 i86pc > >>>> Your sum version doesn't match. Where did it come from? > >>> i've installed the latest ksh93 tarball from the ksh integration > >>> project. in the tarball file list > >>> (http://www.opensolaris.org/os/project/ksh93-integration/downloads/ksh93_integration_20071105_snapshot_i386.lsfiles.txt) > >>> > >>> i found the explanation: > >>> > >>> hr-xr-xr-x test001/users 0 2007-11-06 04:09:14 usr/bin/sum link to > >>> usr/bin/bg > >> >From memory, ksh93 has a builtin sum(1), it looks like Roland enabled > >> that (I would bet that usr/bin/bg was a shellscript, similar to the > >> 'alias.ksh' hack that current ksh uses). > > > > Right... but that doesn't explain his problems. The "sum" builtin (and > > /usr/bin/sum which is a shell script which calls the ksh93 "sum" builtin > > like this: > > -- snip -- > > #!/usr/bin/ksh93 > > builtin basename > > cmd="$(basename "$0")" > > ${cmd} "$@" > > -- snip -- > > ) should return the same hash values as the old Solaris /usr/bin/sum > > > > Alex: > > 1. Could you please post the output of: > > $ bash -c 'echo "chicken monster" | sum' > > $ ksh93 -c 'echo "chicken monster" | sum' > > root: > > # bash -c 'echo "chicken monster" | sum' > 32758 1 > # ksh93 -c 'echo "chicken monster" | sum' > 32758 1 > > non-root: > > as at solstice:~$ bash -c 'echo "chicken monster" | sum' > 1543 1 > as at solstice:~$ ksh93 -c 'echo "chicken monster" | sum' > 1543 1 > > looks as i screw up something... > > > > > 2. Is it possible that you upload the java tarballs which caused the > > problem somewhere to the net (where I can access them) and post the > > output of $ /usr/sfw/bin/openssl md5 name-of-java-tarball # back to this > > list, please ? > > i've downloaded the java file from > http://java.com/en/download/solaris_manual.jsp?locale=en&host=java.com > (x86 version). to get comparable results i've uploaded "my" file to > http://sv-kollerbeck.de/dl/jre-6u3-solaris-i586.sh > > as at solstice:~/Desktop$ /usr/sfw/bin/openssl md5 jre-6u3-solaris-i586.sh > MD5(jre-6u3-solaris-i586.sh)= 5b25269d5059a04411be992ac630b926 > > > > > 3. Could you please post the output of /usr/bin/env to an reply to this > > email ? Somehow my feeling tells me that PATH vs. builtin path bindings > > is responsible for this screw-up. [snip]
AFAIK this was fixed by http://bugs.grommit.com/show_bug.cgi?id=399 ('"alias.sh" may execute the wrong command'). It turned out that neither bash nor ksh93 were responsible for the trouble, instead we found that the script (called "alias.sh") we used to link /usr/bin/sum to the "sum" builtin command had a small glitch. For example the script originally looks like this: -- snip -- #!/usr/bin/ksh93 builtin basename cmd="$(basename "$0")" ${cmd} "$@" -- snip -- ... if PATH is /usr/gnu/bin:/usr/bin and a "sum" builtin is bound to /usr/bin/sum and the script should execute the "sum" builtin it will execute /usr/gnu/bin/sum instead of the builtin command because /usr/gnu/bin comes before /usr/bin in PATH. The solution may be to execute a simple "builtin ${cmd}" before '${cmd} "$@"', however this is tricky becase some consumers of the script like "type" are in fact aliases to other builtin commands, rendering the "builtin ${cmd}"-solution useless. AFAIK the solution is therefore to check whether the requested command is an alias or not - if it isn't an alias we load the requested builtin command without a path binding. If the command is an alias we assume that the executed command is a "shell special builtin" which cannot be bound to a specific element in PATH (alternatively we could add a "blacklist" in the script itself to handle this case for the few commands which use aliases but AFAIK that's not neccesary for now...). Sorry for the hiccup... ---- Bye, Roland P.S.: The java script should really use "cksum" since it's hash value should be identical across platforms... -- __ . . __ (o.\ \/ /.o) roland.mainz at nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 7950090 (;O/ \/ \O;)