+
Skip to content

Conversation

Vesal-J
Copy link
Contributor

@Vesal-J Vesal-J commented Sep 6, 2025

Fixes #8555

When copying the current directory (.) to an existing directory, ensure
that the directory name is properly stripped from the descendant path
and the context is set up correctly. This matches GNU cp behavior.

- Set root_parent to None when copying . to existing directory
- Strip current directory name from descendant path in Entry::new
- Return target path directly in construct_dest_path for . -> dir case
- Fix panic when root.file_name() is None for . path
@sylvestre
Copy link
Contributor

could you please add tests to make sure we don't regress in the future?
also, your change lacks a bit comments :)

@Vesal-J
Copy link
Contributor Author

Vesal-J commented Sep 6, 2025

sure!

Copy link

github-actions bot commented Sep 6, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (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)

This commit introduces several tests to validate the behavior of copying the current directory (.) to both existing and new directories, including checks for verbose output, attribute preservation, and handling of symlinks. Additionally, a test is added to ensure that copying the current directory to itself is disallowed with an appropriate error message. These tests enhance coverage and ensure compliance with expected functionality.
@Vesal-J
Copy link
Contributor Author

Vesal-J commented Sep 6, 2025

@sylvestre Done ✅

Copy link

github-actions bot commented Sep 7, 2025

GNU testsuite comparison:

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

Copy link

github-actions bot commented Sep 7, 2025

GNU testsuite comparison:

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

@Vesal-J
Copy link
Contributor Author

Vesal-J commented Sep 7, 2025

hey @sylvestre , finally all checks have passed

This commit adds tests to verify that file permissions and timestamps are preserved when copying the current directory (.) to a destination. Specific permissions and timestamps are set on the source files, and assertions are made to ensure that these attributes are correctly maintained in the copied files. The tests are conditionally compiled for non-Windows and non-FreeBSD systems.
@Vesal-J Vesal-J requested a review from cakebaker September 8, 2025 17:24
Copy link

github-actions bot commented Sep 8, 2025

GNU testsuite comparison:

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

@cakebaker cakebaker merged commit 2b78922 into uutils:main Sep 9, 2025
94 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR!

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 -p . <existing-directory> creates leading component

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载