logname/w/who/pinky does not work, no utmp record?

Bug #1516440 reported by Mattias Andrée
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Terminator
Incomplete
Low
Unassigned

Bug Description

logname(1) fails in terminator.

Expected result:
$ logname
<YOUR USERNAME>
$ echo $?
0

Actual result:
$ logname
logname: no login name
$ echo $?
1

logname(1) works both in Linux VT and xterm.
logname(1) uses getlogin(3) to get the username
(that is logged in to the controlling terminal.)

Similarly w(1), who(1), and pinky(1) does not return
list logins on terminator terminals. I think all of
these, and getlogin(3), uses utmp.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

This is *probably* an issue with the old libvte being used. If that is the case it cannot be fixed in the GTK2 version of Terminator. There is a GTK3 version of Terminator, which is based on a much newer version of libvte. Have you tested on that? I don't have my other system up right now to check, but suspect that your commands will work there.

(I tested with my installed guake (also using old libvte) and it has the same issue. This is why I think the issue is in libvte, not Terminator itself.)

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

utmp logging is not done and AFAICT never was done by vte. It's up to the app.

Gnome-terminal recently removed it which is a controversial change causing some issues (which I don't care about and am happy to see it gone :)), see https://bugzilla.gnome.org/show_bug.cgi?id=747046.

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

Sorry sorry sorry, shame on me, it _was_ part of vte and not g-t.

So, yup, it's gone, deal with it :P

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

Correspondingly, Profiles -> Command -> Update login records... seems to be a dead option; its underlying variable update_records is (if I'm not mistaken) only set but never read.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

@Egmont: I think the original issue was more about the commands failing. Presumably I can code something in Terminator to replace the utmp logging, If I can figure it out :-)

@Mattias: I tested Terminator(gtk2) in precise (12.04) and saw the same issue as the OP. But in trusty (14.04) it works. Unfortunately you didn't give any info about your system, but if your system is older, it might be related to that.

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

It's quite tricky to code it up, since it has to be a setuid or setgid wrapper to be able to write that file, plus you have to be sure that that's the only thing it can do and that it cannot write untrue records. Probably you should go for the libutempter library. I've never used that, I just see that that's what xterm and tmux and a few others use.

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

Well, that's a C library with probably no python wrapper... to make the story more complicated.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

A little off-topic, but guake is Python and uses libutempter using ctypes library. Just dropping here to keep the reference:
https://github.com/Guake/guake/blob/master/src/guake/guake_app.py

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

(gtk3) Since utmp is no longer supported by vte, remove the corresponding config option for now. (We might bring it back later on, but that requires more work.)

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

@Egmont: Trying to understand a diff between vte 0.2x and vte 0.3x. The following from gtk2:

            if self.config['login_shell']:
                args.insert(0, "-%s" % shell)
            else:
                args.insert(0, shell)

Works for gtk2 if login_shell is true, but throws an exception in gtk3:

Traceback (most recent call last):
  File "./terminator", line 117, in <module>
    TERMINATOR.layout_done()
  File "/home/sboddy/Development/terminator/bugfix-egmontkoblinger/terminatorlib/terminator.py", line 324, in layout_done
    terminal.spawn_child()
  File "/home/sboddy/Development/terminator/bugfix-egmontkoblinger/terminatorlib/terminal.py", line 1415, in spawn_child
    None)
gi._glib.GError: Failed to execute child process "-/bin/bash" (No such file or directory)

From the old vte docs, there is no indication what exactly this is doing. If it was treated as a special case. I'll see if I can get the 0.28 tarball to see if I can figure out what this was for, and if we still need it. Otherwise, we might be able to remove this setting, and option in gtk3.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

BTW, Still awaiting feedback from OP as requested in comment #5 where I asked for more info regarding his system.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Doh! Ignore comment #10, I just noticed LP#1520991.

Changed in terminator:
status: New → Incomplete
Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

:D

Changed in terminator:
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.