Merge pull request #215837 from K900/fhsenv-x11-socket-permissions

buildFHSUserEnv: fix permissions on /tmp/.X11-unix
This commit is contained in:
K900 2023-02-16 12:25:04 +03:00 committed by GitHub
commit 31b278c0a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -137,6 +137,18 @@ let
fi
done
declare -a x11_args
# Always mount a tmpfs on /tmp/.X11-unix
# Rationale: https://github.com/flatpak/flatpak/blob/be2de97e862e5ca223da40a895e54e7bf24dbfb9/common/flatpak-run.c#L277
x11_args+=(--tmpfs /tmp/.X11-unix)
# Try to guess X socket path. This doesn't cover _everything_, but it covers some things.
if [[ "$DISPLAY" == :* ]]; then
display_nr=''${DISPLAY#?}
local_socket=/tmp/.X11-unix/X$display_nr
x11_args+=(--ro-bind-try "$local_socket" "$local_socket")
fi
cmd=(
${bubblewrap}/bin/bwrap
--dev-bind /dev /dev
@ -171,6 +183,7 @@ let
"''${ro_mounts[@]}"
"''${symlinks[@]}"
"''${auto_mounts[@]}"
"''${x11_args[@]}"
${concatStringsSep "\n " extraBwrapArgs}
${init runScript}/bin/${name}-init ${initArgs}
)