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

2010-10-02 Thread Tim Connors
On Mon, 13 Sep 2010, Timo Juhani Lindfors wrote:

 Julien Cristau jcris...@debian.org writes:
  That seems to duplicate the last 512kB rather than remove the rest?
  Perhaps your '' ought to be ''?

 Whoops, yes indeed. I had some debugging prints like starting session
 on $(date) there and forgot .

 Fixed version is attached.

Seems to work thanks.

-- 
TimC
The stereotypical Islay is like chewing on a well-preserved rowing
boat, spiced up with seaweed, whereas the 20yo Laddie is more like
relishing a gourmet meal in said rowing boat. -- Ingvar in ASR



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



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

2010-09-13 Thread Tim Connors
On Mon, 13 Sep 2010, Timo Juhani Lindfors wrote:

 [I'm not a maintainer, just happened be following X bugs...]

 Tim Connors report...@rather.puzzling.org writes:
  before the user gets to review them, they can always log into the
  console and review the errors before they restart X.

 Always might be too strong word. On my PDA I don't have a physical
 keyboard, the only way to read .xsession-errors is via X or by
 connecting a laptop. And on my laptop switching virtual consoles
 sometimes fails if I have used suspend...

  This is particularly insidious when the disk is full because something
  was writing lots of crap to ~/.xsession-errors.  That crap is not

 I think this is the real problem and applications should be fixed to
 limit their error output.

Yep.  But sometimes wmbattery goes haywire trying to connect to HAL, or a
homegrown app might output too much.  In the absense of a library to do
this (and I *really* hate it when gnome by default limits output and just
discards the rest - its limit is arbitrarily small, and I have no way of
retrieving that lost information after a certain point in a desktop
session once it starts discarding data.  Fortunately, I do not use gnome
often).

  because of too much crap emitted to ~/.xsession-errors?  Well, just
  let the unsophisticated user log out and log back in again.

 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).

-- 
TimC
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



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

2010-09-13 Thread Timo Juhani Lindfors
package x11-common
tag 596634 patch
thanks

Tim Connors report...@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.lindf...@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 21
 
 echo $PROGNAME: X session started for $LOGNAME at $(date)
-- 
1.7.1



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

2010-09-13 Thread Julien Cristau
On Mon, Sep 13, 2010 at 14:28:37 +0300, Timo Juhani Lindfors wrote:

 Tim Connors report...@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.lindf...@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 21
  
  echo $PROGNAME: X session started for $LOGNAME at $(date)

Cheers,
Julien


signature.asc
Description: Digital signature


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

2010-09-13 Thread Timo Juhani Lindfors
Julien Cristau jcris...@debian.org writes:
 That seems to duplicate the last 512kB rather than remove the rest?
 Perhaps your '' ought to be ''?

Whoops, yes indeed. I had some debugging prints like starting session
on $(date) there and forgot .

Fixed version is attached.

From d1df83712f29dc7ffe2203f38efdd290fbac6535 Mon Sep 17 00:00:00 2001
From: Timo Juhani Lindfors timo.lindf...@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..6145389 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 21
 
 echo $PROGNAME: X session started for $LOGNAME at $(date)
-- 
1.7.1



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

2010-09-12 Thread Tim Connors
Package: x11-common
Version: 1:7.5+6
Severity: important

Is there any reason why /etc/X11/Xsession appends to the logfile
instead of creating it:

exec $ERRFILE 21

If the argument is that you want to be able to see what errors
happened in the last session, so you don't want to clear them out
before the user gets to review them, they can always log into the
console and review the errors before they restart X.

Meanwhile, the non-priveleged user has no opportunity to make sure
their .xsession-errors file is emptied when their session starts,
because if they empty it unconditionally in their own ~/.xsession
file, then they'll lose any error message output before ~/.xsession
executes.

This is particularly insidious when the disk is full because something
was writing lots of crap to ~/.xsession-errors.  That crap is not
cleared out when the user's session restarts, and so that user can't
log in because their Xauthority file can't be modified, should they
opt for Xauthority to be created in their home directory (or their
desktop manager will get stuck when it tries to read-write-modify
its dotfiles).

All of this talk for the past 5 years that maybe we should have a
mechanism for limiting the size of logfiles is just skirting around
the issue.  The logfile never shrinks if it is never truncated at X
startup!  Fix that one line, and the whole issue goes away!  Disk full
because of too much crap emitted to ~/.xsession-errors?  Well, just
let the unsophisticated user log out and log back in again.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages x11-common depends on:
ii  debconf [debconf-2.0] 1.5.35 Debian configuration management sy
ii  debianutils   3.4Miscellaneous utilities specific t
ii  lsb-base  3.2-23.1   Linux Standard Base 3.2 init scrip

x11-common recommends no packages.

x11-common suggests no packages.

-- debconf information:
  x11-common/xwrapper/actual_allowed_users: console
  x11-common/xwrapper/allowed_users: Console Users Only



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



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

2010-09-12 Thread Timo Juhani Lindfors
[I'm not a maintainer, just happened be following X bugs...]

Tim Connors report...@rather.puzzling.org writes:
 before the user gets to review them, they can always log into the
 console and review the errors before they restart X.

Always might be too strong word. On my PDA I don't have a physical
keyboard, the only way to read .xsession-errors is via X or by
connecting a laptop. And on my laptop switching virtual consoles
sometimes fails if I have used suspend...

 This is particularly insidious when the disk is full because something
 was writing lots of crap to ~/.xsession-errors.  That crap is not

I think this is the real problem and applications should be fixed to
limit their error output.

 because of too much crap emitted to ~/.xsession-errors?  Well, just
 let the unsophisticated user log out and log back in again.

How about a compromise? Could we truncate all but the last 1000 lines
in /etc/X11/Xsession?



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org