GNOME Bugzilla – Bug 52319
vte log pid of terminal in utmp, instead of pid of the process inside
Last modified: 2015-05-09 17:28:37 UTC
Hi, 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
Has this changed in a later release? I can't get 'who' to print PID btw.
Still the same problem.
Any idea where it goes wrong?
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 :)
Still the same problem with 2.0
Moving up then. It's a WONTFIX for 1.4.x.
Moving to gnome-terminal for comments from Havoc. Was this with libzvt or vte?
should be easy to fix, surely?
Bouncing to vte to fix in that copy of pty-helper, then should be bounced to libzvt to fix there.
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.
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).
Seems like we do use sockets already. I'll give this a try.
Obsolete now that g-p-h has been removed.