From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.bugs 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 Message-ID: <87a8l1xl42.fsf@russet.org.uk> References: <87twjjqidp.fsf@Rainer.invalid> <87shz35b8i.fsf@Rainer.invalid> <87lh4v0y1z.fsf@linux-m68k.org> <87egam6hif.fsf@Rainer.invalid> <3bf1141d622845eb4fe66b6dce573551.squirrel@cloud103.planethippo.com> <83fuv2plj5.fsf@gnu.org> <837fgepjm7.fsf@gnu.org> <83oa9po0li.fsf@gnu.org> <87wpodyqdy.fsf@russet.org.uk> <83oa9kjyqt.fsf@gnu.org> <87y48oi0mi.fsf@russet.org.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1460323160 23108 80.91.229.3 (10 Apr 2016 21:19:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Apr 2016 21:19:20 +0000 (UTC) Cc: 23203@debbugs.gnu.org, stromeko@nexgo.de To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 10 23:19:15 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1apMlD-0001wB-UU for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Apr 2016 23:19:12 +0200 Original-Received: from localhost ([::1]:36660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apMlC-0003R0-Vj for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Apr 2016 17:19:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apMl7-0003NQ-VM for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2016 17:19:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1apMl4-00073M-OX for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2016 17:19:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apMl4-00073I-LC for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2016 17:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1apMl4-0004A5-GU for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2016 17:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: phillip.lord@russet.org.uk (Phillip Lord) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Apr 2016 21:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23203 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23203-submit@debbugs.gnu.org id=B23203.146032309515923 (code B ref 23203); Sun, 10 Apr 2016 21:19:02 +0000 Original-Received: (at 23203) by debbugs.gnu.org; 10 Apr 2016 21:18:15 +0000 Original-Received: from localhost ([127.0.0.1]:57589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apMkJ-00048k-IL for submit@debbugs.gnu.org; Sun, 10 Apr 2016 17:18:15 -0400 Original-Received: from cloud103.planethippo.com ([31.216.48.48]:51794) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apMkH-00048Y-FO for 23203@debbugs.gnu.org; Sun, 10 Apr 2016 17:18:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=russet.org.uk; s=default; h=Content-Type:MIME-Version:References:Message-ID :Date:In-Reply-To:Subject:Cc:To:From; bh=S+RwAdGVjSbAqUYGhjJN18ALLE+UBiiSgVRCFYu68kk=; b=U+nVOZe6b/PY8yWBlfOKSu5jXs Na9XZ0rqAEnrIOXsp86/SH/Ig8zP9mq5d1NF13GD6dgivJ69ezvWMYvqj9DeQMaGK5bSuNzvyeVBu OO83vmdXQd88U4zXjwDVQwVYZxZ+lrdEsnHgTxzfI5dgTCFdNztCdF+Y0FTxUVIcDRb2yYjp+SRwa lF5V8zfZ7cMfopDRgg8qmO2lk3FSQuuSDJAn0RdY+4GmOg4Zv5FM6voOu2wM3l7G5OJHGfTNQTa7l YzqlNhmu46EXoVjv7alzE6YfOSRkBXfZYSeoT3l65KJgdWfaimVYzaY7yZmWOIzcaZ8i1Ea/EGdQy SaVtsrXA==; Original-Received: from cpc1-benw10-2-0-cust373.gate.cable.virginm.net ([77.98.219.118]:47170 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.86_1) (envelope-from ) id 1apMkB-001oN8-Fo; Sun, 10 Apr 2016 22:18:07 +0100 In-Reply-To: <87y48oi0mi.fsf@russet.org.uk> (Phillip Lord's message of "Fri, 08 Apr 2016 16:25:09 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud103.planethippo.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - russet.org.uk X-Get-Message-Sender-Via: cloud103.planethippo.com: authenticated_id: phillip.lord@russet.org.uk X-Authenticated-Sender: cloud103.planethippo.com: phillip.lord@russet.org.uk X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:116348 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Prevent-bootstrap-autoload-backup-files.patch >From 8f50973593b408978ae9cc247fe9d6423266d60c Mon Sep 17 00:00:00 2001 From: Phillip Lord 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 --=-=-=--