GNU bug report logs - #38284
27.0.50; [PATCH] Make auth-source-pass-search understand port lists

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: João Távora <joaotavora@HIDDEN>; Keywords: patch; dated Wed, 20 Nov 2019 00:22:05 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug Marked as fixed in versions 27.1. Request was from João Távora <joaotavora@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 38284 <at> debbugs.gnu.org:


Received: (at 38284) by debbugs.gnu.org; 22 Nov 2019 09:35:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 22 04:35:56 2019
Received: from localhost ([127.0.0.1]:53751 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iY5M4-0000ch-Bb
	for submit <at> debbugs.gnu.org; Fri, 22 Nov 2019 04:35:56 -0500
Received: from mail-wr1-f47.google.com ([209.85.221.47]:39575)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1iY5M1-0000cS-BB
 for 38284 <at> debbugs.gnu.org; Fri, 22 Nov 2019 04:35:53 -0500
Received: by mail-wr1-f47.google.com with SMTP id y11so4657352wrt.6
 for <38284 <at> debbugs.gnu.org>; Fri, 22 Nov 2019 01:35:53 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=C7RULRsMH75Zz9g3PaW8FFpZiir+DUOR3lYnYvJ5hxU=;
 b=gndpad29WZoF7NTyTX5PjZePTfVlyancOnW8p+jM7zzMO3NejHg4nHd7Uo2rHKvusn
 XdLK498NbAsG+bHxwj3M5QvQr+gYUcjxmMkLhkWWbNb40zoQVojg0pEXKHZ0cPmiYJta
 cT2jaJR2XOt0DbK0pgn5atmlXyh4LwExeOTIiaUTCEPBwXcLbzX1MiKBF+sSB7skKjr7
 dmXWrAt7kn3f7QX3evWKNScZYB63kPK4NS3JgVcLM6gE7E5cq9UnEFJSH6w3POyAHoUc
 G02M4PwH4FptKDhdUylbxCWQUgrN8Fe6VLME9K1oCSnSjQecGD8soo1VyzptrSkYo0QK
 vItQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=C7RULRsMH75Zz9g3PaW8FFpZiir+DUOR3lYnYvJ5hxU=;
 b=g6Lrb7ym6sN+jFsKvz2Ku+VSmvt+glnLQ6wdCPIxBfdjXh9FMt2u4Sd/z6ZBkaKOMy
 Cu0EBO1nIpIgfJziIFVsbcDKq2nWIWa17HANfxBMeNBGFYaS7Kul4PX9os7epxLEeCRa
 ubRQ2ebkHHzIEjmSqlHH7n2H3WqnMNRNRu/ZFviSQTZE53MO+4a7fnNk+9xbc5gUWl5e
 bM2+W2l9bt69Hzp+EkrnY/PcPLqRW+E7JnbZlcsrU+do+nKCIF/5OeoKRZk2itnm5oUf
 taHjAc1c3O/ks5hq+TrhiUS8n/+WkqmTTjA/yUOayUkRSVqwzyq4o0pyOJNARfPcCBMy
 2IYw==
X-Gm-Message-State: APjAAAUjlw+piVMVEUgZ+2uE8zLP/W12HuLqk6Ib/h6LOHM+CWlL+07y
 m3a+se8j4RrItoSnXgZs+O8=
X-Google-Smtp-Source: APXvYqwtfrj/4riWtT0Kxq74B16n+3SfUW00oWnc2ODFraNRs/58u0V9uWTexywK/gxpOi+ek4BhnQ==
X-Received: by 2002:a5d:460b:: with SMTP id t11mr17091598wrq.185.1574415347385; 
 Fri, 22 Nov 2019 01:35:47 -0800 (PST)
Received: from lolita.yourcompany.com
 ([2001:818:d820:9500:1ebb:afd8:ab26:f0f6])
 by smtp.gmail.com with ESMTPSA id s8sm6591623wrt.57.2019.11.22.01.35.45
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 22 Nov 2019 01:35:45 -0800 (PST)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Damien Cassou <damien@HIDDEN>
Subject: Re: bug#38284: 27.0.50; [PATCH] Make auth-source-pass-search
 understand port lists
References: <87ftijz9df.fsf@HIDDEN> <874kyxt78p.fsf@HIDDEN>
 <CALDnm53fsq6QBfLVQkpsY=et4T0zj8zUEPdPaWfSKzf0bgPVmQ@HIDDEN>
 <87lfs8thwv.fsf@HIDDEN>
Date: Fri, 22 Nov 2019 09:35:38 +0000
In-Reply-To: <87lfs8thwv.fsf@HIDDEN> (Damien Cassou's message of "Fri, 22
 Nov 2019 09:49:20 +0100")
Message-ID: <87lfs8b6dx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38284
Cc: 38284 <at> debbugs.gnu.org, Nicolas Petton <nicolas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Damien Cassou <damien@HIDDEN> writes:

> Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes:
>>> can you please rename "d" to "domain"?
>>
>> ok.  I do call your attention that it was already the
>> single letter n there
>
> yes I saw. This should never have been merged like that. Thank you for
> improving the code.

I think the single letter idiom is fine there.  It was just the wrong
letter.  By the way, I've left the p for the port, because calling it
"port", while it would work, would seriously confuse a reader.

>>> Can you please add a unit test covering this new use-case?
>>
>> No. This is too much work for such a trivial change
>
> I care a lot about the automated testing of the code I write.

Certainly, I care a lot, too.  I don't write tests for these changes out
of principle, not out of lazyness.  Most, if not all, the projects I
manage have automated tests.

> I won't try to convince you though. Can you please merge the attached
> patch with yours?

No, but you can do that, because it's your work (I can push it for you
though).  Anyway, now I read the test you wrote, I agree it's a good
test.  You are testing auth-source-pass-match-entry-p, much higher up
than auth-source-pass--generate-entry-suffixes, the function I changed.

Of course, only someone who was involved in the design would be able to
confidently place the tests at that correct level, the finding of which
is the most difficult part.

My advice and personal opinion is to later use this and more such tests
to perhaps redesign/cleanup the auth-source-pass.el library, which seems
needlessly complicated in the little stuff like the function I touched.
(to be fair it wasn't much helped by the style of the auth-source.el
parent library.)

Jo=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38284; Package emacs. Full text available.

Message received at 38284 <at> debbugs.gnu.org:


Received: (at 38284) by debbugs.gnu.org; 22 Nov 2019 08:49:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 22 03:49:28 2019
Received: from localhost ([127.0.0.1]:53732 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iY4d6-0007zW-HH
	for submit <at> debbugs.gnu.org; Fri, 22 Nov 2019 03:49:28 -0500
Received: from mail.choca.pics ([62.210.108.126]:39896)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <damien@HIDDEN>) id 1iY4d3-0007zM-1n
 for 38284 <at> debbugs.gnu.org; Fri, 22 Nov 2019 03:49:25 -0500
Received: from localhost (localhost.localdomain [IPv6:::1])
 by mail.choca.pics (Postfix) with ESMTP id 8AC34F1C3C2;
 Fri, 22 Nov 2019 09:49:23 +0100 (CET)
Received: from mail.choca.pics ([IPv6:::1])
 by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032)
 with ESMTP id qMbSTu4hTtSW; Fri, 22 Nov 2019 09:49:22 +0100 (CET)
