There are bugs and incidents that stupid, awkward, ugly, well hidden,
embarassing and unexpected one might not even believe in their existence.
Nevertheless, they do exist.
On this page I will present several of those. Your contributions are welcome!
#/bin/sh
whoi=`whoami`
if "$whoi" = "root"; then
echo "*root-root!*"
else
echo "*sniff*"
fi
and on my machine it says:
ARC: Cannot read source archive root.arc
UNIX: No such file or directory
*sniff*
Huh? No single line saying somthing like ARC ... and what about UNIX??
How comes?
tentacle% whoi=`whoami`
tentacle% echo $whoi
marc
tentacle% marc
MARC - Archive merger, Version 5.21, created on 04/22/87 at 15:05:10
Usage: MARC [ . . .]
Where: is the archive to add files to,
is the archive to get files from, and
is zero or more file names to get.
Adapted from MSDOS by Howard Chu
tentacle% marc = "root"
ARC: Cannot read source archive root.arc
UNIX: No such file or directory
--- nonexist.sh ---
#!/bin/sh
# This program is spread in the evil hope that it will be desastrous,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABATAILITY or FITNESS FOR A PARTICULAR PERSON.
srcdir=`whereis vi`
if test -z "$srcdir"; then
echo "Eyes closed. Cannot find vi." 1>&2
else
echo Found $srcdir
fi
echo "I am blind no more!"
-------------------
.. which refuses to run:
tentacle% ./nonexist.sh
zsh: no such file or directory: ./nonexist.sh
tentacle% ls -l ./nonexist.sh
-rwxr-xr-x 1 marc marc 562 Sep 26 1999 nonexist.sh
And, yes, everything is OK with the libs.
Reason for this behavior:
As it seems the file was converted from DOS to UNIX, leaving an invisible
character (which can only be seen using a hex editor/hexdump) behind the
#!/bin/sh
string,
making it a lot different from the string #!/bin/sh
.
Here is the File: nonexist.sh
The first line:
# ! / b i n / s
h \n
23 21 2F 62 69 6E 2F
73 68 0D 0A
Next result: console window gets flooded with messages
/Addressbook: permission denied
.
Started an xterm and looked what was happening.. hundreds of copys of
sh foobar.c &
hanging around.. and they can't be all
killed at once using one command due to no "killall" command.
One minute later:
Proc table full
floods the screen.
foobar.c
:
/*
* foobar.c
*
* This code does ...
...
/Addressbook: permission denied
was due to a file
Addressbook
in the root directory which of course was attempted to
execute by /*
(first line of foobar.c).
The File was executed by olwm file manager because it had an x bit left over
from transport on a msdos filesystem.