]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: mention the edge case of hex durations with 'd' suffix
authorPádraig Brady <P@draigBrady.com>
Sat, 5 Apr 2025 19:26:23 +0000 (20:26 +0100)
committerPádraig Brady <P@draigBrady.com>
Sat, 5 Apr 2025 23:07:37 +0000 (00:07 +0100)
* doc/coreutils.texi (sleep invocation): Mention that suffixes are
best avoided with hex arguments.
(timeout invocation): Likewise.
* tests/misc/sleep.sh: Ensure 'd' is not interpreted as "day".

doc/coreutils.texi
tests/misc/sleep.sh

index d6633f04cf80a48c9c9fcb0b5a2113b0c3917c8e..2d1f162aa48566067625ec8b098a93afb1504e17 100644 (file)
@@ -18913,6 +18913,11 @@ C locale (@pxref{Floating point}) followed by an optional unit:
 @samp{h} for hours
 @samp{d} for days
 @end display
+@macro hexDuration
+Note it's best to avoid combining suffixes with hexadecimal arguments,
+as any @samp{d} will @emph{not} be interpreted as a suffix.
+@end macro
+@hexDuration
 A duration of 0 disables the associated timeout.
 The actual timeout duration is dependent on system conditions,
 which should be especially considered when specifying sub-second timeouts.
@@ -19089,6 +19094,8 @@ non-negative integer argument without a suffix, GNU @command{sleep}
 also accepts two or more arguments, unit suffixes, and floating-point
 numbers in either the current or the C locale.  @xref{Floating point}.
 
+@hexDuration
+
 For instance, the following could be used to @command{sleep} for
 1 second, 234 milli-, 567 micro- and 890 nanoseconds:
 
index d1e3bc76c5799d43c79f9aebf47fc3efec001da0..6806a6fe29fd3e70ac64768d066e970a84bf2f82 100755 (executable)
@@ -32,6 +32,7 @@ returns_ 1 timeout 10 sleep || fail=1
 # subsecond actual sleep
 timeout 10 sleep 0.001 || fail=1
 timeout 10 sleep 0x.002p1 || fail=1
+timeout 10 sleep 0x0.01d || fail=1  # d is part of hex, not a day suffix
 
 # Using small timeouts for larger sleeps is racy,
 # but false positives should be avoided on most systems