bug-make
[Top][All Lists]
Advanced

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

Re: Bug in $(shell ...) I can't understand


From: Paul Smith
Subject: Re: Bug in $(shell ...) I can't understand
Date: Sun, 06 Feb 2022 17:35:55 -0500
User-agent: Evolution 3.42.3 (flatpak git)

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 <psmith@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

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