flaws in xinitrc-ng

Tomasz Pala gotar at polanet.pl
Sun Jan 29 23:17:38 CET 2012


On Sun, Jan 29, 2012 at 16:58:33 +0200, Elan Ruusamäe wrote:

> 78    # Run all system xinitrc shell scripts.
> 79    for i in /etc/X11/xinit/xinitrc.d/* ; do
> 80            if [ -x "$i" ]; then
> 81                    . "$i"
> 82            fi
> 83    done
> 
> this code has several flaws:
> 
> 1) what if script sourced writes "exit 1"?

It does what author of such script wanted - like preventing starting up
(e.g. temporary lockdown or sth).

> * for third, the scripts must be written in /bin/sh compatible way! (no 
> .csh, no .pl)

Yes, as it's primary function is to set environment for running sh.

> for first problem, make all -x scripts executed, not sourced?

If you want to execute some code, just create #!sh script with proper
commands and source it. That's the same rule we follow for many other
scripts using sth.d for config inclusion (e.g. login shell startup).

-- 
Tomasz Pala <gotar at pld-linux.org>


More information about the pld-devel-en mailing list