-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
Description
touch: Incorrect "months ago" calculation with -d options
Component
touch
Description
When using touch -d "X months ago", uutils touch calculates the date differently from GNU coreutils, resulting in a 1-day discrepancy.
Test / Reproduction Steps
$ touch -d "2025-12-30" /tmp/date
$ touch -r /tmp/date -d "1 month ago" /tmp/t; stat t
# ...
Access: 2025-11-30 00:00:00.000000000 +0000
Modify: 2025-11-30 00:00:00.000000000 +0000
$ coreutils touch -r /tmp/date -d "1 month ago" /tmp/tt; stat tt
# ...
Access: 2025-11-29 00:00:00.000000000 +0000
Modify: 2025-11-29 00:00:00.000000000 +0000Impact
Files may be modified with unintended dates, breaking compatibility with GNU coreutils.
Recommendations
Fix the relative month calculation algorithm to match GNU's implementation using proper calendar month arithmetic.
Reactions are currently unavailable