From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filipp Gunbin Newsgroups: gmane.emacs.help Subject: Re: problems importing keys via epa-search-keys Date: Mon, 13 Mar 2023 15:37:31 +0300 Message-ID: References: <87zg8mz998.fsf@xelera.eu> <83mt4jycxt.fsf@gnu.org> <83o7oyv5qd.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3733"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: help-gnu-emacs@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 13 13:38:04 2023 Return-path: Envelope-to: geh-help-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 1pbhRD-0000hs-Ie for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 13 Mar 2023 13:38:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbhQv-0003Ub-O2; Mon, 13 Mar 2023 08:37:45 -0400 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 1pbhQr-0003T7-Ei for help-gnu-emacs@gnu.org; Mon, 13 Mar 2023 08:37:41 -0400 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbhQp-0006W4-77; Mon, 13 Mar 2023 08:37:41 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 7B0EC5C0172; Mon, 13 Mar 2023 08:37:35 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 13 Mar 2023 08:37:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1678711055; x=1678797455; bh=0q y2dJW6jf4BEEPpVvjEOIPOUpoGxW8scjKBVTrgqzc=; b=XKTIuXO6F3QtqPHrwB srXIGBJf7SBPn8T6lghCjmJNkMBOEXfMzrXLkEefoB3JwXmZ2OSGQ9esAAUtcWb8 wliiWyia0R7Dqy83fdCY//mQJnl0cbGhLdQZ4Fded/7vGDSN8ljztPIFc9WlkFOQ VCFdVNK/4mcLKoJ93okmUFqGGJe6zb62cJa6qRFRJnVtD+qGG8yPXxEim8+C1zjo wIrcJwXYbTIOuNI1TfbRJOAc0SFG/O9oTKJHe4vyy0aBLlh4SgLP0IzcKhVoXW40 CpU5ni30GSVbG2cR7/FUOZ5TjGczUkpM3WcrvtH+TDF3F0CBBpevviyFCxHjqmIY pEyQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1678711055; x=1678797455; bh=0qy2dJW6jf4BE EPpVvjEOIPOUpoGxW8scjKBVTrgqzc=; b=a7TJlATu1mVzApevCV76UqTHU6jXO Emp0qn4ttdAMwt3GDG0n0/wiQA1GLs2CY0RIaS4KGxOTOCJJWjvOw7YPC/GI261d HsdBH5DbC42PRFvFZ93tEyqyI0jKrXMnbj1AHI0D5VQQuz3TTFqMI69Zn4hIZ3Dp nJgfN4HPXN5u3nh/qVkwBA0gO0cuCM1ZCHJgYcqcfFrqVpHPoA84EtsFWV23BuHw sak5+aC421AP63vZdZT3+Wf5ML1Waw3NnWF3q9JL4g0rkx4dLsE9IM7N5p1i8Uju MxdjyriWggGFwBjra2rF35pfz/4JVko8Y/p11EqPlDBSEeEOAdZ+4CEww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvgedggeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffgffkfggtgesthdtredttdertdenucfhrhhomhephfhilhhi phhpucfiuhhnsghinhcuoehfghhunhgsihhnsehfrghsthhmrghilhdrfhhmqeenucggtf frrghtthgvrhhnpeffhfejveeiieeiudetgfehffelieevfeeffedtkeelheeludefueeu udehveeiffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehfghhunhgsihhnsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Feedback-ID: id48c41f1:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Mar 2023 08:37:34 -0400 (EDT) In-Reply-To: <83o7oyv5qd.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 12 Mar 2023 08:33:30 +0200") Mail-Followup-To: Eli Zaretskii , help-gnu-emacs@gnu.org Received-SPF: pass client-ip=66.111.4.29; envelope-from=fgunbin@fastmail.fm; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143015 Archived-At: On 12/03/2023 08:33 +0200, Eli Zaretskii wrote: >> From: Filipp Gunbin >> Cc: help-gnu-emacs@gnu.org >> Date: Sun, 12 Mar 2023 02:04:21 +0300 >> >> On 11/03/2023 09:17 +0200, Eli Zaretskii wrote: >> >> > It's a regression that existed since Emacs 28.1, right? So its fix >> > should try to avoid changing APIs. Therefore, please try to make a >> > change that leaves the signature of epa-ks--query-url unchanged, I >> > think it should be easy in this case. (Yes, I know it's an internal >> > function, but that doesn't mean we can change the signature when we >> > can avoid that.) >> >> Yes, since 28.1. The updated patch is below. >> >> But why an internal function is part of API? Don't we assume that >> anyone using them is doing so at their own risk? In this case the >> default for operation is "index" (to preserve compatibility), but it's >> better here to not have the default value at all. > > I agree that we can break the API if we need, but we don't need to, > and it is always better to keep the signature unless it's impossible. Thanks, noted. > So please modify your patch to leave the signature intact, I don't > think it's hard in this case. But I did in the last patch? There's now an optional parameter, which preserves API compatibility. Or did you mean something else? For convenience, I post the patch again below. I still need your decision where to install this - master or emacs-29. >> > P.S. And why are you posting patches and their discussion here, not on >> > the bug tracker? >> >> Because OP wrote here? And we didn't open a bug for this. Should we, >> even for such simple fixes? > > It's better, because then the discussion is recorded and referenced in > the commit. Noted. Thanks. diff --git a/lisp/epa-ks.el b/lisp/epa-ks.el index 77d896fa438..015bf910ac6 100644 --- a/lisp/epa-ks.el +++ b/lisp/epa-ks.el @@ -140,8 +140,8 @@ epa-ks-do-key-to-fetch (epa-ks--fetch-key id))))) (tabulated-list-clear-all-tags)) -(defun epa-ks--query-url (query exact) - "Return URL for QUERY. +(defun epa-ks--query-url (query exact &optional operation) + "Return URL for QUERY and OPERATION (defaults to \"index\"). If EXACT is non-nil, don't accept approximate matches." (format "https://%s/pks/lookup?%s" (cond ((null epa-keyserver) @@ -154,13 +154,13 @@ epa-ks--query-url (url-build-query-string (append `(("search" ,query) ("options" "mr") - ("op" "index")) + ("op" ,(or operation "index"))) (and exact '(("exact" "on"))))))) (defun epa-ks--fetch-key (id) "Send request to import key with specified ID." (url-retrieve - (epa-ks--query-url (concat "0x" (url-hexify-string id)) t) + (epa-ks--query-url (concat "0x" (url-hexify-string id)) t "get") (lambda (status) (when (plist-get status :error) (error "Request failed: %s" @@ -236,7 +236,7 @@ epa-search-keys (erase-buffer)) (epa-ks-search-mode)) (url-retrieve - (epa-ks--query-url query exact) + (epa-ks--query-url query exact "index") (lambda (status) (when (plist-get status :error) (when buf