-
Notifications
You must be signed in to change notification settings - Fork 574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: show that snap from snapd deb can be bundled #14551
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,30 @@ | ||||||
summary: snaps bundling /bin/snap from snapd.deb can do so | ||||||
|
||||||
details: | | ||||||
The snap binary may be embedded in a snap for as long as the bases match. | ||||||
The snap binary may be called with LD_PRELOAD=, or other dynamic linker | ||||||
environment variables without ill effects. | ||||||
|
||||||
Note that this contract does *not* extend to the snap binary from the snapd | ||||||
snap. That version cannot be embedded in snap applications. | ||||||
|
||||||
systems: | ||||||
# This test runs only on systems that are ABI-matching the core24 snap. This | ||||||
# test could be extended to include more bases later. This test cannot run | ||||||
# on ubuntu core, because /usr/bin/snap is the "snapd snap" version which is | ||||||
# linked differently. | ||||||
- ubuntu-24.04-64 | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra space |
||||||
|
||||||
prepare: | | ||||||
cp "$(command -v snap)" test-snapd-sh-core24/bin | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this could also copy the snap command the snapd snap and show that it fails to run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes but then the test name would need to be different. I also don't know what that specific test would show. On some systems (without apparmor) it would actually work because it would load the dynamic linker from /snap/snapd/current There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is running only on ubuntu-24.04, which means that if you copy a snap binary from the snap it will fail (or at least should), which is the exact scenario folks should not be doing. i.e. copying stuff from the snapd snap into their snaps. |
||||||
snap pack test-snapd-sh-core24 | ||||||
snap install --dangerous ./test-snapd-sh-core24_1.0_all.snap | ||||||
|
||||||
execute: | | ||||||
# We are pre-loading libz simply because it's small and easy to get. The | ||||||
# point is to show, that the copied snap executable does not crash in this | ||||||
# configuration. | ||||||
# | ||||||
# shellcheck disable=SC2016 | ||||||
test-snapd-sh-core24.sh -c 'LD_PRELOAD=/lib/x86_64-linux-gnu/libz.so "$SNAP"/bin/snap' | MATCH 'Usage: snap <command> \[<options>...\]' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure LD_PRELOAD is making any difference here if it's loading a library from base which matches the running system. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the whole point. It's supposed to show you can do it in a very specific way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's nothing specific about it. We almost guarantee that taking a binary from 24.04 it keeps working when executed in a snap that uses core24, preload or not. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
PS1='$ ' | ||
exec /bin/sh "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: test-snapd-sh-core24 | ||
version: 1.0 | ||
architectures: ["all"] | ||
base: core24 | ||
apps: | ||
sh: | ||
command: bin/sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Summary should start with capital, and preferable end with '.'