bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #40431] .SHELLFLAGS is passed to shell as single argument.


From: Van de Bugger
Subject: [bug #40431] .SHELLFLAGS is passed to shell as single argument.
Date: Thu, 31 Oct 2013 22:41:36 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0

Follow-up Comment #2, bug #40431 (project make):

Thanks, I also found this trick independently. Unfortunately the trick does
not work. Or, stricly speaking, it works, but there is an unwanted side effect
which makes it useless. Look:

# Note: in current shell pipefail is not set.
$ echo $SHELLOPTS
braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
# Starting a new shell with "-o pipefail".
$ bash -o pipefail
# In nested shell pipefail is set.
$ echo $SHELLOPTS
braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:pipefail
# Starting one more nested shell:
$ bash
# In gransson, pipefail is not set.
$ echo $SHELLOPTS
braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor

It looks like shell options (real shell options specified in command line) are
*not* inherited.

Now let us try to set SHELLOPTS variable:

# In current shell pipefailis not set:
$ echo $SHELLOPTS
braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
# Starting a nested shell with modified SHELLOPTS:
$ env SHELLOPTS=$SHELLOPTS:pipefail bash
# Here pipefail is set, as expected:
$ echo $SHELLOPTS
braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:pipefail
# Starting one more nested shell:
$ bash
# And check pipefail: it is still set!
$ echo $SHELLOPTS
braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:pipefail

Effect of SHELLOPTS *is* inherited. Practically it means that many third-party
shell scripts invoked from make directly or indirectly will not work, because
they do not expect pipefail (or erexit).

In my real makefile there is a command:

rpmbuild -bb foo.spec

With 

SHELLOPTS += pipefail:errexit

rpmbuild fails with no meanigful message. It reports something like this:
"%install return non-zero status". I spend sometime to debug an issue and
found that problem is in /usr/lib/rpm/check-buildroot script (it is an
internal part of rpmbuild). It executes:

find ... | grep ... > $tmp

Grep finds nothing, returns status 1, and bash exits the script prematurely.

Thus, setting SHELLOPTS is not an option. :-(

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?40431>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]