Debian Bug report logs - #388458
time: better shell built-in warning in man page

version graph

Package: time; Maintainer for time is Bob Proulx <bob@proulx.com>; Source for time is src:time (PTS, buildd, popcon).

Reported by: Martin Jambor <jamborm@matfyz.cz>

Date: Wed, 20 Sep 2006 14:48:32 UTC

Severity: minor

Merged with 501378

Found in versions time/1.7-21, time/1.7-23, time/1.7-23.1

Done: Bob Proulx <bob@proulx.com>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Tollef Fog Heen <tfheen@debian.org>:
Bug#388458; Package time. (full text, mbox, link).


Acknowledgement sent to Martin Jambor <jamborm@matfyz.cz>:
New Bug report received and forwarded. Copy sent to Tollef Fog Heen <tfheen@debian.org>. (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Martin Jambor <jamborm@matfyz.cz>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: time: Time does not parse its parameters
Date: Wed, 20 Sep 2006 16:21:02 +0200
Package: time
Version: 1.7-21
Severity: important


Time does  not parse its own  parameters and treats  everything on the
command line like the program it should run and its parameters.

For example the following works:

jamborm@cetus:~/tmp/randwrite$ time bash < /dev/null

real    0m0.005s
user    0m0.000s
sys     0m0.004s

But this does not:

jamborm@cetus:~/tmp time -f "%e" bash < /dev/null
bash: -f: command not found

real    0m0.002s
user    0m0.000s
sys     0m0.000s

OTOH, I suspect  this might be a bash issue because  I have just found
out that /usr/bin/time works as expected.

TIA

Martin

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16.14mj01
Locale: LANG=C, LC_CTYPE=cs_CZ (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)

Versions of packages time depends on:
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries

time recommends no packages.

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, Tollef Fog Heen <tfheen@debian.org>:
Bug#388458; Package time. (full text, mbox, link).


Acknowledgement sent to Bas Kloet <stage@hoffmannbv.nl>:
Extra info received and forwarded to list. Copy sent to Tollef Fog Heen <tfheen@debian.org>. (full text, mbox, link).


Message #10 received at 388458@bugs.debian.org (full text, mbox, reply):

From: Bas Kloet <stage@hoffmannbv.nl>
To: 388458@bugs.debian.org
Subject: time: Time does not parse its parameters
Date: Fri, 16 Feb 2007 13:09:02 +0100
This is not a bug in the debian `time' program , but you get this
problem when you use Bash (or another shells) built-in time command.
Use /usr/bin/time and you will see that all works as expected.

Greetings,
Bas Kloet






Information forwarded to debian-bugs-dist@lists.debian.org, Tollef Fog Heen <tfheen@debian.org>:
Bug#388458; Package time. (full text, mbox, link).


Acknowledgement sent to Sven Mueller <debian@incase.de>:
Extra info received and forwarded to list. Copy sent to Tollef Fog Heen <tfheen@debian.org>. (full text, mbox, link).


Message #15 received at 388458@bugs.debian.org (full text, mbox, reply):

From: Sven Mueller <debian@incase.de>
To: 388458@bugs.debian.org
Subject: time: Time does not parse its parameters
Date: Thu, 19 Jul 2007 17:13:25 +0200
Unfortunately, it looks as if bash doesn't have a "time" builtin (only a
"times" one), so this is - at best - only part of the problem. But
still, this builtin seems to be the cause here.

Perhaps reassign the bug to bash (since it is impossible to disable the
builtin interpretation of "time" since it isn't formally a builtin).

short summary:

(Shell used: bash from Debian Etch, preparation "enable -n times")

time                       -o /tmp/time_usage sleep 1            # fails
/usr/bin/time              -o /tmp/time_usage sleep 1            # works
perl -e 'system("time","-o","/tmp/time_usage","sleep","1");'     # works

So it isn't a problem within the time binary itself, but with bash here.
However "enable" (a builtin command in bash to enable/disable builtin
commands) doesn't list the "time" builtin. "enable time" reports there
isn't any such builtin, "enable -n times" disables the equivalent to
"time" that is a builtin, but "time" is still interpreted inside bash as
you can see from the above tests.

regards,
Sven



Information forwarded to debian-bugs-dist@lists.debian.org, Tollef Fog Heen <tfheen@debian.org>:
Bug#388458; Package time. (full text, mbox, link).


Acknowledgement sent to Tollef Fog Heen <tfheen@err.no>:
Extra info received and forwarded to list. Copy sent to Tollef Fog Heen <tfheen@debian.org>. (full text, mbox, link).


Message #20 received at 388458@bugs.debian.org (full text, mbox, reply):

From: Tollef Fog Heen <tfheen@err.no>
To: 388458@bugs.debian.org
Subject: Bash bug, I believe
Date: Fri, 20 Jun 2008 21:56:09 +0200
reassign 388458 bash
thanks

Hi, this looks like a bug in bash, not /usr/bin/time, so reassigning
there.

-- 
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are




Bug reassigned from package `time' to `bash'. Request was from Tollef Fog Heen <tfheen@err.no> to control@bugs.debian.org. (Fri, 20 Jun 2008 20:33:08 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, goswin-v-b@web.de, Matthias Klose <doko@debian.org>:
Bug#388458; Package bash. (full text, mbox, link).


Acknowledgement sent to Goswin von Brederlow <goswin-v-b@web.de>:
Extra info received and forwarded to list. Copy sent to goswin-v-b@web.de, Matthias Klose <doko@debian.org>. (full text, mbox, link).


Message #27 received at 388458@bugs.debian.org (full text, mbox, reply):

From: Goswin von Brederlow <goswin-v-b@web.de>
To: Debian Bug Tracking System <388458@bugs.debian.org>
Subject: Patch for NMU upload
Date: Sat, 06 Sep 2008 19:00:20 +0200
[Message part 1 (text/plain, inline)]
Package: gerris
Version: 0.6.0-3.1
Followup-For: Bug #494243

Hi,

attached the patch for a NMU upload as allowed in the bug log. As
suggested it includes the fix for #350595 which hopefully fixes
that. Can't test it here.

MfG
	Goswin

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (400, 'unstable-i386')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.25-kvm-nofb (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
[gerris.patch (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#388458; Package bash. (full text, mbox, link).


Acknowledgement sent to Goswin von Brederlow <goswin-v-b@web.de>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (full text, mbox, link).


Message #32 received at 388458@bugs.debian.org (full text, mbox, reply):

From: Goswin von Brederlow <goswin-v-b@web.de>
To: 388458@bugs.debian.org
Subject: Sorry for wrong mail
Date: Tue, 09 Sep 2008 10:35:38 +0200
Hi,

please disregard the last mail as it was send to the wrong mail due to some
reportbug screwup.

MfG
	Goswin




Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#388458; Package bash. (Sat, 10 Oct 2009 04:00:10 GMT) (full text, mbox, link).


Acknowledgement sent to Neil Moore <neil@s-z.org>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (Sat, 10 Oct 2009 04:00:10 GMT) (full text, mbox, link).


Message #37 received at 388458@bugs.debian.org (full text, mbox, reply):

From: Neil Moore <neil@s-z.org>
To: 388458@bugs.debian.org
Subject: time: Time does not parse its parameters
Date: Fri, 9 Oct 2009 23:57:36 -0400
The reason 'enable' does not list the 'time' builtin is that in bash
'time' is a keyword, not a builtin.  The reason is because
syntactically bash's 'time' governs an entire pipeline, not just a
single command.  See the section "Pipelines" of the bash man page.


Besides using /usr/bin/time, you can ensure you launch the time(1)
executable by using 'command time' or 'time' in quotes:

  /usr/bin/time --help

  command time --help

  'time' --help

It would perhaps be nice if this keyword were disabled in Posix mode,
or if it could be disabled some other way, but I'm not sure how
difficult that would be to implement.

-- 
Neil Moore, neil@s-z.org, http://s-z.org/neil/




Bug reassigned from package 'bash' to 'time'. Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Wed, 03 Nov 2010 01:33:08 GMT) (full text, mbox, link).


Bug No longer marked as found in versions gerris/0.6.0-3.1. Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Wed, 03 Nov 2010 01:33:09 GMT) (full text, mbox, link).


Bug Marked as found in versions time/1.7-21. Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Wed, 03 Nov 2010 01:33:09 GMT) (full text, mbox, link).


Bug Marked as found in versions time/1.7-23.1. Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Wed, 03 Nov 2010 01:33:09 GMT) (full text, mbox, link).


Severity set to 'minor' from 'important' Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Wed, 03 Nov 2010 01:33:09 GMT) (full text, mbox, link).


