This condition will always be triggered even if the Xorg server
terminates promptly. This will simply result in confusing diagnostics
being printed in the common case. As kill has no quiet option, I will
have to unfortunately silence them instead.
I was under the false assumption that -a, like &&, was used
short-circuit semantics. However the behaviour of -a is not specified
by POSIX.
At least on Linux using bash or dash the behaviour is not
short-circuiting.
As there's no reason to test the RHS if the LHS is false I've switched
back to [ ] && notation which is defined to be short-circuiting.
Turns out openssl rand would obnoxiously create a HOME/.rnd dotfile
unless told otherwise with the RANDFILE environment. Unfortunately
this neither options are compelling and neither can openssl rand be
told to not write this file.
Instead I'm going to use /dev/urandom which appears to be available
on practically every UNIX.
This commit also tidies up the timeout kill logic to better express
what I am doing.
Upon review of GNU tail I discovered that the implemention of --pid was
the same method as polling kill -0 on a sleep interval, which defaults
to 1 second unless -s is used.
This is perhaps expected due to the lack of a pwait(2) system call, I
decided to implement the same mechanic myself and drop both the
requirement on GNU tail and GNU timeout at the same time.
This commit also replaces mcookie from util-linux with openssl rand
which is used to generate a random MD5 checksum for use in the
MIT-MAGIC-COOKIE-1 value.
We need to do this in sx as neither xauth(1) or touch(1) will create the
path. Requiring the user to do this would lead to additional code on
their side to account for a detail that sx already controls. There
is no obvious benefit for omitting this functionality.
There's not a lot of point in absorbing the xserver's log file when it
will just be less intuitive for those looking for it in the standard
location. Since the log is generated by Xorg and not sx, it only seems
reasonable.
This commit also renames xauthfile to xauthority for a little more
consistency with documentation and prior art.
Xorg.wrap default system of autodetection of root rights requirement is
wrong in every case I've seen it used. The result is the Xorg server
runs as the root user when it is not necessary.
The main autodetection failure case is when the proprietary nvidia
drivers are used, incorrectly assuming Xorg needs to be run as root.