<i>glob -dir $dir -tail returns name with leading / if $dir ends in a /</i>.
by
.
D 2026-05-21T06:58:31.850
J assignee nobody
J closer nobody
J cmimetype text/x-markdown
J comment Originally\sreported\sby\s@JulianNoble\sin\sthe\sdiscussion\sin\sunrelated\sissue\s[596936dd2d](https://core.tcl-lang.org/tcl/tktview/596936dd)\r\n\r\n```\r\nWhen\syou\sdo\sa\sglob\s-dir\s$dir\s-tail\son\sa\sdir\sending\sin\sa\sslash\s-\sit\scan\sreturn\s/name\sinstead\sof\sjust\sname\s\r\n\r\nThen\sthe\sfile\sjoin\sfails\sto\swork\sas\sit\stakes\sthe\sname\sas\san\sabsolute\spath\sand\sdoesn't\sadd\sthe\sdir.\r\n\r\n\s#with\strailing\sslash\sin\spath\r\n\s%\sset\spath\s{C:\\Program\sFiles\\PowerShell\\7}\r\n\sC:\\Program\sFiles\\PowerShell\\7\r\n\s%\stcl::unsupported::representation\s$path\r\n\svalue\sis\sa\spure\sstring\swith\sa\srefcount\sof\s4,\sobject\spointer\sat\s0x1ea036f3270,\sstring\srepresentation\s"C:\\Program\sFi..."\r\n\s%\sappend\spath\s\\\\\r\n\sC:\\Program\sFiles\\PowerShell\\7\\\r\n\s%\stcl::unsupported::representation\s$path\r\nvalue\sis\sa\sutf32string\swith\sa\srefcount\sof\s2,\sobject\spointer\sat\s0x1ea036ef2e0,\sinternal\srepresentation\s0x1ea038c70b0:0x0,\sstring\srepresentation\s"C:\\Program\sFi..."\r\n\s%\sglob\s-dir\s$path\s-tail\spwsh.exe\r\n\s/pwsh.exe\r\n\r\n\r\n\s\r\n\s#without\strailing\sslash\s\r\n\s%\sset\spath\s{C:\\Program\sFiles\\PowerShell\\7}\r\n\sC:\\Program\sFiles\\PowerShell\\7\r\n\s%\stcl::unsupported::representation\s$path\r\nvalue\sis\sa\spure\sstring\swith\sa\srefcount\sof\s5,\sobject\spointer\sat\s0x1ea036f3270,\sstring\srepresentation\s"C:\\Program\sFi..."\r\n\s%\sglob\s-dir\s$path\s-tail\spwsh.exe\r\n\spwsh.exe\r\n\r\n\r\nWhether\sor\snot\sa\strailing\sslash\sshould\sstrictly\sexist\sat\sthe\send\sof\sa\spath\s-\sI\sbelieve\sit\sto\sbe\sfairly\scommon\son\swindows\s(some\sinstallers\sdo\sit)\sand\sit\sshould\swork.\r\n\r\nTcl8.5\son\sthe\sother\shand\sdoes\sit\scorrectly:\r\n\r\n%\sglob\s-dir\s"c:\\\\"\s-tail\swindows-version.txt\r\nwindows-version.txt\r\n\r\nversus\stesting\sin\s8.6,\s8.7,\s9.0\r\n%\sglob\s-dir\s"c:\\\\"\s-tail\swindows-version.txt\r\n/windows-version.txt\r\n```
J foundin 8.6
J is_private 0
J login apnadkarni
J priority 5\sMedium
J private_contact 9546e9877f1a8899e25a89082561ee694e7fb402
J resolution None
J severity Important
J status Open
J submitter apnadkarni
J subsystem -\sNew\sBuiltin\sCommands
J title glob\s-dir\s$dir\s-tail\sreturns\sname\swith\sleading\s/\sif\s$dir\sends\sin\sa\s/
J type Bug
K e860418c2d20c7bf93f751b9d56dd2644440a45a
U apnadkarni
Z b7647dab2ec20a74dd95b592696992e6