Opened 36 hours ago

Closed 35 hours ago

#19215 closed bug (duplicate)

utime assigns arbitrary subsecond timestamps

Reported by: bhaible Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/POSIX Version: R1/beta5
Keywords: Cc:
Blocked By: #19213 Blocking:
Platform: All

Description

The utime() function, specified by previous POSIX at https://pubs.opengroup.org/onlinepubs/9699919799/functions/utime.html, ought to set the access time and modification time of a file to the specified values.

On Haiku (I'm using a July 2024 snapshot) the subsecond part is ignored, and instead an subsecond value is used. If this arbitrary value was the same for all files, it would be OK. But no, the arbitrary values are different!

This has the effect that files that should have the same modification time suddenly have different modification times. And thus, when I have a Makefile rule that generates one of the files from the other one, this Makefile rule will trigger, although it shouldn't.

How to reproduce: Save fu.c (attached).

$ gcc -Wall fu.c
$ ./a.out
$ ls -lrt --full-time dummy*
-rw-r--r-- 1 user root 0 2024-10-30 16:48:30.023855104 +0100 dummy3
-rw-r--r-- 1 user root 0 2024-10-30 16:48:30.023855104 +0100 dummy2
-rw-r--r-- 1 user root 0 2024-10-30 16:48:30.023855104 +0100 dummy1
-rw-r--r-- 1 user root 0 2024-10-30 16:48:30.023855104 +0100 dummy0
-rw-r--r-- 1 user root 0 2024-10-30 16:48:30.024117248 +0100 dummy8
-rw-r--r-- 1 user root 0 2024-10-30 16:48:30.024117248 +0100 dummy7
-rw-r--r-- 1 user root 0 2024-10-30 16:48:30.024117248 +0100 dummy6
-rw-r--r-- 1 user root 0 2024-10-30 16:48:30.024117248 +0100 dummy5
-rw-r--r-- 1 user root 0 2024-10-30 16:48:30.024117248 +0100 dummy4
-rw-r--r-- 1 user root 0 2024-10-30 16:48:30.024379392 +0100 dummy9

You can see that dummy0 and dummy9, for example, have different time stamps.

Attachments (1)

fu.c (457 bytes ) - added by bhaible 36 hours ago.
test case fu.c

Download all attachments as: .zip

Change History (2)

by bhaible, 36 hours ago

Attachment: fu.c added

test case fu.c

comment:1 by waddlesplash, 35 hours ago

Blocked By: 19213 added
Resolution: duplicate
Status: newclosed

This invokes the same syscall as #19213 (_kern_write_stat).

Note: See TracTickets for help on using tickets.