| Ticket UUID: | 7eb6b3a53f963364c3c6f29d7622d70ddf8dd610 | ||
| Title: | glob on UNC path requires additional slash | ||
| Type: | Bug | Created on: | 2026-05-29 07:48:54 |
| Submitter: | anonymous | Assigned to: | nobody |
| Subsystem: | 36. Pathname Management | Severity: | Important |
| Priority: | 5 Medium | Last modified: | 2026-05-31 16:18:59 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | 8.4-9.1 | ||
| Description: | ||||
Glob on windows unc path sometimes works incorrectly:
% llength [glob //?/C:/WINDOWS/*]
112
% llength [glob {\\?\C:\WINDOWS\*}]
no files matched glob pattern "\\?\C:\WINDOWS\*"
% llength [glob "\\\\?\\C:\\WINDOWS\\*"]
no files matched glob pattern "\\?\C:\WINDOWS\*"
With additional slash:
% llength [glob {\\?\C:\WINDOWS\\*}]
112
% llength [glob "\\\\?\\C:\\WINDOWS\\\\*"]
112
(latest tcl 9.1 from repo on windows 10)
This behavior seems inconsistent.
| ||||
| User Comments: | ||||
oehhar added on 2026-05-29 08:43:22:
Bug confirmed. Great catch! Harald apnadkarni added on 2026-05-29 11:54:36:
That is not a UNC path. As far as I can see, UNC paths work correctly.
The Tcl does not really support the See bc7925fc50 for other cases. anonymous added on 2026-05-29 12:26:41:
Same behaviour on network path:
% llength [glob {\\srv\share\tmp\\*}]
132
% llength [glob {\\srv\share\tmp\*}]
no files matched glob pattern "\\srv\share\tmp\*"
I'm using native windows shares from windows domain
anonymous added on 2026-05-29 12:34:11:
Hmm, works great in the top directory
% llength [glob {\\srv\share\\*}]
31
% llength [glob {\\srv\share\*}]
31
apnadkarni added on 2026-05-29 13:12:28:
Indubitably a bug then :-) Also present in 8.6 apnadkarni added on 2026-05-31 04:40:03:
Reversing myself yet again, I think works as designed, confusing as it might be. When globbing a component like The confusing part is why the The filesystem component itself is not treated as a pattern. In the following:
The file system component is parsed as The reason top level wildcards as in The same issue arises with simple drive paths as well, only even more confusing :-) because of the potential for drive-relative paths. The path I'm not sure there is a satisfactory solution to all this due to the inherent ambiguities. All I can suggest is to use Tcl canonical (forward slash) patterns as far as possible. Above analysis is not authoritative :-) so leaving ticket open. oehhar added on 2026-05-31 16:18:59:
At least this is reasonable, thanks Ashok for looking into this. Perhaps we can add something to the documentation: Native Windows path ({C:\test}) may only be used for the -directory and -path options. The glob pattern argument should use the forward slash as separator for unique results. Background is the ambiguity of the backslash character, which may escape a glob character ("\*" to specify a literal "*" character). So, for "glob {C:\test\*}", it is not clear, if the last backslash is a path separator or an escaped glob character. Take care, Harald | ||||
