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

Jérémy Bobbio lunar at moszumanska.debian.org
Sat Aug 29 18:26:15 UTC 2015


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

lunar pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit 8d09898b4fce5ad1409cf3bbdf502d1b8d7d774d
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
    Stable-Candidate: 1.16.x 1.17.x
---
 debian/changelog   |  2 ++
 lib/dpkg/command.c | 14 ++++++++------
 man/dpkg.1         |  5 +++--
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 46b3e8e..e28a524 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,8 @@ dpkg (1.18.2) UNRELEASED; urgency=low
   * Switch libdpkg xz compressor to use CRC64 for integrity checks, to match
     the default on the command-line tool, which should provide slightly better
     detection against damaged data, at a negligible speed difference.
+  * Only use the SHELL environment variable for interactive shells.
+    Closes: #788819
   * Perl modules:
     - Remove non-functional timezone name support from
       Dpkg::Changelog::Entry::Debian.
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);
diff --git a/man/dpkg.1 b/man/dpkg.1
index f5a599f..dd506fb 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -751,7 +751,8 @@ Sent just before a processing stage starts. \fIstage\fR is one of
 .TP
 \fB\-\-status\-logger\fR=\fIcommand\fR
 Send machine-readable package status and progress information to the
-shell \fIcommand\fR's standard input (since dpkg 1.16.0).
+shell \fIcommand\fR's standard input, to be run via \*(lqsh \-c\*(rq
+(since dpkg 1.16.0).
 This option can be specified multiple times.
 The output format used is the same as in \fB\-\-status\-fd\fP.
 .RE
@@ -808,7 +809,7 @@ temporary files and directories.
 The program \fBdpkg\fP will execute when displaying the conffiles.
 .TP
 .B SHELL
-The program \fBdpkg\fP will execute when starting a new shell.
+The program \fBdpkg\fP will execute when starting a new interactive shell.
 .TP
 .B COLUMNS
 Sets the number of columns \fBdpkg\fP should use when displaying formatted

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