Page MenuHomeFreeBSD

makefs: Define HAVE_STRUCT_STAT_{BIRTHTIME,_ST_MTIMENSEC}
AcceptedPublic

Authored by jlduran on Wed, Jan 7, 7:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jan 14, 10:59 PM
Unknown Object (File)
Wed, Jan 14, 8:16 AM
Unknown Object (File)
Mon, Jan 12, 12:21 PM
Unknown Object (File)
Sat, Jan 10, 3:19 PM
Unknown Object (File)
Fri, Jan 9, 6:07 AM
Unknown Object (File)
Fri, Jan 9, 2:38 AM
Unknown Object (File)
Thu, Jan 8, 10:50 PM
Unknown Object (File)
Thu, Jan 8, 5:28 PM
Subscribers

Details

Summary

Define HAVE_STRUCT_STAT_BIRTHTIME and HAVE_STRUCT_STAT_ST_MTIMENSEC in
the main header file.

FreeBSD supports both. For cross-builds, on Linux it is defined as 0,
and on macOS it is defined as 1 in their respective nbtool_config.h
header files.

Rearrange #if directives accordingly.

Tests marked with "XXX" will be addressed (or at least discussed)
separately.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69697
Build 66580: arc lint + arc unit

Event Timeline

What I'm currently looking for is opinions on what the time values should be before I continue adding mkimg tests. I have annotated what I believe should be the correct result with XXX comments. Do not worry about the actual fixes, as those are relatively trivial.

An attached simple shell script that mimics these tests is what I have used to create the following comparative table between FreeBSD, NetBSD, and OpenBSD (there are more combinations in the shell script).

At the moment, the strangest result is when the -F flag is used together with -T flag. FreeBSD's man page suggests that if there is a time keyword in the spec file passed to the -F flag, that time should be used over the one specified in -T, on NetBSD, it is not clear which one should prevail.

-F metalog time=timestamp_F -T timestamp_T flag:

-t fs-typeFreeBSDNetBSDOpenBSD
cd9660st_atime=timestamp_T st_mtime=timestamp_T st_ctime=timestamp_T st_birthtime=-1st_atime=timestamp_T st_mtime=timestamp_T st_ctime=timestamp_T st_birthtime=0N/A
ffsst_atime=timestamp_F st_mtime=timestamp_F st_ctime=current st_birthtime=currentst_atime=timestamp_T st_mtime=timestamp_T st_ctime=timestamp_T st_birthtime=timestamp_TN/A
msdosst_atime=timestamp_F_day st_mtime=timestamp_F_2 st_ctime=timestamp_F_2 st_birthtime=current_2st_atime=timestamp_T_day st_mtime=timestamp_T_2 st_ctime=0 st_birthtime=0N/A

Where timestamp_F_2 is timestamp_F with a resolution of 2 seconds, and timestamp_F_day is the timestamp_F date (without time, or a resolution of one day D54584).

Notice that in the table, the results for cd9660 on FreeBSD appear with timestamp_T, whereas in the tests here, they appear as timestamp_F, that is because -o rockridge is missing from the list of makefs options, regardless, I believe the result should be the same, and this is another issue.

I'll be submitting a similar bug report/patch on NetBSD GNATS once the dust settles with the rest of makefs issues on FreeBSD, I'll try to align the results whenever possible.

Tagging everyone that has helped me recently with either mtree or makefs. Thank you!


Basic script that mimics our tests. Adapted for FreeBSD, NetBSD and OpenBSD (very crude).

usr.sbin/makefs/makefs.h
46

The handling of the "time" attribute in makefs/mtree.c doesn't update the inode's birthtime. Should it?

usr.sbin/makefs/makefs.h
46

I think it should. I have that change planned separately with some tests.
I see no reason for -F or a metalog file be different time-wise than -T. If -T updates all 4 times (a,m,c,birth), what could be the reason to not do it with an mtree specification file or the -F flag? One of the features of the -F flag is to override the time stamped globally by -T right? (From FreeBSD's makefs manual page (-T flag): "Timestamps in a mtree(5) specfile (specified with -F) are used even if a default timestamp is specified.")

FreeBSD supports both. For cross-builds, on Linux it is defined as 0, and on macOS it is defined as 1 in their respective nbtool_config.h header files.

It is not clear what "it" refers to here.

This revision is now accepted and ready to land.Mon, Jan 12, 12:33 AM

FreeBSD supports both. For cross-builds, on Linux it is defined as 0, and on macOS it is defined as 1 in their respective nbtool_config.h header files.

It is not clear what "it" refers to here.

You are right, originally it was only HAVE_STRUCT_STAT_BIRTHTIME, while rebasing I also added HAVE_STRUCT_STAT_ST_MTIMENSEC, but I did not fully update the commit message. Should be fixed upon commit, thank you!