Open() on path that exceeds 248 char limit results in "FileNotFoundError: [Errno 2] No such file or directory"
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Attempting to open or appending paths to sys.path with paths that length exceed the 248 character limit results in incorrect errors. In the case of opening paths that exceeded the limit, rather than an error pointing to the path length being exceeded we see a file not found. A similar error handling issue is prevalent with appending paths that exceed the limit to sys.path. In this case when trying to access the module you will receive a module not found error. I am now aware the path limit can be disabled on installation or later but these false flags led me astray while debugging.
Reproduction Steps:
- Create a text file whose path exceeds 248 characters
- Attempt to read/write from that file
or - Create a Python module whose path exceeds 248 characters
- Attempt to import that module from an external directory by appending the path to sys.path
Environment
- CPython versions tested on: 3.10.4
- Operating system and architecture: Windows x64
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、Windows x64 上の Python 3.10.4 で報告された挙動を再現します。パスが 248 文字を超えるファイルを開き、その後、sys.path に追加した長すぎるパスからモジュールをインポートしてテストします。open と import の失敗を追跡し、長さの条件が失われる箇所を特定します。両方のケースで、FileNotFoundError や ModuleNotFoundError ではなく、パス長に関する正確なエラーが報告されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- operating-systems
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100