bugfindutils - Bugs: bug #65792, Improve support for file birth time

 
 

bug #65792: Improve support for file birth time

Submitter:  James Youngman <jay>
Submitted:  Sun 26 May 2024 11:09:03 AM UTC
   
 
Category:  find Severity:  2 - Minor
Item Group:  None Status:  Platform Issue
Privacy:  Public Assigned to:  berny
Originator Name:  Bernhard Voelker Open/Closed:  Open
Release:  4.9.0 Fixed Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 27 May 2024 06:10:51 AM UTC, comment #3: 


comment #2:

> That already exists (https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/stat-time.h#n156) and we're using it, as detailed in the first comment on this bug.  But there are limitations in NetBSD's implementation which can give rise to incorrect results.   See the link above for details.


Apologies, I probably explained it poorly. I'm aware of the stat-time module and the BSD bug.

I was proposing an extended stat function in Gnulib that accepts an extra 'struct timespec *' argument.

That way any OS-specific details could be contained there, i.e. populating 'struct stat' from 'struct statx' on Linux.

The extra argument would contain the file creation time if supported by the OS/file-system. Or else it's values will be set to -1 like get_stat_birthtime().

Collin Funk <collinfunk>
Sun 26 May 2024 11:59:36 AM UTC, comment #2: 


> Perhaps it makes sense to add a function in Gnulib that allows fetching the creation-time of a file?



That already exists (https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/stat-time.h#n156) and we're using it, as detailed in the first comment on this bug.  But there are limitations in NetBSD's implementation which can give rise to incorrect results.   See the link above for details.




James Youngman <jay>
Group administrator
Sun 26 May 2024 11:50:16 AM UTC, comment #1: 

Perhaps it makes sense to add a function in Gnulib that allows fetching the creation-time of a file?

On the BSDs you can use struct stat to get the birthtime [1].

Linux has statx as you mentioned [2].

Windows (not sure if Findutils supports it) through GetFileTime [3].

From what I can tell AIX and Solaris don't have any way to get it.

Maybe a wrapper function around stat with an extra argument?

extern int stat_birthtime (const char *file, struct stat *st, struct timespec *birthtime);

[2] https://man.freebsd.org/cgi/man.cgi?query=stat&sektion=2
[2] https://man7.org/linux/man-pages/man2/statx.2.html
[3] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfiletime

Collin Funk <collinfunk>
Sun 26 May 2024 11:09:03 AM UTC, original submission:  

We currently use gnulib's get_stat_birthtime() to determine the time-of-creation of a file (if it is known and the OS and file system support it).

Partly due to limitations in NetBSD, this can be unreliable (for details see the gnulib source code).

We may be able to use statx() (this is Linux-specific) to improve the quality of support on Linux-based systems, at least.

(James added this bug on behalf of Bernhard).

James Youngman <jay>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by collinfunk (Posted a comment)
  • -email is unavailable- added by jay (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-8ccc.
    Corresponding source code