terminator -e doesn't work as gnome-terminal -e

Bug #247330 reported by Andrea Corbellini
4
Affects Status Importance Assigned to Milestone
Terminator
Fix Released
Critical
Thomas Hurst

Bug Description

`terminator -e "/bin/bash -c /usr/bin/python"` doesn't work like `gnome-terminal -e "/bin/bash -c /usr/bin/python"`.

Revision history for this message
Chris Jones (cmsj) wrote :

This is a completely valid bug. xterm behaves the same as gnome-terminal (I expect g-t copied their behaviour from xterm), and we should do the same.
I need to poke around their parsers to see exactly how they handle things like escaped quotes, but we must have this fixed for the next release.

Changed in terminator:
importance: Undecided → Critical
milestone: none → 1.0-beta
status: New → Triaged
Chris Jones (cmsj)
Changed in terminator:
milestone: 1.0-beta → 0.9.1
Revision history for this message
Thomas Hurst (tom.hurst) wrote :

gnome-terminal uses g_shell_parse_argv() on the argument, which "does a semi-arbitrary weird subset of the way the shell parses a command line."

xterm attempts to execv() and failing that calls the shell using execlp.

I suggest we follow the latter; terminator -e "/bin/bash -c /usr/bin/python" would result in us telling vte to fork '/bin/sh -c "/bin/bash -c /usr/bin/python"' (or whatever the user's shell is). Far easier than making our own argument tokenizer.

Revision history for this message
Thomas Hurst (tom.hurst) wrote :

I've committed a change to HEAD that uses the shell to spawn commands, so even "terminator -e 'cd $HOME && bash'" will work now (it doesn't in gnome-terminal, but does in xterm). Can you verify it makes terminator do the right thing?

Changed in terminator:
assignee: nobody → tom.hurst
status: Triaged → Fix Committed
Revision history for this message
Thomas Hurst (tom.hurst) wrote :

This currently breaks -x, since "-x foo bar" ends up running /bin/sh -c foo bar.

We can either quote it so it runs sh -c "foo bar" and so -x foo \&\& bar will work as -e "foo && bar", or we can pass it directly to exec if there's more than one argument (so -x "foo && bar" will Just Work, but -x foo \&\& bar will run /path/to/foo "&&" "bar").

The latter seems like a reasonable compromise.

Revision history for this message
Thomas Hurst (tom.hurst) wrote :

-x should work correctly now; -e is always handled by the shell, -x is used directly after a path lookup. The code is a bit neater too.

Chris Jones (cmsj)
Changed in terminator:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.