GNU bug report logs - #25360
File mode specification errors during building

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Wed, 4 Jan 2017 20:29:02 UTC

Severity: normal

Fixed in version 26.0.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #75 received at 25360 <at> debbugs.gnu.org (full text, mbox):

From: phillip.lord <at> russet.org.uk (Phillip Lord)
To: Glenn Morris <rgm <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 25360 <at> debbugs.gnu.org,
 npostavs <at> users.sourceforge.net
Subject: Re: bug#25360: File mode specification errors during building
Date: Tue, 17 Jan 2017 22:04:22 +0000
[Message part 1 (text/plain, inline)]
Glenn Morris <rgm <at> gnu.org> writes:

> npostavs <at> users.sourceforge.net wrote:
>
>> Using insert-file-contents instead of file-file-noselect seems to fix it
>> for me:
>
> That sounds like a good change anyway. (I forget, does this respect
> "coding:"? Does this even matter in this case?)

I think, no, it doesn't respect coding, but that it doesn't matter.

>
> (But it still seems like a potential problem to me if functions that used to
> be available early in the build no longer are.)

It shouldn't be, if they are not being called.

Anyway, the cause of the error in this case is this line in files.el.

	 (assoc-default nil magic-fallback-mode-alist
		(lambda (re _dummy)
		  (if (functionp re)
		      (funcall re)
		    (looking-at re)))))))

This is called when loading cangjie-table.b5 with
'image-type-auto-detected-p as the first parameter. Normally, the
condition returns "t", but in this case it will return f, then
the looking-at form fails with the error given. I don't understand which
this process does not happen during the build which generates
ldefs-boot-auto.el.

The bigger problem is that the bootstrap-emacs executable has different
functionality compiled in, even when it does not require it to perform
the task of bootstrapping. This might invalidate my approach, but I am
not sure yet.

The follow patch addresses, the problem at hand, though.

[0001-Fix-file-mode-errors-in-bootstrap.patch (text/x-diff, inline)]
From bed019eb18fbafffd397eaac7962e30428fe1e04 Mon Sep 17 00:00:00 2001
From: Phillip Lord <phillip.lord <at> russet.org.uk>
Date: Mon, 16 Jan 2017 23:09:06 +0000
Subject: [PATCH] Fix file-mode errors in bootstrap.

* lisp/files.el (set-auto-mode): Do not call `looking-at' on a symbol.
* lisp/international/titdic-cnv.el (miscdic-convert): Use
  `insert-file-contents' rather than `find-file-noselect'.
---
 lisp/files.el                    | 28 ++++++++++++++++++++++------
 lisp/international/titdic-cnv.el |  8 ++++----
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index b57e35b..e7b15a8 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2911,9 +2911,18 @@ set-auto-mode
 						(+ (point-min) magic-mode-regexp-match-limit)))
 			 (assoc-default nil magic-mode-alist
 					(lambda (re _dummy)
-					  (if (functionp re)
-					      (funcall re)
-					    (looking-at re)))))))
+                                          (cond
+                                           ;; Bug#25360 We might have a
+                                           ;; symbol which is not a
+                                           ;; function during bootstrap.
+                                           ((and
+                                              (symbolp re)
+                                              (functionp re))
+                                            (funcall re))
+                                           ((stringp re)
+					    (looking-at re)))
+                                          (t (error "Problem with `magic-mode-alist'."))
+                                           )))))
 	  (set-auto-mode-0 done keep-mode-if-same)))
     ;; Next compare the filename against the entries in auto-mode-alist.
     (unless done
@@ -2966,9 +2975,16 @@ set-auto-mode
 						(+ (point-min) magic-mode-regexp-match-limit)))
 			 (assoc-default nil magic-fallback-mode-alist
 					(lambda (re _dummy)
-					  (if (functionp re)
-					      (funcall re)
-					    (looking-at re)))))))
+                                          ;; Bug#25360 We might have a
+                                          ;; symbol which is not a
+                                          ;; function during bootstrap.
+					  (cond
+                                           ((functionp re)
+                                            (funcall re))
+                                           ((stringp re)
+                                            (looking-at re))
+                                           (t (error "Problem with `magic-fallback-mode-alist'."))
+                                           ))))))
 	  (set-auto-mode-0 done keep-mode-if-same)))
     (unless done
       (set-buffer-major-mode (current-buffer)))))
diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el
index 6f65d49..6986b3f 100644
--- a/lisp/international/titdic-cnv.el
+++ b/lisp/international/titdic-cnv.el
@@ -1168,10 +1168,10 @@ miscdic-convert
 		      "Chinese-GB"))
 		  "\" \"" title "\" t\n")
 	  (let* ((coding-system-for-read
-		  (coding-system-change-eol-conversion coding 'unix))
-		 (dicbuf (find-file-noselect filename)))
-	    (funcall converter dicbuf name title)
-	    (kill-buffer dicbuf))
+		  (coding-system-change-eol-conversion coding 'unix)))
+            (with-temp-buffer
+              (insert-file-contents filename)
+              (funcall converter (current-buffer) name title)))
 	  (insert ";; Local Variables:\n"
 		  ";; version-control: never\n"
 		  ";; no-update-autoloads: t\n"
-- 
2.9.3


This bug report was last modified 8 years and 77 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.