r54557 - in /desktop/unstable/gnome-terminal/debian: changelog gnome-terminal.wrapper

smcv at users.alioth.debian.org smcv at users.alioth.debian.org
Mon Oct 23 19:13:38 UTC 2017


Author: smcv
Date: Mon Oct 23 19:13:38 2017
New Revision: 54557

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=54557
Log:
debian/gnome-terminal.wrapper: Improve emulation of xterm -e.
Run gnome-terminal -- EXECUTABLE [ARGS] instead of deprecated
gnome-terminal -e QUOTED_STRING or gnome-terminal -x EXECUTABLE [ARGS],
and emulate xterm's fallback-to-shell behaviour more precisely.

Modified:
    desktop/unstable/gnome-terminal/debian/changelog
    desktop/unstable/gnome-terminal/debian/gnome-terminal.wrapper

Modified: desktop/unstable/gnome-terminal/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-terminal/debian/changelog?rev=54557&op=diff
==============================================================================
--- desktop/unstable/gnome-terminal/debian/changelog	[utf-8] (original)
+++ desktop/unstable/gnome-terminal/debian/changelog	[utf-8] Mon Oct 23 19:13:38 2017
@@ -1,3 +1,12 @@
+gnome-terminal (3.26.1-2) UNRELEASED; urgency=medium
+
+  * debian/gnome-terminal.wrapper: Improve emulation of xterm -e.
+    Run gnome-terminal -- EXECUTABLE [ARGS] instead of deprecated
+    gnome-terminal -e QUOTED_STRING or gnome-terminal -x EXECUTABLE [ARGS],
+    and emulate xterm's fallback-to-shell behaviour more precisely.
+
+ -- Simon McVittie <smcv at debian.org>  Fri, 06 Oct 2017 14:03:15 +0100
+
 gnome-terminal (3.26.1-1) unstable; urgency=medium
 
   * New upstream translations release (Closes: #877293)

Modified: desktop/unstable/gnome-terminal/debian/gnome-terminal.wrapper
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-terminal/debian/gnome-terminal.wrapper?rev=54557&op=diff
==============================================================================
--- desktop/unstable/gnome-terminal/debian/gnome-terminal.wrapper	[utf-8] (original)
+++ desktop/unstable/gnome-terminal/debian/gnome-terminal.wrapper	[utf-8] Mon Oct 23 19:13:38 2017
@@ -1,6 +1,19 @@
 #! /usr/bin/perl -w
 
 my $login=0;
+
+sub exists_in_path {
+    my $command = shift;
+    my @path = split ':', $ENV{PATH};
+
+    foreach my $dir (@path) {
+	if (-x "$dir/$command") {
+	    return 1;
+	}
+    }
+
+    return 0;
+}
 
 while ($opt = shift(@ARGV))
 {
@@ -57,15 +70,43 @@
     }
     elsif ($opt eq '-e')
     {
+	# Debian Policy says we would be free to translate this into:
+	# push(@args, '--', @ARGV);
+	# but let's be nice to people with local scripts that rely on
+	# xterm -e having a special case for a singular argument.
 	$arg = shift(@ARGV);
 	if (@ARGV)
 	{
-	    push(@args, '-x', $arg, @ARGV);
+	    push(@args, '--', $arg, @ARGV);
 	    last;
 	}
 	else
 	{
-	    push(@args, '-e', $arg);
+	    # Emulate xterm's special case for a single argument: if it
+	    # isn't something we can execute directly, pass it to a shell
+	    my $executable;
+
+	    if ($arg =~ m{/})
+	    {
+		$executable = -x $arg;
+	    }
+	    else
+	    {
+		$executable = exists_in_path($arg);
+	    }
+
+	    if ($executable)
+	    {
+		push(@args, '--', $arg);
+	    }
+	    else
+	    {
+		# Historically, we used the now-deprecated gnome-terminal -e
+		# for this case, which would split the command line up as if
+		# by a shell, but didn't support shell constructs like "if"
+		# and pipes. But this is easier, and matches what xterm does.
+		push(@args, '--', 'sh', '-c', $arg);
+	    }
 	}
 	last;
     }




More information about the pkg-gnome-commits mailing list