From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 5 00:31:34 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 1713116A468 for ; Mon, 5 Nov 2007 00:31:34 +0000 (UTC) (envelope-from jhs@berklix.org) Received: from thin.berklix.org (thin.berklix.org [194.246.123.68]) by mx1.freebsd.org (Postfix) with ESMTP id 2970113C491 for ; Mon, 5 Nov 2007 00:31:32 +0000 (UTC) (envelope-from jhs@berklix.org) Received: from js.berklix.net (p549A4439.dip.t-dialin.net [84.154.68.57]) (authenticated bits=128) by thin.berklix.org (8.12.11/8.12.11) with ESMTP id lA500Pqj016146 for ; Mon, 5 Nov 2007 01:00:35 +0100 (CET) (envelope-from jhs@berklix.org) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by js.berklix.net (8.13.8/8.13.8) with ESMTP id lA502KUU005425 for ; Mon, 5 Nov 2007 01:00:19 +0100 (CET) (envelope-from jhs@berklix.org) Received: from fire.js.berklix.net (localhost.js.berklix.net [127.0.0.1]) by fire.js.berklix.net (8.13.8/8.13.8) with ESMTP id lA502KUe064392 for ; Mon, 5 Nov 2007 01:02:20 +0100 (CET) (envelope-from jhs@fire.js.berklix.net) Message-Id: <200711050002.lA502KUe064392@fire.js.berklix.net> To: hackers@freebsd.org From: "Julian Stacey" Organization: http://berklix.com BSD Unix Linux Consultancy, Munich/Muenchen. User-agent: EXMH on FreeBSD http://berklix.com/free/ X-URL: http://berklix.com/~jhs/cv/ Date: Mon, 05 Nov 2007 01:02:20 +0100 Sender: jhs@berklix.org Cc: Subject: make: evaluation of symbolic link with ../ fails X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list 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 00:31:34 -0000 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.