GNU bug report logs - #36763
`guix search` does unexpected logical and

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: guix; Reported by: zimoun <zimon.toutoune@HIDDEN>; dated Mon, 22 Jul 2019 17:13:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

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


Received: (at 36763) by debbugs.gnu.org; 25 Jul 2019 17:35:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 25 13:35:56 2019
Received: from localhost ([127.0.0.1]:40384 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hqhem-0004T9-Dx
	for submit <at> debbugs.gnu.org; Thu, 25 Jul 2019 13:35:56 -0400
Received: from eggs.gnu.org ([209.51.188.92]:56550)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1hqhek-0004St-0R
 for 36763 <at> debbugs.gnu.org; Thu, 25 Jul 2019 13:35:54 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:47724)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1hqhee-0000Cl-Qv; Thu, 25 Jul 2019 13:35:48 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=49608 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1hqhee-0005jv-Cv; Thu, 25 Jul 2019 13:35:48 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: zimoun <zimon.toutoune@HIDDEN>
Subject: Re: bug#36763: `guix search` does unexpected logical and
References: <CAJ3okZ1_EiGOY6O6ytyr7XtePZcMUpQ779S1agV5MwgbP8xTRw@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 7 Thermidor an 227 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Thu, 25 Jul 2019 19:35:46 +0200
In-Reply-To: <CAJ3okZ1_EiGOY6O6ytyr7XtePZcMUpQ779S1agV5MwgbP8xTRw@HIDDEN>
 (zimoun's message of "Mon, 22 Jul 2019 19:11:50 +0200")
Message-ID: <87imrqrp8t.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 36763
Cc: 36763 <at> debbugs.gnu.org
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: -3.3 (---)

Hi Simon,

zimoun <zimon.toutoune@HIDDEN> skribis:

> As discussed here [1], the `relevance` in `guix/ui.scm` does not match
> "inter-field".
>
> Attached a fix.
> Now,  the example from the manual
>   $ guix search crypto library | \
>         recsel -e '! (name ~ "^(ghc|perl|python|ruby)")' -p name,synopsis
> outputs the expected crypto libraries as `libb2`.

Nice!

> Then, please indicate me how the commit has to be filled.
> The commit 8874faaaac665100a095ef25e39c9a389f5a397f introducing the
> logical AND says:
>
> ui: 'relevance' considers regexps connected with a logical and.
>
> * guix/ui.scm (relevance)[score]: Change to return 0 when one of REGEXPS
> doesn't match.
> * tests/ui.scm ("package-relevance"): New test.

Yes, you can provide a commit log along these lines.

> Should another test be added?

Yes please, that would be perfect!

> +  (define (update relevance weight scores)
> +    (map + relevance
> +           (map (lambda (score)
> +                  (* weight score))
> +                scores)))
> +
> +  (let ((scores (fold (lambda (metric relevance)
> +                        (match metric
> +                          ((field . weight)
> +                           (match (field obj)
> +                             (#f  relevance)
> +                             ((? string? str)
> +                              (update relevance weight (score str)))
> +                             ((lst ...)
> +                              (update relevance weight
> +                                      (fold (lambda (elem prev)
> +                                              (if (zero? (length elem))
> +                                                  prev
> +                                                  (map + elem prev)))
> +                                            (make-list (length regexps) =
0)
> +                                            (map score lst)))
> +                              )))))
> +                      (make-list (length regexps) 0)
> +                      metrics)))

I don=E2=80=99t have a clear mind on that, but I feel like this could be
simplified somehow.  For instance,

  (fold p (make-list =E2=80=A6) metrics)

looks a lot like:

  (map (lambda (x) (fold p x metrics)) regexps)

Well, something like that.  :-)

Thanks for working on it!

Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#36763; Package guix. Full text available.
Disconnected #36763 from all other report(s). Request was from Efraim Flashner <efraim@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 36757 36763 36770. Request was from Efraim Flashner <efraim@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 22 Jul 2019 17:12:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 22 13:12:10 2019
Received: from localhost ([127.0.0.1]:33548 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hpbr7-00046F-TY
	for submit <at> debbugs.gnu.org; Mon, 22 Jul 2019 13:12:10 -0400
Received: from lists.gnu.org ([209.51.188.17]:46590)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1hpbr6-000467-5f
 for submit <at> debbugs.gnu.org; Mon, 22 Jul 2019 13:12:08 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47398)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1hpbr5-0006Gq-4E
 for bug-guix@HIDDEN; Mon, 22 Jul 2019 13:12:08 -0400
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,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1hpbr3-0003KJ-3P
 for bug-guix@HIDDEN; Mon, 22 Jul 2019 13:12:07 -0400
Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]:46880)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <zimon.toutoune@HIDDEN>)
 id 1hpbr1-0003JZ-2r
 for bug-guix@HIDDEN; Mon, 22 Jul 2019 13:12:03 -0400
