Skip to content
Tcl Source Code Artifact [adfaa611e1]
Login

Artifact [adfaa611e1]

Artifact adfaa611e1058b35a5c80fae33fc0cc6a879aa725444bad22754789a590645fa:

Ticket change [adfaa611e1] - Ticket [4dc35e0c0cf24b4a|4dc35e0c0c] <i>auto_execok on windows not always using absolute path</i> status still Open with 3 other changes by juliannoble2 on 2025-01-26 16:33:16.
D 2025-01-26T16:33:16.403
J icomment Yes,\sI\sagree.\r\nI\sfirst\stried\smy\soverridden\sauto_execok\swith\ssome\sauto_resets\sadded\sto\savoid\scacheing\s-\sbut\sbroke\severything\sfor\sthe\sauto_load\sreason\syou\smentioned!\r\n\r\nThen\susing\sunset\s-nocomplain\s::auto_execs\s\sI'm\spretty\shappy\swith\sthe\sresult.\r\n\r\nI\shave\sabout\s90\sdirs\sin\smy\spath\s-\sso\sI\sget\sa\sperceivable\sdelay\sif\sI\sfat-finger\sa\scommand\sand\sit\sgoes\sout\sto\ssearch\sfor\sa\snon-existant\sone\s(~200ms)\s\r\n\r\nThis\sis\sno\sbig\sdeal\sfor\sthat\scase\s-\sand\salso\sno\sbig\sdeal\sfor\smy\scodebase\s-\swhere\sthere\sare\sa\sfew\splaces\sI\scan\smanually\scache\ssome\spaths\sas\syou\ssuggest.\r\n\r\nIt\sdoes\showever\sunmask\san\sissue,\swhich\sI\snow\srealise\sis\swhy\sI\swas\splaying\swith\sinit.tcl\sin\sthe\sfirst\splace\sback\sin\s'23\s\r\n\r\nThe\sauto_execok\ssearches\sforeach\sextension\sand\sthen\snests\sforeach\sdirectory\sin\sthe\spath\s-\sWhich\swould\smake\ssense\sif\sthe\sexpectation\sis\sthat\swhen\syou\stype\sfoobar\s-\syou\smust\stest\sall\spaths\sfor\sthat\sbefore\smatching\sthings\slike\sfoobar.exe\sor\sfoobar.bat,\sbut\sI\sdon't\s*think*\sthat's\sthe\sway\sthings\sshould\swork\son\swindows.\r\n\r\nIf\sI\shave\sa\spath\sset\sas\sa\shigh\sprecedence\s-\sI\sexpect\sit\sto\smatch\sthe\sfirst\sexecutable\swith\sthat\sbase\sin\sthe\searliest\spath\s-\snot\smatch\ssome\sexact\smatch\slater\sdown.\r\ne.g\sThis\shas\scaused\sme\ssome\sfrustrations\sin\sthe\spast\swith\sTcl\strying\sto\srun\svarious\sinappropriate\sthings\ssuch\sas\sa\sbash\sscript\snamed\scmd\s(provided\sby\smsys\sfor\ssome\sreason)\r\n\r\nWith\sthe\sauto_execok\scaching\sdisabled\s-\sit's\snow\smore\sapparent\sthat\sthis\sscanning\sthe\sentire\spath\slist\srepeatedly\sfor\seach\sextension\sin\sorder\sis\soccurring.\r\nAs\s.bat\sis\slater\sin\slist\sof\sextensions\s-\sthere\sis\sa\snoticable\sdelay\styping\ssomething\svs\ssomething.bat\r\n\r\nThe\sissue\swill\sbe\sworse\sif/when\sauto_exec\sis\supdated\sto\shandle\sother\sitems\scommonly\sin\sPATHEXT\ssuch\sas\s.RB\s.PY\s\r\nI\sthink\sit\swould\sbe\sreasonable\sfor\sauto_execok\sto\sdetermine\sthe\sright\sscript\sengine\sfor\sregistered\sextensions\sand\scall\sthem\s-\sbut\sperhaps\sthat's\sa\sbug/RFE\sfor\sanother\stime.\r\n(just\sreturning\s"<resolvedpath>/cmd.exe\s/c\s<name>"\sworks\sfor\sthese\sand\sthose\sobtuse\s'reparse\spoint'\sbased\swindows\sinstalls\s-\sbut\sperhaps\sthere's\sa\sbetter\sway)\r\n\r\nAt\sany\srate\s-\son\smy\ssystem,\swith\scaching\sdisabled\s-\sit's\snow\sgetting\snear\sone\ssecond\sto\s[auto_execok\ssomeuniquescriptname]\sif\sit's\ssomeuniquescriptname.py\r\n\r\nFrom\smy\sexperiments\swith\scmd.exe\sand\spowershell\sgiven\sa\snon-suffixed\scommand,\sthey\sboth\sgive\sprecedence\sto\sthe\spath\sorder\sfirst.\sie\sopposite\sof\sTcl's\scurrent\sslow\sauto_execok\smethod\sof\sscanning.\r\nI\sdon't\sknow\sif\sthis\swas\sdone\sdeliberately\sto\stry\sto\smatch\ssome\scross-platform\sbehaviour(?)\s-\sbut\sit\shas\salways\sviolated\smy\sexpections\son\swindows.\r\n\r\nBelow\sis\smy\stweak\sfor\sthe\ssearchorder\sin\sinit.tcl.\s\sIt\sseems\sto\sfix\sthe\sbug\sin\sthis\sticket,\simproves\sthe\suncached\sauto_execok\sspeed\sfor\sunsuffixed\scommands,\sand\sprovides\sa\sresult\smore\sinline\swith\show\swindows\scommandlines\sdo\sit.\s\r\n\r\n\r\n\s\s\s\sset\slookfor\s[lmap\sext\s$execExtensions\s{string\scat\s${name}\s${ext}}]\r\n\s\s\s\sforeach\sdir\s[split\s$path\s{;}]\s{\r\n\s\s\s\s\s\s\s\sset\sdir\s[file\snormalize\s$dir]\r\n\s\s\s\s\s\s\s\s#\sSkip\salready\schecked\sdirectories\r\n\s\s\s\s\s\s\s\sif\s{[info\sexists\schecked($dir)]\s||\s($dir\seq\s"")}\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\scontinue\r\n\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\sset\schecked($dir)\s{}\r\n\s\s\s\s\s\s\s\s\r\n\s\s\s\s\s\s\s\sforeach\smatch\s\s[glob\s-nocomplain\s-dir\s$dir\s-tail\s{*}$lookfor]\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\sset\sfile\s[file\sjoin\s$dir\s$match]\r\n\s\s\s\s\s\s\s\s\s\s\s\sif\s{[file\sexists\s$file]\s&&\s![file\sisdirectory\s$file]}\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn\s[set\sauto_execs($name)\s[list\s$file]]\r\n\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s}\r\n\s\s\s\s}\r\n\r\nVersus\sthe\soriginal:\r\n\r\n\s\s\s\s\s\s\sforeach\sext\s$execExtensions\s{\r\n\s\s\s\s\s\s\s\sunset\s-nocomplain\schecked\r\n\s\s\s\s\s\s\s\sforeach\sdir\s[split\s$path\s{;}]\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s#\sSkip\salready\schecked\sdirectories\r\n\s\s\s\s\s\s\s\s\s\s\s\sif\s{[info\sexists\schecked($dir)]\s||\s($dir\seq\s"")}\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\scontinue\r\n\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s\s\s\s\sset\schecked($dir)\s{}\r\n\s\s\s\s\s\s\s\s\s\s\s\sset\sfile\s[file\sjoin\s$dir\s${name}${ext}]\r\n\s\s\s\s\s\s\s\s\s\s\s\sif\s{[file\sexists\s$file]\s&&\s![file\sisdirectory\s$file]}\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn\s[set\sauto_execs($name)\s[list\s$file]]\r\n\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s}
J login juliannoble2
J mimetype text/plain
K 4dc35e0c0cf24b4a997556b70396d998ebb6adfe
U juliannoble2
Z b39698c46b40b8d3d2b07445a80c4db3