Bug#457846: gnome-terminal.wrapper: problem with a particular command
Ben Hutchings
ben at decadent.org.uk
Fri Jul 18 01:46:53 UTC 2008
Here's a patch to achieve xterm-compatible behaviour (except for (c)
which doesn't seem important).
Ben.
diff -u gnome-terminal-2.22.3/debian/gnome-terminal.wrapper gnome-terminal-2.22.3/debian/gnome-terminal.wrapper
--- gnome-terminal-2.22.3/debian/gnome-terminal.wrapper
+++ gnome-terminal-2.22.3/debian/gnome-terminal.wrapper
@@ -2,6 +2,27 @@
my $login=0;
+sub is_cmd_name
+{
+ my $arg = shift;
+ if ($arg =~ /\//) {
+ return -x $arg;
+ } else {
+ for my $dir (split(/:/, $ENV{PATH})) {
+ return 1 if -x "$dir/$arg";
+ }
+ return 0;
+ }
+}
+
+sub user_shell
+{
+ return $ENV{SHELL} if exists($ENV{SHELL});
+ my @pw = getpwuid($<);
+ return $pw[8] if defined($pw[8]);
+ return '/bin/sh';
+}
+
while ($opt = shift(@ARGV))
{
if ($opt eq '-display')
@@ -57,7 +78,11 @@
}
elsif ($opt eq '-e')
{
- push(@args, '-e', @ARGV);
+ push(@args, '-x');
+ if ($#ARGV == 0 && !is_cmd_name($ARGV[0])) {
+ push(@args, user_shell(), '-c');
+ }
+ push(@args, @ARGV);
last;
}
elsif ($opt eq '-h' || $opt eq '--help')
--- END ---
--
Ben Hutchings
Nothing is ever a complete failure; it can always serve as a bad example.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/pkg-gnome-maintainers/attachments/20080718/dc4c8723/attachment-0001.pgp
More information about the pkg-gnome-maintainers
mailing list