|
2026-05-25
| ||
| 11:01 | • Closed ticket [e860418c2d]: glob -dir $dir -tail returns name with leading / if ... artifact: 867a2379f6 user: apnadkarni | |
| 10:59 | Merge 9.0 Fix [e860418c] Windows: glob -dir $dir -tail returns name with leading / check-in: 6c72917060 user: apnadkarni tags: trunk, main | |
| 10:45 | Fix [e860418c] Windows: glob -dir $dir -tail returns name with leading / check-in: 9f84d3ca4d user: apnadkarni tags: core-9-0-branch | |
|
2026-05-24
| ||
| 11:19 | • Ticket [e860418c2d] glob -dir $dir -tail returns name with leading / if $dir end... artifact: 282f0831dc user: apnadkarni | |
| 09:13 | • Ticket [e860418c2d]: 4 changes artifact: 24e277f1ea user: apnadkarni | |
|
2026-05-21
| ||
| 06:58 | • New ticket [e860418c2d]. artifact: 9ffd549a83 user: apnadkarni | |
glob -dir $dir -tail returns name with leading / if $dir ends in a /
Closed / Fixede860418c2d20c7bf93f751b9d56dd2644440a45aCreated 196 days agoUpdated 191 days ago
Descriptionmarkdown2026-05-21 06:58:31
Originally reported by @JulianNoble in the discussion in unrelated issue 596936dd2d
When you do a glob -dir $dir -tail on a dir ending in a slash - it can return /name instead of just name
Then the file join fails to work as it takes the name as an absolute path and doesn't add the dir.
#with trailing slash in path
% set path {C:\Program Files\PowerShell\7}
C:\Program Files\PowerShell\7
% tcl::unsupported::representation $path
value is a pure string with a refcount of 4, object pointer at 0x1ea036f3270, string representation "C:\Program Fi..."
% append path \\
C:\Program Files\PowerShell\7\
% tcl::unsupported::representation $path
value is a utf32string with a refcount of 2, object pointer at 0x1ea036ef2e0, internal representation 0x1ea038c70b0:0x0, string representation "C:\Program Fi..."
% glob -dir $path -tail pwsh.exe
/pwsh.exe
#without trailing slash
% set path {C:\Program Files\PowerShell\7}
C:\Program Files\PowerShell\7
% tcl::unsupported::representation $path
value is a pure string with a refcount of 5, object pointer at 0x1ea036f3270, string representation "C:\Program Fi..."
% glob -dir $path -tail pwsh.exe
pwsh.exe
Whether or not a trailing slash should strictly exist at the end of a path - I believe it to be fairly common on windows (some installers do it) and it should work.
Tcl8.5 on the other hand does it correctly:
% glob -dir "c:\\" -tail windows-version.txt
windows-version.txt
versus testing in 8.6, 8.7, 9.0
% glob -dir "c:\\" -tail windows-version.txt
/windows-version.txt
apnadkarnimarkdown2026-05-24 09:13:24
Forward slashes seem to work fine.
% glob -dir c:/ -tail windows
windows
And without -tail output seem ok but weird, unnecessary escaping.
% glob -dir c:\\ windows
{c:\/windows}
apnadkarnimarkdown2026-05-24 11:19:56
And my second example, which I thought was cosmetic, is also a bug (double escapes).
Proposed fix for both in bug-e860418c branch.
apnadkarniplain2026-05-25 11:01:34
Fixed in [9f84d3ca4d] for 9.0.4 onward.
Log in (anonymous is fine) to add a comment.