[Xquartz-dev] 2.3.2_rc4
Cameron Simpson
cs at zip.com.au
Sun Dec 21 03:00:43 PST 2008
On 21Dec2008 11:05, Martin Costabel <costabel at wanadoo.fr> wrote:
> Based on the contributions to this thread, I have now an X11 wrapper
> script that works for me both with bash and tcsh login shells. Here is
> my /Applications/Utilities/X11.app/Contents/MacOS/X11 script:
>
>
> #!/bin/bash --login
> cmd="$(dirname $0)"/X11.bin
> args="${@}"
> exec -l "$SHELL" -c "exec $cmd $args"
This wrapper runs two sets of login stuff: bash's login stuff from the
--login option, even if the user is _not_ a bash user, and then the
login stuff for the shell run via "exec -l". For a bash user, running
this stuff twice is wrong even if it is harmless, and for a non-bash
user running the bash login stuff is wrong outright.
And like Harald, i don't see that this:
args="${@}"
accomplishes anything. Is this some bash-specific args autoquoting stuff
that makes $args itself magic. _And_ magicly makes shell independent
quoting for the subshell (unknown shell syntax via $SHELL)? As he says,
you could just put $* in the -c string i.e. not be safe.
The cmd= line also seems wrong: you don't need the "" quotes you do
have, and you really ought to be more paranoid about $0, eg:
cmd=$(dirname "$0")/X11.bin
> (Of course, if you want to reestablish the ~/.x11run hook, you can add
> the corresponding line, but I for one won't need it any more with this
> wrapper script).
>
> This script reads the login startup scripts for bash and for tcsh login
> shells.
Running both is incorrect behaviour.
> Concerning other login shells, I made some quick tests for ksh and zsh
> that confirmed that the script works as intended.
They're both Bourne style shells.
--
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
More information about the Xquartz-dev
mailing list