GNU bug report logs - #79931
possible option additions/changes for GNU "touch"

Previous Next

Package: coreutils;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Mon, 1 Dec 2025 17:04:02 UTC

Severity: normal

To reply to this bug, email your comments to 79931 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#79931; Package coreutils. (Mon, 01 Dec 2025 17:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Eggert <eggert <at> cs.ucla.edu>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 01 Dec 2025 17:04:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Stan Marsh <gazelle <at> xmission.com>
Cc: Coreutils <bug-coreutils <at> gnu.org>
Subject: possible option additions/changes for GNU "touch"
Date: Mon, 1 Dec 2025 09:03:35 -0800
[Opening up a new bug report number for this, in reply to a message 
involving Bug#79907.]

On 2025-12-01 00:25, Stan Marsh wrote:

> I've often wished that "touch" had an option like -c, but the opposite
> - that is, *always* create (and generate an error if the file already
> exists) (*).

What use cases would there be for -c?

NetBSD "touch" has these options:

 -D       Don't change a file's times if they're already OK.
 -R FILE  Like -r FILE, but don't follow symlinks.

I.e., NetBSD -h affects only whether symlinks are followed in the target 
file, not in the reference file. This is incompatible with GNU touch. 
For example, with NetBSD:

   touch -Dhr SYMLINK SYMLINK

updates SYMLINK's timestamp to be that of the file it references; there 
is no easy way to do that with GNU touch. Perhaps we should change GNU 
touch to be compatible with NetBSD in this respect.

FreeBSD "touch" has this option:

  -A [-][[HH]MM]SS]
    Adjust the access and modification times by HH:MM:SS.
    This implies -c.

This is for when you have a bunch of files with wrong timestamps (e.g., 
you imported them from MS-DOS and they had the wrong timezone). This 
might be a useful flag to add to GNU "touch".




Information forwarded to bug-coreutils <at> gnu.org:
bug#79931; Package coreutils. (Mon, 01 Dec 2025 17:16:02 GMT) Full text and rfc822 format available.

Message #8 received at 79931 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Stan Marsh <gazelle <at> xmission.com>
Cc: 79931 <at> debbugs.gnu.org
Subject: Re: bug#79931: possible option additions/changes for GNU "touch"
Date: Mon, 1 Dec 2025 09:14:58 -0800
On 2025-12-01 09:03, Paul Eggert wrote:
>> I've often wished that "touch" had an option like -c, but the opposite
>> - that is, *always* create (and generate an error if the file already
>> exists) (*).
> 
> What use cases would there be for -c?

Sorry, I meant to write, "What use cases would there be for this new 
option?"




This bug report was last modified 3 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.