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

Re: Weird set -u error



On Fri, 26 Aug 2022 at 23:41, Tim Woodall <debianuser@woodall.me.uk> wrote:
> On Fri, 26 Aug 2022, David wrote:
> > On Fri, 26 Aug 2022 at 22:14, <tomas@tuxteam.de> wrote:

> >> And then, there's that other riddle: why is a shell invoked from a
> >> Makefile sourcing /etc/bash.bashrc in the first place?
> >
> > Hi, my understanding is that the rule commands in the Makefile are run by
> > a shell, one for each line. The output stream of those commands is usually
> > stdout (unless redirected), to allow the user to see the output. The shell
> > detects that the command output is not redirected away from stdout, and so
> > it starts itself in interactive mode.
> >
> > 'man bash' says:
> >
> >  When an interactive shell that is not a login shell is started, bash
> >  reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
> >  these files exist. This may be inhibited by using the --norc option.
> >
> But that's backwards, make is starting an interactive shell when its
> output is redirected. When I don't redirect make's output it works.

As already stated, my guess is that while you might be redirecting the
make command line, there are no redirection operations in the commands
in the Makefile rules, so the the shells started by make are interactive.

Anyway, as I already suggested, if you ask your original question to
a mailing list of either the 'make' project [1] or the 'bash' project [2], then
the developers of these projects can give you a more authoritative answer
than the speculations of random Debian users such as myself.

[1] https://savannah.gnu.org/mail/?group=make
[2] https://savannah.gnu.org/mail/?group=bash


Reply to: