get_unique_name appends to the previous candidate name when a collision triggers a retry
メンテナーはふだん 1 日以内に返信
@rahul05ranjan がすでに取り組んでいます。
2026年10月28日 から。
評価
調査の方向性
Start in the implementation of fsutil.get_unique_name() and inspect how the candidate name is built before the exists() check. The issue suggests reproducing the collision with sequential UUIDs and checking that a retry builds a fresh candidate; the suggested regression test can verify the second name. Two linked pull requests are already open.
索引モデルが issue の本文から書いたものです。
説明
Summary
fsutil.get_unique_name() builds the candidate name with += while the name is initialized to "" outside the retry loop:
name = ""
while True:
if prefix:
name += f"{prefix}{separator}"
uid = uuid.uuid4()
name += f"{uid}"
...
if exists(join_path(path, name)):
continue
break
When the exists() check finds a collision and continues, the candidate is not rebuilt from scratch: the next prefix/uuid/suffix/extension are appended onto the previous (already colliding) candidate, producing a garbage name like:
prefix-<uid1>-suffix.txtprefix-<uid2>-suffix.txt
instead of
prefix-<uid2>-suffix.txt
This is hard to hit with random uuid4 values, but the loop exists precisely to handle collisions (e.g. when a caller passes a monkeypatched/sequential uuid source, or get_unique_name is reused as a generic "find unused name" helper by replace_dir / replace_file which rely on it for safe temporary names).
Suggested fix
Move name = "" inside the while True: loop so every retry starts clean. Adding a regression test is easy by monkeypatching fsutil.paths.uuid.uuid4 to a sequential iterator and creating the first candidate on disk before the second call.
Happy to send a PR.
- 主要言語
- Python
- スター
- 268
- フォーク
- 25
- 平均マージ
- 20時間 48分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fabiocaccamo/python-fsutil のほかの issue
-
download_file ignores the RFC 6266 filename* Content-Disposition parameter対応中かも @rahul05ranjan が 7 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
fabiocaccamo/python-fsutil#208 ·
メンテナーはふだん 1 日以内に返信
-
Atomic append fails to create a missing file対応中かも @harbinresearcher が 22 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
fabiocaccamo/python-fsutil#201 ·
メンテナーはふだん 1 日以内に返信
-
Add `toml` files operation support.再び着手できるかも @fabiocaccamo が 1343 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement
fabiocaccamo/python-fsutil#42 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
fabiocaccamo/python-fsutil の issue をすべて見る
似ている issue
-
curriculum documentation quality
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
githubnext/gh-aw-workshop#5367 ·
メンテナーはふだん 3 日以内に返信
-
Create Noise Latents ignores randomize_seed and produces the same noise every run対応中かも @griptapeops が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
griptape-ai/griptape-nodes-library-diffusers#127 ·
メンテナーはふだん 1 日以内に返信
-
Jenkins capacity report: metrics history is lost when archiving a month fails対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
adoptium/infrastructure#4568 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
huggingface/deep-rl-class#723 ·
-
premises-missing
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
WingedGuardian/GENesis-AGI#3928 ·
メンテナーはふだん 1 日以内に返信