unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmail.com>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: 41489@debbugs.gnu.org
Subject: bug#41489: `package-dir-info' fails on a directory with a non-saved file
Date: Tue, 26 May 2020 08:54:00 +0200	[thread overview]
Message-ID: <CAG7BpaosTeDdygKr5ibo+sVRKdo8p=TknEMxOm=K15Asyd-ftg@mail.gmail.com> (raw)
In-Reply-To: <CADwFkm=HdeJ-A75FaCUBgUV=Za2JLERrCjZ0hSBpR+MF_e_PzQ@mail.gmail.com>

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

> Do we really want to ignore *any* error from insert-file-contents here?

Well, maybe that should be limited to `file-missing' instead (what actually
happens when it tries to read a lock file).

> Should we really run package-buffer-info if inserting the file fails?
> Won't that reach (error "Package lacks a file header") and signal an
> error anyways, just a different and more cryptic one?

`package-buffer-info' is already inside a different `ignore-errors', so it
will signal an error, but that error will be ignored and the file skipped.

I'm not attached to any particular way this bug is fixed. Please adjust it
yourself, the patch is only an example of how it could be done. This will
be faster than if we try to negotiate the best way and recreate the patch.

BTW, the bug being reproducible only in 50% of the cases makes it even more
important to be fixed from my point of view. Nothing is worse than
unspecified behavior when it's not justified by reasons like huge
performance gain in my opinion.

Paul

On Tue, 26 May 2020 at 04:07, Stefan Kangas <stefankangas@gmail.com> wrote:

> Paul Pogonyshev <pogonyshev@gmail.com> writes:
>
> > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> > index 9a6d1d7319..99ba5d7107 100644
> > --- a/lisp/emacs-lisp/package.el
> > +++ b/lisp/emacs-lisp/package.el
> > @@ -1181,7 +1181,9 @@ package-dir-info
> >              info)
> >          (while files
> >            (with-temp-buffer
> > -            (insert-file-contents (pop files))
> > +            ;; Skip unreadable files, e.g. locks for unsaved `.el'
> > +            ;; buffers (bug#41489).
> > +            (ignore-errors (insert-file-contents (pop files)))
> >              ;; When we find the file with the data,
> >              (when (setq info (ignore-errors (package-buffer-info)))
> >                ;; stop looping,
>
> Do we really want to ignore *any* error from insert-file-contents here?
>
> Should we really run package-buffer-info if inserting the file fails?
> Won't that reach (error "Package lacks a file header") and signal an
> error anyways, just a different and more cryptic one?
>
> Best regards,
> Stefan Kangas
>

[-- Attachment #2: Type: text/html, Size: 2929 bytes --]

  reply	other threads:[~2020-05-26  6:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-23 17:50 bug#41489: `package-dir-info' fails on a directory with a non-saved file Paul Pogonyshev
2020-05-23 18:23 ` Eli Zaretskii
2020-05-23 18:37   ` Paul Pogonyshev
2020-05-25 22:55     ` Paul Pogonyshev
2020-05-26  2:07       ` Stefan Kangas
2020-05-26  6:54         ` Paul Pogonyshev [this message]
2020-05-26  8:51           ` Stefan Kangas
2021-12-05  1:13 ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAG7BpaosTeDdygKr5ibo+sVRKdo8p=TknEMxOm=K15Asyd-ftg@mail.gmail.com' \
    --to=pogonyshev@gmail.com \
    --cc=41489@debbugs.gnu.org \
    --cc=stefankangas@gmail.com \
    /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 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).