[Bug 260871] [patch] /usr/bin/touch enhancement

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 02 Jan 2022 02:15:40 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260871

            Bug ID: 260871
           Summary: [patch] /usr/bin/touch enhancement
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: jamie@catflap.org

Created attachment 230614
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=230614&action=edit
patch to add "-R" to touch(1)

I'm not quite sure how you deal with "non-standard" additions to standard
commands, so please be gentle!

Incidentally, I have no preference for actual implementation, this is just what
I've been using for a while. Comments welcome!

Basically, touch(1) has:

-h      If the file is a symbolic link, change the times of the link itself
rather than the file that the link points to.

and:

 -r      Use the access and modifications times from the specified file instead
of the current time of day.

If "-r" points to a link, the link is always followed to retrieve the datetime
information.

I have a program that needs to "-r" the datetime of the link itself if the file
is a link.

Up to now, I've been doing a stat of the file, and then forming the date to
add, but recently thought to add this option:

-R      As -r , but if the file is a symbolic link, return the times of the
link itself rather than the file that the link points to.

Patch attached. Comments?

-- 
You are receiving this mail because:
You are the assignee for the bug.