Re: xenodm: save ~/.xesssion to ~/.xsession.old

2022-11-14 Thread Theo de Raadt
Klemens Nanni  wrote:

> On Mon, Nov 14, 2022 at 10:33:44AM -0700, Theo de Raadt wrote:
> > Stuart Henderson  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 -   
> > > > 1.2
> > > > +++ app/xenodm//config/Xsession.in  14 Nov 2022 16:47:03 -
> > > > @@ -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.

ln -s /tmp ~/.xsession-errors.old

Your plan is half baked.






Re: xenodm: save ~/.xesssion to ~/.xsession.old

2022-11-14 Thread Klemens Nanni
On Mon, Nov 14, 2022 at 10:33:44AM -0700, Theo de Raadt wrote:
> Stuart Henderson  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.in1 Jul 2022 20:42:06 -   
> > > 1.2
> > > +++ app/xenodm//config/Xsession.in14 Nov 2022 16:47:03 -
> > > @@ -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 -   1.2
+++ app/xenodm/config/Xsession.in   14 Nov 2022 19:39:57 -
@@ -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



Re: xenodm: save ~/.xesssion to ~/.xsession.old

2022-11-14 Thread Theo de Raadt
Stuart Henderson  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 -   1.2
> > +++ app/xenodm//config/Xsession.in  14 Nov 2022 16:47:03 -
> > @@ -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




Re: xenodm: save ~/.xesssion to ~/.xsession.old

2022-11-14 Thread Stuart Henderson
On 2022/11/14 16:50, Klemens Nanni wrote:
> X segfaulted when I opened a window, Xorg.log.old only showed the
> address without anything specific, no core dump was created and
> xenodm automatically restarted.
> 
> After I logged in I checked ~/.xsession for possible indications, but
> that file gets truncated on login.
> 
> I've restarted xenodm again, so the old Xorg.log.old containing the
> generic "X segfaulted at addr 0x86..." is also gone.
> 
> Woul it make sense to save an old copy in analogy to Xorg.log.old
> so crashes like this have a higher chance of being hunted down?
> 
> I haven't extensively tested this patch, but relogging into X now leaves
> ~/.xesssion-errors.old with logs from the previous session behind.
> 
> 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.in1 Jul 2022 20:42:06 -   1.2
> +++ app/xenodm//config/Xsession.in14 Nov 2022 16:47:03 -
> @@ -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.

>  if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
>  then
>   exec > "$errfile" 2>&1
> 



Re: xenodm: save ~/.xesssion to ~/.xsession.old

2022-11-14 Thread Aaron Bieber


Klemens Nanni  writes:

> X segfaulted when I opened a window, Xorg.log.old only showed the
> address without anything specific, no core dump was created and
> xenodm automatically restarted.
>
> After I logged in I checked ~/.xsession for possible indications, but
> that file gets truncated on login.
>
> I've restarted xenodm again, so the old Xorg.log.old containing the
> generic "X segfaulted at addr 0x86..." is also gone.
>
> Woul it make sense to save an old copy in analogy to Xorg.log.old
> so crashes like this have a higher chance of being hunted down?
>
> I haven't extensively tested this patch, but relogging into X now leaves
> ~/.xesssion-errors.old with logs from the previous session behind.
>

Tested, works as expected! This would have helped me semi-recently!

OK abieber@ fwiw :D

> 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.in1 Jul 2022 20:42:06 -   1.2
> +++ app/xenodm//config/Xsession.in14 Nov 2022 16:47:03 -
> @@ -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
>  if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
>  then
>   exec > "$errfile" 2>&1



xenodm: save ~/.xesssion to ~/.xsession.old

2022-11-14 Thread Klemens Nanni
X segfaulted when I opened a window, Xorg.log.old only showed the
address without anything specific, no core dump was created and
xenodm automatically restarted.

After I logged in I checked ~/.xsession for possible indications, but
that file gets truncated on login.

I've restarted xenodm again, so the old Xorg.log.old containing the
generic "X segfaulted at addr 0x86..." is also gone.

Woul it make sense to save an old copy in analogy to Xorg.log.old
so crashes like this have a higher chance of being hunted down?

I haven't extensively tested this patch, but relogging into X now leaves
~/.xesssion-errors.old with logs from the previous session behind.

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 -   1.2
+++ app/xenodm//config/Xsession.in  14 Nov 2022 16:47:03 -
@@ -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
 if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
 then
exec > "$errfile" 2>&1