[Xquartz-dev] 2.3.2_rc4
Martin Costabel
costabel at wanadoo.fr
Sun Dec 21 05:06:41 PST 2008
Cameron Simpson wrote:
> 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.
Would you guys please make some tests before lecturing ;-)
As I repeatedly wrote here (and I am used to making tests before making
claims):
1. The bash startup scripts are *not* read twice with my script, because
running bash after exec -l does *not* start a login shell, contrary to
what you may infer from reading man pages.
2. The commands like args="${@}" are *necessary* for this to work with a
tcsh startup shell. Otherwise X11 crashes with errors like what I showed
before:
> Dec 20 01:11:47 mbookp [0x0-0x62062].org.x.X11[1524]: \312\376\272\276^B^G^C^P^Z\2120^L^R: Command not found.
> Dec 20 01:11:47 mbookp [0x0-0x62062].org.x.X11[1524]: Illegal variable name.
Finally, the situation that when the startup shell is tcsh and some bash
startup scripts are present, then both sets of startup scripts are read
- well, this is what we all had in xquartz before 2.3.2-rc4 for the apps
executed from the X11 Application menu. I haven't seen anyone
complaining about it, nor even anyone noticing beside me.
Likewise, the situation where X11.app is in a directory with spaces or
other garbage in its name: In this case, my wrapper script works as well
as Jeremy's that comes with 2.3.2-rc4 or the one he proposed with the
~/.x11run hook: namely not. Again, nobody has ever complained about this.
Anyway, I won't spend any more time on this subject. I found a script
that resolves the problem Jeremy's had, namely giving a login
environment to X11 for users that don't have bash as their login shell.
I have no time for further hair splitting.
--
Martin
More information about the Xquartz-dev
mailing list