NetBSD Problem Report #59888

From www@netbsd.org  Sun Jan  4 15:37:20 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 87C101A923D
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  4 Jan 2026 15:37:20 +0000 (UTC)
Message-Id: <20260104153719.4E0E61A923F@mollari.NetBSD.org>
Date: Sun,  4 Jan 2026 15:37:19 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: touch(1) parses dates wrongly
X-Send-Pr-Version: www-1.0

>Number:         59888
>Category:       standards
>Synopsis:       touch(1) parses dates wrongly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 04 15:40:01 +0000 2026
>Originator:     Taylor R Campbell
>Release:        10, 9, ...
>Organization:
The DateBSD Touchination
>Environment:
>Description:

	touch(1) does not correctly implement the POSIX.1-2008 `-d'
	syntax for dates (same in POSIX.1-2024, I think):

	https://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html

-d  date_time
    Use the specified date_time instead of the current time. The option-argument shall be a string of the form:

    YYYY-MM-DDThh:mm:SS[.frac][tz]

    or:

    YYYY-MM-DDThh:mm:SS[,frac][tz]

    where:

        YYYY are at least four decimal digits giving the year.

        MM, DD, hh, mm, and SS are as with -t time.

        T is the time designator, and can be replaced by a single <space>.

        [.frac] and [,frac] are either empty, or a <period> ( '.' ) or a <comma> ( ',' ) respectively, followed by one or more decimal digits, specifying a fractional second.

        [tz] is either empty, signifying local time, or the letter 'Z', signifying UTC. If [tz] is empty, the resulting time shall be affected by the value of the TZ environment variable.

    If the resulting time precedes the Epoch, the behavior is implementation-defined. If the time cannot be represented as the file's timestamp, touch shall exit immediately with an error status.

>How-To-Repeat:

	$ touch -d 1970-01-01T01:01:01Z pkg_summary.gz
	touch: Could not parse `1970-01-01T01:01:01Z'
	$ touch -d 1970-01-01T01:01:01 pkg_summary.gz
	$ ls -lT pkg_summary.gz
	-rw-r--r--  1 riastradh  riastradh  0 Dec 31 18:01:01 1969 pkg_summary.gz

>Fix:

	Pull up kre's February 2024 changes to src/usr.bin/touch.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.