All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] tmux new does not take tw commands
@ 2013-06-11 14:28 Peter Seebach
  2013-06-11 14:28 ` [PATCH 1/1] handle two-word commands with tmux Peter Seebach
  2013-06-11 14:59 ` [PATCH 0/1] tmux new does not take tw commands Chris Larson
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Seebach @ 2013-06-11 14:28 UTC (permalink / raw)
  To: openembedded-core

This got routed to me because the visible error message says
	Execution of "pseudo /bin/bash" failed

but actually it's nothing to do with pseudo. The real
problem is that the tmux class in terminal.py is producing
a string like:
	'tmux new <args> {command}'

This then gets .format called on it, substituting in a command. If
the comand is "pseudo /bin/bash", this is:
	'tmux new <args> pseudo /bin/bash'
which is a usage error. It would be okay if it were:
	'tmux new <args> "pseudo /bin/bash"'

So add double quotes. Of course, that assumes that <command> never has
double quotes in it... If it does, that may need a fancier solution.

The following changes since commit b4f208f418d18f2a4e78a56bebacef481061d917:
  Saul Wold (1):
        tar: don't mv tar for nativesdk

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib seebs/tmuxfix
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=seebs/tmuxfix

Peter Seebach (1):
  handle two-word commands with tmux

 meta/lib/oe/terminal.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] handle two-word commands with tmux
  2013-06-11 14:28 [PATCH 0/1] tmux new does not take tw commands Peter Seebach
@ 2013-06-11 14:28 ` Peter Seebach
  2013-06-11 14:59 ` [PATCH 0/1] tmux new does not take tw commands Chris Larson
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Seebach @ 2013-06-11 14:28 UTC (permalink / raw)
  To: openembedded-core

Trying to make a devshell using tmux can fail because "tmux new"
expects a single command, not a series of arguments. It does, however,
split strings in a suitable way. So you can quote the command.

The failure mode is particularly arcane, in that you end up
with a message like:

	ERROR: Unable to spawn terminal auto: \
	Execution of 'pseudo /bin/bash' failed with exit code 1:
	usage: new-session [-d] [-n window-name] [-s session-name] \
	[-t target-session] [command]

which is confusing because there's no "new-session" anywhere in
sight (that's actually "tmux new"), and because what failed to execute
wasn't either pseudo or bash.
---
 meta/lib/oe/terminal.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 28470e3..25f8004 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -122,7 +122,7 @@ class TmuxRunning(Terminal):
 
 class Tmux(Terminal):
     """Start a new tmux session and window"""
-    command = 'tmux new -d -s devshell -n devshell {command}'
+    command = 'tmux new -d -s devshell -n devshell "{command}"'
     priority = 0.75
 
     def __init__(self, sh_cmd, title=None, env=None, d=None):
@@ -133,7 +133,7 @@ class Tmux(Terminal):
         # devshells, if it's already there, add a new window to it.
         window_name = 'devshell-%i' % os.getpid()
 
-        self.command = 'tmux new -d -s {0} -n {0} {{command}}'.format(window_name)
+        self.command = 'tmux new -d -s {0} -n {0} "{{command}}"'.format(window_name)
         Terminal.__init__(self, sh_cmd, title, env, d)
 
         attach_cmd = 'tmux att -t {0}'.format(window_name)
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/1] tmux new does not take tw commands
  2013-06-11 14:28 [PATCH 0/1] tmux new does not take tw commands Peter Seebach
  2013-06-11 14:28 ` [PATCH 1/1] handle two-word commands with tmux Peter Seebach
@ 2013-06-11 14:59 ` Chris Larson
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Larson @ 2013-06-11 14:59 UTC (permalink / raw)
  To: Peter Seebach; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 905 bytes --]

On Tue, Jun 11, 2013 at 7:28 AM, Peter Seebach
<peter.seebach@windriver.com>wrote:

> This got routed to me because the visible error message says
>         Execution of "pseudo /bin/bash" failed
>
> but actually it's nothing to do with pseudo. The real
> problem is that the tmux class in terminal.py is producing
> a string like:
>         'tmux new <args> {command}'
>
> This then gets .format called on it, substituting in a command. If
> the comand is "pseudo /bin/bash", this is:
>         'tmux new <args> pseudo /bin/bash'
> which is a usage error. It would be okay if it were:
>         'tmux new <args> "pseudo /bin/bash"'
>
> So add double quotes. Of course, that assumes that <command> never has
> double quotes in it... If it does, that may need a fancier solution.
>

 I'd suggest calling pipes.quote() on the value being passed into format().
-- 
Christopher Larson

[-- Attachment #2: Type: text/html, Size: 1438 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-11 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-11 14:28 [PATCH 0/1] tmux new does not take tw commands Peter Seebach
2013-06-11 14:28 ` [PATCH 1/1] handle two-word commands with tmux Peter Seebach
2013-06-11 14:59 ` [PATCH 0/1] tmux new does not take tw commands Chris Larson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.