Opened 2 years ago

Last modified 3 months ago

#14311 new bug

utimes(2) does not set the correct microsecond for modification time

Reported by: leorize Owned by: axeld
Priority: normal Milestone: Unscheduled
Component: File Systems/BFS Version: R1/Development
Keywords: Cc: nielx
Blocked By: Blocking:
Platform: All


Attached below is a program that creates a file and set its modification time to 1000 microsecond using utimes(2)

How to run:

$ gcc -o ut ut.c
$ ./ut

Expected output:

Modified second: 0
Modified nanosec: 1000000


Modified second: 0
Modified nanosec: 786432

Attachments (1)

ut.c (642 bytes ) - added by leorize 2 years ago.

Download all attachments as: .zip

Change History (5)

by leorize, 2 years ago

Attachment: ut.c added

comment:1 by leorize, 2 years ago

patch: 01

comment:2 by leorize, 2 years ago

patch: 10

comment:3 by korli, 22 months ago

Component: System/POSIXFile Systems/BFS
Owner: changed from nobody to axeld

It seems to be on BFS? Because write_stat will use: and to calculate the on-disk mtime.

and read_stat:

786432 is 48 << 14, (((1000000 + 16383) >> 14) & 0xfff0) is exactly 48.

So it works as badly as designed :)

comment:4 by nielx, 3 months ago

Cc: nielx added
Note: See TracTickets for help on using tickets.