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

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



package x11-common
tag 596634 patch
thanks

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?

>> 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
+
 exec >>"$ERRFILE" 2>&1
 
 echo "$PROGNAME: X session started for $LOGNAME at $(date)"
-- 
1.7.1


Reply to: