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

mv: gnu test case part-hardlink fix #6632

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

matrixhead
Copy link
Contributor

@matrixhead matrixhead commented Aug 11, 2024

fix #6631

behaviours changed
- mv will now preserve links during an inter-device move.
- Previously, mv would silently fail to create a backup when no-target-directory was specified and the destination ended with a / This patch resolves that issue.
- The progress bar will now work for simple inter-device file moves as well.

This pr now focus on copy directory part of mv.

src/uu/mv/src/mv.rs Outdated Show resolved Hide resolved
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/mv/hard-link-1 is no longer failing!
Congrats! The gnu test tests/mv/part-hardlink is no longer failing!
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

src/uu/mv/src/mv.rs Outdated Show resolved Hide resolved
@sylvestre
Copy link
Contributor

Bravo

Congrats! The gnu test tests/mv/hard-link-1 is no longer failing!
Congrats! The gnu test tests/mv/part-hardlink is no longer failing!


Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/mv/hard-link-1 is no longer failing!
Congrats! The gnu test tests/mv/part-hardlink is no longer failing!

1 similar comment
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/mv/hard-link-1 is no longer failing!
Congrats! The gnu test tests/mv/part-hardlink is no longer failing!

Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/mv/hard-link-1 is no longer failing!
Congrats! The gnu test tests/mv/part-hardlink is no longer failing!

@matrixhead matrixhead requested a review from sylvestre August 13, 2024 04:47
src/uu/mv/src/mv.rs Outdated Show resolved Hide resolved
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/mv/hard-link-1 is no longer failing!
Congrats! The gnu test tests/mv/part-hardlink is no longer failing!

Copy link
Collaborator

@BenWiederhake BenWiederhake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for tackling these issues! However, combining these three behavioral changes seems like a bad idea, given that each of them have delicate consequences.

It seems that get_dir_content is the entirely wrong tool to approach mv, and it causes incorrect behavior.

Finally, it seems you fell into a common trap / bad pattern: Guessing a potential error condition (and not detecting others), then doing an action (and badly handling most error conditions.) This causes unhelpful error messages and unnecessary syscalls.

src/uu/mv/src/mv.rs Outdated Show resolved Hide resolved
src/uu/mv/src/mv.rs Outdated Show resolved Hide resolved
src/uu/mv/src/mv.rs Outdated Show resolved Hide resolved
tests/by-util/test_mv.rs Outdated Show resolved Hide resolved
tests/by-util/test_mv.rs Outdated Show resolved Hide resolved
src/uu/mv/src/mv.rs Outdated Show resolved Hide resolved
src/uu/mv/src/mv.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@BenWiederhake BenWiederhake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I meant to set the "Request changes" flag. See above for my reasoning. In particular, get_dir_content must go.

May I suggest to split the tree changes into two or three PRs?

Copy link

github-actions bot commented Sep 8, 2024

GNU testsuite comparison:

GNU test failed: tests/timeout/timeout. tests/timeout/timeout is passing on 'main'. Maybe you have to rebase?
Congrats! The gnu test tests/mv/hard-link-1 is no longer failing!
Congrats! The gnu test tests/mv/part-hardlink is no longer failing!

Copy link

GNU testsuite comparison:

GNU test failed: tests/mv/backup-dir. tests/mv/backup-dir is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)

Copy link

GNU testsuite comparison:

GNU test failed: tests/mv/backup-dir. tests/mv/backup-dir is passing on 'main'. Maybe you have to rebase?

@matrixhead matrixhead marked this pull request as draft September 11, 2024 17:47
@matrixhead
Copy link
Contributor Author

@BenWiederhake I cleaned up this PR. Now, it focuses solely on the directory copying part. I'll work on verbose output and error reporting next. For now, could you let me know if this approach looks okay?

Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

src/uu/mv/src/mv.rs Outdated Show resolved Hide resolved
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

@matrixhead
Copy link
Contributor Author

@sylvestre 😅 I'm working it, i didn't thoroughly tested it on other platforms 😕 just found out that this would break copying on mac os my bad.

@sylvestre
Copy link
Contributor

@matrixhead do you have an update on this ? :) thanks

@matrixhead
Copy link
Contributor Author

Sorry for the late reply and for being unmotivated 😓. I've started working on it again 😃.

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

Copy link

GNU testsuite comparison:

GNU test failed: tests/mv/into-self-2. tests/mv/into-self-2 is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/mv/part-symlink. tests/mv/part-symlink is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/misc/stdbuf is no longer failing!

@matrixhead matrixhead force-pushed the part-hardlink branch 2 times, most recently from 814650c to 8c91ed2 Compare January 22, 2025 10:44
Copy link

GNU testsuite comparison:

GNU test failed: tests/mv/into-self-2. tests/mv/into-self-2 is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/mv/part-symlink. tests/mv/part-symlink is passing on 'main'. Maybe you have to rebase?
Congrats! The gnu test tests/misc/stdbuf is no longer failing!

Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/misc/stdbuf is no longer failing!

@matrixhead matrixhead marked this pull request as draft January 22, 2025 13:07
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)

@matrixhead matrixhead marked this pull request as ready for review January 24, 2025 08:14
@matrixhead
Copy link
Contributor Author

I tested this in macOS and windows, everything seems to be working

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.

mv: gnu test case part-hardlink compatibility
3 participants