Re: .ONESHELL enhancement?

David Boyce <[email protected]>
Newsgroups gmane.comp.gnu.make.devel
Message-ID <[email protected]>
On Wed, Sep 23, 2009 at 1:57 PM, Paul Smith <[email protected]> wrote:
> It seems to me that we might be able to get close to this, with the
> following changes:
>
>     1. Add -e to the shell invocation by default if .POSIX is set.
>     2. Use the simple "pass the entire thing to the shell, unmodified"
>        version of the .ONESHELL implementation.
>
> After this, adding both .POSIX and .ONESHELL (could be easily done by
> setting a MAKEFILES environment variable to a file containing those
> targets, before invoking make) will get you very nearly what you are
> looking for, I think.

General agreement, I think, except for a few nits:

- How does this address the command-line issues? I.e. passing -e
automatically and setting SHELL to an arbitrary interpreter are
incompatible, given that -e has different meanings to different
interpreters. So it seems to me you will also need .SHELLFLAGS or
similar. Of course if you use a temp file you could prepend "set -e"
to it but that runs into the same problem.

- Can we assume that assigning to SHELL absolves us of the need to
follow POSIX? Because I think there's no way to guarantee (or even
define) "set -e" behavior with an arbitrary interpreter.

- The hack to remove [@+-] from interior recipe lines would have to be
contingent on SHELL not being reassigned. It could wreak havoc on a
Perl script, for instance.

- I thought I remembered that .POSIX disables certain useful
extensions, but I don't see any reference to that in the  manual for
3.81. Am I remembering wrong?

The number of permutations implied by .POSIX, .ONESHELL, SHELL, and
.SHELLFLAGS is worrisome. Perhaps certain combinations can be
disallowed or ignored?

DSB
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.