make: evaluation of symbolic link with ../ fails
Julian Stacey
jhs at berklix.org
Sun Nov 4 16:31:34 PST 2007
I found some unexpected behaviour within make on 6.2-RELEASE,
Not sure if it's a bug, or proper behaviour. Comment please ?
Make seems to be being too clever, evaluating where it
think the CWD (current working directory) is, whereas I think
it should better let the external per line shell discover for itself.
Make fails to realise that because of symbolic links, it is not
acceptable to shorten
cd /site/home/jhs/pics/.. ; rdist
to
cd /site/home/jhs ; rdist
How I discovered the behaviour:
I keep my data split in 2:
Some small enough to back up to a USB stick, eg:
/usra/home/jhs/._/txt/
& some bulky eg:
/usra/jhs/xtra/pics
using symbolic links eg
/site/home -> /usra/home
~/.HOME -> /site/home/jhs/._
~/txt -> .HOME/txt
~/pics -> .HOME/pics
~/._/pics -> xtra/pics
~/._/xtra/pics -> /usra/jhs/xtra/pics
Some links are more complex than shown, for reasons
beyond scope of this posting, but it's all been working fine
for 8 years & I've had patches to 2.2.8 onward
kernels to increase the allowed traversal count for sym
links etc
http://berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/gen/sys/sys/param.h.REL=ALL.diff
It's been fine while I manually ran:
cd ; rdist `hostname -s`
cd ~/xtra/LN ; rdist xtra # LN -> /usra/jhs/xtra
The make behaviour was noticed when I embeded those lines in a Makefile.
Here's some to try yourself:
# Warning cant use eg ~/pics/../Distfile
bug1:
-cd ~/txt/.. && pwd
@# /usr/home/jhs
-cd ~/txt/.. && /bin/pwd
@# /usra/home/jhs
-cd ~/txt && cd .. && /bin/pwd
@# /usra/home/jhs
-cd ~/._/txt/.. && /bin/pwd
@# /usra/home/jhs/._
bug2:
cd ~/pics && pwd
@# /usr/home/jhs/pics
cd ~/pics/.. && pwd
@# /usr/home/jhs
cd ~/pics && /bin/pwd
@# /usra/jhs/xtra/pics
cd ~/pics/.. && /bin/pwd
@# /usra/home/jhs
See from results marked @#, make is evaluating eg
cd ~/txt/.. ; rdist
as if it's equivalent to
cd ~; rdist
& it's Not equivalent,
if I do eg:
cd ~/pics/.. ; rdist
rdist6 runs using the Distfile in my ~/Distfile, rather than different
/usra/jhs/xtra/Distfile.
I can cludge round this make behaviour, eg by in Makefile avoiding the ../ in
cd ~/xtra/pics/.. && rdist -f /usra/jhs/xtra/Distfile pics
but seems make is trying to be too clever, & failing, & make would be better
if it did less.
(BTW, to avoid distracting answers: I know make invokes a seperate
shell per line, that's not the issue, also not the issue is /usr/obj/
or which external interactive shell I use).
Julian
--
Julian Stacey. Munich Consultant: BSD Unix Linux. http://berklix.com
Ihr Rauch=mein allergischer Kopfschmerz. Dump cigs 4 snuff.
More information about the freebsd-hackers
mailing list