[Top][All Lists]

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

[Bug-time] FW: POSIX output should not start with "Command exited with n

From: Assaf Gordon
Subject: [Bug-time] FW: POSIX output should not start with "Command exited with non-zero status" line
Date: Wed, 8 Nov 2017 13:29:23 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

forwarding message from
http://lists.gnu.org/archive/html/bug-gnu-utils/2017-11/msg00000.html :

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

           "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]