Skip to content
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

test/cp: fix test_copy_through_dangling_symlink_no_dereference_permissions #3789

Conversation

niyaznigmatullin
Copy link
Contributor

@niyaznigmatullin niyaznigmatullin commented Aug 7, 2022

The test checked -p option that shouldn't change timestamps.

According to coreutils documentation, it shouldn't change atime and mtime, but changes ctime.

     ‘timestamps’
          Preserve the times of last access and last modification, when
          possible.

...

     Using ‘--preserve’ with no ATTRIBUTE_LIST is equivalent to
     ‘--preserve=mode,ownership,timestamps’.

GNU coreutils cp works like it's written in documentation in this case.

The test was passing most of the time, because it was checking the timestamp in seconds, and in a single second both the original link and copied link were created, so their timestamps were equal. Sometimes it was failing, for instance here https:/uutils/coreutils/runs/7711138977?check_suite_focus=true.

  • added 5 seconds timeout between file creation and copy, so that timestamps are for sure different (after adding this it started failing every time because of ctime has been changed by 5)
  • removed ctime checking
  • made atime and mtime checking more accurate, started checking atime_nsec and mtime_nsec as well

@sylvestre
Copy link
Contributor

I was concerned that we would slow down a lot the test execution with the sleep(5s) but it seems that it is already the case in other places. Looking at:
cargo test --features=unix -- --test-threads 1

@sylvestre sylvestre merged commit fee851d into uutils:main Aug 8, 2022
@niyaznigmatullin niyaznigmatullin deleted the fix_test_copy_through_dangling_symlink_no_dereference_permissions branch August 14, 2022 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants