Subject: Re: bug#41000: 28.0.50; Package file(.el) is 0 bytes after downloading

From: Stefan Kangas <[email-masked]>
Date: Sun, 03 May 2020 22:15:13 +0200

Hi,

[email-masked] writes:

> After downloading a package using `package-install` or automatically at
> startup through `leaf` or `use-package`, I sometimes get an Emacs Lisp
> file of size 0 bytes only. When I try to use `M-x load-library
> zero-bytes-package` it loads fine but the related definitions(variables
> and functions) are not loaded into the interpreter i.e. `M-x` or `C-h
> v`
> or `C-h f`. The package manager is very dumb and only reports a void
> definition error when a related configuration is loaded at startup.

Thanks for the bug report.

Do you have a recipe for reproducing this issue?  Or does it happen
only sporadically?  Can you reproduce it under "emacs -Q"?

FWIW, I can't remember having seen anything like that myself.

> Suggestions:
>
> 1. There should be hash checking mechanism after package download so
>    that a corrupted file can be detected earlier and can be
>    re-downloaded.

Agreed, and for other reasons as well.  See Bug#19565:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19565

I have a patch there which no one has commented on.  As soon as its
reviewed and any outstanding issues are addressed, it should only be a
matter of writing the documentation before it could go in, I think.

> 2. Another option would be to re-download a 0 bytes emacs lisp package.
>    The issue would be that a partially downloaded package might go
>    unnoticed which will be a rare case anyway. I haven't found such a
>    case personally.

Yes, it would probably be a good idea to add a check for that.  It
should be easier to do than the above, in any case.

Best regards,
Stefan Kangas