Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: tmpfs: touch does not update ctime



Thomas Klausner <wiz%netbsd.org@localhost> writes:

> On Sat, Sep 26, 2026 at 08:25:56AM +0100, Greg Troxel wrote:
>> What does POSIX say?
>
> https://pubs.opengroup.org/onlinepubs/9799919799/functions/futimens.html
>
> has
>
> "Upon successful completion, futimens() and utimensat() shall mark the
> last file status change timestamp for update, with the exception that
> if both tv_nsec fields are set to UTIME_OMIT, the file status change
> timestamp need not be marked for update."
>
> where I think that 'last file status change timestamp' refers to
> ctime, and so I think this reads as 'it should be updated as well'.

Then it's a bug!  ("tmpfs and ffs are different" might be a "NetBSD
thinks they should be consistent" issue and worthy of fixing even if not
a POSIX conformanc bug.)

I can reproduce this on NetBSD 10 with base system touch and base system
stat.  (I think you were using those, but coreutils?)

I think updating ctime is missing in

  src/sys/fs/tmpfs_subr.c:tmpfs_chtimes()

and probably needs

  tmpfs_update(vp, TMPFS_UPDATE_CTIME);  

guarded on if any of the updates are actually done.



Home | Main Index | Thread Index | Old Index