alexcrichton / filetime

Accessing file timestamps in a platform-agnostic fashion in Rust
Apache License 2.0
122 stars 56 forks source link

Fix Emscripten and FreeBSD #31

Closed tomaka closed 5 years ago

tomaka commented 5 years ago

My primary motivation is to fix #24 However this also fixes #29, but I didn't test it.

On emscripten utimes is just a wrapper on top of utimensat, which is why my change makes sense: https://github.com/kripken/emscripten/blob/6e4b98636618989bcd99308391e51aa1b81f4c61/system/lib/libc/musl/src/linux/utimes.c#L9 https://github.com/kripken/emscripten/blob/6e4b98636618989bcd99308391e51aa1b81f4c61/system/lib/libc/musl/src/stat/futimesat.c#L20

However the tests don't work because:

alexcrichton commented 5 years ago

Thanks!

alexcrichton commented 5 years ago

I'm not sure what to do about the test failures, but getting things compiling seems like a good first start

derkbell commented 5 years ago

This breaks on FreeBSD 11:

error[E0425]: cannot find value `utimensat` in module `libc`
 --> src/unix/utimensat.rs:8:45
  |
8 |     super::utimensat(p, atime, mtime, libc::utimensat, 0)
  |                                             ^^^^^^^^^ did you mean `utimes`?

When I remote the cfg target freebsd from unix/mod and let it use utimes, it works fine

alexcrichton commented 5 years ago

Oh dear sorry about that! Want to send a PR to fix FreeBSD?

derkbell commented 5 years ago

Yes, I will do that tomorrow. I will look into the problem because it does seem that utimesnsat is prevered over utimes in freebsd 10.3+

On Sat, 10 Nov 2018, 18:23 Alex Crichton <notifications@github.com wrote:

Oh dear sorry about that! Want to send a PR to fix FreeBSD?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/alexcrichton/filetime/pull/31#issuecomment-437600407, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAtjJPvehnGqlzYSARxPo2LKf-m4yK4ks5utwt3gaJpZM4YNGrX .

derkbell commented 5 years ago

I checked, the latest release of rust libc (0.2.43) doesn't have the utimensat call for freebsd. It's in the master branch but not in the release version. I can patch out the cfg=freebsd and create a pull request, but the real solution would be for libc to create a 0.2.44 version.

alexcrichton commented 5 years ago

Ok!