Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Sep 2013 18:25:44 -0500
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        Ian Lepore <ian@FreeBSD.org>
Cc:        FreeBSD Hackers <freebsd-hackers@FreeBSD.org>, freebsd-current <freebsd-current@FreeBSD.org>
Subject:   Re: The right way to invoke sh from a freebsd makefile?
Message-ID:  <523F7C78.8080603@FreeBSD.org>
In-Reply-To: <1379891905.1197.115.camel@revolution.hippie.lan>
References:  <1379891905.1197.115.camel@revolution.hippie.lan>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 9/22/2013 6:18 PM, Ian Lepore wrote:
> What's the right way to launch the bourne shell from a makefile?  I had
> assumed the ${SHELL} variable would be set to "the right" copy
> of /bin/sh (like maybe the one in tmp or legacy at various stages).  It
> appears that that's not the case, and ${SHELL} is whatever comes from
> the environment, which can lead to using csh or bash or whatever.
> 
> I see some of our makefiles use just a bare "sh" which seems reasonable
> to me, but I don't want to glitch this in src/include/Makefile again.
> The goal is to run a script in src/include/Makefile by launching sh with
> the script name (as opposed to launching the script and letting the #!
> do its thing, which doesn't work if the source dir is mounted noexec).
> 
> -- Ian
> 

Grepping the Makefiles in the tree, 'sh' is the very common. I see
around 157 users of this pattern. 13 use /bin/sh directly. Also consider
that it is highly likely, if not required, that a /bin/sh will exist.

Calling 'sh' specifically is definitely more proper than ${SHELL} since
it is an sh script.

-- 
Regards,
Bryan Drewery


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSP3x4AAoJEG54KsA8mwz5kSAP/2wm6+efiXjPZAKG2AYntqPX
seA40sfTGd0p81eW32HroEv+r3bg0FXL4CnRoIduQQ68tPLvlVA8/V/4JnD/LE3L
EiIIru5sRvW1QodHTRVB572jknocFULFg7VquLeEc6mXCmjuvdslHhgnJk84/MZa
ZMrhyQzw+HmGzkVGACqFC98FIQsRASwEWxBihz6C2n0naVUo5DhPfjio/uKOtq5+
QBUMvICAAA0K2S2foPP1fV8tyefQxWl43uGxFQqj9GDmU7xAYCjkC0TmJ7cHgCcI
h39jGNABCQ8pR8wwEdI8JvbF9XaqukAPuuU3yov0MfWi0waKPWZaX6rWdtLeMpkP
JXfBovXR3gyWE5LjYTqja4NFmhbA4bzq/GJhXa5IB4K0XcVOQhj5Eb/MdfniXADz
bsspdkR+NDNtNmHB9tAdjE/Bvh0KoRc4+BhF2aQCua5yHrVQPaAJP3g0AvquD1Ux
j8u9pXbrTx6dLHdhmASmD/C/lB6L0HMjpGC1peUweZGl7a5uR/Ln+QegokdJuPbk
BnGSZb0eKxp28auIMbAPlGPziEAouXprLbJ4mihtP5WT9zwUeZmrmUzNXluwEofA
59q3wneeYnwFOgRnTYO0qKqAqKW/GLaMjl/AIuwmMn7LemCVKmVRQE6A/mw4x/OK
ICSdGlW0nZC+1oLmllDG
=bH97
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?523F7C78.8080603>