[Xquartz-dev] 2.3.2_rc4

Martin Costabel costabel at wanadoo.fr
Sun Dec 21 10:12:28 PST 2008


Jeremy Huddleston wrote:
> 
> 
> On Dec 21, 2008, at 08:41, Harald Hanche-Olsen wrote:
> 
>> + Martin Costabel <costabel at wanadoo.fr>:
>>
>>> The problem with spaces in the directory name is not the problem we 
>>> were discussing here.
>>
>> There are several discussions going at once, so it's really hard to 
>> know what is being discussed at any given time.
>>
>>> Jeremy's wrapper script in rc4 has this problem, as has my wrapper 
>>> script. If you find a solution for it, it will be welcome.
>>
>> Oh, now I see it:
>>
>> "$(dirname $0)"/X11.bin "${@}"
>>
>> should really be more like
>>
>> dir=$(dirname "$0")
>> "${dir}/X11.bin" "${@}"
> 
> This should be fine:
> exec "$(dirname "$0")"/X11.bin "${@}"

The following is tested on bash, tcsh, ksh, zsh login shells, and in a 
directory with spaces in its name. In all cases it transmits a login 
environment to X11.bin. This is the X11 wrapper script, not the 
~/.x11run user script, which will be superfluous with this.

  #!/bin/bash --login
  export cmd=$(dirname "$0")/X11.bin
  export args="${@}"
  exec -l "$SHELL" -c 'exec "$cmd" "$args"'

The "export" is necessary, because with this level of quoting, the $cmd 
and $args variables are expanded by $SHELL and not by bash.

There are only two things that are not optimal:

If your login shell is not bash, but you nevertheless have bash startup 
scripts, then they will be read before your shell startup scripts. This 
is the situation we had (with the commands started form the Applications 
menu) for tcsh users until now, and nobody complained about it. Every 
other proposal I have seen so far will do the same.

Secondly, with the above, there will be two additional environment 
variables "cmd" and "args" in the environment of X11. Maybe they should 
get some more exotic names, like "X11_cmd" and "X11_args", so that they 
will not interfere with everyday life.

-- 
Martin



More information about the Xquartz-dev mailing list