Local range download leaves an output file after source-read failure despite delete_on_failure=True
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
libcloud/storage/base.py の範囲ダウンロードの契約と、libcloud/storage/drivers/local.py のローカル実装を読んでください。issue にあるソースが存在しないケースを再現し、ローカルドライバーの既存テストの隣に回帰テストを追加してください。delete_on_failure=True の場合、範囲ダウンロードに失敗すると宛先が削除され、フラグが false の場合の動作は意図どおりに維持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
On trunk 8a0ef626, the local driver's range-download method creates a destination file but does not clean it up when opening the source fails, even with delete_on_failure=True.
This reproducer is sequential: obtain the object metadata, explicitly remove the stored file, then try to download. It does not depend on winning a filesystem race.
import os
import tempfile
from libcloud.storage.drivers.local import LocalStorageDriver
with tempfile.TemporaryDirectory() as root:
driver = LocalStorageDriver(root)
container = driver.create_container("bucket")
obj = driver.upload_object_via_stream(iter([b"payload"]), container, "object")
os.unlink(driver.get_object_cdn_url(obj))
destination = os.path.join(root, "download")
try:
driver.download_object_range(
obj, destination, start_bytes=0, delete_on_failure=True
)
except FileNotFoundError:
pass
print(os.path.exists(destination), os.path.getsize(destination))
# True 0
The public range-download contract describes delete_on_failure as deleting a partially downloaded file when the download was unsuccessful, with hash mismatch/file size given as examples. I expected the newly created empty output to be removed for a source-read failure as well. Otherwise a failed operation leaves a file that can be mistaken for a valid empty download.
The local implementation accepts the flag but never reads it. It opens the destination before consuming the source iterator and has no failure cleanup around that loop.
Checks with unchanged source, Python 3.12/Linux:
- Range download with
delete_on_failure=True: raisesFileNotFoundError, leaves a zero-byte output. - Range download with
delete_on_failure=False: same result. - Full
download_objectwith the same missing source: returnsFalse, leaves no output. - Successful range
[0, 3)before removing the source: returnsTrue, writesb"pay".
No code change yet. This report is limited to failure cleanup for local range downloads; it does not claim a concurrent-write reproduction or a full test-suite pass.
- 主要言語
- Python
- スター
- 2.1k
- フォーク
- 935
- 平均マージ
- 5日 3時間
- マージ済み PR(30日)
- 15
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/libcloud のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
apache/libcloud#2215 · コメント 3 件 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
メンテナーはふだん 1 日以内に返信
apache/libcloud の issue をすべて見る
似ている issue
-
Email validation accepts a trailing newline対応中かも @marcello-pichini が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dbt-labs/spark-utils#51 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
bug frontend
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
vendrabuck/HERD#1419 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信