Date: Mon, 5 Nov 2007 08:58:52 +0100 (CET) From: Harti Brandt <hartmut.brandt@dlr.de> To: Julian Stacey <jhs@berklix.org> Cc: hackers@freebsd.org Subject: Re: make: evaluation of symbolic link with ../ fails Message-ID: <20071105085259.A39496@knop-beagle.kn.op.dlr.de> In-Reply-To: <200711050002.lA502KUe064392@fire.js.berklix.net> References: <200711050002.lA502KUe064392@fire.js.berklix.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 5 Nov 2007, Julian Stacey wrote: JS>I found some unexpected behaviour within make on 6.2-RELEASE, JS>Not sure if it's a bug, or proper behaviour. Comment please ? JS> JS>Make seems to be being too clever, evaluating where it JS>think the CWD (current working directory) is, whereas I think JS>it should better let the external per line shell discover for itself. JS>Make fails to realise that because of symbolic links, it is not JS>acceptable to shorten JS> cd /site/home/jhs/pics/.. ; rdist JS>to JS> cd /site/home/jhs ; rdist JS> JS>How I discovered the behaviour: JS> I keep my data split in 2: JS> Some small enough to back up to a USB stick, eg: JS> /usra/home/jhs/._/txt/ JS> & some bulky eg: JS> /usra/jhs/xtra/pics JS> using symbolic links eg JS> /site/home -> /usra/home JS> ~/.HOME -> /site/home/jhs/._ JS> ~/txt -> .HOME/txt JS> ~/pics -> .HOME/pics JS> ~/._/pics -> xtra/pics JS> ~/._/xtra/pics -> /usra/jhs/xtra/pics JS> JS> Some links are more complex than shown, for reasons JS> beyond scope of this posting, but it's all been working fine JS> for 8 years & I've had patches to 2.2.8 onward JS> kernels to increase the allowed traversal count for sym JS> links etc JS> http://berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/gen/sys/sys/param.h.REL=ALL.diff JS> JS>It's been fine while I manually ran: JS> cd ; rdist `hostname -s` JS> cd ~/xtra/LN ; rdist xtra # LN -> /usra/jhs/xtra JS>The make behaviour was noticed when I embeded those lines in a Makefile. JS> JS>Here's some to try yourself: JS># Warning cant use eg ~/pics/../Distfile JS>bug1: JS> -cd ~/txt/.. && pwd JS> @# /usr/home/jhs JS> -cd ~/txt/.. && /bin/pwd JS> @# /usra/home/jhs JS> -cd ~/txt && cd .. && /bin/pwd JS> @# /usra/home/jhs JS> -cd ~/._/txt/.. && /bin/pwd JS> @# /usra/home/jhs/._ JS>bug2: JS> cd ~/pics && pwd JS> @# /usr/home/jhs/pics JS> cd ~/pics/.. && pwd JS> @# /usr/home/jhs JS> cd ~/pics && /bin/pwd JS> @# /usra/jhs/xtra/pics JS> cd ~/pics/.. && /bin/pwd JS> @# /usra/home/jhs JS> JS>See from results marked @#, make is evaluating eg JS> cd ~/txt/.. ; rdist JS>as if it's equivalent to JS> cd ~; rdist JS>& it's Not equivalent, JS>if I do eg: JS> cd ~/pics/.. ; rdist JS>rdist6 runs using the Distfile in my ~/Distfile, rather than different JS>/usra/jhs/xtra/Distfile. JS> JS>I can cludge round this make behaviour, eg by in Makefile avoiding the ../ in JS> cd ~/xtra/pics/.. && rdist -f /usra/jhs/xtra/Distfile pics JS>but seems make is trying to be too clever, & failing, & make would be better JS>if it did less. JS> JS>(BTW, to avoid distracting answers: I know make invokes a seperate JS>shell per line, that's not the issue, also not the issue is /usr/obj/ JS>or which external interactive shell I use). Are you sure that this is not a problem with /bin/sh? Make always execs a shell if it finds special symbols like ';' in the line. It does not interprete the cd. What shell are you using (I mean in which shell did you do the successful tests above)? Try something like: .SHELL: name="sh" path="/path/to/your/shell" in the Makefile (given that you're not using a c-shell). If it works then the problem is in /bin/sh. harti
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071105085259.A39496>