JustinBinber opened a new pull request, #41748: URL: https://github.com/apache/beam/pull/41748
Fixes #41747. Copying a local source file/directory onto an ancestor directory removes the destination tree, including the source and unrelated siblings, before failing. Directory copies into their own output descendants can also recurse into the output. Check source access dependencies and output containment before destination removal. The source check follows the argument's ancestors and link targets, including intermediate links; drive-relative Windows paths are anchored without discarding symlink-sensitive `..` components. Output checks use the actual entry and target locations so a safe `source/../neighbor` copy remains valid. Existing self-copy/hard-link checks, ordinary overwrites, byte paths and per-pair error aggregation remain intact. Ordinary file-to-file copies skip the ancestry traversal. Validation on Windows / Python 3.11.7: - Collected **30 explicit offline regression cases**. On unchanged master: **22 failed, 7 passed, 1 skipped**. With the fix: **29 passed, 1 skipped** (the skipped case specifically requires POSIX symlink/`..` semantics). - Complete `localfilesystem_test.py`, `filesystem_test.py` and `filesystems_test.py`: **142 passed, 1 skipped, 50 subtests passed**. Coverage includes the real public `FileSystems.copy`, source/sibling preservation, link aliases and chains, cycle termination, C:/D: drive-relative probes, valid sibling/overwrite copies and mixed-batch errors. Tripwires prevent unsafe recursive-copy/deletion entry in the descendant/link tests. - Configured pre-commit checks pass (YAPF 0.43.0 and hook Ruff 0.15.7); SDK Ruff 0.17.6 passes, Pyrefly 1.5.0 reports 0 errors, and `git diff --check` passes. The source checkout reused released 2.78.0 generated protobuf bindings in the ignored API directory. A fresh SDK/protobuf build, live POSIX run and full runner/OS matrix were not run locally. This is a per-pair preflight check; concurrent namespace mutation, atomic copying and symlink graphs nested inside copied directory contents retain existing behavior. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
