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

Bug#596634: x11-common: /etc/X11/Xsession always appends to .xsession-errors



On Mon, Sep 13, 2010 at 14:28:37 +0300, Timo Juhani Lindfors wrote:

> Tim Connors <reportbug@rather.puzzling.org> writes:
> > this (and I *really* hate it when gnome by default limits output and just
> 
> Can you locate where this limit is in gnome? Is it a per-app limit or
> global to all gnome applications?
> 
It used to be in gdm, was removed in 2.20.11-2.

> >> How about a compromise? Could we truncate all but the last 1000 lines
> >> in /etc/X11/Xsession?
> >
> > Sure.  Or perhaps 1000*80 characters (never encountered super long lines
> > as output to .xsession-errors, but could happen).
> 
> Good point. I recall seeing binaries in ~/.xsession-errors.
> 
> The attached patch keeps only the last 512 KiB of ~/.xsession-errors
> on login. Can you test if this works for you?
> 

> >From 5433fac367d3c14fedfc542b0710cc1399683ac4 Mon Sep 17 00:00:00 2001
> From: Timo Juhani Lindfors <timo.lindfors@iki.fi>
> Date: Mon, 13 Sep 2010 14:25:54 +0300
> Subject: [PATCH] Keep only last 512 KiB of .xsession-errors
> 
> ---
>  debian/x11-common/etc/X11/Xsession |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/debian/x11-common/etc/X11/Xsession b/debian/x11-common/etc/X11/Xsession
> index 6ad7d6e..6937e8f 100755
> --- a/debian/x11-common/etc/X11/Xsession
> +++ b/debian/x11-common/etc/X11/Xsession
> @@ -74,6 +74,13 @@ else
>    errormsg "unable to create X session log/error file; aborting."
>  fi
>  
> +if ERRFILETMP=$(tempfile 2> /dev/null); then
> +    # Keep only last 512 KiB of $ERRFILE
> +    tail --bytes 524288 "$ERRFILE" > "$ERRFILETMP"
> +    cat "$ERRFILETMP" >> "$ERRFILE"
> +    rm -f "$ERRFILETMP"
> +fi
> +

That seems to duplicate the last 512kB rather than remove the rest?
Perhaps your '>>' ought to be '>'?

>  exec >>"$ERRFILE" 2>&1
>  
>  echo "$PROGNAME: X session started for $LOGNAME at $(date)"

Cheers,
Julien

Attachment: signature.asc
Description: Digital signature


Reply to: