Page MenuHomeFreeBSD

cp: fix -R recursion detection
ClosedPublic

Authored by kevans on Mar 24 2022, 2:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 26, 10:51 AM
Unknown Object (File)
Thu, Oct 24, 10:24 PM
Unknown Object (File)
Oct 7 2024, 8:29 AM
Unknown Object (File)
Sep 25 2024, 12:38 PM
Unknown Object (File)
Sep 21 2024, 10:43 PM
Unknown Object (File)
Sep 18 2024, 10:30 PM
Unknown Object (File)
Sep 18 2024, 8:34 AM
Unknown Object (File)
Sep 17 2024, 2:15 PM
Subscribers

Details

Reviewers
bapt
Group Reviewers
Klara
Commits
rGf00f8b4fbd26: cp: fix -R recursion detection
Summary

The correct logic is a lot simpler than the previous iteration. We
record the base fts_name to avoid having to worry about whether we
needed the root symlink name or not (as applicable), then we can simply
shift allof that logic to after path translation to make it less
fragile.

If we're copying to DNE, then we'll have swapped out the NULL root_stat
pointer and then attempted to recurse on it. The previously nonexistent
directory shouldn't exist at all in the new structure, so just back out
from that tree entirely and move on.

The tests have been amended to indicate our expectations better with
subdirectory recursion. If we copy A to A/B, then we expect to copy
everything from A/B/* into A/B/A/B, with exception to the A that we
create in A/B.

Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable