Overview
| Artifact ID: | 9f1078d473104bac57fe5e90f1032f587213ade7a037cc49287a113a86c32b1b |
|---|---|
| Ticket: | 4dc35e0c0cf24b4a997556b70396d998ebb6adfe
auto_execok on windows not always using absolute path |
| User & Date: | apnadkarni on 2025-01-26 10:23:54 |
Changes
- icomment:
Nevertheless, I believe this `auto_exec` behavior is worth revisiting though I'm not certain of what the right behavior should be. At the very least I do not think it should cache results. What you report is one result of the cache. The other is the usual problem with caches - picking up stale results or results inconsistent with PATH. For example, (cmd prompts removed for clarity) ``` % writeFile c:/bin/x.bat "echo %~dp0" % {*}[auto_execok x] C:\Bin\ % writeFile ./x.bat "echo %~dp0" % {*}[auto_execok x] C:\Bin\ % exec ./x.bat D:\src\ ``` The second `auto_execok` still runs the C:\bin version of x.bat instead of the one in the current directory. This is wrong imo. The same would also happen even if both files already existed but CWD was changed. The `auto_reset` solution is not satisfactory because one does not always know when it will be needed. It also has the side effect on `auto_load`. Removal of the cache has a performance cost. However, aside from correctness being more important, I suspect this is negligible compared to the cost of creating a new process anyways. Applications where it matters can cache it for themselves. - login: "apnadkarni"
- mimetype: "text/x-markdown"