]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/files.el (dir-locals-read-from-file): Check file non-empty
authorLeo Liu <sdl.web@gmail.com>
Sat, 1 Dec 2012 15:45:38 +0000 (23:45 +0800)
committerLeo Liu <sdl.web@gmail.com>
Sat, 1 Dec 2012 15:45:38 +0000 (23:45 +0800)
before reading.

Fixes: debbugs:13038
lisp/ChangeLog
lisp/files.el

index 735798e3f3e990bc758ec10b3b2bf5e6cc4a2b2b..eb41fff8c9ac56c5304b7499f69d7d2918302cb8 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-01  Leo Liu  <sdl.web@gmail.com>
+
+       * files.el (dir-locals-read-from-file): Check file non-empty
+       before reading.  (Bug#13038)
+
 2012-11-28  Glenn Morris  <rgm@gnu.org>
 
        * jka-cmpr-hook.el (jka-compr-get-compression-info):
index 51f8256f71ac9cec92c8323f1c1f53cef03dc858..62ad96cf28c55b4fc378918df86132bd879d7e59 100644 (file)
@@ -3625,14 +3625,15 @@ is found.  Returns the new class name."
       (condition-case err
          (progn
            (insert-file-contents file)
-           (let* ((dir-name (file-name-directory file))
-                  (class-name (intern dir-name))
-                  (variables (let ((read-circle nil))
-                               (read (current-buffer)))))
-             (dir-locals-set-class-variables class-name variables)
-             (dir-locals-set-directory-class dir-name class-name
-                                             (nth 5 (file-attributes file)))
-             class-name))
+           (unless (zerop (buffer-size))
+             (let* ((dir-name (file-name-directory file))
+                    (class-name (intern dir-name))
+                    (variables (let ((read-circle nil))
+                                 (read (current-buffer)))))
+               (dir-locals-set-class-variables class-name variables)
+               (dir-locals-set-directory-class dir-name class-name
+                                               (nth 5 (file-attributes file)))
+               class-name)))
        (error (message "Error reading dir-locals: %S" err) nil)))))
 
 (defcustom enable-remote-dir-locals nil