This was fixed in 2025:

https://savannah.gnu.org/bugs/?68745


On Mon, Nov 16, 2026 at 01:50:19PM +0100, Joakim Sernbrant via Bug reports for 
the GNU Bourne Again SHell wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -g -O2
> Machine Type: x86_64-pc-linux-gnu
> 
> Bash Version: 5.3
> Patch Level: 9
> Release Status: release
> 
> Description:
> When the fractional seconds of a timed command round up to 1000
> milliseconds (e.g., 0.9995s - 0.9999s) under the default TIMEFORMAT, the
> `time` builtin fails to carry the overflow into the whole-seconds field.
> This causes the hundreds-of-milliseconds digit to overflow ASCII '0' + 10
> into ':', outputting `0m0.:00s` instead of `0m1.000s`.
> 
> I have verified that no TIMEFORMAT or `print_timeval` fixes appear in the
> official bash-5.3 patch notes through bash53-020.
> 
> Repeat-By:
> Run `time` in a loop with a command whose total real execution time lands
> near the 0.9995s-0.9999s rounding boundary (adjusting the sleep duration
> slightly for local process-spawn overhead):
> 
> while true; do
>   out=$( { time sleep 0.993; } 2>&1 )
>   echo "$out" | grep -q ':' && { echo "$out"; break; }
> done
> 
> Actual output:
> real    0m0.:00s
> user    0m0.001s
> sys     0m0.006s
> 
> Expected output:
> real    0m1.000s
> 
> Fix:
> In `print_timeval` (`execute_cmd.c`), carry the overflow into the seconds
> integer and reset the fractional part to 0 whenever rounding fractional
> seconds reaches the precision modulus (e.g., 1000 for 3-digit millisecond
> precision).
> 
> -- 
> 
> 
> The information contained in this message is intended only for the 
> recipient, and may be a confidential attorney-client communication or may 
> otherwise be privileged and confidential and protected from disclosure and 
> subject to important terms and conditions available at Disclaimer - Osttra 
> <https://osttra.com/disclaimer/>. If the reader of this message is not the 
> intended recipient, or an employee or agent responsible for delivering this 
> message to the intended recipient, please be aware that any dissemination 
> or copying of this communication is strictly prohibited. If you have 
> received this communication in error, please immediately notify us by 
> replying to the message and deleting it from your computer. OSTTRA Group 
> Ltd. reserves the right, subject to applicable local law, to monitor, 
> review and process the content of any electronic message or information 
> sent to or from OSTTRA Group Ltd. e-mail addresses without informing the 
> sender or recipient of the message. By sending electronic messages or 
> information to OSTTRA Group LTd. e-mail addresses you, as the sender, are 
> consenting to OSTTRA Group Ltd. processing any of your personal data 
> therein.

  • Bug in `ti... Joakim Sernbrant via Bug reports for the GNU Bourne Again SHell
    • Re: B... Matti Andreas Kähäri
    • Re: B... Chet Ramey

Reply via email to