bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Petr Pisar
Subject: [time] POSIX output should not start with "Command exited with non-zero status" line
Date: Wed, 8 Nov 2017 16:39:44 +0000 (UTC)
User-agent: slrn/1.0.2 (Linux)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]