[Bug 257075] touch(1) does not accept input from date(1) with -I to -d

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 09 Jul 2021 08:23:03 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257075

            Bug ID: 257075
           Summary: touch(1) does not accept input from date(1) with -I to
                    -d
           Product: Base System
           Version: 12.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs_at_FreeBSD.org
          Reporter: michael.osipov_at_siemens.com

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
2021-07-09T10:17:08+02:00
# 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:
YYYY-MM-DDThh:mm:SS[.frac][Z]

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Fri Jul 09 2021 - 08:23:03 UTC

Original text of this message