Package: bash
Version: 3.1-3
Severity: normal
.bash_logout now invokes clear_console to get rid of any history in the
scrollback. This is good, but there's a cute interaction effect which
means that logging out of a su - root session in an xterm causes the
entire screen to go black for a second, which is frightening (I thought
I had somehow killed my entire X session until it came back).
Some basic analysis: Under normal conditions, clear_console does nothing
if DISPLAY is set. However, in a su - session, DISPLAY is not set, so
clear_console proceeds to try switching vt's. The ioctls fail if run
against X's console as an unprivileged user; but if you did su - root,
the kernel lets you do the vt switch, and thus, the screen goes black for
a second.
People commonly use su - to become root, as it ensures root has no
dangerous environment variables hanging around from the parent session.
So I think this will happen fairly often in real life. Suggestion:
instead of looking for DISPLAY, have clear_console call ttyname() and
skip the console-switching ioctls if it's running in a pseudoterminal.
(It Would Be Nice if it issued the clear-screen-and-scrollback escape
sequence under those conditions, instead of giving an error message and
doing nothing useful.)
... It occurs to me that the above suggestion will do the wrong thing
in, say, a screen(1) session in a text console. But it may still be
a step toward the proper solution.
Appended is an strace -f of clear_console run as root from inside X.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/dash
Kernel: Linux 2.6.15-1-686-smp
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Versions of packages bash depends on:
ii base-files 3.1.11 Debian base system miscellaneous f
ii debianutils 2.15.3 Miscellaneous utilities specific t
ii libc6 2.3.6-3 GNU C Library: Shared libraries an
ii libncurses5 5.5-1 Shared libraries for terminal hand
bash recommends no packages.
-- no debconf information
-- strace
1096 execve("/usr/bin/clear_console", ["clear_console"], [/* 13 vars */]) = 0
1096 uname({sys="Linux", node="banpei", ...}) = 0
1096 brk(0) = 0x804b000
1096 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1096 old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7f78000
1096 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
1096 open("/etc/ld.so.cache", O_RDONLY) = 3
1096 fstat64(3, {st_mode=S_IFREG|0644, st_size=56785, ...}) = 0
1096 old_mmap(NULL, 56785, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f6a000
1096 close(3) = 0
1096 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1096 open("/lib/libncurses.so.5", O_RDONLY) = 3
1096 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p\203\n"..., 512)
= 512
1096 fstat64(3, {st_mode=S_IFREG|0644, st_size=269760, ...}) = 0
1096 old_mmap(0x4f09a000, 273580, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x4f09a000
1096 old_mmap(0x4f0d4000, 36864, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x39000) = 0x4f0d4000
1096 close(3) = 0
1096 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1096 open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
1096 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260\337"...,
512) = 512
1096 fstat64(3, {st_mode=S_IFREG|0755, st_size=1269812, ...}) = 0
1096 old_mmap(0x4e8f9000, 1276892, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x4e8f9000
1096 old_mmap(0x4ea27000, 32768, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12d000) = 0x4ea27000
1096 old_mmap(0x4ea2f000, 7132, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4ea2f000
1096 close(3) = 0
1096 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1096 open("/lib/tls/i686/cmov/libdl.so.2", O_RDONLY) = 3
1096 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20<\243"...,
512) = 512
1096 fstat64(3, {st_mode=S_IFREG|0644, st_size=11176, ...}) = 0
1096 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7f69000
1096 old_mmap(0x4ea33000, 12404, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x4ea33000
1096 old_mmap(0x4ea35000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x4ea35000
1096 close(3) = 0
1096 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7f68000
1096 mprotect(0x4ea27000, 20480, PROT_READ) = 0
1096 set_thread_area({entry_number:-1 -> 6, base_addr:0xb7f686c0,
limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1,
seg_not_present:0, useable:1}) = 0
1096 munmap(0xb7f6a000, 56785) = 0
1096 open("/dev/tty", O_RDWR) = 3
1096 ioctl(3, KDGKBTYPE, 0xbf879667) = -1 EINVAL (Invalid argument)
1096 close(3) = 0
1096 open("/dev/tty0", O_RDWR) = 3
1096 ioctl(3, KDGKBTYPE, 0xbf879667) = 0
1096 ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
...}) = 0
1096 brk(0) = 0x804b000
1096 brk(0x806c000) = 0x806c000
1096 access("/root/.terminfo/x/xterm", R_OK) = -1 ENOENT (No such file or
directory)
1096 access("/etc/terminfo/x/xterm", R_OK) = -1 ENOENT (No such file or
directory)
1096 access("/lib/terminfo/x/xterm", R_OK) = 0
1096 open("/lib/terminfo/x/xterm", O_RDONLY|O_LARGEFILE) = 4
1096 read(4, "\32\1\34\0\35\0\17\0\235\1&\5", 12) = 12
1096 read(4, "xterm|X11 terminal emulator\0", 28) = 28
1096 read(4, "\0\1\0\0\1\0\0\0\1\0\0\0\0\1\1\0\0\0\0\0\0\0\1\0\0\1\0"..., 29)
= 29
1096 read(4, "\0", 1) = 1
1096 read(4, "P\0\10\0\30\0\377\377\377\377\377\377\377\377\377\377\377"...,
30) = 30
1096 read(4, "\0\0\4\0\6\0\10\0\31\0\36\0&\0*\0.\0\377\3779\0J\0L\0P"..., 826)
= 826
1096 read(4, "\33[Z\0\7\0\r\0\33[%i%p1%d;%p2%dr\0\33[3g\0\33["..., 1318) = 1318
1096 read(4, "", 10) = 0
1096 close(4) = 0
1096 ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
...}) = 0
1096 ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
...}) = 0
1096 ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
...}) = 0
1096 ioctl(1, TIOCGWINSZ, {ws_row=24, ws_col=80, ws_xpixel=0, ws_ypixel=0}) = 0
1096 fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
1096 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0xb7f77000
1096 ioctl(3, VT_GETSTATE, 0xbf8796d2) = 0
1096 ioctl(3, VIDIOC_G_COMP or VT_ACTIVATE, 0x1) = 0
1096 ioctl(3, VIDIOC_S_COMP or VT_WAITACTIVE, 0x1) = 0
1096 ioctl(3, VIDIOC_G_COMP or VT_ACTIVATE, 0x7) = 0
1096 ioctl(3, VIDIOC_S_COMP or VT_WAITACTIVE, 0x7) = 0
1096 write(1, "\33[H\33[2J", 7) = 7
1096 munmap(0xb7f77000, 4096) = 0
1096 exit_group(0) = ?
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]