GNOME Bugzilla – Bug 152717
-e command line is inconsistent with other terminal emulators
Last modified: 2015-03-31 12:59:56 UTC
for gnome-terminal, -e is only to be used with one argument beeing the command to execute (like gnome-terminal -e "man rxvt"). For most available terminal emulators (rxvt, xterm, konsole), -e is for executing remaining arguments as command (ie like -x for gnome-terminal). This inconsistency is causing problems when using a alternative (for instance xvt on Mandrakelinux or x-terminal-emulator) to run a terminal emulator from programs, without knowning which one is installed on the system.
This has been like this for ever, and can hardly be changed now. It should not be difficult for distros to pack a little app which does command line mangling, or wraps a call to (something similar to) gnome_execute_terminal_shell, which would then look up the preferred terminal app from the user's (gconf or other) setup.
I don't see why you're reluctant to implementing this, it's not like extra arguments past -e are used for something else right now. The -e / --command arg is passed as it to g_shell_parse_argv(), supporting this is only a matter of reading remaining arguments and appending them to the arg string of -e / --command (separated by spaces). Or what would that break?
Currently, a command line like gnome-terminal --command some-app --geometry 20x40 runs some-app in a 20x40 window; if we passed arguments to the command, it would not do that.
I checked the behavior of -e in xterm, and the main difference is not with remaining arguments that are interpreted or not, but with the fact that -e MUST be the last command line argument. I agree it's a breakage to require -e to be the last option for next versions of gnome-terminal. But can't this change in behavior be scheduled for a major release?
[Actually, the xterm man page is not very precise, as -e cannot of necessity be the last command line argument, as that would not allow one to even name the command one wants to run or pass arguments to it; what it means is that xterm will stop processing its command line options as soon as it seens a -e, and it will collect all remaining args into the command to be run. Exactly as g-t does with -x.] [I really don't know why g-t chose to break tradition with -e/-x; maybe Havoc remembers the rationale?] We could break this for 3.0, I guess, but then we'd need to go out and patch everything that has adapted to this. I can think of at least libgnome's gnome_execute_terminal_shell. Also, users have a key installed in their gconf databases called /desktop/gnome/applications/terminal/exec_arg, and we would need to somehow change those, unless gnome as a whole decides to break existing installations when going over to 3.0, which we {don't|try not to} do for minor releases.
Just some historic input here. I seem to remember Miguel saying that gnome-terminal was supposed to be as close to xterm in behaviour as possible when he started the project way back when. The ChangeLog in the current gnome-terminal says this: 002-02-15 Havoc Pennington <hp@pobox.com> * src/terminal.c (main): make option parsing accept exactly the same --command/-e/--execute/-x options as gnome-terminal and handle them the same way. So I don't know why we're doing stuff differently...
I found it :-) http://mail.gnome.org/archives/gnome-announce-list/1999-June/msg00022.html explains how GNOME got it wrong the first time and because of that added -x to mimic xterm's behaviour. So the answer is to use -x to get the desired effect.
*** Bug 747108 has been marked as a duplicate of this bug. ***