* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
@ 2016-06-03 22:03 Clément Pit--Claudel
2016-06-03 22:50 ` Glenn Morris
0 siblings, 1 reply; 11+ messages in thread
From: Clément Pit--Claudel @ 2016-06-03 22:03 UTC (permalink / raw)
To: 23692
[-- Attachment #1.1: Type: text/plain, Size: 2069 bytes --]
When the a single-package file has no autoloads, the call to update-directory-autoloads leaves the generated autoload files modified, but unsaved. This causes package.el to prompt the user about killing a modified file.
Small repro: paste the following in *scratch* and run package-install-from-buffer.
;;; test-package.el --- blah
;; Author: Me
;; Version: 1.0
(provide 'test-package)
;;; test-package.el ends here
This will show the following message: "Buffer test-package-autoloads.el modified; kill anyway? (yes or no)"
The problem happens when package.el reaches the following bit:
(defun package-generate-autoloads (name pkg-dir)
(let* (...)
...
(let ((buf (find-buffer-visiting generated-autoload-file)))
(when buf (kill-buffer buf))) ;; <-- HERE
...))
The particular path that leads to an error condition is the following: inside of update-directory-autoloads, we see this:
;; Don't modify the file if its content has not been changed, so `make'
;; dependencies don't trigger unnecessarily.
(when changed
(let ((version-control 'never))
(save-buffer)))
The flag `changed` is only set to `t` if files autoloads are found. However, file without autoloads also get added to the generated autoloads file:
;;;### (autoloads nil nil (some file names here) (0 0 0
;;;;;; 0))
I'm not sure which part of this is a bug: package.el assuming that update-directory-autoloads always saves the file after modifying it (which seems false), or update-directory-autoloads not saving the file. In any case, it's probably a misfeature that package.el prompts the user about killing a modified autoloads file as part of the installation process.
Thanks!
Clément.
In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
of 2016-05-28 built on clem-w50-mint
Repository revision: 8377f2ed8aad863d6c59987b7b53fbceee46881e
Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
System Description: Linux Mint 17.3 Rosa
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
2016-06-03 22:03 bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads) Clément Pit--Claudel
@ 2016-06-03 22:50 ` Glenn Morris
2016-06-04 4:34 ` Clément Pit--Claudel
2016-06-06 17:24 ` Glenn Morris
0 siblings, 2 replies; 11+ messages in thread
From: Glenn Morris @ 2016-06-03 22:50 UTC (permalink / raw)
To: Clément Pit--Claudel; +Cc: 23692
Clément Pit--Claudel wrote:
> [...] the call to update-directory-autoloads leaves the generated
> autoload files modified, but unsaved.
Due to recent e971ce6de27f. Seems like an update-directory-autoloads bug
to me.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
2016-06-03 22:50 ` Glenn Morris
@ 2016-06-04 4:34 ` Clément Pit--Claudel
2016-06-06 17:24 ` Glenn Morris
1 sibling, 0 replies; 11+ messages in thread
From: Clément Pit--Claudel @ 2016-06-04 4:34 UTC (permalink / raw)
To: Glenn Morris; +Cc: 23692
[-- Attachment #1.1: Type: text/plain, Size: 335 bytes --]
On 2016-06-03 18:50, Glenn Morris wrote:
> Clément Pit--Claudel wrote:
>
>> [...] the call to update-directory-autoloads leaves the generated
>> autoload files modified, but unsaved.
>
> Due to recent e971ce6de27f. Seems like an update-directory-autoloads bug
> to me.
Brilliant, thanks for spotting this so quickly :)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
2016-06-03 22:50 ` Glenn Morris
2016-06-04 4:34 ` Clément Pit--Claudel
@ 2016-06-06 17:24 ` Glenn Morris
2016-06-09 1:47 ` Stefan Monnier
1 sibling, 1 reply; 11+ messages in thread
From: Glenn Morris @ 2016-06-06 17:24 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Clément Pit--Claudel, 23692
Stefan, FYI:
Glenn Morris wrote:
> Clément Pit--Claudel wrote:
>> When the a single-package file has no autoloads, the call to
>> update-directory-autoloads leaves the generated autoload files
>> modified, but unsaved. This causes package.el to prompt the user
>> about killing a modified file.
>
> Due to recent e971ce6de27f. Seems like an update-directory-autoloads
> bug to me.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
2016-06-06 17:24 ` Glenn Morris
@ 2016-06-09 1:47 ` Stefan Monnier
2016-06-13 18:33 ` Glenn Morris
2016-06-13 22:17 ` Clément Pit--Claudel
0 siblings, 2 replies; 11+ messages in thread
From: Stefan Monnier @ 2016-06-09 1:47 UTC (permalink / raw)
To: Glenn Morris; +Cc: Clément Pit--Claudel, 23692
>>> When the a single-package file has no autoloads, the call to
>>> update-directory-autoloads leaves the generated autoload files
>>> modified, but unsaved. This causes package.el to prompt the user
>>> about killing a modified file.
Does the patch below fix the problem for you?
Stefan
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 6473e31..9cf96fd 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -1111,7 +1111,8 @@ write its autoloads into the specified file instead."
;; Don't modify the file if its content has not been changed, so `make'
;; dependencies don't trigger unnecessarily.
- (when changed
+ (if (not changed)
+ (set-buffer-modified-p nil)
(let ((version-control 'never))
(save-buffer)))
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
2016-06-09 1:47 ` Stefan Monnier
@ 2016-06-13 18:33 ` Glenn Morris
2016-06-14 0:40 ` Stefan Monnier
2016-06-13 22:17 ` Clément Pit--Claudel
1 sibling, 1 reply; 11+ messages in thread
From: Glenn Morris @ 2016-06-13 18:33 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Clément Pit--Claudel, 23692
Stefan Monnier wrote:
> - (when changed
> + (if (not changed)
> + (set-buffer-modified-p nil)
I guess that will work. Some vague thoughts:
i) I guess now autoload will sometimes not create any output file.
Does that matter?
ii) I wonder what this means for reproducibility of the loaddefs file.
IIRC When building Emacs itself, the loaddefs file can change if you:
make -j8 bootstrap; make -C lisp autoloads
due to changes in "files with no autoloads" section owing to generated
files being created in parallel with loaddefs.el (this is really a
failure in dependency tracking for loaddefs, but it's harmless).
But it does finally converge to a fixed state. Will it still do so if
the loaddefs file sometimes isn't written?
iii) Would applying a move-if-change style logic be better?
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
2016-06-13 18:33 ` Glenn Morris
@ 2016-06-14 0:40 ` Stefan Monnier
2016-10-10 9:56 ` Eli Zaretskii
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2016-06-14 0:40 UTC (permalink / raw)
To: Glenn Morris; +Cc: Clément Pit--Claudel, 23692
> i) I guess now autoload will sometimes not create any output file.
I think this shouldn't happen. Both in the sense that it would be
a bug, and that my understanding of the code makes me think it
won't happen. We create the file before we even try to update it.
> ii) I wonder what this means for reproducibility of the loaddefs file.
Good question.
> iii) Would applying a move-if-change style logic be better?
Could be, indeed. My only motivation for the original patch was to
avoid repeatedly re-dumping Emacs even when no significant change had
happened. I wrote the patch years ago, and at that point the
time-stamps were always different, so the buffer's content was
definitely changed, tho in ways which had no impact on the dump, so
"move-if-changed" was not an option.
Now that we avoid time-stamps maybe we can actually compare the buffer's
content with the file and skip saving if it's identical.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
2016-06-14 0:40 ` Stefan Monnier
@ 2016-10-10 9:56 ` Eli Zaretskii
2016-10-11 19:56 ` Stefan Monnier
0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2016-10-10 9:56 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 23692, clement.pitclaudel
> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Date: Mon, 13 Jun 2016 20:40:24 -0400
> Cc: Clément Pit--Claudel <clement.pitclaudel@live.com>,
> 23692@debbugs.gnu.org
>
> > i) I guess now autoload will sometimes not create any output file.
>
> I think this shouldn't happen. Both in the sense that it would be
> a bug, and that my understanding of the code makes me think it
> won't happen. We create the file before we even try to update it.
>
> > ii) I wonder what this means for reproducibility of the loaddefs file.
>
> Good question.
>
> > iii) Would applying a move-if-change style logic be better?
>
> Could be, indeed. My only motivation for the original patch was to
> avoid repeatedly re-dumping Emacs even when no significant change had
> happened. I wrote the patch years ago, and at that point the
> time-stamps were always different, so the buffer's content was
> definitely changed, tho in ways which had no impact on the dump, so
> "move-if-changed" was not an option.
> Now that we avoid time-stamps maybe we can actually compare the buffer's
> content with the file and skip saving if it's identical.
Stefan, you didn't commit your patch, please do (it should go to the
master branch).
TIA
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
2016-10-10 9:56 ` Eli Zaretskii
@ 2016-10-11 19:56 ` Stefan Monnier
2016-10-11 20:54 ` Eli Zaretskii
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2016-10-11 19:56 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 23692-done, clement.pitclaudel
> Stefan, you didn't commit your patch, please do (it should go to the
> master branch).
Done,
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
2016-10-11 19:56 ` Stefan Monnier
@ 2016-10-11 20:54 ` Eli Zaretskii
0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2016-10-11 20:54 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 23692, clement.pitclaudel
> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: 23692-done@debbugs.gnu.org, rgm@gnu.org, clement.pitclaudel@live.com
> Date: Tue, 11 Oct 2016 15:56:35 -0400
>
> > Stefan, you didn't commit your patch, please do (it should go to the
> > master branch).
>
> Done,
Thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
2016-06-09 1:47 ` Stefan Monnier
2016-06-13 18:33 ` Glenn Morris
@ 2016-06-13 22:17 ` Clément Pit--Claudel
1 sibling, 0 replies; 11+ messages in thread
From: Clément Pit--Claudel @ 2016-06-13 22:17 UTC (permalink / raw)
To: Stefan Monnier, Glenn Morris; +Cc: 23692
[-- Attachment #1.1: Type: text/plain, Size: 982 bytes --]
Yup, works for me!
On 2016-06-08 21:47, Stefan Monnier wrote:
>>>> When the a single-package file has no autoloads, the call to
>>>> update-directory-autoloads leaves the generated autoload files
>>>> modified, but unsaved. This causes package.el to prompt the user
>>>> about killing a modified file.
>
> Does the patch below fix the problem for you?
>
>
> Stefan
>
>
> diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
> index 6473e31..9cf96fd 100644
> --- a/lisp/emacs-lisp/autoload.el
> +++ b/lisp/emacs-lisp/autoload.el
> @@ -1111,7 +1111,8 @@ write its autoloads into the specified file instead."
>
> ;; Don't modify the file if its content has not been changed, so `make'
> ;; dependencies don't trigger unnecessarily.
> - (when changed
> + (if (not changed)
> + (set-buffer-modified-p nil)
> (let ((version-control 'never))
> (save-buffer)))
>
>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-10-11 20:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-03 22:03 bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads) Clément Pit--Claudel
2016-06-03 22:50 ` Glenn Morris
2016-06-04 4:34 ` Clément Pit--Claudel
2016-06-06 17:24 ` Glenn Morris
2016-06-09 1:47 ` Stefan Monnier
2016-06-13 18:33 ` Glenn Morris
2016-06-14 0:40 ` Stefan Monnier
2016-10-10 9:56 ` Eli Zaretskii
2016-10-11 19:56 ` Stefan Monnier
2016-10-11 20:54 ` Eli Zaretskii
2016-06-13 22:17 ` Clément Pit--Claudel
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).