summaryrefslogtreecommitdiff
path: root/x11/xinit/files/patch-startx.in
diff options
context:
space:
mode:
Diffstat (limited to 'x11/xinit/files/patch-startx.in')
-rw-r--r--x11/xinit/files/patch-startx.in50
1 files changed, 50 insertions, 0 deletions
diff --git a/x11/xinit/files/patch-startx.in b/x11/xinit/files/patch-startx.in
new file mode 100644
index 000000000000..3ad43142b845
--- /dev/null
+++ b/x11/xinit/files/patch-startx.in
@@ -0,0 +1,50 @@
+# remove expr GNUisms: use BRE syntax and remove match, based on
+# upstream commit e3bab0cc706880c22f2b205e7abad9d8c0227071, but
+# also shield expr from leading dash of X server args.
+#
+# generate displayname as dictated in the xauth manpage
+#
+--- startx.in.orig 2025-03-09 20:44:26 UTC
++++ startx.in
+@@ -179,7 +179,7 @@ while [ "$1" != "" ]; do
+ else
+ # display must be the FIRST server argument
+ if [ "$serverargs" = "" ] && \
+- expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
++ expr \( "$1" \) : ':[0-9][0-9]*$' > /dev/null 2>&1; then
+ display="$1"
+ else
+ serverargs="$serverargs $1"
+@@ -242,7 +242,7 @@ for i in $serverargs; do
+ # if no vt is specified add vtarg (which may be empty)
+ have_vtarg="no"
+ for i in $serverargs; do
+- if expr "$i" : 'vt[0-9][0-9]*$' > /dev/null; then
++ if expr \( "$i" \) : 'vt[0-9][0-9]*$' > /dev/null; then
+ have_vtarg="yes"
+ fi
+ done
+@@ -271,9 +271,9 @@ if [ "$enable_xauth" = 1 ] ; then
+ mcookie=$($mk_cookie)
+ else
+ if [ -r /dev/urandom ]; then
+- mcookie=$(dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \"%08x\")
++ mcookie=$(dd if=/dev/urandom bs=16 count=1 2>/dev/null | /usr/bin/hexdump -e \"%08x\")
+ else
+- mcookie=$(dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \"%08x\")
++ mcookie=$(dd if=/dev/random bs=16 count=1 2>/dev/null | /usr/bin/hexdump -e \"%08x\")
+ fi
+ fi
+ if [ "$mcookie" = "" ]; then
+@@ -302,9 +302,9 @@ EOF
+ # now add the same credentials to the client authority file
+ # if '$displayname' already exists do not overwrite it as another
+ # server may need it. Add them to the '$xserverauthfile' instead.
+- for displayname in $authdisplay $hostname$authdisplay; do
++ for displayname in $authdisplay $hostname/unix$authdisplay; do
+ authcookie=$(xauth list "$displayname" \
+- | sed -n 's/.*'"$displayname"'[[:space:]*].*[[:space:]*]//p' 2>/dev/null);
++ | sed -n 's|.*'"$displayname"'[[:space:]*].*[[:space:]*]||p' 2>/dev/null);
+ if [ "z${authcookie}" = "z" ] ; then
+ "$xauth" -q << EOF
+ add $displayname . $mcookie