snap <directory> is error prone

Bug #1583204 reported by Gustavo Niemeyer
This bug report is a duplicate of:  Bug #1707095: snap-dir command doesn't exist. Edit Remove
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Snapcraft
Triaged
Wishlist
Sergio Schvezov

Bug Description

Having "cd $dir; snapcraft snap" and "snapcraft snap $dir" behaving completely different and producing completely different results is extremely error prone. The latter should be a command of its on. Something like "snapcraft snap-content $dir".

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

I am in favor of this fwiw. I would really like to decouple things that belong more to the life cycle and things that are more of an out of band thing.

Take as another example the upload command (should a snap built with the snap command be uploaded without specifying a file? I think it should as we will know if it is indeed the snap you want to upload).

That said, I am not so sure we can change this and kill `snapcraft snap <dir>` as it would break our existing users and API (the cli API that is).
We can implement it and add a deprecation message to the former one though.

Changed in snapcraft:
status: New → Incomplete
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

I am marking as incomplete just to see where we prefer to go here.

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

We can do a few things to prevent any major issues while fixing behavior:

1. Obsolete the behavior first rather than killing altogether

2. Detect the intention of the user by having a quick look inside the directory at hand and checking if a $DIR/meta/snap.yaml is there. If there's no such file, this is definitely not supposed to be packed as-is.

3. Show a bit fat warning when people use it with the old command expecting the wrong semantics. It can still work, but we should warn loudly and point them towards the new command.

Revision history for this message
Oliver Grawert (ogra) wrote :

whatever gets decided, please let me know *before* it lands, the live-build scripts currently use
"snapcraft snap $dir" for os and kernel snaps, so if the command name changes the scripts need adjustment.

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

With the proposal above, your scripts would not break.

Changed in snapcraft:
status: Incomplete → Triaged
importance: Undecided → Wishlist
assignee: nobody → Sergio Schvezov (sergiusens)
milestone: none → 2.11
Changed in snapcraft:
milestone: 2.12 → 2.13
Changed in snapcraft:
milestone: 2.13 → 2.14
Changed in snapcraft:
milestone: 2.13 → none
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

I just ran into this odd inconsistency, any plan to fix?
Comment #3 item 2 would easily resolve it

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.