Package: make
Version: 4.2.1-1.2
Severity: normal
X-Debbugs-CC: r...@debian.org

Dear Maintainer,

First of all, thanks a lot for taking care of GNU make in Debian!

What do you think about the attached patches to the version of make in
Debian 10 (buster) that backport two commits from version 4.3 and
let make recognize more commands (both in recipes and in $(shell ...))
as shell built-ins that really need to be run via /bin/sh? I realize
that it may be a bit weird to file a report against oldstable, but
buster is still a supported release, and there is at least one shell
built-in, namely "command", that is in relatively wide use and hence
leads to problems.

I am also attaching a sample Makefile that demonstrates the way make(1)
fails to recognize "command" and "alias" as shell built-ins. I know that
"alias" is completely pointless in non-interactive shells, but it is on
the list of more recognized built-ins in the second patch/commit, so it
was easy to use for testing.

Thanks in advance for looking at this, and keep up the great work!

G'luck,
Peter


-- System Information:
Debian Release: 10.11
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.16.0-4-amd64 (SMP w/8 CPU cores; PREEMPT)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages make depends on:
ii  libc6  2.28-10

make recommends no packages.

Versions of packages make suggests:
pn  make-doc  <none>

-- no debconf information
From 3f947d1a7dce1cffc4f20ffafab7e896f8919c7f Mon Sep 17 00:00:00 2001
From: Peter Pentchev <r...@debian.org>
Date: Sat, 19 Mar 2022 20:05:01 +0200
Subject: [PATCH 1/3] Add "command" as a known shell built-in.

Obtained from: 
https://git.savannah.gnu.org/cgit/make.git/commit/?id=1af314465e5dfe3e8baa839a32a72e83c04f26ef
---
 job.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/job.c b/job.c
index 31799a5..857b8a1 100644
--- a/job.c
+++ b/job.c
@@ -2464,7 +2464,7 @@ construct_command_argv_internal (char *line, char 
**restp, const char *shell,
     { "cd", "echo", "eval", "exec", "exit", "login", "logout", "set", "umask",
       "wait", "while", "for", "case", "if", ":", ".", "break", "continue",
       "export", "read", "readonly", "shift", "times", "trap", "switch",
-      "unset", "ulimit", 0 };
+      "unset", "ulimit", "command", 0 };
 
   const char *sh_chars;
   const char **sh_cmds;
@@ -2491,7 +2491,7 @@ construct_command_argv_internal (char *line, char 
**restp, const char *shell,
     { "echo", "cd", "eval", "exec", "exit", "login", "logout", "set", "umask",
       "wait", "while", "for", "case", "if", ":", ".", "break", "continue",
       "export", "read", "readonly", "shift", "times", "trap", "switch",
-      "unset", 0 };
+      "unset", "command", 0 };
 
   const char *sh_chars;
   const char **sh_cmds;
@@ -2501,7 +2501,7 @@ construct_command_argv_internal (char *line, char 
**restp, const char *shell,
   static const char *sh_cmds[] =
     { "cd", "eval", "if", "delete", "echo", "copy", "rename", "set", "setenv",
       "date", "makedir", "skip", "else", "endif", "path", "prompt", "unset",
-      "unsetenv", "version", 0 };
+      "unsetenv", "version", "command", 0 };
 
 #elif defined (WINDOWS32)
   /* We used to have a double quote (") in sh_chars_dos[] below, but
@@ -2524,7 +2524,7 @@ construct_command_argv_internal (char *line, char 
**restp, const char *shell,
   static const char *sh_cmds_sh[] =
     { "cd", "eval", "exec", "exit", "login", "logout", "set", "umask", "wait",
       "while", "for", "case", "if", ":", ".", "break", "continue", "export",
-      "read", "readonly", "shift", "times", "trap", "switch", "test",
+      "read", "readonly", "shift", "times", "trap", "switch", "test", 
"command",
 #ifdef BATCH_MODE_ONLY_SHELL
       "echo",
 #endif
@@ -2538,10 +2538,10 @@ construct_command_argv_internal (char *line, char 
**restp, const char *shell,
 #else  /* must be UNIX-ish */
   static const char *sh_chars = "#;\"*?[]&|<>(){}$`^~!";
   static const char *sh_cmds[] =
