Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > gnu.utils.bug > #2222

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

From Petr Pisar <ppisar@redhat.com>
Newsgroups gnu.utils.bug
Subject [time] POSIX output should not start with "Command exited with non-zero status" line
Date 2017-11-08 16:39 +0000
Message-ID <mailman.3245.1510160314.27995.bug-gnu-utils@gnu.org> (permalink)

Show all headers | View raw


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

Back to gnu.utils.bug | Previous | Next | Find similar


Thread

[time] POSIX output should not start with "Command exited with non-zero status" line Petr Pisar <ppisar@redhat.com> - 2017-11-08 16:39 +0000

csiph-web