Bug 443059 - time & /usr/bin/time confusion
time & /usr/bin/time confusion
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: man-pages (Show other bugs)
All Linux
low Severity low
: rc
: ---
Assigned To: Ivana Varekova
Depends On:
  Show dependency treegraph
Reported: 2008-04-18 09:39 EDT by Petr Šplíchal
Modified: 2016-05-31 21:36 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-11-11 04:13:51 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Petr Šplíchal 2008-04-18 09:39:33 EDT
There is quite a bad confusion between /usr/bin/time command and bash time
reserved word. As as looked I am not the first one, who encountered the problem:

bug 27200: time <command> works, but time <options> command doesn't
bug 49482: time does not take arguments
bug 91540: Time ignores --format
bug 142474: "time" command does not function according to man page

I suggest to modify the time man page to include a warning about shell reserved
word time not to be confused with /usr/bin/time. Perhaps something like this:


Please do not confuse "time" command with shell reserved word "time" which does
not take any options and reports time consumed by executing a pipeline (for more
see: man bash, section pipelines).

Confusion example (motivation):

# man time
[oh, there is --format option, great! that's exactly what i need!]

# time -f '%E' sleep 1
-bash: -f: command not found

# which time

# time --version
-bash: --version: command not found

... after half an hour? hour?

# type time
time is a shell keyword
Comment 1 Roman Rakus 2008-12-04 03:46:30 EST
Probably not a bug. It is confusing, but if anyone wants to know what will be run, should use `command -v time'. Command `which' don't see shell builtins.
On the other hand `man time' should show the right page. The same for `echo'...
Comment 2 Petr Šplíchal 2008-12-04 04:18:22 EST
I see it's not a bug, but a confusion caused by naming two functions which behave differently with the same name. And because of this (plus the fact that people run into this confusion again and again) this should be documented in time man page.

Either by including the warning mentioned in the comment #0, or at least mentioning bash in SEE ALSO section. I would prefer the first, more descriptive option, as finding the time shell keyword in pipelines section of bash large man page is not very intuitive either.
Comment 3 Ivana Varekova 2008-12-04 04:23:09 EST
Upstream maintainer looked to this issue and do some changes to 3.14 so I think there is no problem to backport them to rhel5 version, because this issue could be quite confusing.
Comment 4 Petr Šplíchal 2008-12-04 04:48:40 EST
Oh, really:

    Note: some shells (e.g., bash(1)) have a built-in time command
    that provides less functionality than  the  command  described
    here.  To access the real command, you may need to specify its
    pathname (something like /usr/bin/time).

That's great! Thanks for pointing this out.
Comment 11 errata-xmlrpc 2009-11-11 04:13:51 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.