[Bug]: Local filesystem ancestor copies delete the source and unrelated files
Les mainteneurs répondent en général sous 2 jours
Évaluation
Cette issue n'a pas encore été évaluée.
Description
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.
- Langage dominant
- Java
- Étoiles
- 8.7k
- Forks
- 4.8k
- Merge moyen
- 3 j 16 h
- PR mergées (30 j)
- 445
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/beam
-
awaiting triage java new feature P2
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 2 jours
-
[Bug]: [Python] BigTableEnrichmentHandler coerces None lookup keys to literal b'None' and formats blank key name on KeyErrorPeut-être pris @shikhabhadoria l’a pris il y a 6 jours. Ouverteio P2 python
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
apache/beam#41346 · 4 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
-
Release notes links wrongPeut-être pris @schizophrenicmaniac l’a pris il y a 20 jours. Ouvertebug P3
Difficulté 1/5 Moins d'une heure Accessibilité débutants 67/100
apache/beam#41197 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
apache/beam#39624 · 2 réactions ·
Les mainteneurs répondent en général sous 2 jours
-
[Bug]: PubsubIO used in batch incorrect batch cutoff sizePeut-être pris @1fanwang l’a pris il y a 98 jours. Ouvertebug io P3 pinned pubsub
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/beam#28011 · 4 commentaires ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de apache/beam
Issues similaires
-
effort/l priority/p1 risk/high triage/core
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
iflytek/skillhub#1188 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
testng-team/testng#3675 ·
Les mainteneurs répondent en général sous 1 jour
-
Improve readability of build file paths in the Run/Debug configuration "Build file" dropdownOuvertedesign
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
OpenLiberty/liberty-tools-intellij#1869 ·
Les mainteneurs répondent en général sous 1 jour
-
`ovsx verify` fails for a version older than the 100 newest of an extensionPeut-être pris @trivikr l’a pris aujourd’hui. Ouvertecli
Difficulté 2/5 1-3 heures Accessibilité débutants 81/100
eclipse-openvsx/openvsx#2482 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
Les mainteneurs répondent en général sous 1 jour