[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Thoughts about /etc/X11/Xsession and .xsession-errors



Hello.
/etc/X11/Xsession creates a ~/.xsession-errors and then creates a 
symlink from that file to /tmp/xsession-$USER. But if that fails, it 
tells the user that it has tried it the other way round.
Doing it the other way would not only fit to the message, but would also 
make more sense to me. If thats in /home is just a symlink and the real 
file is in /tmp on a tmpfs, you avoid unnecessary accesses to hard-disk 
(could sometimes prevent a spin-up) or ssd. The second benefit is that 
the old xsession-errors are discarded on reboot (even on non tmpfs), so 
it doesn't grow to infinity.
Is this something worth writing a bug report about, or do i just get 
something wrong?
Below is the relevant part of my working personal version of Xsession:

SYSSESSIONDIR=/etc/X11/Xsession.d
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession
ERRFILE=$HOME/.xsession-errors
TMPDIR=/tmp

# attempt to create an error file; abort if we cannot
if (umask 077 && touch "$TMPDIR/xsession-$USER") 2> /dev/null && [ -w 
"$TMPDIR/xsession-$USER" ] &&
  [ ! -L "$TMPDIR/xsession-$USER" ]; then
  chmod 600 "$TMPDIR/xsession-$USER"
  if ! ln -sf "$TMPDIR/xsession-$USER" "$ERRFILE"; then
    message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \
             "\"$ERRFILE\"; look for session log/errors in" \
             "\"$TMPDIR/xsession-$USER\"."
  fi
else
  errormsg "unable to create X session log/error file; aborting."
fi

exec >>"$TMPDIR/xsession-$USER" 2>&1

echo "$PROGNAME: X session started for $LOGNAME at $(date)"


Reply to: