After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 107534 - leaves ghosts on system
leaves ghosts on system
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
0.11.x
Other other
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2003-03-04 08:45 UTC by Christian Marillat
Modified: 2006-04-12 09:11 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
strace log file (174.34 KB, application/x-gzip)
2003-05-02 14:41 UTC, Christian Marillat
Details
Helper strace (1.52 KB, application/x-gzip)
2003-05-02 20:17 UTC, Christian Marillat
Details
strace (17.76 KB, text/plain)
2005-02-14 20:36 UTC, Kjartan Maraas
Details

Description Christian Marillat 2003-03-04 08:45:33 UTC
Hi,

http://bugs.debian.org/183035

gnome-terminal does not remove entries from /var/run/utmp properly.
After running exiting a ghost of that user on that pty is left on the
system.
Comment 1 Nalin Dahyabhai 2003-03-04 17:58:44 UTC
I can't reproduce this.
Comment 2 Christian Marillat 2003-03-04 19:42:28 UTC
Hi,

I did an strace and I see a that. Any idea what's wrong ?

16521 access("/usr/lib/libvte4/gnome-pty-helper", X_OK) = 0
16521 open("/dev/null", O_RDONLY)       = 16
16521 open("/dev/null", O_RDONLY)       = 17
16521 socketpair(PF_UNIX, SOCK_STREAM, 0, [18, 19]) = 0
16521 close(16)                         = 0
16521 close(17)                         = 0
16521 fork()                            = 16522
16522 --- SIGSTOP (Stopped (signal)) @ 0 (0) ---
16522 getpid()                          = 16522
16522 getrlimit(0x3, 0xbffff360)        = 0
16522 setrlimit(RLIMIT_STACK, {rlim_cur=RLIM_INFINITY,
rlim_max=RLIM_INFINITY}) = 0
16522 getrlimit(0x7, 0xbffff378)        = 0

[...]

16522 close(15)                         = 0
16522 close(16)                         = -1 EBADF (Bad file descriptor)
16522 close(17)                         = -1 EBADF (Bad file descriptor)
16522 close(18)                         = 0
16522 close(20)                         = -1 EBADF (Bad file descriptor)
16522 close(21)                         = -1 EBADF (Bad file descriptor)
16522 close(22)                         = -1 EBADF (Bad file descriptor)
16522 close(23)                         = -1 EBADF (Bad file descriptor)
16522 close(24)                         = -1 EBADF (Bad file descriptor)
Comment 3 Nalin Dahyabhai 2003-03-04 19:50:37 UTC
That looks correct.  The parent is closing one end of the socket pair
(it uses one end, and the gnome-pty-helper child uses the other).
Comment 4 Christian Marillat 2003-03-04 20:13:28 UTC
How I can debug that ?
Comment 5 Nalin Dahyabhai 2003-03-04 20:33:08 UTC
Try firing up gnome-terminal, attaching strace to the gnome-pty-helper
which it starts up, and exiting the terminal.  That should let you see
just what the pty-helper does when the parent asks it to shut down a
terminal.  Thanks!
Comment 6 Christian Marillat 2003-03-12 19:10:32 UTC
Apparently gnome-pty-helper doesn't write /var/run/utmp when I quit
gnome-terminal :

read(0, 0xbffff5e0, 4)                  = ? ERESTARTSYS (To be restarted)
--- SIGTERM (Terminated) @ 0 (0) ---
Comment 7 Nalin Dahyabhai 2003-04-22 21:39:05 UTC
Okay, should be fixed in CVS now.  Please reopen if you continue to
see problems.
Comment 8 Christian Marillat 2003-04-27 16:40:45 UTC
Still here in 0.11.4 Even worse now gnome-pty-helper doesn't write a
new entry in utmp
Comment 9 Nalin Dahyabhai 2003-04-29 01:55:55 UTC
Can you strace it again and see what's going on in the helper?
Comment 10 Christian Marillat 2003-05-02 14:41:23 UTC
Created attachment 16202 [details]
strace log file
Comment 11 Christian Marillat 2003-05-02 14:41:46 UTC
I did a strace (3 gnome-terminals are launched) and gnome-pty-helper
is unable to write the utmp file :

29403 access("/var/run/utmpx", F_OK)    = -1 ENOENT (No such file or
directory)
29403 open("/var/run/utmp", O_RDWR)     = -1 EACCES (Permission denied)
29403 open("/var/run/utmp", O_RDONLY)   = 3

Of course gnome-pty-helper is correctly setgid :

$ ls -l /usr/lib/libvte4
total 652
-rwxr-xr-x    1 root     root          284 avr 29 16:22 decset
-rwxr-sr-x    1 root     utmp         8536 avr 29 16:22 gnome-pty-helper
Comment 12 Nalin Dahyabhai 2003-05-02 18:07:04 UTC
What are the permissions on /var/run/utmp?  Is it writable by the utmp
group?
Comment 13 Christian Marillat 2003-05-02 19:19:29 UTC
Yes :

ls -l /var/run/utmp 
-rw-rw-r--    1 root     utmp         6144 mai  2 19:08 /var/run/utmp
Comment 14 Nalin Dahyabhai 2003-05-02 19:57:11 UTC
Aargh, please attach to the helper process after the terminal has been
started instead of running it directly under strace.  If you as an
unprivileged user attempt to strace a setuid or setgid process, the
kernel will start the process without elevated privileges.
Comment 15 Christian Marillat 2003-05-02 20:17:06 UTC
Created attachment 16218 [details]
Helper strace
Comment 16 Christian Marillat 2003-05-02 20:18:14 UTC
Ah OK. I attached another strace to the helper and opened/closed
different gnome-terminal.
Comment 17 Kjartan Maraas 2003-10-30 13:30:26 UTC
Reopening after new information was given.
Comment 18 Kjartan Maraas 2005-02-14 20:36:04 UTC
Created attachment 37472 [details]
strace

Attaching a non-gzipped version to make it easier to look at it.
Comment 19 Behdad Esfahbod 2006-04-12 09:11:36 UTC
This has been fixed a long time ago.  The problem was that vte sends SIGTERM to gnome-pty-helper upon termination, and gnome-pty-helper was not handling the signal, so it was getting killed before getting the chance to clean up.  It handles the signal and cleans up correctly now.