[Bug]: Local filesystem ancestor copies delete the source and unrelated files
维护者通常 2 天内回复
评估
这个 Issue 还没有评估数据。
描述
What happened?
FileSystems.copy() can delete the source and unrelated files when an existing destination directory is an ancestor of the source. The source and destination are distinct objects, so the existing same-file check does not prevent the deletion.
Reproduced on current master a9b9e8d3cd13e1b5109175968bf00d137f497cf8, Windows / Python 3.11.7, using current Python sources and real local filesystem operations.
Reproduction
from pathlib import Path
from tempfile import TemporaryDirectory
from apache_beam.io.filesystem import BeamIOError
from apache_beam.io.filesystems import FileSystems
with TemporaryDirectory() as temporary:
tree = Path(temporary) / "tree"
source = tree / "source"
source.mkdir(parents=True)
(source / "data").write_text("source data")
(tree / "unrelated").write_text("keep this")
try:
FileSystems.copy([str(source)], [str(tree)])
except BeamIOError as error:
print(error)
print((source / "data").exists()) # False
print((tree / "unrelated").exists()) # False
A source file copied to its containing directory loses data in the same way. LocalFileSystem.copy() removes the existing destination before attempting to read the source.
Expected behavior
Reject the overlapping pair through the existing BeamIOError aggregation before removing any destination data. Copying a directory into one of its own output descendants should also be rejected before entering copytree. Independent valid pairs in the batch should continue as they currently do.
The check needs to account for source access through link entries/targets and Windows drive-relative paths. Looking only at the final resolved source misses a link inside the destination that points outside; looking only at original parents misses an outside link whose target or intermediate link is inside the destination. Normal disjoint copies, including a harmless source/../neighbor output, should continue to work.
This is a follow-up to #41561 / #41562, which addressed copying onto the same filesystem object. It does not require changing cloud filesystems or making local copies transactional.
- 主要语言
- Java
- 星标
- 8.7k
- 派生
- 4.8k
- 平均合并
- 3 天 16 小时
- 30 天内合并 PR
- 445
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/beam 的其他 Issue
-
awaiting triage java new feature P2
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
[Bug]: [Python] BigTableEnrichmentHandler coerces None lookup keys to literal b'None' and formats blank key name on KeyError可能已有人在做 @shikhabhadoria 于 6 天前认领。 未关闭io P2 python
难度 2/5 1-3 小时 新手友好度 82/100
apache/beam#41346 · 4 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
Release notes links wrong可能已有人在做 @schizophrenicmaniac 于 20 天前认领。 未关闭bug P3
难度 1/5 1 小时以内 新手友好度 67/100
apache/beam#41197 · 3 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
apache/beam#39624 · 2 个 reaction ·
维护者通常 2 天内回复
-
[Bug]: PubsubIO used in batch incorrect batch cutoff size可能已有人在做 @1fanwang 于 98 天前认领。 未关闭bug io P3 pinned pubsub
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
相似的 Issue
-
`ovsx verify` fails for a version older than the 100 newest of an extension可能已有人在做 @trivikr 今天认领。 未关闭cli
难度 2/5 1-3 小时 新手友好度 81/100
eclipse-openvsx/openvsx#2482 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
Magic-team-jvav/confluence#281 ·
-
area/dependencies area/dependencies/js backport/26.6 backport/26.8 kind/cve severity/medium source/scan-dependencies status/triage
难度 1/5 1 小时以内 新手友好度 67/100
维护者通常 2 天内回复
-
[DEFECT] AsciiDoc builders write a stray ## before every schema member when the namespace prefixes file binds the schema's own namespace可能已有人在做 @Beehtrix 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
cimug-org/CIMTool#427 · 1 条评论 ·
维护者通常 1 天内回复
-
userRaised
难度 2/5 1-3 小时 新手友好度 76/100
eclipse-openj9/openj9#25285 ·
维护者通常 1 天内回复