Received: from localhost (localhost.localdomain [IPv6:::1])
 by mail.choca.pics (Postfix) with ESMTP id 57591F1C479;
 Fri, 22 Nov 2019 09:49:22 +0100 (CET)
X-Virus-Scanned: amavisd-new at choca.pics
Received: from mail.choca.pics ([IPv6:::1])
 by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026)
 with ESMTP id zd3Mqko655QZ; Fri, 22 Nov 2019 09:49:22 +0100 (CET)
Received: from luz4 (unknown [86.215.189.124])
 by mail.choca.pics (Postfix) with ESMTPSA id 06375F1C3C2;
 Fri, 22 Nov 2019 09:49:21 +0100 (CET)
From: Damien Cassou <damien@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Subject: Re: bug#38284: 27.0.50;
 [PATCH] Make auth-source-pass-search understand port lists
In-Reply-To: <CALDnm53fsq6QBfLVQkpsY=et4T0zj8zUEPdPaWfSKzf0bgPVmQ@HIDDEN>
References: <87ftijz9df.fsf@HIDDEN> <874kyxt78p.fsf@HIDDEN>
 <CALDnm53fsq6QBfLVQkpsY=et4T0zj8zUEPdPaWfSKzf0bgPVmQ@HIDDEN>
Date: Fri, 22 Nov 2019 09:49:20 +0100
Message-ID: <87lfs8thwv.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38284
Cc: 38284 <at> debbugs.gnu.org, Nicolas Petton <nicolas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi Jo=C3=A3o,

Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes:
>> can you please rename "d" to "domain"?
>
> ok.  I do call your attention that it was already the
> single letter n there


