[core] Better work-around for GnuTLS bug with emacs 26.1 and 26.2

Use the variable libgnutls-version.
Thanks to CJex.
This commit is contained in:
syl20bnr 2019-09-14 22:15:53 -04:00
parent f97c0ae6c1
commit 42cc5f25f3
1 changed files with 5 additions and 14 deletions

View File

@ -21,20 +21,11 @@
"need the TLS work-around...")
emacs-version)
(message "More info at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341")
(let ((stime (current-time)))
(with-temp-buffer
(ignore-errors (call-process "gnutls-cli" nil t nil "--version"))
(unless (string-empty-p (buffer-string))
(goto-char (point-min))
(let ((gnutls-version-line (thing-at-point 'line t)))
(when (string-match ".*\\([0-9]+\\.[0-9]+\\.[0-9]+\\).*"
gnutls-version-line)
(let ((gnutls-version (match-string 1 gnutls-version-line)))
(unless (version<= gnutls-version "3.6.3")
(message (concat "Your Emacs version %s and GnutTLS version %s "
"need the work-around, applying it...")
emacs-version gnutls-version)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")))))))))
(unless (<= libgnutls-version 30603)
(message (concat "Your Emacs version %s and GnutTLS version %s "
"need the work-around, applying it...")
emacs-version libgnutls-version)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")))
(when (version< emacs-version "26")
;; backport fix for macOS battery status