-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
First, thank you for pr-review, it's a pleasure to use, and miles better than the Github interface!
I've been facing an intermittent bug where pr-review command fails because of a parsing error in ghub--handle-response-headers:
Recipe:
- Run
M-x pr-reviewand provide a url - Produces the error
Invalid search bound (wrong side of point).
Backtrace:
Click to expand
Debugger entered--Lisp error: (error "Invalid search bound (wrong side of point)")
(re-search-forward "^\\([^:]*\\): \\(.+\\)" #<marker at 1 in *http api.github.com:443*> t)
(while (re-search-forward "^\\([^:]*\\): \\(.+\\)" url-http-end-of-headers t) (setq headers (cons (cons (match-string 1) (match-string 2)) headers)))
(let (headers) (if (memq url-http-end-of-headers '(nil 0)) (progn (if url-debug nil (setq url-debug t)) (error "BUG: Missing headers in response buffer %s" (current-buffer)))) (goto-char (point-min)) (forward-line 1) (while (re-search-forward "^\\([^:]*\\): \\(.+\\)" url-http-end-of-headers t) (setq headers (cons (cons (match-string 1) (match-string 2)) headers))) (setq headers (nreverse headers)) (goto-char (1+ url-http-end-of-headers)) (if (and req (or (progn (or (progn (and ... t)) (signal 'wrong-type-argument (list ... req))) (aref req 11)) (progn (or (progn (and ... t)) (signal 'wrong-type-argument (list ... req))) (aref req 12)))) (set (make-local-variable 'ghub-response-headers) headers) (progn (set-default 'ghub-response-headers headers))) headers)
(ghub--handle-response-headers (:peer (:certificates ((:version 3 :serial-number "2a:..." :issuer "C=GB,ST=Greater Manchester,L=Salford,O=Sectigo Lim..." :valid-from "2025-02-05" :valid-to "2026-02-05" :subject "CN=*.github.com" :public-key-algorithm "EC/ECDSA" :certificate-security-level "High" :signature-algorithm "ECDSA-SHA256" :public-key-id "sha1:..." :certificate-id "sha1:..." :pem "-----BEGIN CERTIFICATE-----\nMIIE...") (:version 3 :serial-number "00:..." :issuer "C=US,ST=New Jersey,L=Jersey City,O=The USERTRUST N..." :valid-from "2018-11-02" :valid-to "2030-12-31" :subject "C=GB,ST=Greater Manchester,L=Salford,O=Sectigo Lim..." :public-key-algorithm "EC/ECDSA" :certificate-security-level "High" :signature-algorithm "ECDSA-SHA384" :public-key-id "sha1:..." :certificate-id "sha1:..." :pem "-----BEGIN CERTIFICATE-----\n..."..." :issuer "C=GB,ST=Greater Manchester,L=Salford,O=Comodo CA L..." :valid-from "2019-03-12" :valid-to "2028-12-31" :subject "C=US,ST=New Jersey,L=Jersey City,O=The USERTRUST N..." :public-key-algorithm "EC/ECDSA" :certificate-security-level "Ultra" :signature-algorithm "RSA-SHA384" :public-key-id "sha1:..." :certificate-id "sha1:..." :pem "-----BEGIN CERTIFICATE-----\nMIID...")) :certificate (:version 3 :serial-number "2a:..." :issuer "C=GB,ST=Greater Manchester,L=Salford,O=Sectigo Lim..." :valid-from "2025-02-05" :valid-to "2026-02-05" :subject "CN=*.github.com" :public-key-algorithm "EC/ECDSA" :certificate-security-level "High" :signature-algorithm "ECDSA-SHA256" :public-key-id "sha1:..." :certificate-id "sha1:..." :pem "-----BEGIN CERTIFICATE-----\nMIIE...") :key-exchange "ECDHE-RSA" :protocol "TLS1.3" :cipher "AES-128-GCM" :mac "AEAD" :encrypt-then-mac nil)) #s(ghub--req :url #s(url :type "https" :user nil :password nil :host "api.github.com" :portspec nil :filename "/repos/karthink/gptel/compare/4b50..." :target nil :attributes nil :fullness t :silent nil :use-cookies t :asynchronous nil) :forge nil :silent nil :method "GET" :headers #f(compiled-function () #<bytecode -0x1e7e04aea6df6602>) :handler ghub--handle-response :unpaginate nil :noerror nil :reader ghub--decode-payload :buffer #<buffer *pr-review karthink/gptel/767*> :callback nil :errorback nil :value nil :extra nil))
(ghub--handle-response (:peer (:certificates ((:version 3 :serial-number "2a:..." :issuer "C=GB,ST=Greater Manchester,L=Salford,O=Sectigo Lim..." :valid-from "2025-02-05" :valid-to "2026-02-05" :subject "CN=*.github.com" :public-key-algorithm "EC/ECDSA" :certificate-security-level "High" :signature-algorithm "ECDSA-SHA256" :public-key-id "sha1:..." :certificate-id "sha1:..." :pem "-----BEGIN CERTIFICATE-----\nMIIE...") (:version 3 :serial-number "00:..." :issuer "C=US,ST=New Jersey,L=Jersey City,O=The USERTRUST N..." :valid-from "2018-11-02" :valid-to "2030-12-31" :subject "C=GB,ST=Greater Manchester,L=Salford,O=Sectigo Lim..." :public-key-algorithm "EC/ECDSA" :certificate-security-level "High" :signature-algorithm "ECDSA-SHA384" :public-key-id "sha1:..." :certificate-id "sha1:..." :pem "-----BEGIN CERTIFICATE-----\nMIID...") (:version 3 :serial-number "56:..." :issuer "C=GB,ST=Greater Manchester,L=Salford,O=Comodo CA L..." :valid-from "2019-03-12" :valid-to "2028-12-31" :subject "C=US,ST=New Jersey,L=Jersey City,O=The USERTRUST N..." :public-key-algorithm "EC/ECDSA" :certificate-security-level "Ultra" :signature-algorithm "RSA-SHA384" :public-key-id "sha1:..." :certificate-id "sha1:..." :pem "-----BEGIN CERTIFICATE-----\nMIID...")) :certificate (:version 3 :serial-number "2a:..." :issuer "C=GB,ST=Greater Manchester,L=Salford,O=Sectigo Lim..." :valid-from "2025-02-05" :valid-to "2026-02-05" :subject "CN=*.github.com" :public-key-algorithm "EC/ECDSA" :certificate-security-level "High" :signature-algorithm "ECDSA-SHA256" :public-key-id "sha1:..." :certificate-id "sha1:..." :pem "-----BEGIN CERTIFICATE-----\nMIIE...") :key-exchange "ECDHE-RSA" :protocol "TLS1.3" :cipher "AES-128-GCM" :mac "AEAD" :encrypt-then-mac nil)) #s(ghub--req :url #s(url :type "https" :user nil :password nil :host "api.github.com" :portspec nil :filename "/repos/karthink/gptel/compare/4b50..." :target nil :attributes nil :fullness t :silent nil :use-cookies t :asynchronous nil) :forge nil :silent nil :method "GET" :headers #f(compiled-function () #<bytecode -0x1e7e04aea6df6602>) :handler ghub--handle-response :unpaginate nil :noerror nil :reader ghub--decode-payload :buffer #<buffer *pr-review karthink/gptel/767*> :callback nil :errorback nil :value nil :extra nil))
(ghub--retrieve nil #s(ghub--req :url #s(url :type "https" :user nil :password nil :host "api.github.com" :portspec nil :filename "/repos/karthink/gptel/compare/4b50..." :target nil :attributes nil :fullness t :silent nil :use-cookies t :asynchronous nil) :forge nil :silent nil :method "GET" :headers #f(compiled-function () #<bytecode -0x1e7e04aea6df6602>) :handler ghub--handle-response :unpaginate nil :noerror nil :reader ghub--decode-payload :buffer #<buffer *pr-review karthink/gptel/767*> :callback nil :errorback nil :value nil :extra nil))
(ghub-request "GET" "/repos/karthink/gptel/compare/4b50..." nil :headers (("Accept" . "application/vnd.github.v3.diff")) :reader ghub--decode-payload :auth emacs-pr-review :username nil :host nil)
(pr-review--fetch-compare "4b505e72e9ad0cdbf800457996a4b85c6cb68519" "1e9fbbe53c55e4ef4d6f2596c04b50a8cb358cbf")
(pr-review--fetch-compare-cached "4b505e72e9ad0cdbf800457996a4b85c6cb68519" "1e9fbbe53c55e4ef4d6f2596c04b50a8cb358cbf")
(pr-review--refresh-internal)
(pr-review-refresh)
(pr-review-open "karthink" "gptel" 767 nil nil nil)
(pr-review "https://github.com/karthink/gptel/pull/767" nil)
(funcall-interactively pr-review "https://github.com/karthink/gptel/pull/767" nil)
(command-execute pr-review record)
(execute-extended-command nil "pr-review" nil)
(funcall-interactively execute-extended-command nil "pr-review" nil)
(command-execute execute-extended-command)This fails because url-http-end-of-headers is not set (or set to 1) in one of the buffers that ghub--handle-response-headers is called in. This buffer is named *http api.github.com:443*, attached here:
Info:
- Emacs 29.4
ghubversion4.2.1, commit077e339bd714a0b8cafcb4ce2b9ec684b0509022pr-reviewversion 0.1, commit6b3895c7919762b87a57e4373920ff3592e4a696
Remarks:
This error is intermittent, it fails about 30% of the time for me.
Please let me know if there's more information I can provide to help.
Metadata
Metadata
Assignees
Labels
No labels