yes I saw. This should never have been merged like that. Thank you for
improving the code.

>> Can you please add a unit test covering this new use-case?
>
> No. This is too much work for such a trivial change

I care a lot about the automated testing of the code I write. I won't
try to convince you though. Can you please merge the attached patch with
yours?

--=20
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=0001-WIP.patch

From afd2ebb80c80573447ec1dc23bc1625f9b41046a Mon Sep 17 00:00:00 2001
From: Damien Cassou <damien@HIDDEN>
Date: Fri, 22 Nov 2019 09:36:44 +0100
Subject: [PATCH] WIP

---
 test/auth-source-pass-tests.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/test/auth-source-pass-tests.el b/test/auth-source-pass-tests.el
index bec42a5..ed1752d 100644
--- a/test/auth-source-pass-tests.el
+++ b/test/auth-source-pass-tests.el
@@ -353,6 +353,10 @@ (ert-deftest auth-source-pass--matching-entries-find-entries-with-a-port ()
   (auth-source-pass--with-store '(("bar.com:8080"))
     (should (auth-source-pass-match-entry-p "bar.com:8080" "bar.com" nil "8080"))))
 
+(ert-deftest auth-source-pass--matching-entries-find-entries-with-a-port-when-passed-multiple-ports ()
+  (auth-source-pass--with-store '(("bar.com:8080"))
+    (should (auth-source-pass-match-entry-p "bar.com:8080" "bar.com" nil '("http" "https" "80" "8080")))))
+
 (ert-deftest auth-source-pass--matching-entries-find-entries-with-slash ()
   ;; match if entry filename matches user
   (auth-source-pass--with-store '(("foo.com/user"))
-- 
2.23.0


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38284; Package emacs. Full text available.

Message received at 38284 <at> debbugs.gnu.org:


Received: (at 38284) by debbugs.gnu.org; 21 Nov 2019 19:06:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 21 14:06:58 2019
Received: from localhost ([127.0.0.1]:53341 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iXrn7-0008Am-UL
	for submit <at> debbugs.gnu.org; Thu, 21 Nov 2019 14:06:58 -0500
Received: from mail-io1-f66.google.com ([209.85.166.66]:39916)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1iXrn6-0008Aa-B6
 for 38284 <at> debbugs.gnu.org; Thu, 21 Nov 2019 14:06:56 -0500
Received: by mail-io1-f66.google.com with SMTP id k1so4754256ioj.6
 for <38284 <at> debbugs.gnu.org>; Thu, 21 Nov 2019 11:06:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc:content-transfer-encoding;
 bh=MBgiy+8weKrG6HPzzoI/9X/s9Z8ELAeFZLHiA6cety0=;
 b=MVXP4KaDIO4j2ES+ixgbizoHG5iJ7KJ6HwAd7xhuCnjkhUq/7sHIUE64AWZ0nuS2WE
 1Cwpl3TP/WC+h03RxiVKwlnZlRU+QpblYHXBjmlk3PsoMKd8WSIGJvZwrDxyK5/od7/G
 1XNO0G804XVekH6tK6BNFGN5FxtoRN2kc6X/BTrTOrdxhwxJciDtwpOb+70AE/779dPI
 nE6CSEhNBosfCRuITpeT3WBJ7kNg07ixVshCr8xkzxPCLghcpHv1u9uGMNGSmiSlrS9m
 2+BqYpN5Tp4wz34gkGB+Jh2X5gvo8kX9bpsg5Cm4dMeYjpT2dE2sQF01+YfF5fZhWOxg
 wGMg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc:content-transfer-encoding;
 bh=MBgiy+8weKrG6HPzzoI/9X/s9Z8ELAeFZLHiA6cety0=;
 b=DxadjlnuONvQ1I5mGBgsTnNtMWMJtcJWfdN8VNXgu2XGajIjaPTyfgUTrbjWKVYnN3
 OBlY9YZaY7NfIe9Xq/LeUjNxRqDzMUxIdzH/DYYF39Tv+LVzFLjFvFmluVCbDgZJr6JR
 bjLsD29xR0v47lr4H2EoQP9S7f9shfBk8UkmHx7UIMfsQcXydhJZMC+G/aa3MMEnNLKc
 lotnGFTJifmtMuYmaAjcxA7FKLoHtB9yiu5tgnseeCg1fHDlevvTXfUHDiT82ssHTeg7
 c+TFtgQOkVHaoAKZyjsUAK/eGE/ELAbfFLTFMKgiHd83zBqhwHh+LraGU616ETIpYKpc
 llWA==
X-Gm-Message-State: APjAAAUoD+MxIkLocu+GmyFndcblAaRHSsQl/3u82bpOtgnERVsEN6ef
 UbZ7FVCvIRVbn0vLvHR3/Pw7vcdcQ9x7HkCHMMdOdBW3
X-Google-Smtp-Source: APXvYqxR4dq38+8GbNDmtvZiz/pZPm0HifjQiVJcQN4DUXSe+1sMutkvgPGJl3BNOfXzbNI4j3MWjTNjDNwtVAbXkDQ=
X-Received: by 2002:a02:c54b:: with SMTP id g11mr7379004jaj.136.1574363210553; 
 Thu, 21 Nov 2019 11:06:50 -0800 (PST)
MIME-Version: 1.0
References: <87ftijz9df.fsf@HIDDEN> <874kyxt78p.fsf@HIDDEN>
In-Reply-To: <874kyxt78p.fsf@HIDDEN>
From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Thu, 21 Nov 2019 19:06:39 +0000
Message-ID: <CALDnm53fsq6QBfLVQkpsY=et4T0zj8zUEPdPaWfSKzf0bgPVmQ@HIDDEN>
Subject: Re: bug#38284: 27.0.50; [PATCH] Make auth-source-pass-search
 understand port lists
To: Damien Cassou <damien@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38284
Cc: 38284 <at> debbugs.gnu.org, Nicolas Petton <nicolas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Thu, Nov 21, 2019 at 6:27 PM Damien Cassou <damien@HIDDEN> wrote:
>
> Hi Jo=C3=A3o,
>
> Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes:
> > [=E2=80=A6] Eventually I came to this patch, which seems to do the righ=
t
> > thing.
>
>
> great job, thank you. Some feedback below.
>
> >    (let ((domains (auth-source-pass--domains (split-string hostname "\\=
."))))
> > -    (seq-mapcat (lambda (n)
> > -                  (auth-source-pass--name-port-user-suffixes n user po=
rt))
> > +    (seq-mapcat (lambda (d)
>
>
> can you please rename "d" to "domain"?

ok.  I do call your attention that it was already the
single letter n there, so I was following what I though
was shorthand convention, just adjusting it to the
first letter of the concept actually used.

> > +                  (seq-mapcat
> > +                   (lambda (p)
>
>
> same for "p".

ok.

> > +                     (auth-source-pass--name-port-user-suffixes d user=
 p))
> > +                   (if (listp port) port (list port))))
> >                  domains)))
>
>
> Can you please add a unit test covering this new use-case?

No. This is too much work for such a trivial change that
can be reasoned about locally. I don't usually write tests
for those.  If you permit me to exagerate, it's like testing
that (+ 2 2) really equals 4.

But some people do write tests at this level, and I of
course don't mind if you do.

--=20
Jo=C3=A3o T=C3=A1vora




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38284; Package emacs. Full text available.

Message received at 38284 <at> debbugs.gnu.org:


Received: (at 38284) by debbugs.gnu.org; 21 Nov 2019 18:27:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 21 13:27:41 2019
Received: from localhost ([127.0.0.1]:53306 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iXrB7-00079k-8e
	for submit <at> debbugs.gnu.org; Thu, 21 Nov 2019 13:27:41 -0500
Received: from mail.choca.pics ([62.210.108.126]:58060)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <damien@HIDDEN>) id 1iXrB5-00079a-5h
 for 38284 <at> debbugs.gnu.org; Thu, 21 Nov 2019 13:27:39 -0500
Received: from localhost (localhost.localdomain [IPv6:::1])
 by mail.choca.pics (Postfix) with ESMTP id 5B3D7F18CFD;
 Thu, 21 Nov 2019 19:27:37 +0100 (CET)
Received: from mail.choca.pics ([IPv6:::1])
 by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032)
 with ESMTP id sIc_g1D98INL; Thu, 21 Nov 2019 19:27:36 +0100 (CET)
Received: from localhost (localhost.localdomain [IPv6:::1])
 by mail.choca.pics (Postfix) with ESMTP id A4A06F18EF5;
 Thu, 21 Nov 2019 19:27:36 +0100 (CET)
X-Virus-Scanned: amavisd-new at choca.pics
Received: from mail.choca.pics ([IPv6:::1])
 by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026)
 with ESMTP id 7-Y6TqHUTF5y; Thu, 21 Nov 2019 19:27:36 +0100 (CET)
Received: from luz4 (254.116.5.93.rev.sfr.net [93.5.116.254])
 by mail.choca.pics (Postfix) with ESMTPSA id 48DCAF18CFD;
 Thu, 21 Nov 2019 19:27:36 +0100 (CET)
From: Damien Cassou <damien@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>,
 38284 <at> debbugs.gnu.org
Subject: Re: bug#38284: 27.0.50;
 [PATCH] Make auth-source-pass-search understand port lists
In-Reply-To: <87ftijz9df.fsf@HIDDEN>
References: <87ftijz9df.fsf@HIDDEN>
Date: Thu, 21 Nov 2019 19:27:34 +0100
Message-ID: <874kyxt78p.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38284
Cc: Nicolas Petton <nicolas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Jo=C3=A3o,

Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes:
> [=E2=80=A6] Eventually I came to this patch, which seems to do the right
> thing.


great job, thank you. Some feedback below.

>    (let ((domains (auth-source-pass--domains (split-string hostname "\\."=
))))
> -    (seq-mapcat (lambda (n)
> -                  (auth-source-pass--name-port-user-suffixes n user port=
))
> +    (seq-mapcat (lambda (d)


can you please rename "d" to "domain"?


> +                  (seq-mapcat
> +                   (lambda (p)


same for "p".


> +                     (auth-source-pass--name-port-user-suffixes d user p=
))
> +                   (if (listp port) port (list port))))
>                  domains)))


Can you please add a unit test covering this new use-case?

--=20
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38284; Package emacs. Full text available.

Message received at 38284 <at> debbugs.gnu.org:


Received: (at 38284) by debbugs.gnu.org; 21 Nov 2019 13:48:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 21 08:48:14 2019
Received: from localhost ([127.0.0.1]:51617 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iXmog-0004Lg-10
	for submit <at> debbugs.gnu.org; Thu, 21 Nov 2019 08:48:14 -0500
Received: from quimby.gnus.org ([95.216.78.240]:59536)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1iXmob-0004LO-MT
 for 38284 <at> debbugs.gnu.org; Thu, 21 Nov 2019 08:48:10 -0500
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1iXmoM-00053Z-Tl; Thu, 21 Nov 2019 14:47:57 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Subject: Re: bug#38284: 27.0.50; [PATCH] Make auth-source-pass-search
 understand port lists
References: <87ftijz9df.fsf@HIDDEN>
Date: Thu, 21 Nov 2019 14:47:54 +0100
In-Reply-To: <87ftijz9df.fsf@HIDDEN> (=?utf-8?Q?=22Jo=C3=A3o_T=C3=A1vor?=
 =?utf-8?Q?a=22's?= message of "Wed, 20 Nov 2019 00:20:28 +0000")
Message-ID: <875zjdz6gl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 
 Content preview:  João Távora <joaotavora@HIDDEN> writes: > This modification
    makes this library understand and unroll the port > list so that, i.e. "domain:993",
    "domain:imaps"", "domain:imap", > etc. are computed as potential suffixes.
    Previously a nonsens [...] 
 
 Content analysis details:   (-2.9 points, 5.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
                             blocked.  See
                             http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
                              for more information.
                             [URIs: ingebrigtsen.no]
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
                             [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38284
Cc: Damien Cassou <damien@HIDDEN>, 38284 <at> debbugs.gnu.org,
 Nicolas Petton <nicolas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes:

> This modification makes this library understand and unroll the port
> list so that, i.e. "domain:993", "domain:imaps"", "domain:imap",
> etc. are computed as potential suffixes.  Previously a nonsensical
> string "domain:(993 imaps imap ...)" was return.
>
>    (let ((domains (auth-source-pass--domains (split-string hostname "\\."=
))))
> -    (seq-mapcat (lambda (n)
> -                  (auth-source-pass--name-port-user-suffixes n user port=
))
> +    (seq-mapcat (lambda (d)
> +                  (seq-mapcat
> +                   (lambda (p)
> +                     (auth-source-pass--name-port-user-suffixes d user p=
))
> +                   (if (listp port) port (list port))))
>                  domains)))

Looks good to me, but I don't use password-store so I can't really
test.  If it works for you, please go ahead and apply.

--=20
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38284; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 Nov 2019 00:21:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 19 19:21:11 2019
Received: from localhost ([127.0.0.1]:48754 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iXDk7-00069L-Cd
	for submit <at> debbugs.gnu.org; Tue, 19 Nov 2019 19:21:11 -0500
Received: from lists.gnu.org ([209.51.188.17]:40940)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1iXDk5-00069C-74
 for submit <at> debbugs.gnu.org; Tue, 19 Nov 2019 19:21:10 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:60621)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <joaotavora@HIDDEN>) id 1iXDk4-0007LD-11
 for bug-gnu-emacs@HIDDEN; Tue, 19 Nov 2019 19:21:09 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <joaotavora@HIDDEN>) id 1iXDk1-0008IN-2s
 for bug-gnu-emacs@HIDDEN; Tue, 19 Nov 2019 19:21:06 -0500
Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:50295)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <joaotavora@HIDDEN>)
 id 1iXDjz-0008Di-AO
 for bug-gnu-emacs@HIDDEN; Tue, 19 Nov 2019 19:21:03 -0500
Received: by mail-wm1-x332.google.com with SMTP id l17so5197202wmh.0
 for <bug-gnu-emacs@HIDDEN>; Tue, 19 Nov 2019 16:21:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:user-agent:mime-version;
 bh=7qL6eQmuM05REfIStsGvRB0xH73s1MTKl/KfOYUmPPA=;
 b=ta4ZnWlsmQxml3BEXE2A8EMn/82B/4cJCLaTG5ub5/bzGnrvSnscrzuHS/kqN59DAs
 ebQe6oskpg//yqA1pfwKL+20jz9DFpHm3on1E53JU3ioF79AwcILicrCVnLl4crfnRwI
 ljDEb+9oG+leGeB4qYJbZxpnD4CnD83su3YWXdlJ6GKWRQM3xKIfNDLV0PEJEY4QwEMy
 JYk+7ryaO1sJpNO0Dm/rAIFr161ipqhHMTtbhXVZS8njMQ1SjwJdPNqrze9jSFzLKUXU
 /7F7L5oKGNf7i3JxVRnUJpJsgsgVvdmoPQQfUoVVacGwtXrLj4iqLOs4gMZ3NDU3kdzk
 CZNg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:user-agent
 :mime-version;
 bh=7qL6eQmuM05REfIStsGvRB0xH73s1MTKl/KfOYUmPPA=;
 b=iYDn2R1eTjsWc/HoDeyxvrxYX3LE7Pw6MsozXsTGe7WQvdY72iQJ5Av2ie9X4JVRF4
 fmzjbD6QhsWSFAfpr/rdgx8RCsZp28iE6UXceM3JohIJ5UAqBm4pxo0vncSxRSncTr6k
 aJ4JL0pzNZ7ZspBIeg++oyg1KTiRTus5f9A81ePyrzuGjNtHt0C0bGvgV9LIbfhfT5oe
 /iOS5LuhCG+hwhvOywBejCtsHr3aNs86R1/cqE+WE3tALabPGFAj6rHF5MAcWMJYan3r
 rTznCErR9KIyXlF0SGMeUmUxms2CIOOSlUnzLu/E5qyT+SzUDv+T/OLEvo2kd8GRgq3N
 tBTw==
X-Gm-Message-State: APjAAAWab8CHttN7IFmiKE9QcInO4ujj50ukQ8U3/V4nRisBnHTu3WXz
 DhB/chrmryPQf3k4RwhUHLn8yr5K
X-Google-Smtp-Source: APXvYqzTcxsvRk1GWFgy3O6m+U/atkjziD4VQ2COH06h3nt8X3zAQZwtuKl4ot4OIqT5E9JEjyQBLg==
X-Received: by 2002:a1c:f317:: with SMTP id q23mr70641wmq.97.1574209259386;
 Tue, 19 Nov 2019 16:20:59 -0800 (PST)
Received: from lolita.yourcompany.com ([89.180.145.231])
 by smtp.gmail.com with ESMTPSA id f14sm28613067wrv.17.2019.11.19.16.20.57
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 19 Nov 2019 16:20:58 -0800 (PST)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.50; [PATCH] Make auth-source-pass-search understand port lists
X-Debbugs-CC: Damien Cassou <damien@HIDDEN>, Nicolas Petton
 <nicolas@HIDDEN>
Date: Wed, 20 Nov 2019 00:20:28 +0000
Message-ID: <87ftijz9df.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::332
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain

Hi,

When trying to follow along a tutorial on setting up Gnus for GMAIL, I
tried to use auth-source-pass.el to access encrypted entries under
~/.password-store instead of the usual ~/.authinfo.gpg.

After much wrestling with the system, I couldn't figure out why my
entry:

   gmail:imap.gpg

whose contents are

   NotReallyThePassword
   host: imap.gmail.com
   user: joaotavora@HIDDEN
   port: 993

weren't being understood by the new auth-source.  Eventually I came to
this patch, which seems to do the right thing.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Make-auth-source-pass-search-understand-port-lists.patch

From 4a6c24c23c9f7097807c1ef58688b51db330f503 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= <joaotavora@HIDDEN>
Date: Wed, 20 Nov 2019 00:11:00 +0000
Subject: [PATCH] Make auth-source-pass-search understand port lists

For cases such as a typical IMAP Gnus setup, auto-source-pass-search
will be passed a list of "port aliases" like (993 "imaps" "imap" "993"
"143") in hopes of finding a matching ~/.password-store entry.

This modification makes this library understand and unroll the port
list so that, i.e. "domain:993", "domain:imaps"", "domain:imap",
etc. are computed as potential suffixes.  Previously a nonsensical
string "domain:(993 imaps imap ...)" was return.

* lisp/auth-source-pass.el
(auth-source-pass--generate-entry-suffixes): Allow PORT to
be a list of ports.
---
 lisp/auth-source-pass.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index 524a72792c..cc0a6fe4de 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -269,10 +269,15 @@ auth-source-pass--generate-entry-suffixes
 
 Based on the supported pathname patterns for HOSTNAME, USER, &
 PORT, return a list of possible suffixes for matching entries in
-the password-store."
+the password-store.
+
+PORT may be a list of ports."
   (let ((domains (auth-source-pass--domains (split-string hostname "\\."))))
-    (seq-mapcat (lambda (n)
-                  (auth-source-pass--name-port-user-suffixes n user port))
+    (seq-mapcat (lambda (d)
+                  (seq-mapcat
+                   (lambda (p)
+                     (auth-source-pass--name-port-user-suffixes d user p))
+                   (if (listp port) port (list port))))
                 domains)))
 
 (defun auth-source-pass--domains (name-components)
-- 
2.24.0


--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


Please have a look,
Jo=C3=A3o



--=-=-=--




Acknowledgement sent to João Távora <joaotavora@HIDDEN>:
New bug report received and forwarded. Copy sent to damien@HIDDEN, nicolas@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to damien@HIDDEN, nicolas@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#38284; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.