Support PATH-resolved commands in exec lines
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
Fix Released
|
High
|
Ted Gould |
Bug Description
Let's say I am making a snap with an ubuntu package built into it. Let's say 'wget'.
As I make my package.yaml, I may naively use the exec line 'wget' instead of 'usr/bin/wget' because I'm unfamiliar with the appropriate syntax of package.yaml or I don't happen to know where snapcraft put the wget executable after I asked it to include it.
As a nice piece of magic, I think snapcraft could figure out what happened and help the user.
Right now, we wrap all the exec lines with .wrapper files (like wget.wrapper). In this case, we could do something like:
1) is the command a single path fragment (i.e. no slashes)?
2) does the command not exist in the toplevel (i.e. is it not actually a relative path)?
3) given the PATH= variables that our plugins have given us, does that command exist in any of them?
We could now assume that it is a mistake by the user, and help them out. When we make our .wrapper file, we can put it next to the real command that the user meant, and replace the exec line with the actual relative path.
Very magic, but harmless, I think. Maybe could emit a warning about it too.
Related branches
- Michael Terry (community): Approve
- Leo Arias (community): Needs Fixing
-
Diff: 30 lines (+17/-1)1 file modifiedsnapcraft/cmds.py (+17/-1)
Changed in snapcraft: | |
status: | New → In Progress |
importance: | Undecided → High |
assignee: | nobody → Ted Gould (ted) |
Changed in snapcraft: | |
status: | In Progress → Fix Committed |
Changed in snapcraft: | |
status: | Fix Committed → Fix Released |
(original idea by Ted)