Subject: Arguments to redo-if*

From: goredo <[email-masked]>
Date: Sun, 1 Oct 2023 14:15:37 +0200 (GMT+02:00)

Hello!

I have noticed an issue with redo-ifchange and redo-ifcreate which is hard to work with.

I am building a generalised toolchain based on redo, which provides a framework for which the actual project is not yet known. It provides many redo targets which take dependencies as user input. There, I noticed the following discrepancy between goredo and apenwarr redo: I cannot, in general avoid that a user might provide, ever in error, a dependency that starts with a dash. In apenwarr redo, redo-if* commands don't take any options but take the whole argument list as targets. goredo chokes on those arguments trying to interpret them as options. Now the issue: apenwarr redo-if* commands also don't treat a double dash argument specially (which you can use to end the option list). It treats it as a target name and chokes on it. So, for me, building this toolchain, it's impossible to secure my calls to redo-if* properly, because I would have to know whether the user uses goredo or apenwarr redo.

My suggestion is to either get rid of arguments to redo-if* commands entirely or to let them check whether they are executed in a running redo chain, e.g. by existence of certain environment variables, and ignore any options and treat them as targets.

In my understanding, the contract always was: Any target name is allowed unless it contains a newline character. So this includes targets that look like command line options. And it is certainly helpful when building general toolchains with redo, when the primary internal commands redo-if* allow for maximum freedom in their arguments.

Kind regards,
–Michael