On Tue, Mar 07, 2017 at 10:18:25AM +0000, Simon McVittie wrote:
> Control: reopen -1
> Control: found -1 1:45.7.1-2
> Control: retitle -1 /usr/bin/thunderbird: $TB_ARGS does not pass multiple 
> args correctly
> 
> On Thu, 16 Feb 2017 at 16:36:03 -0500, Daniel Kahn Gillmor wrote:
> > the special "$@" is getting mangled into the env
> > var THUNDERBIRD_OPTIONS which then gets replaced as a single string,
> > rather than being passed separately.
> 
> This is still the case, except the variable is named TB_ARGS now.
> 
>         # every other argument is needed to get down to the TB starting call
>         *) TB_ARGS="${TB_ARGS} ${ARG}"
> ...
>     output_debug "call '$MOZ_LIBDIR/$MOZ_APP_NAME ${TB_ARGS}'"
>     $MOZ_LIBDIR/$MOZ_APP_NAME "${TB_ARGS}"
> 
> Because the thunderbird wrapper is a #!/bin/bash script, you could use
> a bash array. $@ is the only variable in a POSIX shell that has special
> behaviour similar to bash arrays.

FWIW git-pbuilder has code to mangle options to pass them on to pbuilder
(which is a very similar problem) and uses a shell array. You can rip
out the code from there.
Cheers,
 -- Guido

> 
> > For example (note the whitespace that should be a _ in the child process 
> > below):
> > 
> > 0 dkg@alice:~$ ps -eFH | grep 'thun[d]er'
> > dkg      18921  3185  0  1072  1588   2 16:32 pts/1    00:00:00             
> >     /bin/sh /usr/bin/thunderbird -- -P foo
> > dkg      18932 18921 17 242031 278836 2 16:32 pts/1    00:00:12             
> >       /usr/lib/thunderbird/thunderbird -P foo
> > 0 dkg@alice:~$ tr '\0' '_' < /proc/18921/cmdline ; echo
> > /bin/sh_/usr/bin/thunderbird_--_-P_foo_
> > 0 dkg@alice:~$ tr '\0' '_' < /proc/18932/cmdline ; echo
> > /usr/lib/thunderbird/thunderbird_-P foo_
> 
> Please test something like this before closing this bug again.
> Typing
> 
>     /usr/bin/thunderbird -P 'foo bar'
> 
> at a shell prompt should result in *two* arguments being passed to
> /usr/lib/thunderbird/thunderbird, with content "-P" and "foo bar". One
> argument is wrong, three arguments are also wrong.

Reply via email to