On Mon, Nov 14, 2022 at 10:33:44AM -0700, Theo de Raadt wrote: > Stuart Henderson <s...@spacehopper.org> wrote: > > > > Index: app/xenodm//config/Xsession.in > > > =================================================================== > > > RCS file: /cvs/xenocara/app/xenodm/config/Xsession.in,v > > > retrieving revision 1.2 > > > diff -u -p -r1.2 Xsession.in > > > --- app/xenodm//config/Xsession.in 1 Jul 2022 20:42:06 -0000 > > > 1.2 > > > +++ app/xenodm//config/Xsession.in 14 Nov 2022 16:47:03 -0000 > > > @@ -7,6 +7,7 @@ exec_prefix="@exec_prefix@" > > > # redirect errors to a file in user's home directory if we can > > > > > > errfile="$HOME/.xsession-errors" > > > +cp -f "$errfile" "$errfile.old" 2> /dev/null > > > > Those files can get pretty big. mv is probably a better idea than cp. > > And consider the target being a symbolic link, both file and directory
`mv -f 2>/dev/null' should be good enough for all of this, no? It's a silent one-shot: if it works, great. If not, no .old backup and the file gets truncated as usual. Index: app/xenodm/config/Xsession.in =================================================================== RCS file: /cvs/xenocara/app/xenodm/config/Xsession.in,v retrieving revision 1.2 diff -u -p -r1.2 Xsession.in --- app/xenodm/config/Xsession.in 1 Jul 2022 20:42:06 -0000 1.2 +++ app/xenodm/config/Xsession.in 14 Nov 2022 19:39:57 -0000 @@ -7,6 +7,7 @@ exec_prefix="@exec_prefix@" # redirect errors to a file in user's home directory if we can errfile="$HOME/.xsession-errors" +mv -f "$errfile" "$errfile.old" if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null ) then exec > "$errfile" 2>&1