Message sent on to Martin Jambor <jamborm@matfyz.cz>:
Bug#388458. (Wed, 03 Nov 2010 01:33:12 GMT) (full text, mbox, link).


Message #50 received at 388458-submitter@bugs.debian.org (full text, mbox, reply):

From: Jonathan Nieder <jrnieder@gmail.com>
To: 388458-submitter@bugs.debian.org, time@packages.debian.org
Cc: Neil Moore <neil@s-z.org>
Subject: Re: time: Time does not parse its parameters
Date: Tue, 2 Nov 2010 20:30:23 -0500
reassign 388458 time 1.7-21
found 388458 time/1.7-23.1
severity 388458 minor
quit

Neil Moore wrote:

> The reason 'enable' does not list the 'time' builtin is that in bash
> 'time' is a keyword, not a builtin.

Thanks for a clear explanation.

> It would perhaps be nice if this keyword were disabled in Posix mode,
> or if it could be disabled some other way, but I'm not sure how
> difficult that would be to implement.

Open Group issue 7 says:

| When time is used as part of a pipeline, the times reported are
| unspecified, except when it is the sole command within a grouping
| command (see Grouping Commands ) in that pipeline. For example, the
| commands on the left are unspecified; those on the right report on
| utilities a and c, respectively:
| 
| time a | b | c    { time a; } | b | c
| a | b | time c    a | b | (time c)

