Bug 257684 - utimensat man page error
Summary: utimensat man page error
Status: Closed Works As Intended
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-08 12:39 UTC by Jamie Landeg-Jones
Modified: 2021-08-08 21:07 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jamie Landeg-Jones 2021-08-08 12:39:35 UTC
"For file systems that support file birth (creation) times (such as UFS2), the birth time will be set to the value of the second element if the second element is ***older*** than the currently set birthtime.  To set both a birth time and a modification time, two calls are required; the first to set the birth time and the second to set the (presumably newer) modification time."

"***older***" should be "younger" !
Comment 1 Mark Johnston freebsd_committer 2021-08-08 16:38:01 UTC
The code in question is:

3181         setbirthtime = 0;                                                                                                                
3182         if (numtimes < 3 && !VOP_GETATTR(vp, &vattr, td->td_ucred) &&                                                                    
3183             timespeccmp(&ts[1], &vattr.va_birthtime, < ))                                                                                
3184                 setbirthtime = 1;

i.e., we set setbirthtime = 1, when ts[1] < vattr.va_birthtime.  The timespecs are offsets relative to the epoch, so ts[1] < vattr.va_birthtime means that the input time ts[1] is older than the recorded birth time.  I believe this agrees with the documentation, so I don't understand where the bug is.
Comment 2 Jamie Landeg-Jones 2021-08-08 21:07:15 UTC
Thanks for the detailed response.

Please ignore me, I've been an idiot. I did grok the logic (it has to work that way!), and have written a bit of code to manipulate the btime using the logic, but for some reason I misinterpreted the paragraph in the man page to mean the opposite of what was happening.

I read it again and again, and even came back to it the next day before posting, and still managed to misread it...

Maybe I can blame the Mandela Effect (!)

Sorry for wasting your time.. I must buy you a pint!

Cheers, Jamie

P.S. I couldn't find the "User is a moron" closure status.