~mil/sxmo-devel

sxmo-utils: Force new process group using setgid -f when starting anything that may possibly kill an entire progress group (kill -9 0) #117 v1 APPLIED

Maarten van Gompel: 2
 Force new process group using setgid -f when starting anything that may possibly kill an entire progress group (kill -9 0) #117
 modemmonitortoggle may take an argument "on" or "off" to force toggling to a desired state

 3 files changed, 10 insertions(+), 5 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mil/sxmo-devel/patches/15411/mbox | git am -3
Learn more about email & git

[PATCH sxmo-utils 1/2] Force new process group using setgid -f when starting anything that may possibly kill an entire progress group (kill -9 0) #117 Export this patch

This fixes https://todo.sr.ht/~mil/sxmo-tickets/117 and the crashes when
toggling the modem monitor.

---
 scripts/core/sxmo_gesturehandler.sh      | 4 ++--
 scripts/modem/sxmo_modemmonitortoggle.sh | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/core/sxmo_gesturehandler.sh b/scripts/core/sxmo_gesturehandler.sh
index 673b13a..dd18454 100755
--- a/scripts/core/sxmo_gesturehandler.sh
+++ b/scripts/core/sxmo_gesturehandler.sh
@@ -76,10 +76,10 @@ if [ "$HANDLE" -ne 0 ]; then
			pkill -9 "$KEYBOARD"
			;;
		"showmenu")
			pidof dmenu || sxmo_appmenu.sh &
			pidof dmenu || setsid -f sxmo_appmenu.sh &
			;;
		"showsysmenu")
			pidof dmenu || sxmo_appmenu.sh sys &
			pidof dmenu || setsid -f sxmo_appmenu.sh sys &
			;;
		"hidemenu")
			pkill -9 dmenu
diff --git a/scripts/modem/sxmo_modemmonitortoggle.sh b/scripts/modem/sxmo_modemmonitortoggle.sh
index a06e0b0..732b704 100755
--- a/scripts/modem/sxmo_modemmonitortoggle.sh
+++ b/scripts/modem/sxmo_modemmonitortoggle.sh
@@ -2,7 +2,7 @@
if pgrep -f sxmo_modemmonitor.sh; then
	pgrep -f sxmo_modemmonitor.sh | grep -Ev "^${$}$" | xargs -IP kill -TERM P
else
	sxmo_modemmonitor.sh &
	setsid -f sxmo_modemmonitor.sh &
fi

NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
--
2.29.2
Thanks for your work on this patch. I have merged and this fixes #117. I
also documented sxmo_modemmonitortoggle.sh's changes here:

https://git.sr.ht/~mil/sxmo-docs/commit/66759b8

Feel free to change or provide feedback on sxmo-docs 1.2.0 branch.

Cheers,
Anjan
-- 
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt

[PATCH sxmo-utils 2/2] modemmonitortoggle may take an argument "on" or "off" to force toggling to a desired state Export this patch

---
 scripts/modem/sxmo_modemmonitortoggle.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/modem/sxmo_modemmonitortoggle.sh b/scripts/modem/sxmo_modemmonitortoggle.sh
index 732b704..56b8253 100755
--- a/scripts/modem/sxmo_modemmonitortoggle.sh
+++ b/scripts/modem/sxmo_modemmonitortoggle.sh
@@ -1,7 +1,12 @@
#!/usr/bin/env sh
if pgrep -f sxmo_modemmonitor.sh; then

# This script toggles the modem monitor
# It optionally takes a parameter "on" or "off"
# forcing it to toggle only to that desired state if applicable.

if [ "$1" != "on" ] && pgrep -f sxmo_modemmonitor.sh; then
	pgrep -f sxmo_modemmonitor.sh | grep -Ev "^${$}$" | xargs -IP kill -TERM P
else
elif [ "$1" != "off" ]; then
	setsid -f sxmo_modemmonitor.sh &
fi

--
2.29.2