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

[time] POSIX output should not start with "Command exited with non-zero status" line

0 views
Skip to first unread message

Petr Pisar

unread,
Nov 8, 2017, 11:58:35 AM11/8/17
to bug-gn...@gnu.org
The recently released time-1.8 reports a command failure if -q option is
not specified. This happens even if -p option is specified:

$ ./time-1.8/time -p /usr/bin/false
Command exited with non-zero status 1
real 0.00
user 0.00
sys 0.00

I think the first line should not be here when POSIX mode is request
with the -p option. POSIX says:

If −p is specified, the following format shall be used in the POSIX
locale:

"real %f\nuser %f\nsys %f\n", <real seconds>, <user seconds>,
<system seconds>

[...] The implementation may
append white space and additional information following the format shown
here. The implementation may also prepend a single empty line before the
format shown here.

In the previous 1.7 release, Fedora patched time to report the command
failure only if -v option was specified, so that "time -p" also did not
report it.

But because 1.8 started to control the command failure with -q option,
I feel users will complain that "time -p" from time-1.8 does not behave
as prescribed by the POSIX.

I'd like to apply this change the corrects it:

--- a/src/time.c
+++ b/src/time.c
@@ -431,7 +431,7 @@ summarize (fp, fmt, command, resp)
unsigned long ru; /* Elapsed real microseconds. */
unsigned long vu; /* Elapsed virtual (CPU) microseconds. */

- if (!quiet)
+ if (!quiet && output_format != posix_format)
{
if (WIFSTOPPED (resp->waitstatus))
fprintf (fp, "Command stopped by signal %d\n",

-- Petr


0 new messages