all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: phillip.lord@russet.org.uk (Phillip Lord)
To: Eli Zaretskii <eliz@gnu.org>
Cc: 23203@debbugs.gnu.org, stromeko@nexgo.de
Subject: bug#23203: 25.0.91; some loaddefs files have auto-save remnants after building (and install doesn't ignore them)
Date: Sun, 10 Apr 2016 21:30:21 +0100	[thread overview]
Message-ID: <87a8l1xl42.fsf@russet.org.uk> (raw)
In-Reply-To: <87y48oi0mi.fsf@russet.org.uk> (Phillip Lord's message of "Fri, 08 Apr 2016 16:25:09 +0100")

[-- Attachment #1: Type: text/plain, Size: 255 bytes --]


Complete diff of my proposed change.

If anyone has time to test this it would be appreciated, as I saw some
strange (and now unrepeatable) failures with an earlier version of this.
I've not I'll install it tomorrow, as it seems functional in my hands.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Prevent-bootstrap-autoload-backup-files.patch --]
[-- Type: text/x-diff, Size: 3328 bytes --]

From 8f50973593b408978ae9cc247fe9d6423266d60c Mon Sep 17 00:00:00 2001
From: Phillip Lord <phillip.lord@russet.org.uk>
Date: Fri, 8 Apr 2016 16:22:44 +0100
Subject: [PATCH] Prevent bootstrap autoload backup files

 * lisp/emacs-lisp/autoload (autoload-find-generated-file): Suppress
   backups in newly created file.

  (autoload-ensure-default-file): Function split into two.
  (autoload-ensure-file-writeable): New function from split.

  (Bug#23203)
---
 lisp/emacs-lisp/autoload.el | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index e688d6b..592d69d 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -234,9 +234,22 @@ autoload-find-generated-file
 	(enable-local-eval nil))
     ;; We used to use `raw-text' to read this file, but this causes
     ;; problems when the file contains non-ASCII characters.
-    (let ((delay-mode-hooks t))
-      (find-file-noselect
-       (autoload-ensure-default-file (autoload-generated-file))))))
+    (let* ((delay-mode-hooks t)
+           (file (autoload-generated-file))
+           (file-missing (not (file-exists-p file))))
+      (when file-missing
+        (autoload-ensure-default-file file))
+      (with-current-buffer
+          (find-file-noselect
+           (autoload-ensure-file-writeable
+            file))
+        ;; block backups when the file has just been created, since
+        ;; the backups will just be the auto-generated headers.
+        ;; bug#23203
+        (when file-missing
+          (setq buffer-backed-up t)
+          (save-buffer))
+        (current-buffer)))))
 
 (defun autoload-generated-file ()
   (expand-file-name generated-autoload-file
@@ -357,21 +370,22 @@ autoload-ensure-writable
 ;;;###autoload
 (put 'autoload-ensure-writable 'risky-local-variable t)
 
+(defun autoload-ensure-file-writeable (file)
+  ;; Probably pointless, but replaces the old AUTOGEN_VCS in lisp/Makefile,
+  ;; which was designed to handle CVSREAD=1 and equivalent.
+  (and autoload-ensure-writable
+       (let ((modes (file-modes file)))
+         (if (zerop (logand modes #o0200))
+             ;; Ignore any errors here, and let subsequent attempts
+             ;; to write the file raise any real error.
+             (ignore-errors (set-file-modes file (logior modes #o0200))))))
+  file)
+
 (defun autoload-ensure-default-file (file)
   "Make sure that the autoload file FILE exists, creating it if needed.
 If the file already exists and `autoload-ensure-writable' is non-nil,
 make it writable."
-  (if (file-exists-p file)
-      ;; Probably pointless, but replaces the old AUTOGEN_VCS in lisp/Makefile,
-      ;; which was designed to handle CVSREAD=1 and equivalent.
-      (and autoload-ensure-writable
-	   (let ((modes (file-modes file)))
-	     (if (zerop (logand modes #o0200))
-		 ;; Ignore any errors here, and let subsequent attempts
-		 ;; to write the file raise any real error.
-		 (ignore-errors (set-file-modes file (logior modes #o0200))))))
-    (write-region (autoload-rubric file) nil file))
-  file)
+  (write-region (autoload-rubric file) nil file))
 
 (defun autoload-insert-section-header (outbuf autoloads load-name file time)
   "Insert the section-header line,
-- 
2.8.1


  reply	other threads:[~2016-04-10 20:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-03  7:08 bug#23203: 25.0.91; some loaddefs files have auto-save remnants after building (and install doesn't ignore them) Achim Gratz
2016-04-03  8:26 ` Andreas Schwab
2016-04-03  8:28 ` Andreas Schwab
2016-04-03  8:48   ` Achim Gratz
2016-04-03 10:46     ` Andreas Schwab
2016-04-03 11:47       ` Achim Gratz
2016-04-03 13:58         ` Phillip Lord
2016-04-03 14:36         ` Andreas Schwab
2016-04-03 18:46         ` Phillip Lord
2016-04-03 18:58           ` Eli Zaretskii
2016-04-03 19:33             ` Phillip Lord
2016-04-03 19:39               ` Eli Zaretskii
2016-04-03 20:11                 ` Phillip Lord
2016-04-04 15:27                   ` Eli Zaretskii
2016-04-04 22:12                     ` Phillip Lord
2016-04-05 18:16                       ` Achim Gratz
2016-04-08  8:22                       ` Eli Zaretskii
2016-04-08 15:25                         ` Phillip Lord
2016-04-10 20:30                           ` Phillip Lord [this message]
2016-04-12 12:03                             ` Phillip Lord
2016-04-12 15:20                               ` Eli Zaretskii
2016-04-12 15:39                                 ` Glenn Morris
2016-04-12 16:34                                   ` Phillip Lord
2016-04-12 16:40                                     ` Eli Zaretskii
2016-04-12 18:08                                     ` John Wiegley
2020-08-15  4:11                               ` Stefan Kangas
2016-04-04 15:42             ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8l1xl42.fsf@russet.org.uk \
    --to=phillip.lord@russet.org.uk \
    --cc=23203@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=stromeko@nexgo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.