Public bug reported:

I have a security script that relies on the `wtmpdb last` command
displaying consistent results. However, the `--until` option behaves
erratically.

When I run the _same_ `wtmpdb last --until <some_time>` command several
times, I get different results. This is a sample output:

# wtmpdb last --until "2024-11-17 21:13:14" | head -4
guest    ssh          127.0.0.1        Sun Nov 17 20:47 - 20:47  (00:00)
root     pts/1                         Sun Nov 17 20:15 - still logged in
root     pts/0                         Sun Nov 17 19:49 - 20:01  (00:11)
fedon    tty2                          Sun Nov 17 19:49 - still logged in

# wtmpdb last --until "2024-11-17 21:13:14" | head -4
root     pts/0                         Sun Nov 17 19:49 - 20:01  (00:11)
fedon    tty2                          Sun Nov 17 19:49 - still logged in
gdm      tty1                          Sun Nov 17 19:49 - 19:49  (00:00)
reboot   system boot  6.11.0-9-generic Sun Nov 17 19:49 - still running

# date
Sun 17 Nov 21:32:50 +03 2024

# wtmpdb --version
wtmpdb 0.13.0


As you see, the first invocation correctly displays logins from `guest` and 
`root` happened sometime between 20:00 and 21:00, while the second invocation 
misses these two!

Which output I get when I run the same command seems to be completely
random.

You may think that the second line with `root` "still logged in" causes
a confusion. However, even when I log out from `root`, the same erratic
behavior continues.

---

Ubuntu version 24.10

# apt-cache policy wtmpdb
wtmpdb:
  Installed: 0.13.0-1
  Candidate: 0.13.0-1
  Version table:
 *** 0.13.0-1 500
        500 http://us.archive.ubuntu.com/ubuntu oracular/universe amd64 Packages
        100 /var/lib/dpkg/status

** Affects: wtmpdb (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2088387

Title:
  `wtmpdb last --until` commands print inconsistent results in separate
  invocations

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/wtmpdb/+bug/2088387/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to