*** ver_linux Sun Feb 4 23:53:11 2001
--- /tmp/ver_linux Mon Feb 5 00:00:54 2001
***************
*** 7,12 ****
--- 7,19 ----
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
echo '-- Versions installed: (if some fields are empty or look'
echo '-- unusual then possibly you have very old versions)'
+
+ # to avoid the effect of aliasing "ls" command.
+ # YMMV.
+ # (I am not sure if other commands require similar
+ # treatment.)
+ LS=`which ls`
+
uname -a
insmod -V 2>&1 | awk 'NR==1 {print "Kernel modules ",$NF}'
echo "Gnu C " `gcc --version`
***************
*** 14,24 ****
'/GNU Make/{print "Gnu Make ",$NF}'
ld -v 2>&1 | awk -F\) '{print $1}' | awk \
'/BFD/{print "Binutils ",$NF}'
! ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed -e 's/\.so$//' \
| awk -F'[.-]' '{print "Linux C Library " $(NF-2)"."$(NF-1)"."$NF}'
echo -n "Dynamic linker "
ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -1
! ls -l /usr/lib/lib{g,stdc}++.so 2>/dev/null | awk -F. \
'{print "Linux C++ Library " $4"."$5"."$6}'
ps --version 2>&1 | awk 'NR==1{print "Procps ", $NF}'
mount --version | awk -F\- '{print "Mount ", $NF}'
--- 21,31 ----
'/GNU Make/{print "Gnu Make ",$NF}'
ld -v 2>&1 | awk -F\) '{print $1}' | awk \
'/BFD/{print "Binutils ",$NF}'
! ${LS} -l `ldd /bin/sh | awk '/libc/ { print $3 } ' ` | sed -e 's/\.so$//' \
| awk -F'[.-]' '{print "Linux C Library " $(NF-2)"."$(NF-1)"."$NF}'
echo -n "Dynamic linker "
ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -1
! ${LS} -l /usr/lib/lib{g,stdc}++.so 2>/dev/null | awk -F. \
'{print "Linux C++ Library " $4"."$5"."$6}'
ps --version 2>&1 | awk 'NR==1{print "Procps ", $NF}'
mount --version | awk -F\- '{print "Mount ", $NF}'
[Ishikawa]
> I just noticed that running
>
> . /usr/src/linux/script/ver_linux
>
> prints out strange libc version
[...]
> I found that if the command "ls" is aliased to "ls -aF"
So ... don't use '.' to execute scripts. If there is some
documentation somewhere that told you to do this, please notify the
author that it is wrong.
sh scripts/ver_linux
Peter
Peter Samuelson wrote:
> [Ishikawa]
> > I just noticed that running
> >
> > . /usr/src/linux/script/ver_linux
> >
> > prints out strange libc version
> [...]
> > I found that if the command "ls" is aliased to "ls -aF"
>
> So ... don't use '.' to execute scripts. If there is some
> documentation somewhere that told you to do this, please notify the
> author that it is wrong.
>
> sh scripts/ver_linux
>
This is a good observation.
I have no idea why I invoked ver_linux using "." : I must have
seen it somewhere and just followed it somehow.
Hard to tell where I have seen. I must have seen it in the last few
days.
Here is one URL where "." is used, but this was not where I saw the
usage.
http://oss.sgi.com/projects/devfs/mail/devfs/msg00261.html
I have found the same problem cropped up in the kernel mailing list
before.
http://uwsg.iu.edu/hypermail/linux/kernel/0003.1/0898.html
The above thread showed that non-other than Alan Cox also chimed in the
thread.
So there must have been a reason to let people try "." for
invoking /usr/src/linux/scripts/ver_linux.
One theory might be that, as a root, people may run
# ./ver_linux (under scripts directory).
And then, when they try to show what they did, they may
create a report showing the FULL path name of the scripts so that
there is no mistaking ver_scripts for something else.
And in doing so, somebody might have forgotten to remove the
leading "."
#./usr/src/linux/scripts/ver_linux
Somebody eles looked at the above and "figured" that the
leading "./" is a typo and thus corrects it to ". /"
and now we have
#. /usr/src/linux/scripts/ver_linux
Anyway, I have found another libc version output
in somebody's post. The poster must have similar problem as I did.
(See at the end for ver_linux output result. )
http://www.uwsg.indiana.edu/hypermail/linux/kernel/9906.3/0990.html
So in any case, I think protecting the
ver_linux from strange interaction of various
shell features might be a good idea after all.
(I was not convinced why "sh /usr/src/linux/scripts/ver_linux" works
since /bin/sh is a symlink to bash in my setup and it seems that
my ./bashrc includes the ls alias. But when I tried it, it works. )
[Ishikawa <[email protected]>]
> I have no idea why I invoked ver_linux using "." : I must have seen
> it somewhere and just followed it somehow.
Who knows. Anyway, the following works in 'bash' at least -- don't
know about other shells -- but it's quite a hack....
Peter
--- scripts/ver_linux~ Tue Sep 19 22:28:37 2000
+++ scripts/ver_linux Mon Feb 5 10:38:21 2001
@@ -4,6 +4,15 @@
# /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may
# differ on your system.
#
+case "$_" in /*/sh|/*/bash|sh|bash) ;; *)
+ echo '*** Warning: you appear to have used the dreaded'
+ echo '*** . /path/to/ver_linux'
+ echo '*** syntax -- I hope you don'\''t have any aliases set'
+ echo '*** that might affect this script.'
+ echo '*** Recommended syntax is:'
+ echo '*** sh /path/to/ver_linux'
+ ;;
+esac
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
echo '-- Versions installed: (if some fields are empty or look'
echo '-- unusual then possibly you have very old versions)'