Subject: goredo gets confused with relative paths and symlinks

From: Rafael Fourquet <[email-masked]>
Date: Thu, 23 Oct 2025 15:54:36 +0200

Hi, thanks for this clean and sane implementation of redo!

`redo` fails to see an executable do file when called from a directory
accessed through a symlink, and falls back to
calling `/bin/sh` on the do script, which is unfortunate when the
script depends on `bash` or other languages.

For example:
$ cd /tmp/goredo-test
$  tree -a
.
├── a
│   └── b
├── b -> a/b
├── .redo
│   ├── test1.dep
│   └── test1.lock
├── test1
└── test1.do

$ cat test1.do
#!/bin/bash

# a-b-c is not valid syntax for `/bin/sh`
function a-b-c () {
  echo 1
}

a-b-c

$ cd b; redo /tmp/goredo-test/test1
redo ../test1 ...
test1.do: line 5: `a-b-c': not a valid identifier
err  ../test1 (0.003s): exit status 2

So the problem is that from within `/tmp/goredo-test/b`, `../test1.do`
doesn't exist, and therefore makes goredo believe
it's not executable (in "Prepare command line" from run.go).

This simple change seems enough to fix the issue, but I don't know
whether if leads to other problems:
--- a/run.go
+++ b/run.go
@@ -375,7 +375,7 @@ func runScript(tgt *Tgt, errs chan error, forced,
traced bool) error {
        // Prepare command line
        var cmdName string
        var args []string
-       if err = unix.Access(doFile.rel, unix.X_OK); err == nil {
+       if err = unix.Access(doFile.a, unix.X_OK); err == nil {
                cmdName = doFile.a
                args = make([]string, 0, 3)
        } else {