Received: by mail-qk1-x734.google.com with SMTP id r4so29052230qkm.13
 for <bug-guix@HIDDEN>; Mon, 22 Jul 2019 10:12:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to;
 bh=My/1K9TGtSunqmqCMgtSzl98y4LqEQFukYMPyOS1/mc=;
 b=fSPGUx1RyX7si2+OxIBWMpH9KT1pJwOE386uDx4hAHJNXOQ3fdqsphLKSDw3lCzVqq
 4m80Pvq4msK7iimmU8Z/dn8PTyH4SpyB/CMwL7oorirSes951Jap4X2+nZBxpdYkrevG
 gPqbv28IGePSF58Q0zFoa+PcYl1tq5PvNkGVJ2rN++3sFIb5nkUDcKoRvizM1vy8/T7J
 /PZ1kc8+r/5kiqg/z5pyuHoRmVS2vAdrum+HQp2ERqUukwwJQVmfzAM/XMYkDyEPEXiV
 BPsqwT8hrOhVIcgqmT0LBgCD9wFEJZHZ4QKV9AEXg8lqZmJeg78h/IpJO+YIqF4KZtHd
 4Uyg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=My/1K9TGtSunqmqCMgtSzl98y4LqEQFukYMPyOS1/mc=;
 b=BgtGZm/IDSMhN0H7Li2D1bTl515aLt6Kbb+s2YfP/SI9/tL8pgJVvN7E553mXTE2Nv
 tFGcNoKwICAfBSHf9aDwZ22BWkZ9j4Xc/tSM0PJUnd5+ENHNTZtbGD3MdnvQPZ2fLVPr
 wQ5cFuvE5z15xlp0mw7VDi63pu5qwzcinjNa6bC+LSuv7/7W4sPFED5QKPYwW6gLbual
 VKbl+TcT1vaHSSJbZFHQDKfIV/x4RpMj5EGXFxud3LNeLGUIY/lqzg0Zi60F3u52Xa6T
 iueb09aIn6D5stJmWlPnhoN0TbN0n/DkDz6GfshHZdOAbyOahgeAhaVCM1UImX8+FAiS
 S/NQ==
X-Gm-Message-State: APjAAAV9J7fTo/66pYQkxvKiVdIqcKmGvSzSCnEVOhtpI5Y9E4ME7jPP
 vH0jC7UBEQxF/OkKhCO1KIeW6PIt9iLzg8yNRJQqYxYc
X-Google-Smtp-Source: APXvYqwF1AuqKXpUSjbESvOtghNQisoREiHTBYy+Pdxl2/vM27n0H18lg9OLFKN0GH5nw6Kdvr+bAsfbx0bD9IsO4cQ=
X-Received: by 2002:a37:4f4f:: with SMTP id d76mr42081774qkb.304.1563815521878; 
 Mon, 22 Jul 2019 10:12:01 -0700 (PDT)
MIME-Version: 1.0
From: zimoun <zimon.toutoune@HIDDEN>
Date: Mon, 22 Jul 2019 19:11:50 +0200
Message-ID: <CAJ3okZ1_EiGOY6O6ytyr7XtePZcMUpQ779S1agV5MwgbP8xTRw@HIDDEN>
Subject: `guix search` does unexpected logical and
To: bug-guix@HIDDEN
Content-Type: multipart/mixed; boundary="000000000000ad276b058e482c95"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::734
X-Spam-Score: -1.3 (-)
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 (--)

--000000000000ad276b058e482c95
Content-Type: text/plain; charset="UTF-8"

Dear,

As discussed here [1], the `relevance` in `guix/ui.scm` does not match
"inter-field".

Attached a fix.
Now,  the example from the manual
  $ guix search crypto library | \
        recsel -e '! (name ~ "^(ghc|perl|python|ruby)")' -p name,synopsis
outputs the expected crypto libraries as `libb2`.


Please comment. :-)


Then, please indicate me how the commit has to be filled.
The commit 8874faaaac665100a095ef25e39c9a389f5a397f introducing the
logical AND says:

ui: 'relevance' considers regexps connected with a logical and.

* guix/ui.scm (relevance)[score]: Change to return 0 when one of REGEXPS
doesn't match.
* tests/ui.scm ("package-relevance"): New test.

Should another test be added?


[1] https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00263.html


Thank you in advance,
simon

--000000000000ad276b058e482c95
Content-Type: text/x-patch; charset="US-ASCII"; name="search.patch"
Content-Disposition: attachment; filename="search.patch"
Content-Transfer-Encoding: base64
Content-ID: <f_jyen2vys0>
X-Attachment-Id: f_jyen2vys0

