Support PATH-resolved commands in exec lines

Bug #1477286 reported by Michael Terry
6
This bug affects 1 person
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

Revision history for this message
Michael Terry (mterry) wrote :

(original idea by Ted)

Ted Gould (ted)
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
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.