Therefore I think bash is doing the right thing.

Reassigning to time, so the manual can be updated to warn that
"time" must be quoted to avoid shells' builtin time commands.




Changed Bug title to 'time: better shell built-in warning in man page' from 'time: Time does not parse its parameters' Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Wed, 03 Nov 2010 01:57:03 GMT) (full text, mbox, link).


Merged 388458 501378. Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Wed, 03 Nov 2010 01:57:03 GMT) (full text, mbox, link).


Message sent on to Martin Jambor <jamborm@matfyz.cz>:
Bug#388458. (Wed, 03 Nov 2010 05:54:05 GMT) (full text, mbox, link).


Message #57 received at 388458-submitter@bugs.debian.org (full text, mbox, reply):

From: Tollef Fog Heen <tfheen@err.no>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: 388458-submitter@bugs.debian.org, time@packages.debian.org, Neil Moore <neil@s-z.org>
Subject: Re: time: Time does not parse its parameters
Date: Wed, 03 Nov 2010 06:49:50 +0100
]] Jonathan Nieder 

| Reassigning to time, so the manual can be updated to warn that
| "time" must be quoted to avoid shells' builtin time commands.

It already does:

       Users  of  the  bash shell need to use an explicit path in order to run
       the external time command and not the shell builtin variant. On  system
       where time is installed in /usr/bin, the first example would become
            /usr/bin/time wc /etc/hosts

(arguably, it shouldn't say «bash» there, but that's a really minor
thing.)

-- 
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are




Reply sent to Bob Proulx <bob@proulx.com>:
You have taken responsibility. (Sun, 09 Feb 2014 01:48:04 GMT) (full text, mbox, link).


Notification sent to Martin Jambor <jamborm@matfyz.cz>:
Bug acknowledged by developer. (Sun, 09 Feb 2014 01:48:04 GMT) (full text, mbox, link).


Message #62 received at 388458-done@bugs.debian.org (full text, mbox, reply):

From: Bob Proulx <bob@proulx.com>
To: Martin Jambor <jamborm@matfyz.cz>, 388458-done@bugs.debian.org
Subject: Re: Bug#388458: time: Time does not parse its parameters
Date: Sat, 8 Feb 2014 18:45:46 -0700
[Message part 1 (text/plain, inline)]
I have read through this bug log carefully and I believe that it can
be closed.  A summary of the events of the bug log are:

Martin Jambor wrote:
> jamborm@cetus:~/tmp time -f "%e" bash < /dev/null
> bash: -f: command not found

Bas Kloet wrote:
> This is not a bug in the debian `time' program , but you get this
> problem when you use Bash (or another shells) built-in time command.
> Use /usr/bin/time and you will see that all works as expected.

Tollef Fog Heen wrote:
> reassign 388458 bash

Neil Moore wrote:
> ...explanations and descriptions concerning time keyward in bash...

Jonathan Nieder wrote:
> reassign 388458 time 1.7-21
> severity 388458 minor
> ...
> Reassigning to time, so the manual can be updated to warn that
> "time" must be quoted to avoid shells' builtin time commands.

Tollef Fog Heen wrote:
> It already does:
> 
>        Users  of  the  bash shell need to use an explicit path in order to run
>        the external time command and not the shell builtin variant. On system
>        where time is installed in /usr/bin, the first example would become
>             /usr/bin/time wc /etc/hosts
> 
> (arguably, it shouldn't say «bash» there, but that's a really minor
> thing.)

And the man page does say this.  Perhaps it should say this more
strongly in a WARNINGS section.  I am thinking about it.  But for the
purposes of this bug it is already there. :-)

Bob
[signature.asc (application/pgp-signature, inline)]

Reply sent to Bob Proulx <bob@proulx.com>:
You have taken responsibility. (Sun, 09 Feb 2014 01:48:05 GMT) (full text, mbox, link).


Notification sent to Russ Allbery <rra@debian.org>:
Bug acknowledged by developer. (Sun, 09 Feb 2014 01:48:05 GMT) (full text, mbox, link).


Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sun, 09 Mar 2014 07:31:49 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Jan 12 15:28:43 2018; Machine Name: beach

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.