Red Hat Bugzilla – Bug 119241
Xsession/xinitrc shouldn't source backup and dir files in xinitrc.d/
Last modified: 2007-11-30 17:10:39 EST
Description of problem:
I noticed that the Xsession and xinitrc scripts
source *all* executables in xinitrc.d/. This is
pretty annoying if you happen to edit one of the
files with emacs and then test it.
Steps to Reproduce:
1. cd /etc/X11/xinit/xinitrc.d
2. cp -p xinput xinput~ (alternatively edit the file with emacs)
3. Start a new X session from gdm say.
Both xinput and xinput~ get source'd.
Only xinput to be sourced.
I think /etc/profile gets this right with:
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
I noticed this problem because of the missing "]" in line 25
of xinput. ;)
Also it tries to execute subdirectories too...
Making this block FC2
Another way of inducing backup files, is if one modifies say
xinput, and then upgrade xinitrc: then rpm will generate
xinput.rpmnew, which will get sources along with (after?) xinput...
Mike, do you agree requiring a ".sh" suffix for scripts is a good
way to fix this, or is there a better way?
Yeah, I think the .sh method is the proper solution. I don't see
how else you could do it foolproof. *.sh makes it explicit that
anything needs to be named with a specific extension to get
executed, and has the benefit of backup files, etc. getting ignored.
It has the drawback that any other packages which drop files in
there, which aren't already named *.sh, will get ignored too.
Perhaps we should make the loop:
for file in /etc/X11/xinit/xinitrc.d/* ; do
if echo $file | grep -q "\.sh$" ; then
echo "warning: $file does not end in .sh extension, ignoring"
Perhaps the warning should go to stderr.
What do you think of the above?
The only other way, would be to ignore specific backup extensions,
but that's not foolproof, as there is no standard.
Yeah, I like your solution in comment 4.
I think that is fine.
Fixed in xinitrc-3.40-1
Note that you also have to change the other packages so they contain
.sh scripts instead of saying:
warning: /etc/X11/xinit/xinitrc.d/xinput does not end in .sh