Skip to content
Jonas Bernoulli edited this page Apr 23, 2022 · 1 revision

Emacs Bugs resulting in BUG: missing headers

There are two bugs in Emacs that cause url.el to return an empty buffer to ghub, lacking even response headers. The first of these bugs is fixed in Emacs 26.3 but the second is only fixed on Emacs’ master branch.

Both of these bugs were discussed in issue #81 and elsewhere.

Nowadays both bugs result in an error message like this:

BUG: missing headers; but there's a patch for that
see https://github.com/magit/ghub/wiki/Known-Issues

In the past that would have looked like:

ghub--handle-response-headers: BUG: missing headers
  See https://github.com/magit/ghub/issues/81.
  url: https://example/api/v4/projects/9/issues/154/notes?per_page=100
  headers: 0
  status: nil
  buffer: #<buffer  *http example.com:443*-141010>

First Emacs Bug

In Emacs versions before 26.3 there is a bug that often but not always causes network connections to fail when using TLS1.3.

It is best to update to at least Emacs 26.3 to avoid this problem, but if you don’t, then Ghub by default automatically enables a workaround.

Whether this workaround is used is controlled by the variable ghub-use-workaround-for-emacs-bug.

The workaround works by binding gnutls-algorithm-priority to "NORMAL:-VERS-TLS1.3" in ghub--retrieve around the call to url-retrieve or url-retrieve-synchronously. If you would like to use the same kludge for other uses of these functions, then you have to set this variable globally to the mentioned value.

There have been reports that on macOS the issue persists after updating to Emacs 26.3 and so on macOS we enabled the workaround for this issue even on newer releases. It is now believed that the users who reported that were instead affected by the second bug, so we no longer automatically enable this workaround for macOS users who use Emacs 26.3.

See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23225 and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341 for details about this bug and https://github.com/magit/ghub/issues/81 for how our understanding evolved.

Second Emacs Bug

Currently there is no Emacs release that contains a fix for the second bug. It currently is only fixed on Emacs’ master branch.

The first release expected to fix this issue is 29.1. Because that is not going to be released any time soon, Ghub by default backports the fix.

Whether the backport is used is controlled by the variable ghub-use-workaround-for-emacs-bug-54989. To disable the backport, this variable has to be set to nil before ghub is loaded.

See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54989 for details about this bug and https://github.com/magit/ghub/issues/81 for how our understanding evolved.

More Emacs Bugs

Okay this wasn’t the full truth—there are actually two more Emacs bugs that Ghub has to monkey patch. They are not related to the bugs above or to each other and if necessary the respective kludges are enabled unconditionally.

If you want to learn more about these two additional bugs, see auth-source-netrc-parse-next-interesting@save-match-data and url-http-handle-authentication@unauthorized-bugfix, which are defined, if necessary, near the end of ghub.el.

Github Errors

See https://github.com/magit/ghub/wiki/Github-Errors.