Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: time-1.7 counts rusage wrong on Linux

3 views
Skip to first unread message

David C Niemi

unread,
Feb 16, 2013, 12:24:27 PM2/16/13
to tbus...@google.com, bug-gn...@gnu.org
Hello Thomas,

I think I have a patch for this lying around somewhere. I will take
care of it in the next release.

DCN

On 02/15/2013 04:25 PM, Thomas Bushnell, BSG wrote:
> time-1.7 converts rusage values from page size units to K, unconditionally,
> but this is wrong at least on Linux, where they are already reported in K.
> That results in time printing out values that are four times too big.
>
> The source contains the comment "Note: Some machines express getrusage
> statistics in terms of K, others in terms of pages." but has no actual code
> that attempts to tell or ever works for those "some machines".
>
> Thoughts?
>
> Please keep me in the reply list on replies; I'm not subscribed to
> bug-gnu-utils.
>
> Thomas


Bob Proulx

unread,
Feb 16, 2013, 6:04:18 PM2/16/13
to bug-gn...@gnu.org, David C Niemi, tbus...@google.com
David C Niemi wrote:
> Thomas Bushnell, BSG wrote:
> > Please keep me in the reply list on replies; I'm not subscribed to
> > bug-gnu-utils.
> > ...
> > time-1.7 converts rusage values from page size units to K, unconditionally,
> > but this is wrong at least on Linux, where they are already reported in K.
> > That results in time printing out values that are four times too big.
> >
> > The source contains the comment "Note: Some machines express getrusage
> > statistics in terms of K, others in terms of pages." but has no actual code
> > that attempts to tell or ever works for those "some machines".
>
> I think I have a patch for this lying around somewhere. I will take
> care of it in the next release.

I maintain patches for time-1.7 for Debian. These patches are
available for viewing here:

http://patch-tracker.debian.org/package/time/1.7-24

Of which the two you are most interested in are these:

http://patch-tracker.debian.org/patch/series/view/time/1.7-24/rusage-portability.patch

http://patch-tracker.debian.org/patch/series/view/time/1.7-24/ru_maxrss.patch

However the others are also important and useful.

Bob

Thomas Bushnell, BSG

unread,
Feb 16, 2013, 6:18:37 PM2/16/13
to bug-gn...@gnu.org, David C Niemi, Thomas Bushnell
That's splendid; we saw the bug in ubuntu precise, which is 1.7-23.1; I
presume the patch was added only in 1.7-24?

Bob Proulx

unread,
Feb 16, 2013, 6:41:47 PM2/16/13
to Thomas Bushnell, BSG, David C Niemi, bug-gn...@gnu.org
Thomas Bushnell, BSG wrote:
> That's splendid; we saw the bug in ubuntu precise, which is 1.7-23.1; I
> presume the patch was added only in 1.7-24?

That is correct. I adopted the Debian time package and added that
patch and released Debian's 1.7-24 version.

http://packages.qa.debian.org/t/time.html

That flowed into Ubuntu and shows as being available in Quetzal 12.10
and later.

https://launchpad.net/ubuntu/+source/time

Unfortunately it didn't make it into Precise 12.04 LTS. Which is
especially unfortunate since it is their current LTS release. It is a
behavior change and so I don't think would be a candidate for a
propose-update in a point release.

Bob

Thomas Bushnell, BSG

unread,
Feb 16, 2013, 7:08:49 PM2/16/13
to Thomas Bushnell, BSG, bug-gn...@gnu.org, David C Niemi
I don' think it's a behavior change; it's an outright bug: the behavior of
the program is inconsistent with its documentation. :) But, at the same
time, it's not terribly important.

Bob Proulx

unread,
Feb 16, 2013, 7:27:06 PM2/16/13
to Thomas Bushnell, BSG, David C Niemi, bug-gn...@gnu.org
Thomas Bushnell, BSG wrote:
> I don' think it's a behavior change; it's an outright bug: the behavior of
> the program is inconsistent with its documentation. :) But, at the same
> time, it's not terribly important.

If you want to try to get this into a point release for Ubuntu 12.04
LTS that would be great! I will cheer you on from the sidelines! :-)
In any case, Debian Wheezy 7.0 has this in the queue for the next
stable Debian release.

As historical point I am pretty sure that in the early, early Linux
kernel days that the Linux kernel's system call was where the bug
originated. I think the Linux kernel originally had this incorrect as
compared to other kernels such as BSD. And the time program was
simply downstream of it and reacting by making it work. Then when the
Linux kernel was fixed the ripple never made it downsteam into time.
I will research the Linux kernel sources way-back-then someday. But
it makes the explanation of how this came about make sense. Hopefully
it is even true.

Bob

Andreas Schwab

unread,
Feb 17, 2013, 3:57:52 AM2/17/13
to Thomas Bushnell, BSG, David C Niemi, bug-gn...@gnu.org
Bob Proulx <b...@proulx.com> writes:

> As historical point I am pretty sure that in the early, early Linux
> kernel days that the Linux kernel's system call was where the bug
> originated.

Actually rss accounting is a rather recent addition, see
1f10206cf8e945220f7220a809d8bfc15c21f9a5 (getrusage: fill ru_maxrss
value).

Andreas.

--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

0 new messages