uptime -p reports incorrect output after 52 weeks
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
procps (Ubuntu) |
Fix Released
|
Low
|
Robert Malz | ||
Focal |
Won't Fix
|
Low
|
Robert Malz | ||
Jammy |
Won't Fix
|
Low
|
Robert Malz |
Bug Description
[ Impact ]
uptime -p will provide incorrect data for 24 hours after exactly 52 weeks. Users and tools utilizing this command will receive example output "up 2 hours" instead of "up 52 weeks, 2 hours". After 24 hours since 52 weeks, uptime -p will report "up 1 year" which is correct output.
Issue is already fixed in upstream https:/
Latest procps releases already include this patch (procps 4.0.3 lunar/mantic)
The fix is needed for following set of packages:
procps | 2:3.3.17-6ubuntu2 | jammy
procps | 2:3.3.16-1ubuntu2 | focal
[ Test Plan ]
Reproduction:
UPTIME="31528920 31528800"; mkfifo uptime_fifo; while true; do cat <<<$UPTIME > uptime_fifo; done & sudo mount -obind uptime_fifo /proc/uptime
uptime -p
Running above commands will result in incorrect uptime output.
Testing:
In attached uptime_test_results file there is modified print_uptime function which has been used to test multiple corner cases.
[ Where problems could occur ]
Proposed changes modifies output format of "uptime -p". Issue has been already fixed in latest version of procps package available in lunar/mantic however older releases are based on different code base and patch cannot be directly cherry-picked. Due to backport requirements some code of "uptime" (without -p) has been also changed but this should not impact logic for that usage.
As the change focuses on modifying "uptime -p" output format any potential issues will impact this command.
I have also looked for a reverse dependencies on procps package to check for potential uses of uptime -p, however I was not able to find any. Internally within procps package this functionality is used in "top" application, however for that case "uptime" (without -p) is used.
[ Other Info ]
Bug upstream: https:/
Following patch is needed for older releases: https:/
Old commit on which upstream patch is based: https:/
Small change on top of proposed patch (already included in debdiff): https:/
Changed in procps (Ubuntu): | |
assignee: | nobody → Robert Malz (rmalz) |
Changed in procps (Ubuntu Focal): | |
assignee: | nobody → Robert Malz (rmalz) |
Changed in procps (Ubuntu Jammy): | |
assignee: | nobody → Robert Malz (rmalz) |
Changed in procps (Ubuntu): | |
importance: | Undecided → Low |
Changed in procps (Ubuntu Focal): | |
importance: | Undecided → Low |
Changed in procps (Ubuntu Jammy): | |
importance: | Undecided → Low |
tags: | added: se se-sponsor-dgadomski |
description: | updated |
debdiff with backport for jammy