[MacPorts] #58729: legacy-support missing futimens() (and utimensat)

MacPorts noreply at macports.org
Tue Feb 2 00:44:12 UTC 2021


#58729: legacy-support missing futimens() (and utimensat)
-----------------------------+----------------------
  Reporter:  RJVB            |      Owner:  kencu
      Type:  enhancement     |     Status:  assigned
  Priority:  Normal          |  Milestone:
 Component:  ports           |    Version:
Resolution:                  |   Keywords:
      Port:  legacy-support  |
-----------------------------+----------------------

Comment (by Ionic):

 Yeah, my modified test also fails on 10.13 natively, without our
 `utimensat` implementation.

 {{{
 test/test_utimensat
 Testing: === {305419896, 987654321} {354826056, 123456789} ===
 assert EQ failed {0, 987654321} post stat vs. utimensat Atime nanoseconds
 (utimensat Atime explicit)
 }}}

 The problem, though, is that the 10.13 machine I can test on doesn't use
 APFS as its root file system, but the older HFS+.

 I created a new APFS container, mounted that:

 {{{
 hdiutil create -size 1.1m -fs APFS apfs.dmg
 hdiutil attach apfs.dmg
 }}}

 and changed to that mount point and ran the test:

 {{{
 vm1013:~ root#  cd /Volumes/untitled/
 vm1013:untitled root#  $(port work legacy-support)/macports-legacy-
 support-0.13-x86_64/test/test_utimensat
 Warning: port definitions are more than two weeks old, consider updating
 them by running 'port selfupdate'.
 Testing: === {305419896, 987654321} {354826056, 123456789} ===
 Testing: === {0, -1} {354826056, 123456789} ===
 Testing: === {305419896, 987654321} {0, -1} ===
 Testing: === {0, -1} {0, -1} ===
 Testing: === {0, -2} {354826056, 123456789} ===
 Testing: === {305419896, 987654321} {0, -2} ===
 Testing: === {0, -2} {0, -2} ===
 Testing: === {0, -1} {0, -2} ===
 Testing: === {0, -2} {0, -1} ===
 }}}

 So... the test case we have seems to hold for Apple's native `utimensat`
 implementation. But only on APFS. That's good to know.

 Sadly, we'll never really be able to test it properly on any system older
 than 10.13, since APFS is only available, tada, on 10.13 and higher.

 I'll rewrite the test to do other sanity checking on non-APFS file
 systems, though. We *can* test if the a/mtimes set by our version of
 `utimensat` is within seconds and microseconds range. That should be good
 enough for things like HFS+ and, frankly, Apple's native implementation
 probably won't behave differently on HFS+ either. I'm going to make sure
 that that's the case.

 So... still a bit of work to do on my end, but it's coming along, finally.

-- 
Ticket URL: <https://trac.macports.org/ticket/58729#comment:19>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list