Newsgroups: comp.unix.ultrix
Path: utzoo!utgpu!watserv1!watcgl!idallen
From: "Ian! D. Allen [CGL]" <idallen@watcgl.waterloo.edu>
Subject: Ultrix 3.1 (VAX) #! interpreter symlink bug
Message-ID: <1991Apr14.201659.16075@watcgl.waterloo.edu>
Sender: idallen@watcgl.waterloo.edu (Ian! D. Allen [CGL])
Organization: Computer Graphics Laboratory, University of Waterloo, Ontario, Canada
Date: Sun, 14 Apr 1991 20:16:59 GMT
Lines: 36

#!/bin/sh
# Ultrix-32 V3.1 (Rev. 11)
# Run this on Ultrix 3.1 and see how your #! path symlink messes up.
# idallen@watcgl.waterloo.edu

cd /tmp

# Create an executable file using the "/tmp/2" interpreter.
#
cat >1 <<'EOF'
#!/tmp/2
echo $0 hi there
EOF
chmod +x 1

# Create the "/tmp/2" interpreter as a symlink to a huge pathname.
#
long=/tmp/6789a123456789b123456789c123456789d
ln -s $long 2

# And put sh into the long pathname.
#
cp /bin/sh $long

# Try to execute the file.
# On Ultrix 3.1 (VAX) you'll see "456789d: 456789d: cannot open" here.
# No problem with other Unixes, or on other versions of Ultrix.
# The conjecture is that Ultrix 3.1 is putting a 32-byte limit on the
# *symlink* expansion of the #! interpreter.
#
./1

rm 1 2 $long
-- 
-IAN! (Ian! D. Allen) idallen@watcgl.uwaterloo.ca idallen@watcgl.waterloo.edu
 [129.97.128.64]  Computer Graphics Lab/University of Waterloo/Ontario/Canada
