check that a substituted program is executable?
User request:
I wonder if resholved should check that a substituted program is executable
I'm not sure if there are gotchas here, but this seems like a good improvement.
I guess one gotcha is: a non-executable script could still be sourced, or invoked as an argument to an interpreter. It may not be marked as executable because it's supposed to be sourced (and may cause some trouble if invoked directly?)
In that light, a simple global check won't work (at least, not without quickly ending up on a treadmill of new options for controlling when it blocks and not...).
I'm not sure if it'll be simple enough to justify, but context-sensitive resolution rules might support something like:
- check command first-words
- don't check 2nd args to
.orsource - don't check nth args to bash or some other shell