Bug#1101192: xflock4: bashism: fails with '52: arithmetic expression: expecting primary: "2**31 - 1"'
Package: xfce4-session
Version: 4.20.2-1
Severity: important
File: /usr/bin/xflock4
Tags: upstream
Hallo,
xflock4 has a bashism in the arithmetic expression in line 52:
52 ret=$(echo $(dbus-send --session \
53 --dest=org.xfce.SessionManager \
54 --print-reply=literal \
55 --reply-timeout=$((2**31 - 1)) \
56 --type=method_call \
57 /org/xfce/SessionManager \
58 org.xfce.Session.Manager.Lock))
This only works if sh is symlinked to bash and breaks with dash, which is the
default in Debian.
With /usr/bin/sh -> bash:
$ sh
sh-5.2$ echo $((2**31 - 1))
2147483647
With /usr/bin/sh -> dash:
$ sh
$ echo $((2**31 - 1))
sh: 1: arithmetic expression: expecting primary: "2**31 -1"
Proposed solution: Just hardcode MAXINT as 2147483647 into the script instead
of calculating it on the fly. It is a magick number anyways, nothing is gained by
the calculation.
Grüße,
Sven.
-- System Information:
Debian Release: trixie/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'unstable'), (400, 'testing'), (1, 'experimental-debug')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.12.17-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages xfce4-session depends on:
ii libatk1.0-0t64 2.56.0-3
ii libc6 2.41-6
ii libcairo-gobject2 1.18.4-1+b1
ii libcairo2 1.18.4-1+b1
ii libgdk-pixbuf-2.0-0 2.42.12+dfsg-2
ii libglib2.0-0t64 2.84.0-2
ii libgtk-3-0t64 3.24.49-2
ii libgtk-layer-shell0 0.9.0-2
ii libice6 2:1.1.1-1
ii libpango-1.0-0 1.56.3-1
ii libpolkit-gobject-1-0 126-2
ii libsm6 2:1.2.4-1
ii libx11-6 2:1.8.12-1
ii libxfce4ui-2-0 4.20.1-1
ii libxfce4util7 4.20.1-1
ii libxfce4windowing-0-0 4.20.2-1
ii libxfconf-0-3 4.20.0-1
ii x11-xserver-utils 7.7+11
ii xfce4-settings 4.20.1-1
ii xfconf 4.20.0-1
Versions of packages xfce4-session recommends:
ii dbus-user-session [default-dbus-session-bus] 1.16.2-2
ii dbus-x11 [dbus-session-bus] 1.16.2-2
ii libglib2.0-bin 2.84.0-2
ii libpam-systemd [logind] 257.4-3
ii systemd-sysv 257.4-3
ii upower 1.90.7-1
ii xfce4-screensaver 4.18.4-1
ii xfdesktop4 4.20.1-1
ii xfwm4 4.20.0-1
Versions of packages xfce4-session suggests:
ii fortune-mod 1:1.99.1-9
ii sudo 1.9.16p2-1
-- no debconf information
Reply to: