> 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