python / python/cpython

In Windows, os.path.ismount() returns True for nonsense UNC shares

オープン
#139,916 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

OS-windows stdlib topic-pathlib type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:

Examples below:

  • \\192.168.10.2\share1 is a valid UNC.
  • \\192.168.10.34534543.2\share1 is an invalid UNC as it has five IPv4 octets and an octet is out of range.
  • \\"!£$£"$%\share1 is an invalid UNC as it contains illegal characters.
C:\Users\earpt\source\repos\cowgoesmoo69\cpython>python.bat
Running Debug|x64 interpreter...
Python 3.15.0a0 (heads/main:1c598e0436, Oct 10 2025, 18:08:52) [MSC v.1944 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.ismount("\\\\192.168.10.2\\share1")
True
>>> os.path.ismount("\\\\192.168.10.34534543.2\\share1")
True
>>> os.path.ismount("\\\\\"!£$£\"$%\\share1")
True
>>>

It appears there is no validation in ntpath.ismount() of a path that appears to be a UNC.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ntpath.ismount() から始め、issue のコマンドを使って Windows 上で UNC の例を再現します。完了の条件は、有効な UNC 共有が期待どおりの結果を維持し、形式が不正なアドレスと不正な文字を含む共有が True を返さなくなることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
operating-systems
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
64/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。