flaws in xinitrc-ng

Elan Ruusamäe glen at pld-linux.org
Sun Jan 29 15:58:33 CET 2012


our latest and greatest release

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"?

* for first, it will prevent further scripts being executed as they are 
* for second, WM will consider startup failed and will exit
* for third, the scripts must be written in /bin/sh compatible way! (no 
.csh, no .pl)

so whole session is aborted, user is not logged in, and rather hard to 
diagnose why log in failed!

2) common backups should be excluded, or only known file extensions 
otherwise you end up easily running same script twice.

how to proceed here?
for first problem, make all -x scripts executed, not sourced?
for second problem allow only known extensions, or build blacklist of 
backup files?



More information about the pld-devel-en mailing list