public inbox for goredo-devel@lists.stargrave.org
Atom feed
* goredo gets confused with relative paths and symlinks
@ 2025-10-23 13:54 Rafael Fourquet
  2025-10-23 14:10 ` goredo
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Rafael Fourquet @ 2025-10-23 13:54 UTC (permalink / raw)
  To: goredo-devel

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 {

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-10-26 14:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-23 13:54 goredo gets confused with relative paths and symlinks Rafael Fourquet
2025-10-23 14:10 ` goredo
2025-10-23 14:58   ` Rafael Fourquet
2025-10-24 12:12     ` Sergey Matveev
2025-10-24 13:45       ` Rafael Fourquet
2025-10-24 13:59         ` Sergey Matveev
2025-10-24 12:03 ` Sergey Matveev
2025-10-26 14:34 ` Sergey Matveev