MPSAFE tty and lastcomm output

From: <poyopoyo_at_puripuri.plala.or.jp>
Date: Tue, 11 Oct 2011 21:20:48 +0900
Hi,

Does anyone see this on -CURRENT (and stable/9)? It doesn't look so
smart output to me. I was aware of this issue first back in Aug 2009.

==
$ tty; lastcomm tty|head -1
/dev/pts/12
tty              -       user               pts/12    0.002 secs Tue Oct 11 20:41
==
OK, As this was run on pts/12, nothing is wrong.

==
$ script /dev/null tty; lastcomm tty|head -1; lastcomm tty|head -1
Script started, output file is /dev/null
/dev/pts/13

Script done, output file is /dev/null
tty              -       user               pts/13    0.001 secs Tue Oct 11 20:46
tty              -       user               #C:0x8b   0.001 secs Tue Oct 11 20:46
==
Please look at the second entry of lastcomm. These two entries
should describe the identical tty(1) process, and a tty field in the
second entry does not look good. It looks stored accounting
information is correct, but lastcomm failed to represent device name
gently after it has been destroyed.

Funnier case:
==
$ jot 1000|while read n; do script /dev/null tty < /dev/tty & done > /dev/null 2>&1 ; wait; lastcomm tty|head
==
And you'll see variety of output. Some devices are still alive and
others has been destroyed. Without head(1) you'll see a swarm of them,
of course. (After this one-liner, my tty always goes mad and have to
reset(1) to be back sane. This is another issue though.)

-- 
kuro
Received on Tue Oct 11 2011 - 10:20:51 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:19 UTC