bug-make
[Top][All Lists]
Advanced

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

Make-4.2.1 problem with $(SHELL) syntax


From: busby1
Subject: Make-4.2.1 problem with $(SHELL) syntax
Date: Tue, 26 Mar 2019 16:22:50 -0700
User-agent: Heirloom mailx 12.5 7/5/10

I ran across a small (apparent) regression today.  Here is a little
reproducer: First the makefile:

  $ cat makefile
  export SHELL := /bin/bash
  fooshell := ./fooshell
  SHELL = env a=b $(fooshell)
  #       ^^^ 3.82 works, with or without "env".  4.2.1 requires "env".
  .PHONY: all
  all:
        @echo \
        "This is a test"

And now the replacement $(SHELL) script, fooshell:

  $ cat fooshell
  #!/bin/bash
  shift
  echo "\$a is $a"
  eval "$@"

Originally, we redefined SHELL in the makefile as

  SHELL = a=b $(fooshell)

That is, add an environment variable "a=b" to each instance of fooshell.
This works as expected with gmake-3.82.  However, with gmake-4.2.1,
the recipe for the target "all" behaves as if the backslash after echo
disappeared: Each physical line is passed to a separate instance of
fooshell, which naturally complains:

  /bin/sh: line 1: "This is a test": command not found

I can fix the problem by explicitly running the shell under "env",
as shown.  And this fix is good enough, I imagine.  However, perhaps
there is some other finer point I have missed, so I will pass it along
as an observation/question.

Thank you,
Lee Busby



reply via email to

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