Overview
| Artifact ID: | 67b317145ec6f3ebcd6204e2b67c1490ec4fc332e814dbade7011c346c159273 |
|---|---|
| Ticket: | e5c21e566ff31a51f85bf12e0b5031993a3c4b4a
inconsistent handling of glob -nocomplain |
| User & Date: | sebres on 2025-08-13 17:02:18 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
It looks that on certain circumstances glob -nocomplain may complain about "no such file or directory". Still worse for Tcl 9, because since TIP#637 -glob always works as "nocomplain" now. Normally, following code would return an empty list if the directory doesn't exist: <code><pre> % glob -nocomplain -directory {/path/that/does/not/exist} *.ext ~empty~ </pre></code> However sometimes (depending on file-system/platform/whatever) it may fail... for instance this happens by some of my customer on some SMB-share on Windows: <code><pre> % glob -nocomplain -directory {//server/smb-share/no-such-path} *.ext couldn't read directory "//server/smb-share/no-such-path/*.ext": no such file or directory </pre></code> I cannot reproduce it directly in this constellation on my boxes, but I guess I found it in source code, and was able to reproduce another similar "inconsistence" (e. g. if there is no access to directory): <code><pre> % glob -nocomplain -directory {/path-without-permissions} *.ext couldn't read directory "/path-without-permissions/*.ext": permission denied % glob -nocomplain -directory {/path-without-permissions/.} *.ext ~empty~ % glob -nocomplain -directory {/path-without-permissions/other} *.ext ~empty~ </pre></code> The reason seems to be that neither DoGlob nor Tcl_FSMatchInDirectory know TCL_GLOBMODE_NO_COMPLAIN flag, or rather trying to distinguish the error codes internally, so by the error they'd simply set it to the interpreter and return with TCL_ERROR. I'm pretty sure that from point of view of not complaining glob, both codes, ENOENT and EACCES, shall be considered as no hits, and glob has to return empty list without to complain the error, no matter how deep exactly it was caused. - foundin changed to: "any"
- is_private changed to: "0"
- login: "sebres"
- priority changed to: "5 Medium"
- private_contact changed to: "50e9528765c18296566374b3fde2df942c394efd"
- resolution changed to: "None"
- severity changed to: "Severe"
- status changed to: "Open"
- submitter changed to: "sebres"
- subsystem changed to: "37. File System"
- title changed to: "inconsistent handling of glob -nocomplain"
- type changed to: "Bug"