Bug 257075 - touch(1) does not accept input from date(1) with -I to -d
Summary: touch(1) does not accept input from date(1) with -I to -d
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.2-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2021-07-09 08:23 UTC by Michael Osipov
Modified: 2021-07-09 08:23 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Osipov 2021-07-09 08:23:03 UTC
Running on stable/12:4e2ae05c3

I am trying to set the mtime of a file in the future to trick make.

# ahead_of_time="$(date -v +2S -Iseconds)"
# echo $ahead_of_time
# touch -d "$ahead_of_time" .
touch: out of range or illegal time specification: YYYY-MM-DDThh:mm:SS[.frac][tz]

Although tz is documented as:
                   tz      An optional letter Z indicating the time is in UTC.
                           Otherwise, the time is assumed to be in local time.
                           Local time is affected by the value of the TZ
                           environment variable.

It is confusing in many ways:
* I cannot reuse default values produced by tools from base
* tz is not a TZ, but rather Zulu only and should rather say in the pattern:

A much better approach would be if -d would parse properly extended ISO 8601 format as spit out by date -I and documented as such -- accepting any offset.