Skip to content
Tcl Source Code View Ticket
Login

View Ticket

auto_execok can return relative path names

Closed / Fixed1244733fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 199 days ago
Descriptionplain2005-07-25 19:33:25
auto_execok can return relative path names.

On Windows, "." is one of the standard search
directories.  And on Unix, empty directories in the
path are treated as ".".  In these cases, [file
executable] is successful, and auto_execok returns
something like "./myfile"

It works fine until your application changes working
directory.  Then relative path names are broken.

Perhaps auto_execok should use [file normalize] before
returning.
dgpplain2005-11-02 01:57:39
Logged In: YES 
user_id=80530


Since the purpose of [auto_execok]
is to return something suitable for
passing to [exec], applying [file normalize]
to the return value can only make things
more robust.   So, I think this is a good idea.

One wrinkle in the plan is that [file normalize]
isn't present in safe interps.

Another issue is that freewrap seems to
have issues with [file normalize] (see 1072136)

if someone can resolve those issues, we
can move forward with this.
apnadkarniplain2026-05-18 10:28:52
Fixed for 9.1 in TIP 753 commit [de961e8d](https://core.tcl-lang.org/tcl/info/de961e8dee5470e6).

Paths are not cached - see the TIP and discussion. Tested in `auto_execok-win-6.1`.
Log in (anonymous is fine) to add a comment.