ZGlmZiAtLWdpdCBhL2d1aXgvdWkuc2NtIGIvZ3VpeC91aS5zY20KaW5kZXggNzkyMDMzNTkyOC4u
MGU2MGViNmVkYyAxMDA2NDQKLS0tIGEvZ3VpeC91aS5zY20KKysrIGIvZ3VpeC91aS5zY20KQEAg
LTEyOTEsMjMgKzEyOTEsMzYgQEAgc2NvcmUsIHRoZSBtb3JlIHJlbGV2YW50IE9CSiBpcyB0byBS
RUdFWFBTLiIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUgICAgICAgICAg
ICAgO2V4YWN0IG1hdGNoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxKSkp
KSkKICAgICAgICAgICAgcmVnZXhwcykpCi0KKyAgICBzY29yZXMpCisKKyAgKGRlZmluZSAodXBk
YXRlIHJlbGV2YW5jZSB3ZWlnaHQgc2NvcmVzKQorICAgIChtYXAgKyByZWxldmFuY2UKKyAgICAg
ICAgICAgKG1hcCAobGFtYmRhIChzY29yZSkKKyAgICAgICAgICAgICAgICAgICgqIHdlaWdodCBz
Y29yZSkpCisgICAgICAgICAgICAgICAgc2NvcmVzKSkpCisKKyAgKGxldCAoKHNjb3JlcyAoZm9s
ZCAobGFtYmRhIChtZXRyaWMgcmVsZXZhbmNlKQorICAgICAgICAgICAgICAgICAgICAgICAgKG1h
dGNoIG1ldHJpYworICAgICAgICAgICAgICAgICAgICAgICAgICAoKGZpZWxkIC4gd2VpZ2h0KQor
ICAgICAgICAgICAgICAgICAgICAgICAgICAgKG1hdGNoIChmaWVsZCBvYmopCisgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICgjZiAgcmVsZXZhbmNlKQorICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAoKD8gc3RyaW5nPyBzdHIpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAo
dXBkYXRlIHJlbGV2YW5jZSB3ZWlnaHQgKHNjb3JlIHN0cikpKQorICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAoKGxzdCAuLi4pCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodXBk
YXRlIHJlbGV2YW5jZSB3ZWlnaHQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgKGZvbGQgKGxhbWJkYSAoZWxlbSBwcmV2KQorICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgIChpZiAoemVybz8gKGxlbmd0aCBlbGVtKSkKKyAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJldgorICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobWFwICsgZWxlbSBwcmV2KSkp
CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChtYWtlLWxpc3Qg
KGxlbmd0aCByZWdleHBzKSAwKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAobWFwIHNjb3JlIGxzdCkpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
KSkpKSkKKyAgICAgICAgICAgICAgICAgICAgICAobWFrZS1saXN0IChsZW5ndGggcmVnZXhwcykg
MCkKKyAgICAgICAgICAgICAgICAgICAgICBtZXRyaWNzKSkpCiAgICAgOzsgUmV0dXJuIHplcm8g
aWYgb25lIG9mIFJFR0VYUFMgZG9lc24ndCBtYXRjaC4KICAgICAoaWYgKGFueSB6ZXJvPyBzY29y
ZXMpCiAgICAgICAgIDAKLSAgICAgICAgKHJlZHVjZSArIDAgc2NvcmVzKSkpCi0KLSAgKGZvbGQg
KGxhbWJkYSAobWV0cmljIHJlbGV2YW5jZSkKLSAgICAgICAgICAobWF0Y2ggbWV0cmljCi0gICAg
ICAgICAgICAoKGZpZWxkIC4gd2VpZ2h0KQotICAgICAgICAgICAgIChtYXRjaCAoZmllbGQgb2Jq
KQotICAgICAgICAgICAgICAgKCNmICByZWxldmFuY2UpCi0gICAgICAgICAgICAgICAoKD8gc3Ry
aW5nPyBzdHIpCi0gICAgICAgICAgICAgICAgKCsgcmVsZXZhbmNlICgqIChzY29yZSBzdHIpIHdl
aWdodCkpKQotICAgICAgICAgICAgICAgKChsc3QgLi4uKQotICAgICAgICAgICAgICAgICgrIHJl
bGV2YW5jZSAoKiB3ZWlnaHQgKGFwcGx5ICsgKG1hcCBzY29yZSBsc3QpKSkpKSkpKSkKLSAgICAg
ICAgMAotICAgICAgICBtZXRyaWNzKSkKKyAgICAgICAgKHJlZHVjZSArIDAgc2NvcmVzKSkpKQog
CiAoZGVmaW5lICVwYWNrYWdlLW1ldHJpY3MKICAgOzsgTWV0cmljcyB1c2VkIHRvIGNvbXB1dGUg
dGhlICJyZWxldmFuY2Ugc2NvcmUiIG9mIGEgcGFja2FnZSBhZ2FpbnN0IGEgc2V0Cg==
--000000000000ad276b058e482c95--




Acknowledgement sent to zimoun <zimon.toutoune@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#36763; Package guix. 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: Thu, 25 Jul 2019 17:45:02 UTC

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