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

cp: copy attributes after making subdir #6884

Merged
merged 3 commits into from
Jan 5, 2025
Merged

Conversation

rm-dr
Copy link
Contributor

@rm-dr rm-dr commented Nov 23, 2024

Closes #6875.

TODO:

@rm-dr rm-dr marked this pull request as draft November 23, 2024 23:14
@rm-dr rm-dr changed the title opy attributes after making subdir Copy attributes after making subdir Nov 23, 2024
@rm-dr rm-dr force-pushed the 6875-cp-a branch 2 times, most recently from 898a027 to 6676cde Compare November 23, 2024 23:56
Copy link

GNU testsuite comparison:

GNU test failed: tests/cp/cp-HL. tests/cp/cp-HL is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/cp/cp-deref. tests/cp/cp-deref is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/cp/dir-slash. tests/cp/dir-slash is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/cp/fail-perm. tests/cp/fail-perm is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/cp/link-preserve. tests/cp/link-preserve is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/cp/parent-perm-race. tests/cp/parent-perm-race is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/cp/preserve-mode. tests/cp/preserve-mode is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/cp/symlink-slash. tests/cp/symlink-slash is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/mv/dup-source. tests/mv/dup-source 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)
GNU test error: tests/cp/link-heap. tests/cp/link-heap is passing on 'main'. Maybe you have to rebase?

Copy link

GNU testsuite comparison:

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

@rm-dr rm-dr marked this pull request as ready for review November 24, 2024 17:09
Copy link

GNU testsuite comparison:

GNU test failed: tests/cp/link-heap. tests/cp/link-heap 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)

@cakebaker cakebaker changed the title Copy attributes after making subdir cp: copy attributes after making subdir Nov 25, 2024
fn build_dir(
path: &PathBuf,
recursive: bool,
options: &Options,
Copy link
Contributor

Choose a reason for hiding this comment

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

why changing the order?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the usual convention, no?
The "primary" argument is first, all options and etc come afterwards.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe but if you do, it should be in a sep commit :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, done. I've reorganized commits & force-pushed.

tests/by-util/test_cp.rs Outdated Show resolved Hide resolved
Copy link

GNU testsuite comparison:

GNU test failed: tests/cp/link-heap. tests/cp/link-heap is passing on 'main'. Maybe you have to rebase?

@rm-dr rm-dr marked this pull request as draft November 26, 2024 16:50
Copy link

GNU testsuite comparison:

GNU test failed: tests/cp/link-heap. tests/cp/link-heap 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)

@rm-dr rm-dr marked this pull request as ready for review November 30, 2024 06:23
@rm-dr rm-dr requested a review from sylvestre November 30, 2024 06:23
@rm-dr rm-dr force-pushed the 6875-cp-a branch 4 times, most recently from 82de5b9 to 62c33d4 Compare November 30, 2024 06:33
Copy link

GNU testsuite comparison:

GNU test error: tests/cp/link-heap. tests/cp/link-heap is passing on 'main'. Maybe you have to rebase?

Copy link

github-actions bot commented Dec 1, 2024

GNU testsuite comparison:

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

Copy link

github-actions bot commented Dec 3, 2024

GNU testsuite comparison:

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

@rm-dr rm-dr force-pushed the 6875-cp-a branch 2 times, most recently from 80ef881 to c8f7fdc Compare December 11, 2024 17:24
@rm-dr
Copy link
Contributor Author

rm-dr commented Dec 11, 2024

This pr should be ready to be merged.
Is there anything else I need to do?

@sylvestre
Copy link
Contributor

Sorry, i looked if skip_last wasn't implemented elsewhere and got distracted

// (Note that there can be more than one! We might step out of
// `./a/b/c` into `./a/`, in which case we'll need to fix the
// permissions of both `./a/b/c` and `./a/b`, in that order.)
if direntry.file_type().is_dir() {
Copy link
Contributor

Choose a reason for hiding this comment

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

would it make sense to move this into a function?
it is starting to be a bit long

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm, I don't think so? That code is tightly integrated with the rest of copy_directory, and most of the lines are comments.

Copy link

GNU testsuite comparison:

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

@rm-dr
Copy link
Contributor Author

rm-dr commented Jan 5, 2025

Hm, cp-i.sh from gnu tests is failing. Looks like it's the last two lines:

> touch c d
> cargo run -- cp -b --update=none c d
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.16s
     Running `/uutils/coreutils/target/debug/coreutils cp -b --update=none c d`
> cp -b --update=none c d
cp: --backup is mutually exclusive with -n or --update=none-fail
Try 'cp --help' for more information.

This manual check fails on main and on my branch (which is rebased on latest main).
I don't think this is related to the changes in this pr, and I'm not sure why CI isn't catching this everywhere else.

@sylvestre
Copy link
Contributor

@rm-dr
Copy link
Contributor Author

rm-dr commented Jan 5, 2025

Huh, I think it's only reason this PR hasn't been passing tests?
Shouldn't cp -i be ignored?
Let's see what happens this time.

@rm-dr
Copy link
Contributor Author

rm-dr commented Jan 5, 2025

Looks like it worked!

@sylvestre
Copy link
Contributor

about cp-i.sh #7082
thanks for the investigation!

@sylvestre sylvestre merged commit 49ae68d into uutils:main Jan 5, 2025
65 checks passed
@rm-dr rm-dr deleted the 6875-cp-a branch January 6, 2025 00:29
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.

cp -a does not copy attributes (owner, rights) of directories
2 participants