[Reproducible-commits] [dpkg] 07/17: libdpkg: Only use the SHELL environment variable for interactive shells

Holger Levsen holger at layer-acht.org
Tue May 3 08:44:26 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to annotated tag 1.17.27
in repository dpkg.

commit 089305baca3bce048e17fd8af2fe4a20ad3b759b
Author: Guillem Jover <guillem at debian.org>
Date:   Tue Jun 16 01:33:43 2015 +0200

    libdpkg: Only use the SHELL environment variable for interactive shells
    
    SHELL is the user preferred shell, but it does not guarantee a POSIX
    shell. Use it only for interactive shells, and use «sh» otherwise.
    
    Closes: #788819
---
 debian/changelog   |  2 ++
 lib/dpkg/command.c | 14 ++++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1072c1e..98f36a9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ dpkg (1.17.27) UNRELEASED; urgency=medium
   * Remove trailing space before handling blank line dot-separator in
     Dpkg::Control::HashCore. Regression introduced in dpkg 1.17.25.
     Reported by Jakub Wilk <jwilk at debian.org>. Closes: #789580
+  * Only use the SHELL environment variable for interactive shells.
+    Closes: #788819
 
   [ Updated scripts translations ]
   * German (Helge Kreutzmann). (Various fixes)
diff --git a/lib/dpkg/command.c b/lib/dpkg/command.c
index d378ad2..b6a79d7 100644
--- a/lib/dpkg/command.c
+++ b/lib/dpkg/command.c
@@ -216,14 +216,16 @@ command_shell(const char *cmd, const char *name)
 	const char *shell;
 	const char *mode;
 
-	shell = getenv("SHELL");
-	if (str_is_unset(shell))
-		shell = DEFAULTSHELL;
-
-	if (cmd == NULL)
+	if (cmd == NULL) {
 		mode = "-i";
-	else
+		shell = getenv("SHELL");
+	} else {
 		mode = "-c";
+		shell = NULL;
+	}
+
+	if (str_is_unset(shell))
+		shell = DEFAULTSHELL;
 
 	execlp(shell, shell, mode, cmd, NULL);
 	ohshite(_("unable to execute %s (%s)"), name, cmd);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list