[sawfish] more apps-menu robustness



commit 3e83110ac68345191358e436b0e5dd4375cf7fb4
Author: Christopher Roy Bratusek <zanghar freenet de>
Date:   Wed Feb 10 10:11:25 2010 +0100

    more apps-menu robustness

 ChangeLog                        |    6 ++++++
 lisp/sawfish/wm/ext/apps-menu.jl |   11 +++++++----
 man/news.texi                    |    9 +++++++++
 3 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5b159dd..d24041c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-02-10  Christopher Bratusek <zanghar freenet de>
+	* lisp/sawfish/wm/ext/apps-menu.jl: - ignore .desktop files that are symlinks
+	                                    - don't crash if first char of a keyvalue is ;
+					    - don't crash if # is part of the keyvalue
+					    -- [Matthew Love]
+
 2010-02-02  Teika Kazura <teika lavabit com>
 	* lisp/sawfish/cfg/wm.jl
 	* lisp/sawfish/wm/commands/grow-pack.jl
diff --git a/lisp/sawfish/wm/ext/apps-menu.jl b/lisp/sawfish/wm/ext/apps-menu.jl
index 1c62d64..34ceb75 100644
--- a/lisp/sawfish/wm/ext/apps-menu.jl
+++ b/lisp/sawfish/wm/ext/apps-menu.jl
@@ -67,6 +67,7 @@ set this to non-nil.")
 
   (defvar apps-menu-alphabetize t
     "Sort the apps menu alphabetically.")
+
   (defvar apps-menu-lang nil
     "Language for applications menu, in string. Default is set from locale.")
 
@@ -94,8 +95,9 @@ set this to non-nil.")
 	  (do ((mcount 0 (1+ mcount)))
 	      ((or (string= (substring instring mcount (+ mcount 1)) "\n")
 		   (string= (substring instring mcount (+ mcount 1)) key)
-		   (= mcount (- mlength 2))
-		   (= mcount 398)) mcount)))))
+		   (= mcount (- mlength 1))
+		   (= mcount 398)) 
+	       mcount)))))
 
   (define (get-desktop-key instring)
     (if (> (length instring) 3)
@@ -255,7 +257,7 @@ set this to non-nil.")
   ;; list
   (define (build-cat-list line)
     (if (> (length line) 1)
-	(let ((this-cat (prin1-to-string (read-from-string line))))
+	(let ((this-cat (substring line 0 (get-key-break line ";"))))
 	  (cons this-cat
 		(if (< (length this-cat) (length line))
 		    (build-cat-list
@@ -329,7 +331,8 @@ exile it."
     "Generate a menu entry to run the program specified in the the
 .desktop file `desk-file'."
     (if (and (not (file-directory-p desk-file))
-	     (desktop-file-p desk-file))
+	     (desktop-file-p desk-file)
+	     (not (file-symlink-p desk-file)))
 	(let ((fdo-list (fdo-check-exile (parse-desktop-file desk-file))))
 	  (if apps-menu-ignore-no-display
 	      (let ((a (assoc "NoDisplay" fdo-list)))
diff --git a/man/news.texi b/man/news.texi
index c86a82b..0c795a0 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -15,6 +15,15 @@ they occurred between. For more detailed information see the
 
 @item The 1.6.2 release has some improvements.
 
+ item Bugfixes
+ itemize @minus
+ item Apps-menu is more robust now. [Matthew Love]
+
+Sawfish application-menu @code{apps-menu} introduced in 1.6.0, crashed
+if the desktop file was a symlink, or if the keyvalue was malformed
+(say ; as first character or # somewhere inside). Those .desktop files
+no longer let sawfish crash (or stop the startup-process).
+ end itemize
 @item New features
 @itemize @minus
 @item New command @code{maximize-discard} [Teika kazura]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]