Overview
| Artifact ID: | 9ffd549a8370742adb7aa989c6cf40f41f367bdb9eebc76a8450cf4735b93d1f |
|---|---|
| Ticket: | e860418c2d20c7bf93f751b9d56dd2644440a45a
glob -dir $dir -tail returns name with leading / if $dir ends in a / |
| User & Date: | apnadkarni on 2026-05-21 06:58:31 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-markdown"
- comment changed to:
Originally reported by @JulianNoble in the discussion in unrelated issue [596936dd2d](https://core.tcl-lang.org/tcl/tktview/596936dd) ``` 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 ``` - foundin changed to: "8.6"
- is_private changed to: "0"
- login: "apnadkarni"
- priority changed to: "5 Medium"
- private_contact changed to: "9546e9877f1a8899e25a89082561ee694e7fb402"
- resolution changed to: "None"
- severity changed to: "Important"
- status changed to: "Open"
- submitter changed to: "apnadkarni"
- subsystem changed to: "- New Builtin Commands"
- title changed to:
glob -dir $dir -tail returns name with leading / if $dir ends in a /
- type changed to: "Bug"