From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 5 08:23:39 2007 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 152BC16A418 for ; Mon, 5 Nov 2007 08:23:39 +0000 (UTC) (envelope-from Hartmut.Brandt@dlr.de) Received: from smtp-1.dlr.de (smtp-1.dlr.de [195.37.61.185]) by mx1.freebsd.org (Postfix) with ESMTP id AD73713C481 for ; Mon, 5 Nov 2007 08:23:38 +0000 (UTC) (envelope-from Hartmut.Brandt@dlr.de) Received: from knop-beagle.kn.op.dlr.de ([129.247.173.6]) by smtp-1.dlr.de over TLS secured channel with Microsoft SMTPSVC(6.0.3790.1830); Mon, 5 Nov 2007 08:58:54 +0100 Date: Mon, 5 Nov 2007 08:58:52 +0100 (CET) From: Harti Brandt X-X-Sender: brandt_h@knop-beagle.kn.op.dlr.de To: Julian Stacey In-Reply-To: <200711050002.lA502KUe064392@fire.js.berklix.net> Message-ID: <20071105085259.A39496@knop-beagle.kn.op.dlr.de> References: <200711050002.lA502KUe064392@fire.js.berklix.net> X-OpenPGP-Key: harti@freebsd.org MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 05 Nov 2007 07:58:54.0652 (UTC) FILETIME=[B61AEFC0:01C81F81] Cc: hackers@freebsd.org Subject: Re: make: evaluation of symbolic link with ../ fails X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Harti Brandt List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Nov 2007 08:23:39 -0000 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