From Fedora Project Wiki

time-1.8

Summary

A new time tool version 1.8 has changed output format.

Owner

  • Name: Petr Písař
  • Email: <ppisar@redhat.com>
  • Release notes owner:

Current status

  • Targeted release: Fedora 28
  • Last updated: 2017-11-10
  • Tracker bug: <will be assigned by the Wrangler>

Detailed Description

After many years a new 1.8 version of time tool was released. This version brings some noticeable changes:

  • License changed from (GPLv2+) to (GPLv3+ and GFDL).
  • Additional exit codes are used to report measured command failures and failures to execute the command.
  • A measured command failure is reported by default. See the first line in this output:
$ time /usr/bin/false
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 1196maxresident)k
0inputs+0outputs (0major+55minor)pagefaults 0swaps

In previous Fedora versions, the first line was printed only if -v option was specified. This is not true anymore and the line is printed by default. You can disable it with a new -q option:

$ time -q /usr/bin/false
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 1268maxresident)k
0inputs+0outputs (0major+55minor)pagefaults 0swaps

Because this violated POSIX mode, Fedora changed time-1.8 not to print the first line when invoked with -p option and upstream accepted the change so that future time versions will behave like Fedora. For Fedora users, there is no change in the POSIX mode output:

$ time -p /usr/bin/false
real 0.00
user 0.00
sys 0.00

If you use time tool in your script without the -p option, then either adjust your script to expect different output, or add -q option. Be ware of portability across distributions using different time versions.

Benefit to Fedora

Fedora provides up-to-date time tool that conforms to POSIX. The POSIX mode improves portability and is recommended for use in the scripts.

Scope

  • Proposal owners:

The time package will be upgraded and patched to preserve output format in the POSIX mode.

  • Other developers:

Review their scripts and packages whether they use time' in non-POSIX mode and parse time's output. If they are affected, they should add -q option to the time command, or adjust their code do deal with the new first line.

  • Policies and guidelines: No change is needed.
  • Trademark approval: No approval is needed.

Upgrade/compatibility impact

Scripts that parse time output could stop working. Scripts that invoke time with -p option are not affected.

How To Test

Install time package and check that:

  • time -p COMMAND behaves as in previous Fedoras.
  • time COMMAND prints a new leading line if the COMMAND failed.

Install a package that uses time tool and check it still works as expected.

User Experience

The time tool reports a command failure on the first line of standard error output. The report can be disabled with -q option.

Dependencies

To this date, there are only 6 packages that require time package.

  • akmods
  • kcbench
  • nfsometer
  • ohc
  • redhat-lsb
  • winetricks

Contingency Plan

  • Contingency mechanism: The default command failure reporting will be disabled or the upgrade will be reverted to 1.7 version.
  • Contingency deadline: Anytime.
  • Blocks release? No.
  • Blocks product? No.

Documentation

Release Notes

time tool 1.8 has changed default output format. If the measured command fails, it will report about it on the first line of time's standard error output. This report can be suppressed by using -q option. The POSIX mode (-p option) is unchanged. Users are advised to review their scripts for make sure they can parse the new time output.