A new time tool version 1.8 has changed output format.
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.
- 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.
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 COMMANDbehaves as in previous Fedoras.
time COMMANDprints a new leading line if the COMMAND failed.
Install a package that uses time tool and check it still works as expected.
The time tool reports a command failure on the first line of standard error output. The report can be disabled with -q option.
To this date, there are only 6 packages that require time package.
- akmods – not affected (processes only the last line of the time output)
- kcbench – not affected (processes only line that does not start with a specific word and Command is not one of them)
- nfsometer – not affected (it executes shell built-in command, the dependency on time package is wrong)
- ohc – affected (ohc-consolidate-output prints the time output)
- redhat-lsb – not affected (does not use time)
- winetricks – not affected (it does not use time at all, the dependency on time package is wrong)
- 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.
- Upstream announcement about intention to release 1.8 version
- Upstream time 1.8 release notes
- Upstream bug report about broken POSIX output
- Announcement on Fedora devel mainling list
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.