@@ -332,6 +332,22 @@ parts:
332
332
MACH="/usr/bin/python3 ./mach"
333
333
$MACH configure --prefix=$SNAPCRAFT_PART_INSTALL/usr
334
334
$MACH uniffi generate # workaround for https://bugzilla.mozilla.org/1797714
335
+ # Unset SNAP_INSTANCE_NAME because when snapcraft runs as a snap it is set
336
+ # (and its value is "snapcraft"), and this interferes with firefox's
337
+ # detection of whether it's running sandboxed (see
338
+ # https://searchfox.org/mozilla-central/search?q=IsRunningUnderSnap()).
339
+ # That codes is compiled in the xpcshell binary that's used to generate
340
+ # files at build time, and the environment it runs in prevents it from
341
+ # locating services it needs, causing a crash (see
342
+ # https://searchfox.org/mozilla-central/rev/aa329cf7506ddd966542e642ec00223fd7461599/xpcom/io/SpecialSystemDirectory.cpp#196).
343
+ # This is a temporary workaround to get builds going again, we really need
344
+ # to get to the bottom of this and understand why xpcshell cannot find the
345
+ # appinfo service when run in the build environment.
346
+ # Unsetting SNAP_INSTANCE_NAME has the undesirable side-effect that when
347
+ # generating a profile for PGO-enabled builds, a potentially different
348
+ # code path will be exercised (not confined as a snap), so that's not a
349
+ # good solution.
350
+ unset SNAP_INSTANCE_NAME
335
351
if [ $SNAPCRAFT_TARGET_ARCH = "amd64" ]; then
336
352
# xvfb is only needed when doing a PGO-enabled build
337
353
xvfb-run '--server-args=-screen 0 1920x1080x24' $MACH build -j$SNAPCRAFT_PARALLEL_BUILD_COUNT
0 commit comments