Bug 285670 - x11-wm/xfce4-session: bashism in xflock4 script in 4.20.2
Summary: x11-wm/xfce4-session: bashism in xflock4 script in 4.20.2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-xfce (Nobody)
URL: https://gitlab.xfce.org/xfce/xfce4-se...
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-26 11:22 UTC by Thomas Mueller
Modified: 2025-03-26 14:48 UTC (History)
2 users (show)

See Also:
madpilot: maintainer-feedback+


Attachments
patch-scripts_xflock4 (740 bytes, patch)
2025-03-26 12:17 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Mueller 2025-03-26 11:22:15 UTC
After updating the port to 4.20.2, attempts to lock the screen fail
with this error:

   /usr/local/bin/xflock4: arithmetic expression: expecting primary: "2**31 - 1"

I presume this is due to line#55 in xflock4 and the failure is
caused by the script being run with /bin/sh:

    1   #!/bin/sh
    2   #
   [...]
   49   # echo is used to strip blanks
   50   # $((2**31 - 1)) is MAXINT, which disables timeout: see
   51   # https://dbus.freedesktop.org/doc/api/html/group__DBusPendingCall.html
   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))
Comment 1 Tijl Coosemans freebsd_committer freebsd_triage 2025-03-26 12:17:53 UTC
Created attachment 259040 [details]
patch-scripts_xflock4

This is one way to fix it.  An alternative would be to use $(((1<<31)-1)).
Comment 2 Guido Falsi freebsd_committer freebsd_triage 2025-03-26 12:33:34 UTC
Hi,

Thanks for reporting.

I''m using the patch suggested by tijl. Will commit it later today.

I also plan to submit it upstream once committed to our tree.
Comment 3 commit-hook freebsd_committer freebsd_triage 2025-03-26 14:48:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cf92c5f18543a3758cf67940036289471aa3bb08

commit cf92c5f18543a3758cf67940036289471aa3bb08
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2025-03-26 14:44:12 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2025-03-26 14:44:12 +0000

    x11-wm/xfce4-session: Replace bash only syntax

    Patch, suggested by tijl, sent upstream:

    https://gitlab.xfce.org/xfce/xfce4-session/-/merge_requests/79

    PR:             285670
    Reported by:    tijl (via email),
                    Thomas Mueller <thmu7@freenet.de>

 x11-wm/xfce4-session/Makefile                          |  1 +
 x11-wm/xfce4-session/files/patch-scripts_xflock4 (new) | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2025-03-26 14:48:48 UTC
Patch committed. Thanks!