Date: Sat, 13 Mar 2004 01:28:07 +0100 From: Matthias Andree <ma@dt.e-technik.uni-dortmund.de> To: fuyuki@nigredo.org, pav@freebsd.org Cc: ports@freebsd.org Subject: ports/64037 and the alleged && -> ; failure from March 2002 Message-ID: <20040313002807.GA13745@merlin.emma.line.org>
next in thread | raw e-mail | index | archive | help
Hi, I filed PR #64037 with a patch for a port that fuyuki maintains. My patch included changing the ";" in "cd some dir ; some command " to "&&" in shell command lines was refused by the maintainer, with a reference to http://lists.liquidneon.com/pipermail/kde-freebsd/2002-March/000940.html that claims that "make -jN" could break up a shell command such as "cd dir && foo" and execute foo before cd dir. I am refuting that claim in Akinori's post. 'cd dir && foo' IS a proper use of && in a Makefile. The whole line is a shell command and make doesn't care about the && or ; - it's up to the shell to handle it. (I assume make uses a sane shell such as /bin/sh or ksh.) make(1) is specified to run shell commands, with the exception that command lines have to start with a TAB and if the first non-blank character is - or @ it is treated specially (exit code ignored or not echoed). The shell command lines associated with a target are "a series of shell commands" (make(1)), hence the lines for any single target are executed in order. Consider target: depA depB checksomething && dosomething domore Then make -j4 may build depB before depA - but it will run dosomething and domore in exactly this order only if checksomething passes (exits with code 0). If you believe otherwise, please show evidence that a construct like this target: depends cd foo && bar executes "bar" without having successfully completed "cd foo" first with make -jN. If that evidence cannot be shown or cannot be verified with the make commands of currently supported FreeBSD versions, I ask that spreading FUD about "&&" being invalid in make shell commands be stopped once and for all and that "cd blah && foo" constructs be rehabilitated in Makefiles. Best regards, -- Matthias Andree Encrypt your mail: my GnuPG key ID is 0x052E7D95
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040313002807.GA13745>