From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?=C3=93scar?= Fuentes Newsgroups: gmane.emacs.bugs Subject: bug#36834: 27.0.50; [PATCH] password-cache.el: confuses key absence with nil password Date: Mon, 29 Jul 2019 16:12:45 +0200 Message-ID: <87wog1rkte.fsf@telefonica.net> References: <875znltof0.fsf@telefonica.net> <87v9vlck5a.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="247722"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Stefan Monnier , 36834@debbugs.gnu.org To: "Basil L. Contovounesios" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 29 16:13:21 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hs6Ov-0012KC-AZ for geb-bug-gnu-emacs@m.gmane.org; Mon, 29 Jul 2019 16:13:21 +0200 Original-Received: from localhost ([::1]:52494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hs6Ou-00017i-B2 for geb-bug-gnu-emacs@m.gmane.org; Mon, 29 Jul 2019 10:13:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53081) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hs6Od-0000s3-Fo for bug-gnu-emacs@gnu.org; Mon, 29 Jul 2019 10:13:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hs6Oc-00035b-HD for bug-gnu-emacs@gnu.org; Mon, 29 Jul 2019 10:13:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40040) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hs6Oc-00035W-EN for bug-gnu-emacs@gnu.org; Mon, 29 Jul 2019 10:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hs6Oc-0001FG-7y for bug-gnu-emacs@gnu.org; Mon, 29 Jul 2019 10:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=C3=93scar?= Fuentes Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Jul 2019 14:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36834 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 36834-submit@debbugs.gnu.org id=B36834.15644095814779 (code B ref 36834); Mon, 29 Jul 2019 14:13:02 +0000 Original-Received: (at 36834) by debbugs.gnu.org; 29 Jul 2019 14:13:01 +0000 Original-Received: from localhost ([127.0.0.1]:48861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hs6OZ-0001Ez-Tw for submit@debbugs.gnu.org; Mon, 29 Jul 2019 10:13:00 -0400 Original-Received: from relayout01-redir.e.movistar.es ([86.109.101.201]:16861) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hs6OX-0001Ej-1Z for 36834@debbugs.gnu.org; Mon, 29 Jul 2019 10:12:58 -0400 Original-Received: from sky (162.red-79-151-6.dynamicip.rima-tde.net [79.151.6.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: 981711563@telefonica.net) by relayout01.e.movistar.es (Postfix) with ESMTPSA id 45y1qM6zC5zfb8y; Mon, 29 Jul 2019 16:12:46 +0200 (CEST) In-Reply-To: <87v9vlck5a.fsf@tcd.ie> (Basil L. Contovounesios's message of "Mon, 29 Jul 2019 09:36:17 +0100") X-CTCH-Score: 0.000 X-CTCH-ScoreCust: 0.000 X-TnetOut-Country: IP: 79.151.6.162 | Country: ES X-TnetOut-Information: AntiSPAM and AntiVIRUS on relayout01 X-TnetOut-MsgID: 45y1qM6zC5zfb8y.A9687 X-TnetOut-SpamCheck: no es spam, Unknown X-TnetOut-From: ofv@wanadoo.es X-TnetOut-Watermark: 1565014369.12494@uWr3Cl82H/TluDD2FlvZCw X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164033 Archived-At: "Basil L. Contovounesios" writes: >> The change uses gethash instead of intern-soft, but those functions act >> differently when the password (the value associated with the key) was >> nil. > > Is it valid for the password to be nil? The logic in password-read > suggests otherwise. Callers are sending nil. If it is not valid, there is a problem elsewhere, but my understanding is that a nil password means "no password" and it is cached in the memoization sense. >> The effect is that every call to password-cache-add with nil as >> password creates a new timer, > > Where is password-cache-add being passed a nil password? The caller is auth-source-remember, IIRC, which itself is called from auth-source-search. >> and password-in-cache-p returns nil if >> there exists a (key nil) entry on password-data, when previously it >> would return non-nil. > > I think a nil key is also not expected. (key nil) means a hash table entry with `key' as key and nil as value, not that key is nil. > Note that password-in-cache-p is currently identical to > password-read-from-cache. One can probably be written in terms of the > other. Yes, right now they are identical, which causes a problem, because checking for key existence shall not be the same as retrieving the value when value can be nil. > Even if these "memhash" checks are TRT, I suggest either reusing or > copying the hash table method of map-contains-key, rather than comparing > against an interned symbol. Is map-contains-key available by default? I'm wary of introducing new dependencies for saving just a few characters.