fetch-snaps --channel parameter does not support track/channel syntax for "latest/*"

Bug #1978698 reported by Kyler Hornor
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snap Store Server
New
Undecided
Unassigned

Bug Description

Expectation:

While declaring --channel=latest/stable is redundant, declaring the latest track should still fetch the content as expected. [potentially] If no revisions are downloaded, an error should indicate this to the user so the empty archive isn't pushed to the offline environment.

Behavior:

Declaring the latest track in a fetch-snaps run instead fetches a nearly empty archive, only containing the channel-map.json and the meta.json file. This can be confusing to end-users, as `snap info $name` prepends the latest track to the channel names.

Example:

Below we use jq as a test snap. Note that it doesn't grab any revisions in the test where the latest track is declared.

ubuntu@focal:~$ sudo snap-store-proxy fetch-snaps jq --channel=latest/stable --arch=amd64
Fetching channel map info for jq
Downloaded jq to /var/snap/snap-store-proxy/common/downloads/jq-20220614T144528.tar.gz

ubuntu@focal:~$ sudo snap-store-proxy fetch-snaps jq --channel=stable --arch=amd64
Fetching channel map info for jq
Fetching revision 6 for jq
Downloaded jq to /var/snap/snap-store-proxy/common/downloads/jq-20220614T144534.tar.gz

Revision history for this message
Kyler Hornor (kylerhornor) wrote :

Its worth noting that this is only an issue with the latest track. `snap-store-proxy fetch-snaps powershell --arch=amd64 --channel=lts/stable` works as expected. The issue isn't with using track/channel as a whole, but rather solely with directly declaring the latest track.

Revision history for this message
Kyler Hornor (kylerhornor) wrote :

I think I see the `issue`. get_fetch_urls() in fetch.py tries to build the fetch using the channel name passed down from cli.py. The channel-map.json does not prepend `latest/` to the names of the default tracks, so the raw match here fails. Could just add a simple check/trim if that is appropriate.

This seems to be accommodated for in snapd (or maybe it doesn't use the channel map at all?), but not in snap-store-proxy.

Revision history for this message
Przemysław Suliga (suligap) wrote :

Confirmed. Thanks for the report! We also have an internal bug for tracking this issue.

Note that for fetching snaps for import to an offline store the store-admin snap can be used as well (and it does not have this issue), eg.:

    store-admin export snaps jq bare --channel latest/stable --channel edge --arch amd64 --arch arm64

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.