Ultrix 4.1 still has the mv/rename symlink bug?

Jay Vassos-Libove libove at libove.det.dec.com
Thu Jan 31 02:58:21 AEST 1991


In article <1991Jan29.221803.28905 at watcgl.waterloo.edu> idallen at watcgl.waterloo.edu (Ian! D. Allen [CGL]) writes:

Actually, this is probably a feature you are seeing... If you execute

% ln -s foo bar

then you are making the file "bar" point to a file "foo" _in the current
directory_ - wherever that current directory is located at the time of
reference to the file bar.

Script started on Wed Jan 30 10:52:39 1991
% cd /tmp
% mkdir a foo
% ln -s foo bar
% # so now /tmp/foo is a pointer to ./bar - where ./ varies as you cd!
% cd a
% mkdir xxx
% mv xxx /tmp/bar/xxx
mv: /tmp/bar/xxx: rename: No such file or directory
% # as expected, since /tmp/a/bar does not exist
% cd ..
% rm bar
% ln -s /tmp/foo bar
% # so now /tmp/bar is a pointer to /tmp/foo
% cd a
% mv xxx ../bar
% ls -l ..
drwxr-x---  2 libove        512 Jan 30 10:53 a
lrwxr-x---  1 libove          8 Jan 30 10:53 bar -> /tmp/foo
drwxr-x---  3 libove        512 Jan 30 10:53 foo
% ls -l ../foo ../bar
lrwxr-x---  1 libove          8 Jan 30 10:53 ../bar -> /tmp/foo

../foo:
total 1
drwxr-x---  2 libove        512 Jan 30 10:53 xxx
% exit
script done on Wed Jan 30 10:53:13 1991


   This can really get you if you're in /usr/tmp (a symlink to var/tmp)
   and you try to move directories around.

Now, it is true that /usr/tmp -> var/tmp so indeed this might cause
troubles... but I'd like to see a particular example, since you can't
move a directory across a filesystem boundary anyway!
--

Jay Vassos-Libove                  libove at libove.det.dec.com
Digital Equipment Corporation      decwrl!libove.det.dec.com!libove
Detroit ACT/Ultrix Resource Center Opinions? They're mine, mine, all mine!
Farmington Hills, Michigan         and D.E.C. Can't have 'em!



More information about the Comp.unix.ultrix mailing list