-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Fix typo in util.c #1897
WIP: Fix typo in util.c #1897
Conversation
There must be mtim*e*
Hi sergey-dryabzhinsky! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thanks @sergey-dryabzhinsky . I'm surprised : this code path was supposed to be already tested. Bottom line : it seems we are missing a test to ensure that this code path is being compiled properly. It should be visible during CI. Also, minor thing, but it seems that this code path is only used for relatively recent POSIX platforms, compliant with version |
Checked : this code path is tested on CircleCI. before : after : It seems this story is more than just about a typo ... |
Follow up : Bottom line : only They nonetheless both work (on platform with Since only |
Something is wrong here. And maybe the easiest thing to do is just give up on sub-second precision here, but I'd rather not, if possible (since this can lead to the destination file having an earlier mtime than the source file, which is weird). @Cyan4973, the spec you linked is POSIX 2001. So from a theoretical perspective, I'm confident that the code using
|
Incomplete compliance to posix standards is unfortunately not so rare, A general idea when dealing with such problem :
In this specific case, if a functionality of Yet, you mention that they are not identical, with the 2001 function being limited to second accuracy. In a benchmark function, such limitation would be a deal breaker. But in this case, the objective is to "set access and modification times". Does it have to be sub-second ? Is this accuracy actually stored somewhere ? |
Good point! Maybe we can additionally gate on
Linux filesystems all store nanosecond-precision timestamps. I'm not sure about mac and win, but I'm pretty sure they're sub-second as well. I think in particular the concerning case is that truncation always makes timestamps earlier, which makes a derivative file created by zstd apparently older than its source. This could be confusing to systems such as |
@felixhandte |
Cool. So that matches. I've put up #1920, which I believe should mitigate this issue. Feel free to try it out locally to confirm? |
@felixhandte New error occurs on Ubuntu 10.04:
|
Same at Ubuntu 14.04 on arm64. |
Should we consider adding some similar test in CI to experience the issue, and make sure it remains fixed in the future ? |
Right |
OK, https://travis-ci.org/facebook/zstd/jobs/621243704#L10 So maybe there are additional conditions required note : this test compiles |
As reported, it only fails on Trusty with arm, x86 succeeds. I'll add such a build. First I have to fix |
There must be mtime
Error popup if I use gcc-4.4 and build under Ubuntu 10.04.
And in arm builds up to Ubuntu 14.04.
Probably there must be more clever check for attributes of stat_t structure.