last -t does not work as what man page said

Bug #1408605 reported by elgs
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sysvinit (Ubuntu)
New
Medium
elgs

Bug Description

The man page of the last command says as follows:

-t YYYYMMDDHHMMSS
              Display the state of logins as of the specified time. This is useful, e.g., to determine easily who was logged
              in at a particular time -- specify that time with -t and look for "still logged in”.

However, Wen I ran the command with -t, I got the following output:
# last -F -t 20150107000000 | grep pts
root pts/2 jp001.solidtunne Tue Jan 6 18:39:05 2015 - Tue Jan 6 18:40:34 2015 (00:01)
root pts/2 jp001.solidtunne Tue Jan 6 18:37:24 2015 - Tue Jan 6 18:37:41 2015 (00:00)
root pts/2 jp001.solidtunne Tue Jan 6 16:42:33 2015 - Tue Jan 6 16:43:49 2015 (00:01)
root pts/2 jp001.solidtunne Tue Jan 6 13:03:26 2015 - Tue Jan 6 13:07:02 2015 (00:03)
root pts/2 jp001.solidtunne Tue Jan 6 09:03:24 2015 - Tue Jan 6 09:03:54 2015 (00:00)
root pts/2 jp001.solidtunne Tue Jan 6 04:53:54 2015 - Tue Jan 6 04:54:07 2015 (00:00)
root pts/0 42.243.9.2 Mon Jan 5 03:06:48 2015 - Mon Jan 5 03:07:10 2015 (00:00)
root pts/2 42.243.9.2 Sun Jan 4 14:08:02 2015 - Sun Jan 4 14:09:02 2015 (00:01)
root pts/1 42.243.9.2 Sun Jan 4 12:09:56 2015 - Sun Jan 4 12:10:05 2015 (00:00)
root pts/0 42.243.9.2 Sun Jan 4 03:24:57 2015 - Sun Jan 4 03:25:10 2015 (00:00)
root pts/2 42.243.96.183 Sat Jan 3 14:47:38 2015 - Sat Jan 3 14:47:54 2015 (00:00)
root pts/4 sf003.solidtunne Fri Jan 2 15:23:12 2015 - Fri Jan 2 15:23:51 2015 (00:00)
root pts/0 hk000.solidtunne Thu Jan 1 16:40:55 2015 - Thu Jan 1 16:41:21 2015 (00:00)
root pts/2 hk000.solidtunne Thu Jan 1 15:41:52 2015 - Thu Jan 1 15:42:02 2015 (00:00)
root pts/4 hk000.solidtunne Thu Jan 1 11:24:56 2015 - Thu Jan 1 13:40:40 2015 (02:15)
root pts/4 hk000.solidtunne Thu Jan 1 11:24:34 2015 - Thu Jan 1 11:24:48 2015 (00:00)
root pts/0 hk000.solidtunne Thu Jan 1 08:31:13 2015 - Thu Jan 1 08:31:25 2015 (00:00)

The current date is as follows:
# date
Thu Jan 8 08:12:32 UTC 2015

And Ubuntu version:
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty

Kernel:
# uname -a
Linux install 3.13.0-40-generic #69-Ubuntu SMP Thu Nov 13 17:53:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

So, it seems the -t actually returns the state of logins "up till" the specified time, as opposed to "as of" the specified time as written in the man page, or am I missing something?

Revision history for this message
elgs (elgs1980) wrote :

I expect the implementation of last will be changed to align with the man page, as opposed to the man page being changed to align with the current last command behavior, as I think "as of" is more useful than "up till".

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1408605/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Revision history for this message
elgs (elgs1980) wrote : Re: [Bug 1408605] last -t does not work as what man page said

I’m sorry after reading the FindRightPackage page, I still don’t have any idea which package the last command belongs to.

Best regards,
Elgs

> On Jan 8, 2015, at 8:24 PM, Ubuntu Foundations Team Bug Bot <email address hidden> wrote:
>
> Thank you for taking the time to report this bug and helping to make
> Ubuntu better. It seems that your bug report is not filed about a
> specific source package though, rather it is just filed against Ubuntu
> in general. It is important that bug reports be filed about source
> packages so that people interested in the package can find the bugs
> about it. You can find some hints about determining what package your
> bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage.
> You might also ask for help in the #ubuntu-bugs irc channel on Freenode.
>
> To change the source package that this bug is filed about visit
> https://bugs.launchpad.net/ubuntu/+bug/1408605/+editstatus and add the
> package name in the text box next to the word Package.
>
> [This is an automated message. I apologize if it reached you
> inappropriately; please just reply to this message indicating so.]
>
> ** Tags added: bot-comment
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1408605
>
> Title:
> last -t does not work as what man page said
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+bug/1408605/+subscriptions

Revision history for this message
Brian Murray (brian-murray) wrote :

 $ dpkg -S $(which last)
sysvinit-utils: /usr/bin/last

tags: added: trusty
affects: ubuntu → sysvinit (Ubuntu)
Changed in sysvinit (Ubuntu):
importance: Undecided → Medium
Revision history for this message
elgs (elgs1980) wrote :

Changed package to: sysvinit-utils

Revision history for this message
elgs (elgs1980) wrote :

Thanks Brian. This bug is very critical to my application. I believe it is not correctly implemented. I wish this can be fixed soon. Thanks.

Revision history for this message
elgs (elgs1980) wrote :

Any chance this bug to be assigned?

Revision history for this message
elgs (elgs1980) wrote :

Any chance this bug can get assigned? Thanks.

Revision history for this message
elgs (elgs1980) wrote :

It seems this bug has become inactive now. Am I missing anything in order to push this this bug to be fixed?

Revision history for this message
elgs (elgs1980) wrote :

Am I missing anything, or am I missing the protocol Ubuntu's bug system works. I'm surprised having no response to a bug in the software at all.

Revision history for this message
elgs (elgs1980) wrote :

Problem solve by download the last.c. Go to line 753, change the line from:

if (until && until < ut.ut_time)
  continue;

to

if (until && until < ut.ut_time)
  continue;

then recompile it.

Revision history for this message
elgs (elgs1980) wrote :

Problem solve by download the last.c. Go to line 753, change the line from:

if (until && until < ut.ut_time)
  continue;

to

if (until && until > ut.ut_time)
  continue;

then recompile it.

Changed in sysvinit (Ubuntu):
assignee: nobody → elgs (elgs1980)
Revision history for this message
elgs (elgs1980) wrote :

I think it's worthwhile to add it as a new behavior as opposed to to change it, as I believe different people may need different behaviors. Can someone educate me how to make a patch? Thanks.

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.