On Sun, 2022-02-06 at 17:12 -0500, Dmitry Goncharov wrote:
> This behavior is correct, is not it?
> 
> $ cat makefile
> SHELL:=/badpath/bash
> value:=$(shell echo hello world)
> all: ; $(info $(value))
> $ make >/dev/null
> make: /badpath/bash: No such file or directory
> $
> 
> stdout is redirected to /dev/null, but the user still wants to see
> errors. Is not this scenario what stderr was invented for?

Yes, but that's sent directly to stderr so make's shell function is not
even involved in that.

The weird behavior we're considering is that make was printing the
_stdout_ of the invoked shell to make's stderr, if the shell exited
with code 127 (see the source I mentioned previously).

> On Sun, Feb 6, 2022 at 4:48 PM Paul Smith <psm...@gnu.org> wrote:
> > I decided this was a bug and changed the behavior for the next
> > release.
> 
> What is the new behavior?

The above makefile behaves the same, and this makefile:

  $ cat Makefile
  out := $(shell bad-command 2>&1)
  all: ; @echo 'out = $(out)'

gives:

  $ make
  out = /bin/sh: 1: bad-command: not found

instead of what we get with 4.3:

  $ make
  /bin/sh: 1: bad-command: not found
  out =

Reply via email to