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 52319 - vte log pid of terminal in utmp, instead of pid of the process inside
vte log pid of terminal in utmp, instead of pid of the process inside
Product: vte
Classification: Core
Component: general
Other Linux
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Reported: 2001-03-20 17:27 UTC by Christian Marillat
Modified: 2015-05-09 17:28 UTC
See Also:
GNOME target: ---
GNOME version: ---

Description Christian Marillat 2001-03-20 17:27:40 UTC

As seen below, gnome-terminal logs the pid for gnome-terminal in utmp,
rather than the pid of the user's shell, as is expected. (I.e., the PID
recorded for pts/0 should be 1128.)

> ./who -uH
NAME     LINE         TIME         IDLE          PID COMMENT  
mstone   :0           Mar 14 18:15   ?          1044          
mstone   pts/0        Mar 14 18:16 00:12        1119 (:0)     
mstone   pts/1        Mar 14 18:16   .          1119 (:0)     
mstone   pts/2        Mar 14 18:16 00:16        1119 (:0)     
mstone   pts/3        Mar 14 18:16   .          1119 (:0)     
> ps -ef | grep 1119
mstone    1119     1  0 Mar14 ?        00:00:37 gnome-terminal ...
mstone    1127  1119  0 Mar14 ?        00:00:00 gnome-pty-helper
mstone    1128  1119  0 Mar14 pts/0    00:00:00 -csh
mstone    1135  1119  0 Mar14 pts/1    00:00:01 -csh
mstone    1152  1119  0 Mar14 pts/2    00:00:00 -csh
mstone    1168  1119  0 Mar14 pts/3    00:00:00 -csh
Comment 1 Kjartan Maraas 2002-01-27 00:42:17 UTC
Has this changed in a later release? I can't get 'who' to print PID btw.
Comment 2 Christian Marillat 2002-01-27 02:44:18 UTC
Still the same problem.
Comment 3 Kjartan Maraas 2002-04-26 21:00:19 UTC
Any idea where it goes wrong?
Comment 4 Kjartan Maraas 2002-08-01 12:12:01 UTC
Have you tried this in 2.0? I'm not sure this will be fixed in 1.4.x,
but if it's fixed in 2.0.x I'll close it :)
Comment 5 Christian Marillat 2002-08-02 13:42:21 UTC
Still the same problem with 2.0
Comment 6 Kjartan Maraas 2002-08-02 18:20:02 UTC
Moving up then. It's a WONTFIX for 1.4.x.
Comment 7 Kjartan Maraas 2002-08-02 18:21:10 UTC
Moving to gnome-terminal for comments from Havoc. Was this with libzvt
or vte?
Comment 8 Havoc Pennington 2002-08-02 18:39:13 UTC
should be easy to fix, surely?
Comment 9 Havoc Pennington 2002-09-22 19:28:08 UTC
Bouncing to vte to fix in that copy of pty-helper, then should be
bounced to libzvt to fix there.
Comment 10 Nalin Dahyabhai 2002-11-04 17:57:42 UTC
Fixing this is non-trivial due to how gnome-pty-helper works:  it logs
its parent's PID, which it obtains using getppid().  I don't think
letting the parent pass an arbitrary PID to the helper would be a good
idea, because we don't know what other programs might depend on and
trust that information.

Fixing it would require changing libzvt or vte to to use a separate
gnome-pty-helper process (and separate descriptors for communicating
with them) for each pty, and I'm not sure we want to do that.
Comment 11 Behdad Esfahbod 2008-11-29 07:40:35 UTC
I can think of the following solution:

On Linux, switch over to unix sockets instead of a pipe for communication.  Then the forked child can send a message to the pty helper and the helper can check pid of the sending process using SCM_CREDENTIALS (see man 7 unix).

Comment 12 Behdad Esfahbod 2008-11-29 10:17:06 UTC
Seems like we do use sockets already.  I'll give this a try.
Comment 13 Christian Persch 2015-05-09 17:28:37 UTC
Obsolete now that g-p-h has been removed.