From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#61411: [PATCH] Handle a case where url-basic-auth can crash Date: Thu, 02 Mar 2023 14:37:12 +0200 Message-ID: <83a60ve3d3.fsf@gnu.org> References: <83sfetj8p2.fsf@gnu.org> <7d66200bf9f7541a75484418fa3474ac@elken.dev> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22286"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61411-done@debbugs.gnu.org To: me@elken.dev Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 02 13:57:36 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXiV6-0005b1-0b for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Mar 2023 13:57:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXiCj-0001GF-JS; Thu, 02 Mar 2023 07:38:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXiCC-0000wu-E9 for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2023 07:38:11 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXiCA-0005K4-L8 for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2023 07:38:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pXiCA-0006jo-6u for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2023 07:38:02 -0500 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Mar 2023 12:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 61411 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 61411@debbugs.gnu.org, eliz@gnu.org, me@elken.dev Original-Received: via spool by 61411-done@debbugs.gnu.org id=D61411.167776064925852 (code D ref 61411); Thu, 02 Mar 2023 12:38:01 +0000 Original-Received: (at 61411-done) by debbugs.gnu.org; 2 Mar 2023 12:37:29 +0000 Original-Received: from localhost ([127.0.0.1]:56058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXiBd-0006it-FJ for submit@debbugs.gnu.org; Thu, 02 Mar 2023 07:37:29 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40492) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXiBb-0006ig-67 for 61411-done@debbugs.gnu.org; Thu, 02 Mar 2023 07:37:27 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXiBV-000546-CA; Thu, 02 Mar 2023 07:37:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=CzvvHVj+oYt1mPAD6L0l5D4cxmKjRN8Jm5EtWmR2Kw4=; b=iUM3aEQqHRvu Ce0EDou6sh/p7x6IwkRaBdVMulxkrCyLMlceBYqorwgWZJkH4VZylDHsxesvy6z8PdDea+WLJBmEo psXUVkKBKTBFiVBBxxY5zwP5K8dHojkpFX1mLoUt5Qddnf3QCaIUewOn4eSMbxyJQ2nvmPnxc5CsP GOnnDmucft7UAjTPPsb9K7MEqpffzu4HMFhNlHw95Ry5zkik2Yt39KnJEcamujBfKZj05/aqNpc+j GJJNqlhneaLdS2jPubbUlJS7jkxCbHMacXiRQ1VpmcHDlEVNOlrLYBbwkeqNnJS38qUnznlW+B5hA 7RVowqsaKksTheIKT/NIrw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXiBR-0001iu-OQ; Thu, 02 Mar 2023 07:37:21 -0500 In-Reply-To: <7d66200bf9f7541a75484418fa3474ac@elken.dev> (me@elken.dev) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:257150 Archived-At: > Date: Sun, 26 Feb 2023 08:52:31 +0000 > From: me@elken.dev > Cc: 61411@debbugs.gnu.org > > Thanks for responding; I incorrectly assumed because the patch was so > trivial my description was enough. My bad! > > Below is a snippet of elisp that when `M-x eval-buffer`'d crashes an > `emacs -Q` and causes an `emacs -Q -l repro.el` to freeze indefinitely > on e444115d026c809395d4d248a99bb467bc87bb1d > > (require 'url) > (eval-when-compile (require 'cl-lib)) > > (cl-defun send-request (endpoint &key verb data headers noninteractive > json noauth sync callback) > (let* ((url-request-method (or verb "GET")) > (url-cookie-trusted-urls '(".*")) > (url-request-noninteractive noninteractive) > (url-request-extra-headers > `(("Referer" . ,endpoint) > ("X-CSRF-TOKEN" . nil) > ("Cookie" . nil))) > (url-request-data data)) > (if sync > (with-current-buffer (url-retrieve-synchronously endpoint) > (funcall (or callback #'identity) url-http-response-status)) > (url-retrieve > endpoint > (or callback #'identity))))) > > (send-request "https://httpstat.us/401" :noninteractive t :sync t) > > The linked API is a simple service used to return various status codes, > in this instance always a 401 regardless of what authentication is > passed. > > I'm not sure if my patch is the best catch-all solution to the > underlying issue (I confess, I don't fully understand why this crashes). > With my simple patch applied though, Emacs continues as expected. > > I hope this is enough information now, I apologize for the poor initial > report. As I already had a patch ready, I didn't think I should have > used `M-x report-emacs-bug` but I will in future :) Thanks, I fixed this in a slightly different manner on the emacs-29 branch, and I'm therefore closing this bug.