In Windows, os.path.ismount() returns True for nonsense UNC shares
未关闭
还没有人认领这个 Issue。
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 ntpath.ismount() 开始,使用 issue 中的命令在 Windows 上重现 UNC 示例。完成标准是:有效的 UNC 共享仍保留预期结果,而格式错误的地址和包含非法字符的共享不再返回 True。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- operating-systems
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 64/100