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

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


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

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

commit 663522cb56bd27fa52565b2a8b090e2624dc0f91
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 0a109aa..23f1e44 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ dpkg (1.16.18) UNRELEASED; urgency=medium
   * Remove trailing space before handling blank line dot-separator in
     Dpkg::Control::Hash. Regression introduced in dpkg 1.16.16.
     Reported by Jakub Wilk <jwilk at debian.org>. Closes: #789580
+  * Only use the SHELL environment variable for interactive shells.
+    Closes: #788819
 
  -- Guillem Jover <guillem at debian.org>  Sat, 19 Mar 2016 19:13:34 +0100
 
diff --git a/lib/dpkg/command.c b/lib/dpkg/command.c
index 859f8a1..f9b3302 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