From 524221e503f1a8526f78d9143b946026ec73341b Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Fri, 19 Apr 2024 19:45:08 +0100 Subject: [PATCH] pv-wrap: Don't enable snapd workarounds by default Since snapd 2.62, we do not need any special workarounds, and since https://github.com/canonical/steam-snap/pull/367 Canonical's Steam snap app has required snapd 2.62. This change is in the stable channel as of 2024-04-25, which means that the Steam snap app will refuse to install onto systems with an older snapd until the snapd has been upgraded. For now, disable the workarounds by default but keep them implemented. After we have a beta -> stable cycle without incident, we can delete their implementations. Signed-off-by: Simon McVittie <smcv@collabora.com> --- pressure-vessel/runtime.c | 2 +- pressure-vessel/utils.c | 3 +++ pressure-vessel/utils.h | 5 +++-- tests/pressure-vessel/utils.c | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pressure-vessel/runtime.c b/pressure-vessel/runtime.c index 766862149..87e61009b 100644 --- a/pressure-vessel/runtime.c +++ b/pressure-vessel/runtime.c @@ -260,7 +260,7 @@ pv_runtime_path_belongs_in_interpreter_root (PvRuntime *self, return TRUE; } - /* Special case: when running under Snap we have to use + /* Special case: when running under older Snap we have to use * /run/pressure-vessel/ldso because /var/pressure-vessel/ldso isn't * allowed. We don't expect to be running FEX-Emu under Snap, * so it doesn't matter that this would break FEX-Emu. */ diff --git a/pressure-vessel/utils.c b/pressure-vessel/utils.c index 021aa7c07..85025c32b 100644 --- a/pressure-vessel/utils.c +++ b/pressure-vessel/utils.c @@ -134,10 +134,13 @@ pv_get_workarounds (SrtBwrapFlags bwrap_flags, if (bwrap_flags & SRT_BWRAP_FLAGS_SETUID) flags |= PV_WORKAROUND_FLAGS_BWRAP_SETUID; + /* Reinstate this if workarounds for snapd need to be used by default */ +#if 0 if (_srt_environ_getenv (envp, "SNAP") != NULL && _srt_environ_getenv (envp, "SNAP_NAME") != NULL && _srt_environ_getenv (envp, "SNAP_REVISION") != NULL) flags |= PV_WORKAROUND_FLAGS_SNAP; +#endif if (value != NULL) { diff --git a/pressure-vessel/utils.h b/pressure-vessel/utils.h index 3a3a0664a..61c01b3fb 100644 --- a/pressure-vessel/utils.h +++ b/pressure-vessel/utils.h @@ -50,7 +50,8 @@ typedef enum PV_WORKAROUND_FLAGS_NONE = 0 } PvWorkaroundFlags; -#define PV_WORKAROUND_FLAGS_SNAP \ +/* Workarounds for old snapd bugs, no longer used by default */ +#define PV_WORKAROUND_FLAGS_OLD_SNAP \ (PV_WORKAROUND_FLAGS_STEAMSNAP_356 \ | PV_WORKAROUND_FLAGS_STEAMSNAP_359 \ | PV_WORKAROUND_FLAGS_STEAMSNAP_369 \ @@ -59,7 +60,7 @@ typedef enum #define PV_WORKAROUND_FLAGS_ALL \ (PV_WORKAROUND_FLAGS_BWRAP_NO_PERMS \ | PV_WORKAROUND_FLAGS_BWRAP_SETUID \ - | PV_WORKAROUND_FLAGS_SNAP) + | PV_WORKAROUND_FLAGS_OLD_SNAP) PvWorkaroundFlags pv_get_workarounds (SrtBwrapFlags bwrap_flags, const char * const *envp); diff --git a/tests/pressure-vessel/utils.c b/tests/pressure-vessel/utils.c index 8d01c2d7f..aae69b396 100644 --- a/tests/pressure-vessel/utils.c +++ b/tests/pressure-vessel/utils.c @@ -726,7 +726,7 @@ test_workarounds (Fixture *f, g_assert_cmpint (pv_get_workarounds (SRT_BWRAP_FLAGS_HAS_PERMS, all_env), ==, PV_WORKAROUND_FLAGS_ALL); g_assert_cmpint (pv_get_workarounds (SRT_BWRAP_FLAGS_HAS_PERMS, snap_env), - ==, PV_WORKAROUND_FLAGS_SNAP); + ==, PV_WORKAROUND_FLAGS_NONE); g_assert_cmpint (pv_get_workarounds (SRT_BWRAP_FLAGS_HAS_PERMS, config_env), ==, (PV_WORKAROUND_FLAGS_BWRAP_NO_PERMS | PV_WORKAROUND_FLAGS_STEAMSNAP_356)); -- GitLab