Bug-fix: 160 #'package-suppress, `load-suppress-alist' don't suppress anything
authorNelson Ferreira <nelson.ferreira@ieee.org>
Sat, 24 Aug 2013 21:53:43 +0000 (17:53 -0400)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Sat, 24 Aug 2013 21:53:43 +0000 (17:53 -0400)
There were 3 different bugs conspiring for this:

* lisp/packages.el (package-suppress): the value for filename
added to load-suppress-alist contained the load-file-name instead
of using it as a basis for the directory of the file to exclude.

* src/lread.c (suppressedp_loop): No file was ever being
considered for exclusion because the check for CONSP was being
made against the acons function pointer instead of the _acons_
iteration variable.

* src/lread.c (locate_file_in_directory_mapper): When a file was
suppressed, the value of fd in the closure was left as is. This
not only leaked file descriptors but also made the search end
because in the end this is was the value considered to whether
there was a valid file to load or not, because closure.fd is the
return value of locate_file_in_directory.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
lisp/packages.el
src/lread.c

index 34a555c..e401b03 100644 (file)
@@ -137,7 +137,7 @@ the directory to be ignored."
 When SXEmacs searches for a file in the load path, it will ignore FILE
 if FORM evaluates to non-nil."
   (setq load-suppress-alist
-       (acons (expand-file-name file load-file-name) form
+       (acons (expand-file-name file (file-dirname load-file-name)) form
               load-suppress-alist)))
 
 (defun package-require (name version)
index 08a8819..30140f7 100644 (file)
@@ -381,7 +381,7 @@ static inline int
 suppressedp_loop(int len, char *nonreloc, Lisp_Object reloc)
 {
        EXTERNAL_LIST_LOOP_2(_acons_, Vload_suppress_alist) {
-               if (CONSP(acons) && STRINGP(XCAR(_acons_))) {
+               if (CONSP(_acons_) && STRINGP(XCAR(_acons_))) {
                        Lisp_Object name = XCAR(_acons_);
                        if (XSTRING_LENGTH(name) == len &&
                            !memcmp(XSTRING_DATA(name), nonreloc, len)) {
@@ -1061,6 +1061,9 @@ static int locate_file_in_directory_mapper(char *fn, void *arg)
                                                    F_SETFD, FD_CLOEXEC);
 
                                return 1;
+                       } else {
+                               close(closure->fd);
+                               closure->fd=-1;
                        }
                }
        }