-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function argument substitution failed #109
Comments
Not really a bug, per se, but it is something resholve can't handle yet--so it's fine to have an open issue about it.
If I were resolving this script, I'd probably just patch out the definition and invocations of this function (it's just there to sanity check something we should be able to ~guarantee, and cutting it also enables you to drop the I'd like to have a system where you can work around cases like this by telling resholve that the function has executable arguments, but then you also need the ability to tell resholve which arguments are executable. My first swing at the latter wasn't really usable. resholve uses argparse parsers to do the same work for fairly common commands, but there isn't yet a pluggable mechanism that would let you tack on your own. I don't have time just now, but I'll try to follow up later with some notes on actually resolving these for posterity. |
Shell is too dynamic for a 100% solution to be feasible, so resholve generally aims to grow towards something like a 80-90%ish sort of solution. This class of resolution basically requires resholve to see through a dynamic execution to understand that it in turn executes something else that would accept an executable as its argument. This is thematically in-scope; I've already taken steps towards doing that semi-reliably with well-known external executables that exec their arguments. Your specific example of this class is simple and only requires one level of resolution, but the broader class of problem has to wrestle with some thorny questions since all of shell's behavior is technically fair game. Here are some example functions staking out a few quick edge cases: run_all(){
"$@"
}
run_one(){
"$1"
}
run_with_options(){
case "$1" in
echo)
shift
echo "running command: $@"
"$@"
;;
log)
shift
"$@" > logfile
;;
*)
"$@"
;;
} And then some invocations of those:
A robust solution to this will probably be out of reach for a while. Biting off the simplest cases may be tractable, but part of the trick there is being able to separate simple and complex cases. |
Trying to resholve this script.
jq
andnotify-send
are not substituted inhas
function call, leading to script failure (jq/notify-send are not found obviously). Tried to usefix
but it does nothing. Currently usingkeep
andreplaceStrings
as a fallback, but it's quite hacky. Is this a bug?Invalid output
The text was updated successfully, but these errors were encountered: