NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

xsrc/60198: ctwm_app_menu doesn't consder whitespace



>Number:         60198
>Category:       xsrc
>Synopsis:       ctwm_app_menu doesn't consder whitespace
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    xsrc-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 17 08:35:01 +0000 2026
>Originator:     Robert Whitlock
>Release:        NetBSD 11.99.5 amd64, April 12, 2026
>Organization:
>Environment:
also pkgsrc-2026Q1
>Description:
The /usr/X11R7/libexec/ctwm_app_menu script doesn't consider whitespace around the equals sign. This causes the ctwm menu entry for pkgsrc/editors/dte to show up blank, not run when clicked, and appear in the Misc category instead of Accessories. According to

https://specifications.freedesktop.org/desktop-entry/1.1/basic-format.html#entries

there can be spaces: "Space before and after the equals sign should be ignored"
>How-To-Repeat:
Install pkgsrc/editors/dte
Restart ctwm
See the blank menu entry under Misc
>Fix:
--- ctwm_app_menu.orig  2026-04-13 23:35:43.962212705 -0400
+++ ctwm_app_menu       2026-04-17 04:10:54.884816676 -0400
@@ -33,7 +33,7 @@
 LOCALBASE=$(pkg_info -Q LOCALBASE pkg_install 2>/dev/null) ||
     LOCALBASE=/usr/pkg
 
-find "$LOCALBASE"/share/applications -name '*.desktop' -exec awk -F= '
+find "$LOCALBASE"/share/applications -name '*.desktop' -exec awk '
        function resetentry() {
                name = menu = exec = ""
                terminal = nodisplay = 0
@@ -55,8 +55,12 @@
                return "\"" s "\""
        }
 
-       function iskey(k)       { return $1 == k }      # Assumes FS="="
-       function value( v)      { v = $0; sub(/^[^=]*=/, "", v); return v }
+       function iskey(k, loc1) {
+               loc1 = $0
+               sub(/ *=.*$/, "", loc1)
+               return loc1 == k
+       }
+       function value( v)      { v = $0; sub(/^[^=]*= */, "", v); return v }
 
        BEGIN {
                menuno = 0
@@ -108,9 +112,9 @@
        FNR == 1                { resetentry() }
 
        iskey("Name") && !name  { name = value() }
-       /^Terminal=true$/       { terminal = 1 }
+       /^Terminal *= *true$/   { terminal = 1 }
        iskey("OnlyShowIn")     { nodisplay = 1 }
-       /^NoDisplay=true$/      { nodisplay = 1 }
+       /^NoDisplay *= *true$/  { nodisplay = 1 }
        iskey("Exec") && !exec  { exec = value()
                                  gsub(/ %.*/, "", exec)
                                  if (exec ~ /\"/)      # XXX




Home | Main Index | Thread Index | Old Index