[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時間
- マージ済み PR(30日)
- 445
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 件 ·
メンテナーはふだん 2 日以内に返信
-
[Bug]: PubsubIO used in batch incorrect batch cutoff size対応中かも @1fanwang が 98 日前に担当しました。 オープンbug io P3 pinned pubsub
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/beam#28011 · コメント 4 件 ·
メンテナーはふだん 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 日以内に返信