Hello,

The follwing patch adds a test to check if a path exist before searching
for executables programs in it. This will prevent a bug that have been
reported multiple times on the stumpwm's IRC channel with something
like ENOENT error (with clisp I guess) when the PATH var contains an
invalid path.



-- 

Morgan Veyret ([EMAIL PROTECTED])
http://appart.kicks-ass.net/patzy
>From e021936f33013024404ba26b4c3387c20afcb005 Mon Sep 17 00:00:00 2001
From: Morgan Veyret <[EMAIL PROTECTED]>
Date: Tue, 6 May 2008 20:40:06 +0200
Subject: [PATCH] Added path existance check in "rehash" to prevent from errors 
with buggy PATH var.

---
 user.lisp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/user.lisp b/user.lisp
index dc3bf66..c578126 100644
--- a/user.lisp
+++ b/user.lisp
@@ -568,7 +568,10 @@ each directory seperated by a colon."
 
 (defun rehash (&optional (paths (mapcar 'parse-namestring (split-string 
(getenv "PATH") ":"))))
   "Update the cache of programs in the path stored in @var{*programs-list*} 
when needed."
-  (let ((dates (mapcar 'portable-file-write-date paths)))
+  (let ((dates (mapcar (lambda (p)
+                         (when (probe-path p)
+                           (portable-file-write-date p)))paths)))
+    (finish-output)
     (unless (and *path-cache*
                  (equal (path-cache-paths *path-cache*) paths)
                  (equal (path-cache-modification-dates *path-cache*) dates))
@@ -579,7 +582,9 @@ each directory seperated by a colon."
 (defun complete-program (base)
   "return the list of programs in @var{*path-cache*} whose names begin
 with base. Automagically update the cache."
+  (format t "Rebuilding hash...")
   (rehash)
+  (format t "done.~%")
   (remove-if-not #'(lambda (p)
                     (when (<= (length base) (length p))
                        (string= base p
-- 
1.5.4.5

_______________________________________________
Stumpwm-devel mailing list
Stumpwm-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/stumpwm-devel

Reply via email to