-    { ".", ":", "break", "case", "cd", "continue", "eval", "exec", "exit",
-      "export", "for", "if", "login", "logout", "read", "readonly", "set",
-      "shift", "switch", "test", "times", "trap", "ulimit", "umask", "unset",
-      "wait", "while", 0 };
+    { ".", ":", "break", "case", "cd", "command", "continue", "eval", "exec",
+      "exit", "export", "for", "if", "login", "logout", "read", "readonly",
+      "set", "shift", "switch", "test", "times", "trap", "ulimit", "umask",
+      "unset", "wait", "while", 0 };
 
 # ifdef HAVE_DOS_PATHS
   /* This is required if the MSYS/Cygwin ports (which do not define
-- 
2.35.1

From 65071f5ab79297145f36fbbfcc9603835c5c108d Mon Sep 17 00:00:00 2001
From: Peter Pentchev <r...@debian.org>
Date: Sat, 19 Mar 2022 20:11:06 +0200
Subject: [PATCH 2/3] Recognize more commands as shell built-ins.

Obtained from: 
https://git.savannah.gnu.org/cgit/make.git/commit/?id=3fb7312e9f738c497dcab0fbcad9771f775e10f8
---
 job.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/job.c b/job.c
index 857b8a1..5eb5761 100644
--- a/job.c
+++ b/job.c
@@ -2538,9 +2538,10 @@ construct_command_argv_internal (char *line, char 
**restp, const char *shell,
 #else  /* must be UNIX-ish */
   static const char *sh_chars = "#;\"*?[]&|<>(){}$`^~!";
   static const char *sh_cmds[] =
-    { ".", ":", "break", "case", "cd", "command", "continue", "eval", "exec",
-      "exit", "export", "for", "if", "login", "logout", "read", "readonly",
-      "set", "shift", "switch", "test", "times", "trap", "ulimit", "umask",
+    { ".", ":", "alias", "bg", "break", "case", "cd", "command", "continue",
+      "eval", "exec", "exit", "export", "fc", "fg", "for", "getopts", "hash",
+      "if", "jobs", "login", "logout", "read", "readonly", "return", "set",
+      "shift", "test", "times", "trap", "type", "ulimit", "umask", "unalias",
       "unset", "wait", "while", 0 };
 
 # ifdef HAVE_DOS_PATHS
-- 
2.35.1

From 3ee5af554476f4114bedb01e55518b06d953e6ea Mon Sep 17 00:00:00 2001
From: Peter Pentchev <r...@debian.org>
Date: Sat, 19 Mar 2022 20:16:17 +0200
Subject: [PATCH 3/3] Update the changelog file.

---
 debian/changelog | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index ad02528..c71a616 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+make-dfsg (4.2.1-1.3) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload for patch tracking only.
+  * Recognize more commands as shell built-ins.
+
+ -- Peter Pentchev <r...@debian.org>  Sat, 19 Mar 2022 19:51:20 +0200
+
 make-dfsg (4.2.1-1.2) unstable; urgency=medium
 
   * Non-maintainer upload.
-- 
2.35.1

#!/usr/bin/make -f

all:    test-command test-alias
        echo 'Looks fine'

test-command:
        sh -c 'command -pv make'
        echo '$(shell sh -c 'command -pv make')'
        command -pv make
        echo '$(shell command -pv make)'

test-alias:
        sh -c 'alias'
        echo '$(shell sh -c 'alias')'
        alias
        echo '$(shell alias)'

Attachment: signature.asc
Description: PGP signature

Reply via email to