`os.chmod` is missing validation for `dir_fd` and `follow_symlinks` when `path` is a file descriptor
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
The documentation for os.chmod says it is not correct to use dir_fd or follow_symlinks when path is an open file descriptor...
... but os_chmod_impl never checks it.
When path->is_fd is true it takes the fchmod path and returns success, so both keywords are ignored altogether:
Other os utils (I checked os.stat, os.chown, and os.utime) reject this combination with dir_fd_and_fd_invalid / fd_and_follow_symlinks_invalid before the syscall. os.chown for example:
(The Windows path also has the same problem with: path->is_fd going directly to win32_fchmod.)
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
- gh-156265
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Modules/posixmodule.c の os_chmod_impl から始め、POSIX と Windows の path->is_fd 分岐を調べてください。os.chown、os.stat、os.utime で使用されている検証と、それらの処理を比較してください。path がファイルディスクリプタの場合に、無効な dir_fd と follow_symlinks の組み合わせが拒否され、関連する os テストでその動作がカバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- operating-systems
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 25/100