From unknown Fri Jun 20 05:31:38 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#55845 <55845@debbugs.gnu.org> To: bug#55845 <55845@debbugs.gnu.org> Subject: Status: [PATCH 0/1] Improve pager selection logic when less is not installed Reply-To: bug#55845 <55845@debbugs.gnu.org> Date: Fri, 20 Jun 2025 12:31:38 +0000 retitle 55845 [PATCH 0/1] Improve pager selection logic when less is not in= stalled reassign 55845 guix-patches submitter 55845 Taiju HIGASHI severity 55845 normal tag 55845 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 06:21:46 2022 Received: (at submit) by debbugs.gnu.org; 8 Jun 2022 10:21:46 +0000 Received: from localhost ([127.0.0.1]:42523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nysos-00070D-7m for submit@debbugs.gnu.org; Wed, 08 Jun 2022 06:21:46 -0400 Received: from lists.gnu.org ([209.51.188.17]:59608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nysor-000706-2L for submit@debbugs.gnu.org; Wed, 08 Jun 2022 06:21:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nysoq-0007Ij-Am for guix-patches@gnu.org; Wed, 08 Jun 2022 06:21:44 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:36668) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nysok-0006fF-4y for guix-patches@gnu.org; Wed, 08 Jun 2022 06:21:44 -0400 Received: by mail-pl1-x636.google.com with SMTP id u18so17264029plb.3 for ; Wed, 08 Jun 2022 03:21:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iwBz59qsART4lGuQS4feCfWBA8Q48c2oAFlNvRgZCFA=; b=lnaKkmQmuvgx5XYbmfEPQ72RYdaBf33QwmHpFtSeqJXV+rPzCaacJWKh9FOJifmJTz tUGpElatF5tSbcO6UwdmRE/N69oc5Rx/WM6fpqJ2v+3rdjJQ5QULIPIw2OGcpxm2G1jD VbFra3GJvtgp8jhwll9CLwQZYdGv6jDbFFhj7p4I2C6Ux0rqAFvfzTQZw5RUzqM/GcZO jPO+U4ym1zc5RFy3OsnBgWCFbMi6Qde8Wh8aFi4cDrGVf9IzW+NaXQt2Dupdh+6dJU4q 1Gq+KcD+QLwFFgKHRrN0ITvODE/n9BF4o2EnW2Kw6PB/X7W76V9YlhLl5AqL2r0tBa6F UYOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iwBz59qsART4lGuQS4feCfWBA8Q48c2oAFlNvRgZCFA=; b=dBtSXo2Ycpfw4jw1kEzE5NAHKnDppwfI8LNiPQb9VGCy6S2g42xWXDaJkueTM6Jjrh aWRBfNH8V+q9bEfRTT7mTRrcjZHtlzJCgJ9yNhqlmPCxVZLC5zs9bgqhyoFB8YENumdl nRsExFmXCOgkrMB2YLsJFYgywj2EdVCf/tq0J4Hq88DE54yXB+vM8EbJnju43+UMk6jT 0Lzcyb8xuLM9SDdLcOMnmKYmEaI1bU49pKBnT1x6/FgB8Ik9g2ipq1l9E4ckzpBeYJ8z 66ZsQ3rDsoYKNdgtu/5Nfiyqv0lkjtq8miyYtF8TVO5z8R1St3txraMjsqmsHUk8JG1D ERug== X-Gm-Message-State: AOAM531QN8Iu3fov5522KZLKuT9C0IIF58l84niymAdEWvDEEkIG0XHq rdATDsSss38sc6tjc3jJzpPCfQPkYGuAjkdE X-Google-Smtp-Source: ABdhPJxOTnw2Svk875PI/oozlGxuyYsHwGKcx8tqkw+iI7dbu+lzlFGr9EBaZJg+sSggS8Ng2iv2qA== X-Received: by 2002:a17:902:e892:b0:167:4570:32e3 with SMTP id w18-20020a170902e89200b00167457032e3mr27281160plg.51.1654683694103; Wed, 08 Jun 2022 03:21:34 -0700 (PDT) Received: from Taix.flets-west.jp ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id e16-20020a056a0000d000b0050dc762819bsm14665851pfj.117.2022.06.08.03.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 03:21:33 -0700 (PDT) From: Taiju HIGASHI To: guix-patches@gnu.org Subject: [PATCH 0/1] Improve pager selection logic when less is not installed Date: Wed, 8 Jun 2022 19:21:24 +0900 Message-Id: <20220608102124.14865-1-higashi@taiju.info> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=2607:f8b0:4864:20::636; envelope-from=higashi@taiju.info; helo=mail-pl1-x636.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: Taiju HIGASHI X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, The problem rarely occurs, but when we run guix commands in an environment where "less" is not installed we get an error. This is the same problem reported at the following URL https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1012405 If "more" could be specified as an alternative program to "less", the problem would be less likely to occur at least in a POSIX environment. Also, I would like to avoid using the pager in special environments where "more" is not installed at all. I have written a patch to solve the above. I am concerned about performance degradation due to more unnecessary processing. If you have another good solution, please let me know. Also, if you feel that this is a minor issue and not worth addressing, please feel free to dismiss it. (Still, a fix to make the error message more friendly might be a good idea.) Best Regards, Taiju HIGASHI (1): ui: Improve pager selection logic when less is not installed. guix/ui.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.36.1 From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 06:23:11 2022 Received: (at 55845) by debbugs.gnu.org; 8 Jun 2022 10:23:11 +0000 Received: from localhost ([127.0.0.1]:42528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nysqF-00073A-In for submit@debbugs.gnu.org; Wed, 08 Jun 2022 06:23:11 -0400 Received: from mail-pl1-f173.google.com ([209.85.214.173]:44718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nysqD-00072y-TO for 55845@debbugs.gnu.org; Wed, 08 Jun 2022 06:23:10 -0400 Received: by mail-pl1-f173.google.com with SMTP id h1so17227345plf.11 for <55845@debbugs.gnu.org>; Wed, 08 Jun 2022 03:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KaL2oAv1XnIetV/Xd4/sRxLu2VlCQnQodKvKAgx53Uk=; b=ah/uIf+pmaUDos3K+Q6cMAnShErdrEWALX1GN5VsRd8PMqaCBlA85vVuV4MxZ2UrqU XlQnnbSEDjoXfaz167+xR3gXGniYDl/HG01SZIUTxLcrc3QPQ4iuclx7bva8Tt6kCb/3 ibJm8/YOTerHQB1UMQELjk9zDuxrvY8nl83/ruRMNNCQCIfYBpwxqs5vJZ7bF8snkWlT V45dTK18JEFVfGTn6gmaPz8itEbyeMNmkCy2n00444B+38m0QnLXmdYlzwvyk1V8+ivR wu36qivZ/h2Dhwtm6anG9tXum3V2F3AJPhqASiR7LHRZGxG6eoZAWORzuJ76gOkzq9SI q39g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KaL2oAv1XnIetV/Xd4/sRxLu2VlCQnQodKvKAgx53Uk=; b=BBUEaDS7cyCW6A3iwwuZWKQAyOG95YvyAPf+mtZfJLbJ48uSCMNY9p8Gw3e/Wfwmfb JinXOVW5epBl2nyIBXHxwthRRXElCw3MyZuprz1co5Q3fZm6cuS31ltRn2RRHw1vOgzk yMcqIe7I/IvEE+YFc+KyJofSPAQoKzZJN+8hVOfgvfE6OwTKxCrE1ziiuDKe7wuJQ0nl uxJu67FT4WLQSsK74N+dctw5cT5P4aHH6YJPvphmB2JASBy6Dydakue1knPw+8lM3m+Q Jn3rpZ6//8FoTLDKJEmqBsk6/qoFlJuOnbaqrn36nwfZxp26FzeY3bJs6Eoz+TKv6P7x MB4g== X-Gm-Message-State: AOAM53225InEtn7A5+3FTtKOVLGooxkZHsPWj822HB0Mrcy9IZIhZ06K bwQIHuY/pWbuu1EGjbcVjdL5O6PqqApXJTcN X-Google-Smtp-Source: ABdhPJziGPnf6AGDmoY7BopEcq6FOBi/wFQb68n0phnI3k4+6SM2FzV7rXMJkqVA9UzknSsCckWEug== X-Received: by 2002:a17:903:41d0:b0:167:68a7:c3d with SMTP id u16-20020a17090341d000b0016768a70c3dmr20528353ple.161.1654683781931; Wed, 08 Jun 2022 03:23:01 -0700 (PDT) Received: from Taix.flets-west.jp ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id i69-20020a628748000000b0051c758a3957sm88492pfe.149.2022.06.08.03.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 03:23:01 -0700 (PDT) From: Taiju HIGASHI To: 55845@debbugs.gnu.org Subject: [PATCH 1/1] ui: Improve pager selection logic when less is not installed. Date: Wed, 8 Jun 2022 19:22:57 +0900 Message-Id: <20220608102257.15042-1-higashi@taiju.info> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: Taiju HIGASHI X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/ui.scm (available-pager): New variable. Holds available pagers. (call-with-paginated-output-port): Get an alternative program from the available-pager variable when the environment variable is not set. --- guix/ui.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/guix/ui.scm b/guix/ui.scm index cb68a07c6c..22169a7eb8 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -17,6 +17,7 @@ ;;; Copyright © 2020 Arun Isaac ;;; Copyright © 2020 Maxim Cournoyer ;;; Copyright © 2018 Steve Sprang +;;; Copyright © 2022 Taiju HIGASHI ;;; ;;; This file is part of GNU Guix. ;;; @@ -1672,11 +1673,18 @@ (define* (pager-wrapped-port #:optional (port (current-output-port))) (_ #f))) +(define available-pager + (if (which "less") + "less" + (if (which "more") + "more" + #f))) + (define* (call-with-paginated-output-port proc #:key (less-options "FrX")) (let ((pager-command-line (or (getenv "GUIX_PAGER") (getenv "PAGER") - "less"))) + available-pager))) ;; Setting PAGER to the empty string conventionally disables paging. (if (and (not (string-null? pager-command-line)) (isatty?* (current-output-port))) -- 2.36.1 From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 08:51:48 2022 Received: (at submit) by debbugs.gnu.org; 8 Jun 2022 12:51:48 +0000 Received: from localhost ([127.0.0.1]:42732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyvA4-0000av-6l for submit@debbugs.gnu.org; Wed, 08 Jun 2022 08:51:48 -0400 Received: from lists.gnu.org ([209.51.188.17]:60290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyvA2-0000an-3h for submit@debbugs.gnu.org; Wed, 08 Jun 2022 08:51:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyv9x-00045a-2I for guix-patches@gnu.org; Wed, 08 Jun 2022 08:51:45 -0400 Received: from tobias.gr ([2a02:c205:2020:6054::1]:59852) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyv9b-0000dQ-FA for guix-patches@gnu.org; Wed, 08 Jun 2022 08:51:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=y5xvxpwfcyQnp qSsiD7vJzojCjcLVjVF/4XI1ZmIpJE=; h=in-reply-to:date:subject:cc:to: from:references; d=tobias.gr; b=PR4PTgztOUktH2f3oyL2CtuUbRJuqiGAmhTOMJ J63zWbEErvaJuWGDEwJMdY1xEZC4ROPwfFnZHmNJ3lkI81i2dkolejCC9d39NhZvScjbI+ SW7xRQKLmWPgurgRCKDyelIzRhhVeOyseh1kP0uyiZMKQm7AQWURNg6U7UPq+xv63CQlZT 6snEaMdoBpAw0zkJj5aEhLYARSkpZ/lWyT2VEdGBxTCz0didJQqAFmtAbfZaqdvdq01j3/ zivMhrKZNQABtqJtg11P4fhQuJSsaZByHDJ1/jxfy8c5Oenlf+pSaWUAmfHRXo0VsoBiKL zOKal3FzTpHu0Ekq6eD+me8g== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 81f01fd2 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Wed, 8 Jun 2022 12:50:59 +0000 (UTC) References: <20220608102124.14865-1-higashi@taiju.info> From: Tobias Geerinckx-Rice To: Taiju HIGASHI Subject: Re: [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed Date: Wed, 08 Jun 2022 14:14:34 +0200 In-reply-to: <20220608102124.14865-1-higashi@taiju.info> BIMI-Selector: v=BIMI1; s=default; Message-ID: <87wndrwc5m@nckx> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=2a02:c205:2020:6054::1; envelope-from=me@tobias.gr; helo=tobias.gr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: submit Cc: 55845@debbugs.gnu.org, guix-patches@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) --=-=-= Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi! Taiju HIGASHI =E5=86=99=E9=81=93=EF=BC=9A > The problem rarely occurs, but when we run guix commands in an=20 > environment > where "less" is not installed we get an error. True. Odd that it's gone unreported(?) for so long. > I am concerned about performance degradation due to more=20 > unnecessary > processing. Since you asked=E2=80=A6 :-) One way that this is =E2=80=98expensive=E2=80=99 is that it always calls WH= ICH at=20 least once, no matter what Guix was invoked to do. If you're familiar with Haskell or Nix: Scheme is not that, it's=20 not =E2=80=98lazy=E2=80=99 and will evaluate the (if (which "less") =E2=80= =A6) even when=20 the value is never used. Turning AVAILABLE-PAGER into a procedure=20 would avoid that. Also, you're looking up the final pager in $PATH twice: you call=20 WHICH, but then discard its work by returning the relative string=20 "less". The final OPEN-PIPE* invokes a shell which will search $PATH=20 again. We could save it the trouble by returning an absolute file=20 name: the result of WHICH. And since WHICH returns #f on failure, you can replace the nested=20 IFs with a single OR: (define (available-pager) (or (which "less") (which "more"))) And well, as you probably noticed by now, it's actually more clear=20 and concise if we just in-line what little is left: (let ((pager-command-line (or (getenv "GUIX_PAGER") (getenv "PAGER") (which "less") (which "more") ""))) =E2=80=A6 Your original patch returns #f if no pages could be found. I=20 don't think that is handled, but "" is, so return that instead. Now I think that's 100% equivalent to your original; let me know=20 if I missed a spot. > Also, if you feel that this is a minor issue and not worth=20 > addressing, please > feel free to dismiss it. (Still, a fix to make the error message=20 > more friendly > might be a good idea.) It *is* minor, but then so is the fix, and as written above it=20 doesn't add =E2=80=98overhead=E2=80=99. I think it's a good idea to check = for=20 "more" (but no more) and silently disable paging otherwise. Thanks! T G-R --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYqCbdg0cbWVAdG9iaWFz LmdyAAoJEA2w/4hPVW15J6cA/RQGWhlpt1XXNYCSbQvLTOzELdbnq2yPc9ugwyIP swScAQC4EhfrTujG0/3PIR1Igbvklb7ThJ8dxIzw1rEC9SyFAw== =+rk9 -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 09:12:55 2022 Received: (at submit) by debbugs.gnu.org; 8 Jun 2022 13:12:55 +0000 Received: from localhost ([127.0.0.1]:42757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyvUV-00016R-0O for submit@debbugs.gnu.org; Wed, 08 Jun 2022 09:12:55 -0400 Received: from lists.gnu.org ([209.51.188.17]:57876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyvUS-00016F-W7 for submit@debbugs.gnu.org; Wed, 08 Jun 2022 09:12:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyvUS-0006Zx-Au for guix-patches@gnu.org; Wed, 08 Jun 2022 09:12:52 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:36837) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyvUP-0005E5-B5 for guix-patches@gnu.org; Wed, 08 Jun 2022 09:12:51 -0400 Received: by mail-pg1-x531.google.com with SMTP id y187so18870497pgd.3 for ; Wed, 08 Jun 2022 06:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=U43AoQ11OKCiq3jnwo+i9sNrKzfDKJ6lwhY6HEHWoFY=; b=7TD88WnpqO7bwiC58PNa/L2gMjJvPWPPQlOoUxOj/COdXdlb/e5PIQx+ep8TXoJEpL fKN94SPaPk6jptgfnq/jA1zIdHROk+BpcO3mRWpgFSn1pl+VluSz/zoZCj++09YK3zS8 EQXXqTzTA8WwKpdmnY4O67iGXba/yPa0QaZPcBEUcyzi/yvZcf5Je5L892kYNzoQoWQ9 YyyiuuOjmj+0WQD0IR335DC1SZnQFNvenK8UDTNZMMXzGqDn1Lo9ZOojCP2ayAK2WJRF HA3MTG3WjtKt4BFbXoH5ATosYpRiAItJiVqNmo8AJWIhDGM49NNFOWk/oxmw2tC0Mps4 So1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=U43AoQ11OKCiq3jnwo+i9sNrKzfDKJ6lwhY6HEHWoFY=; b=jGC08ochK3pZcw1AW9VgXI9w2dmKxaA0K9Y9E39vbYni+fTyDcZxne70XbxtS9djWL RdpERKPrIbgDMQlJDVJjgSZ6q4EPMGMsKVDlZA5ILpdDvCIEvk+lPGsWiu+OMfyRcYOd 2yF3xfaTy/So4Czc0tO1fPP7G4jN2Zvn3zk2LVdiKkModiCGvg6Ae2n5WOqw61UGX2Pe bJUGTih5l9YcmFUYkEIZNWMMT59KnDM0P1wOJSwkExX9bTAcxvN851/zvCvN5Rei3696 OBz6P0gQFHnk6kerU6lz8xsivKf+tlSVDjwrwaW1x/2KD0/MQB3yzPNXEBmFBFxI9FZA l7rg== X-Gm-Message-State: AOAM5326or5LfChdux5cynmIej2SGF+TBJCpOmYUXWTCMtW0Ssdzkyic TOjq3WDdB+icR7ci6lNX4DIUJ9Eevs4HTyU9 X-Google-Smtp-Source: ABdhPJxWquvY7zwnl3SApFee8YE+bAL9n3mv5dVxnIGV1U2t5hMalGKkWSfk8SQbKHP2TDzYJR9tWg== X-Received: by 2002:a63:189:0:b0:3fa:ab5:4218 with SMTP id 131-20020a630189000000b003fa0ab54218mr29574537pgb.91.1654693967490; Wed, 08 Jun 2022 06:12:47 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id f13-20020a63dc4d000000b003fdb58d951dsm6792186pgj.42.2022.06.08.06.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 06:12:37 -0700 (PDT) From: Taiju HIGASHI To: Tobias Geerinckx-Rice Subject: Re: [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed References: <20220608102124.14865-1-higashi@taiju.info> <87wndrwc5m@nckx> Date: Wed, 08 Jun 2022 22:12:34 +0900 In-Reply-To: <87wndrwc5m@nckx> (Tobias Geerinckx-Rice's message of "Wed, 08 Jun 2022 14:14:34 +0200") Message-ID: <8735gf47ul.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Received-SPF: none client-ip=2607:f8b0:4864:20::531; envelope-from=higashi@taiju.info; helo=mail-pg1-x531.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: 55845@debbugs.gnu.org, guix-patches@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi $B Hi! > > Taiju HIGASHI $B> The problem rarely occurs, but when we run guix commands in an >> environment >> where "less" is not installed we get an error. > > True. Odd that it's gone unreported(?) for so long. > >> I am concerned about performance degradation due to more unnecessary >> processing. > > Since you asked$B!D(B :-) > > One way that this is $B!F(Bexpensive$B!G(B is that it always calls WHICH at > least once, no matter what Guix was invoked to do. > > If you're familiar with Haskell or Nix: Scheme is not that, it's not > $B!F(Blazy$B!G(B and will evaluate the (if (which "less") $B!D(B) even when the > value is never used. Turning AVAILABLE-PAGER into a procedure would > avoid that. I understand that I can delay the evaluation timing if I make it a procedure, but is my understanding correct that the number of calls will remain the same because it will be evaluated each time the `call-with-paginated-output-port` procedure is called? I agree with your point that it would be better to make it a procedure, as it would be more eco-friendly to not have to evaluate when GUIX_PAGER or PAGER is specified. > Also, you're looking up the final pager in $PATH twice: you call > WHICH, but then discard its work by returning the relative string > "less". > > The final OPEN-PIPE* invokes a shell which will search $PATH again. > We could save it the trouble by returning an absolute file name: the > result of WHICH. I see, I did not understand that behavior. Thank you. > And since WHICH returns #f on failure, you can replace the nested IFs > with a single OR: > > (define (available-pager) > (or (which "less") > (which "more"))) This one is also more readable. Thank you. > And well, as you probably noticed by now, it's actually more clear and > concise if we just in-line what little is left: > > (let ((pager-command-line (or (getenv "GUIX_PAGER") > (getenv "PAGER") > (which "less") > (which "more") > ""))) > $B!D(B You mean that the $PATH lookup in open-pipe can be suppressed? Also, I misunderstood the string-null? spec; available-pager should have returned an empty string. > Your original patch returns #f if no pages could be found. I don't > think that is handled, but "" is, so return that instead. > > Now I think that's 100% equivalent to your original; let me know if I > missed a spot. I thought what you said was completely correct. >> Also, if you feel that this is a minor issue and not worth >> addressing, please >> feel free to dismiss it. (Still, a fix to make the error message >> more friendly >> might be a good idea.) > > It *is* minor, but then so is the fix, and as written above it doesn't > add $B!F(Boverhead$B!G(B. I think it's a good idea to check for "more" (but > no more) and silently disable paging otherwise. I will just write what you have told me, but may I continue to modify the patch? Thank, -- Taiju From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 09:18:42 2022 Received: (at 55845) by debbugs.gnu.org; 8 Jun 2022 13:18:42 +0000 Received: from localhost ([127.0.0.1]:42767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyva3-0001FJ-1f for submit@debbugs.gnu.org; Wed, 08 Jun 2022 09:18:42 -0400 Received: from laurent.telenet-ops.be ([195.130.137.89]:53474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyvZm-0001Et-KJ for 55845@debbugs.gnu.org; Wed, 08 Jun 2022 09:18:38 -0400 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by laurent.telenet-ops.be with bizsmtp id gdJL2700F4UW6Th01dJLlj; Wed, 08 Jun 2022 15:18:21 +0200 Message-ID: Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. From: Maxime Devos To: Taiju HIGASHI , 55845@debbugs.gnu.org Date: Wed, 08 Jun 2022 15:18:20 +0200 In-Reply-To: <20220608102257.15042-1-higashi@taiju.info> References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-zLsOdS6vquILpEudFZWb" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1654694301; bh=5l9hwFX0O0zBYzfhSNkcBd68OJA4O6ZXPiDC/G2MT6U=; h=Subject:From:To:Date:In-Reply-To:References; b=Pxzcbs9+fR73am7tAd4o0rTUBSnngqzVP/Oq+Hpj+5nPdcf+qUfNkbXXBRkwjrKYj Kv7j5bwcht5WeATSo5wGPlNFNRG0ErzO/qoTDlpd44uSdmH2GpGXzF+nZ3KbYCQabc FV5AtsNoqj0Ag2TTF00EIYMY8sPjhUEQ+cgyjc13N7HQMFj9HEJSOOFwncoCt24fnL FW2iVV6QPwANAXC8tCW8cyNVbbSd23+FB2g6tqOmFQ9/iJH6k2pOSqw9erq6GIfoNp Pt/k4VdrSua2xmd7EY53qd/5igKFoxMwaaY/S8v56QXrNrm7WBOs4g+DpAm+k5RlAN mZ6763V1V+j9Q== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 55845 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-zLsOdS6vquILpEudFZWb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Taiju HIGASHI schreef op wo 08-06-2022 om 19:22 [+0900]: > +(define available-pager > +=C2=A0 (if (which "less") > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "less" > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if (which "more") > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "more" > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #f))) Can be simplified to something like,: (define (find-available-pager) "[appropriate docstring]" (or (getenv "GUIX_PAGER") ;; <-- simplify 'if' chains by using 'or' (getenv "PAGER") (which "less") (which "more") ;; <--- TODO: how to handle no pager being found? )) and (let ((pager-command-line (available-pager))) [...]) I've thunked find-available-pager here, such that call-with-paginated- output-port respects the $PATH that is set before call-with-paginated- output-port instead of the $PATH from when "guix ui" was loaded? Ideally there would be some regression tests as well. Greetings, Maxime --=-zLsOdS6vquILpEudFZWb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYqChnBccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7j5RAPsEj5yYdIlfKWin4my2/ti4UWA2 QJt55+toXXZqqeRxtwEAjZmV/wVo9Um33TQVfFu3hk8Gwjhuw2O0Q+hass6Z+A8= =pR+i -----END PGP SIGNATURE----- --=-zLsOdS6vquILpEudFZWb-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 10:39:44 2022 Received: (at submit) by debbugs.gnu.org; 8 Jun 2022 14:39:44 +0000 Received: from localhost ([127.0.0.1]:43961 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nywqW-0005dx-7q for submit@debbugs.gnu.org; Wed, 08 Jun 2022 10:39:44 -0400 Received: from lists.gnu.org ([209.51.188.17]:60980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nywqS-0005dh-HR for submit@debbugs.gnu.org; Wed, 08 Jun 2022 10:39:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nywqR-0001iI-Vp for guix-patches@gnu.org; Wed, 08 Jun 2022 10:39:40 -0400 Received: from tobias.gr ([2a02:c205:2020:6054::1]:51080) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nywqQ-0003H4-1C for guix-patches@gnu.org; Wed, 08 Jun 2022 10:39:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=Uf1NGtv4J5uwI Wpkj6RJlBsu4OZEaRh2KPDkoPEVvUI=; h=in-reply-to:date:subject:cc:to: from:references; d=tobias.gr; b=eqD4IpsxHKzCdTuU0kSV+3vcBgA/qYzz2koRVU P0MzepZUYRd2S7fekLOOQIqMwsveVkjz4dCeKjqq5FjrJWhI5EDVs0t3h/9ezArTivPVc8 GmrxJfLAqOJgsXqKf6ECOH8vNmep5ETs50e8wckJaK+lyWyBe8G+NlSIS5SeBRyw1KDlJG 5yzEFzPkFfbaBnnRNjF/RNbGcmLZjqKTYXxzw/yKAJS2kOxe1ruDyi0rktWgbkkw0uTuTH FjZ6yhxLAM8lQHI0uTG1aWMOTBd6mE9BY9M+tDL2ECktuRwUe5W0+gHvvnoGvguk/miQ8x WK179fh+fsSo3lfVfDoQGeiQ== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 272f922d (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Wed, 8 Jun 2022 14:39:34 +0000 (UTC) References: <20220608102124.14865-1-higashi@taiju.info> <87wndrwc5m@nckx> <8735gf47ul.fsf@taiju.info> From: Tobias Geerinckx-Rice To: Taiju HIGASHI Subject: Re: [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed Date: Wed, 08 Jun 2022 16:22:08 +0200 In-reply-to: <8735gf47ul.fsf@taiju.info> BIMI-Selector: v=BIMI1; s=default; Message-ID: <87k09rw74q@nckx> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=2a02:c205:2020:6054::1; envelope-from=me@tobias.gr; helo=tobias.gr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: submit Cc: 55845@debbugs.gnu.org, guix-patches@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) --=-=-= Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi again, Taiju HIGASHI =E5=86=99=E9=81=93=EF=BC=9A > I understand that I can delay the evaluation timing if I make it=20 > a > procedure, but is my understanding correct that the number of=20 > calls will > remain the same because it will be evaluated each time the > `call-with-paginated-output-port` procedure is called? Previously, it would have been evaluated even if=20 call-with-paginated-output-port was never called at all. As for the >0 calls case: yes=E2=80=A6 but when do we expect=20 call-with-paginated-output-port to be called more than once per=20 run? The use case for this code is to do something, then display it in=20 a pager and exit. I think calling it multiple times in one run=20 would imply bad UX. Do I misunderstand? > I agree with your point that it would be better to make it a=20 > procedure, > as it would be more eco-friendly to not have to evaluate when=20 > GUIX_PAGER > or PAGER is specified. I wish the rest of Guix were so efficient that it mattered :-) [/me is waiting for =E2=80=98guix pull=E2=80=99 as I reply to multiple mail= s, on=20 battery=E2=80=A6] Regardless, not calling a procedure at all is even more efficient=20 and IMO more readable here. > You mean that the $PATH lookup in open-pipe can be suppressed? Yes. OPEN-PIPE* won't need to stat $PATH at all if we give it=20 "/run/current-system/profile/bin/less" instead of "less". (It's not relevant to the above, but my previously reply=20 mistakenly mentioned a shell =E2=80=94 there is no shell involved with=20 OPEN-PIPE*, only with OPEN-PIPE. Sorry.) > I will just write what you have told me, but may I continue to=20 > modify > the patch? Of course! Curious how, though. Kind regards, T G-R --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYqC05Q0cbWVAdG9iaWFz LmdyAAoJEA2w/4hPVW15P/AA/2cbBXHSGYEW1IztN5Vc8xA55LVoIwAiV8dY9xJn jT2cAP4t32jz4Yh88FxgEfjYw77tgG05sqB971XkBni38fR+Bw== =qZKk -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 11:08:21 2022 Received: (at 55845) by debbugs.gnu.org; 8 Jun 2022 15:08:21 +0000 Received: from localhost ([127.0.0.1]:43977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyxID-0006Lz-9Z for submit@debbugs.gnu.org; Wed, 08 Jun 2022 11:08:21 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:44092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyxIB-0006Lq-3y for 55845@debbugs.gnu.org; Wed, 08 Jun 2022 11:08:20 -0400 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by baptiste.telenet-ops.be with bizsmtp id gf8H2700C4UW6Th01f8HDf; Wed, 08 Jun 2022 17:08:17 +0200 Message-ID: <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. From: Maxime Devos To: Taiju HIGASHI Date: Wed, 08 Jun 2022 17:08:13 +0200 In-Reply-To: <87leu72sbo.fsf@taiju.info> References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-IZTYJcXk3fXp9W/qJwmy" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1654700897; bh=eYoQr/EE7OYYG1+ib1w65DOoqAJMs36jCppnxTdBxd0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=J7xiyb0XyPKRgm/6ur8vvG4Bj6q4JR8IwXkMRBlU/kKAUeg76jmN2+A0NDdC8ncfa sTDznGvdi9yzxPpfnD3S36rL7H1Za5uuGbvXE4ywm2+lN5/Ldx9eNKnHsDaScbn+R9 v/4UK51YTWN4D7jU127lOIRj88HM3bEl3WdIT/S2XrHgMwWgRYRYUvc4GvGgQF3eoh VShf12dS2wGvXvMfzWoKSZdy++tTnNdQg27JKFeLvTIOqXg4+8Dn3Dn5soTXuF/WnK jaAcF9Lgk3W//va7HJiX/Pf+U+BWfWfZ9+2uU9Xgr5A+itQ4U4/+hbg+69VHCIGBsh ANhlZQ0wJ7Awg== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-IZTYJcXk3fXp9W/qJwmy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable [Please keep debbugs in CC] Taiju HIGASHI schreef op wo 08-06-2022 om 22:33 [+0900]: > > Ideally there would be some regression tests as well. >=20 > I think I can write tests if I can figure out how to give a minimal > specific package to the test preconditions, do you have any test > codes > that are similar and can be used as a reference? Not really, but FWIW it might be convenient to use the with-environment-variables macro and mock the call to open-pipe* with the 'mock' macro to make sure that open-pipe* is called with the =E2=80=98correct=E2=80=99 pager according to PATH (*). Searching for 'mock= ' with "git grep -F" should find some examples. (*) call-with-temporary-directory + chmod + call-with-output-file may be useful for setting up a simulated $PATH with a dummy 'less' and/or 'more'. Greetings, Maxime. --=-IZTYJcXk3fXp9W/qJwmy Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYqC7XRccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7h8jAP9B1zTmcC+e4dCLljBI+fLq8TVq CsP2jacOxeIJD+rUYQD/Y8m5xt/oqWeJ8w60ZqdK/EnAgc6Cbi6mBQIf7Tq9XAw= =eb9M -----END PGP SIGNATURE----- --=-IZTYJcXk3fXp9W/qJwmy-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 11:09:30 2022 Received: (at submit) by debbugs.gnu.org; 8 Jun 2022 15:09:30 +0000 Received: from localhost ([127.0.0.1]:43984 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyxJJ-0006Nw-Tu for submit@debbugs.gnu.org; Wed, 08 Jun 2022 11:09:30 -0400 Received: from lists.gnu.org ([209.51.188.17]:35188) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyxJF-0006Na-9W for submit@debbugs.gnu.org; Wed, 08 Jun 2022 11:09:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyxJD-0000vF-Q9 for guix-patches@gnu.org; Wed, 08 Jun 2022 11:09:24 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:42819) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyxJB-00005h-GO for guix-patches@gnu.org; Wed, 08 Jun 2022 11:09:23 -0400 Received: by mail-pl1-x634.google.com with SMTP id d22so17866473plr.9 for ; Wed, 08 Jun 2022 08:09:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=D84by1sZDsvs54XAGDpfLyQuUma/2NsiOPYV9yhoGgU=; b=GlXp3MhyyS0LdUvAOS18wMI/b6jn854LHSTe+MvhyVOklq5zVhxSY20mtEKzyXyfP8 RVsrs0ze03chZZou9hKTc3Bc0/kZLSM5uDwouNQugB3jNmGH/fIE/odmYRBxv/BlMaJ9 mLmXEeWTcW3/COQEeE716z+M95MlD+hi5WPP13X16D77f7/Ew0IINOV8GPPhK/in0uI6 4L3Ylna+z1LZCMBn6gpE+BGgIDeUmo2CXaRUZPMwAhade0kNU+E+EbApQY6bovgMPhnU qYETgcPwplgiBoFjBF3O6aCstesOc0x9SU0u23P+71rzBDkCxwrl3eRsSdh7Dluzc+/1 50kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=D84by1sZDsvs54XAGDpfLyQuUma/2NsiOPYV9yhoGgU=; b=SpHTen5ITPFzyJdGv84HpYmzrDDc4cNwVafWrtPwPny7wDJNvpWBdhwkGXG78OXkOC JBDqdgIR3kkXlVmNaycRr8VJaRdVF8cQWN6kicRcSS8KcZ+MQVhctfttjDu5Yk9z0l3q cvBAh+gfFBMFUYI7rtBzLOVbkMYLotkiwZR0MffiRkpteUiYRKoZClDpVWrz0B6pasE2 7UPIKQVt2W1GVUJEsHYeD6esO6eGn/ZDOUap0rJ7BN7al0ZjIZsO6hPHOhE3dubQjAeU jbwKij0++CKSZ+XaCwM99ZiuxVj/cIzgfoHNdYDOrSStDe2D7SDRWz3Q2xKrN1yPHjBR qCdw== X-Gm-Message-State: AOAM530w/sedD3Q2E9d/LDEelrYulijT3iJntofpj+7BZbWPGjcs6UJE 7s1HiIhFKUwBIFLUMDIlCzjloQRJkNujQtYC X-Google-Smtp-Source: ABdhPJxP10xTy5wImRWwwZvnpuwqLNGp8U4Dfr6x7zpTiBb1EN546BLEzHgWM6zC3OxDBFFVnIS8ZA== X-Received: by 2002:a17:90a:4414:b0:1df:9b8f:c3cc with SMTP id s20-20020a17090a441400b001df9b8fc3ccmr72779500pjg.56.1654700959621; Wed, 08 Jun 2022 08:09:19 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id m6-20020a1709026bc600b0016370e1af6bsm12073943plt.128.2022.06.08.08.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 08:09:19 -0700 (PDT) From: Taiju HIGASHI To: Tobias Geerinckx-Rice Subject: Re: [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed References: <20220608102124.14865-1-higashi@taiju.info> <87wndrwc5m@nckx> <8735gf47ul.fsf@taiju.info> <87k09rw74q@nckx> Date: Thu, 09 Jun 2022 00:09:16 +0900 In-Reply-To: <87k09rw74q@nckx> (Tobias Geerinckx-Rice's message of "Wed, 08 Jun 2022 16:22:08 +0200") Message-ID: <87sfof19b7.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Received-SPF: none client-ip=2607:f8b0:4864:20::634; envelope-from=higashi@taiju.info; helo=mail-pl1-x634.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: 55845@debbugs.gnu.org, guix-patches@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Tobias, Thank you kindly for your detailed explanation. Tobias Geerinckx-Rice writes: > Hi again, > > Taiju HIGASHI $B> I understand that I can delay the evaluation timing if I make it a >> procedure, but is my understanding correct that the number of calls >> will >> remain the same because it will be evaluated each time the >> `call-with-paginated-output-port` procedure is called? > > Previously, it would have been evaluated even if > call-with-paginated-output-port was never called at all. > > As for the >0 calls case: yes$B!D(B but when do we expect > call-with-paginated-output-port to be called more than once per run? > > The use case for this code is to do something, then display it in a > pager and exit. I think calling it multiple times in one run would > imply bad UX. > > Do I misunderstand? No, you don't. As you said, my implementation was a bad idea, as call-with-paginated-output-port is executed even when it is not needed. It seems unlikely that call-with-paginated-output-port will be called more than once in a single process. I did not have enough insight. >> I agree with your point that it would be better to make it a >> procedure, >> as it would be more eco-friendly to not have to evaluate when >> GUIX_PAGER >> or PAGER is specified. > > I wish the rest of Guix were so efficient that it mattered :-) > > [/me is waiting for $B!F(Bguix pull$B!G(B as I reply to multiple mails, on > battery$B!D(B] > > Regardless, not calling a procedure at all is even more efficient and > IMO more readable here. I agree. >> You mean that the $PATH lookup in open-pipe can be suppressed? > > Yes. OPEN-PIPE* won't need to stat $PATH at all if we give it > "/run/current-system/profile/bin/less" instead of "less". > > (It's not relevant to the above, but my previously reply mistakenly > mentioned a shell $B!=(B there is no shell involved with OPEN-PIPE*, only > with OPEN-PIPE. Sorry.) No problem. I'm sorry I'm the one who asked a ton of questions. >> I will just write what you have told me, but may I continue to >> modify >> the patch? > > Of course! Curious how, though. I have also received a response from Maxime and plan to include the following information. (define (find-available-pager) "Returns the program name or path of an available pager. If neither less nor more is installed, return an empty string so that call-with-paginated-output-port will not call pager." (or (getenv "GUIX_PAGER") (getenv "PAGER") (which "less") (which "more") "" ;; Returns an empty string so that call-with-paginated-output-port does not call pager. )) (define* (call-with-paginated-output-port proc #:key (less-options "FrX")) (let ((pager-command-line (find-available-pager))) ... However, I can't submit the v2 patch yet because I don't know how to implement the integration test. Thanks, -- Taiju From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 11:17:31 2022 Received: (at 55845) by debbugs.gnu.org; 8 Jun 2022 15:17:31 +0000 Received: from localhost ([127.0.0.1]:43990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyxR4-0006Za-SF for submit@debbugs.gnu.org; Wed, 08 Jun 2022 11:17:31 -0400 Received: from mail-pg1-f170.google.com ([209.85.215.170]:41529) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyxR2-0006ZL-RX for 55845@debbugs.gnu.org; Wed, 08 Jun 2022 11:17:30 -0400 Received: by mail-pg1-f170.google.com with SMTP id e66so19155156pgc.8 for <55845@debbugs.gnu.org>; Wed, 08 Jun 2022 08:17:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=cLv4XN5pX5ZlU6Rne9OoMwBwqmiVph1TWVUrgpwISic=; b=f7kXyeHz0xGcU43zbiBPTz/hDjuO+jb2KYpS9nyR0O8tl9364TuacWoW0pfXtUA5cQ keL3Y70Se1fsjHLb66mJeDKdWnbb78xj7/EWHEbcdUr8WUMaEGvVsWloD1lMmYVA064S LWoxEPEE8gYNzyIezRaeMY4Bi06N7YPhJuiyF+Fk+C3Z2ugLNn9vXkX6YN6U2nmcRdH8 UqGSDvEBOoyHbXsQS1P9KjG30zlHZVn/NZRVPfNFwygI1EGX7r6y+U/OKNdM9cqfU+LJ s+ASJN9Kb6iOmti0/ntcoyByOciRVcli94JkQMnkBE8jZMcL7xO+BE9G3/GSQy9q0ZH9 42vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=cLv4XN5pX5ZlU6Rne9OoMwBwqmiVph1TWVUrgpwISic=; b=qUIUNx7ySNTQhJbmAv7I7Ddi2eAN6U0iDXqr1AYPTI/WwD3xX9HbbIL0MdGrS2LxIZ Eq4+UVDeVVmFQo+lkAhWvaP6kYGoC8JW8FU/u2QPY3bV9ONbIs/EAErAZkoM90thjFdm KWCBup1hj5X3cTXbm3n3MChdfahC4wmK3EBeVNDTiAqacvVgob3NMKxFTrJVI5fTD7xF lg9UJZJr8nszx15iQ9LyrzA/9NKwk/ptAOBzgRuv9tMM2i2uh7iET2vtxY2nU3o5G/Cw /8Cgrht0CveKo1r6q5WrUJhHAIj0tPxeMPkl4L3Ciw1P1ucYGdRHZIucgQ7fQSM/Msin pi3w== X-Gm-Message-State: AOAM531VsW4HbGr71ytEwQkusITCiNygbdzeJKmH1lJ+nACVoXJPVyTa CltiQrJpTV6gdAp2FuiHSxucUvtL8B+d9dYS X-Google-Smtp-Source: ABdhPJwlsGhnMs0Si7tGO58HIW5yi3BXVQLUAAeiSD5aLaZSf0DJ+kC3bDdkIb6drRBrcjPI0duswg== X-Received: by 2002:a05:6a00:198e:b0:51c:3511:4aff with SMTP id d14-20020a056a00198e00b0051c35114affmr10149659pfl.20.1654701442627; Wed, 08 Jun 2022 08:17:22 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id i3-20020a056a00004300b0050dc76281c9sm15198983pfk.163.2022.06.08.08.17.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 08:17:22 -0700 (PDT) From: Taiju HIGASHI To: Maxime Devos Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> Date: Thu, 09 Jun 2022 00:17:19 +0900 In-Reply-To: <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> (Maxime Devos's message of "Wed, 08 Jun 2022 17:08:13 +0200") Message-ID: <87k09r18xs.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Maxime Devos writes: > [Please keep debbugs in CC] I'm sorry. > Taiju HIGASHI schreef op wo 08-06-2022 om 22:33 [+0900]: >> > Ideally there would be some regression tests as well. >> >> I think I can write tests if I can figure out how to give a minimal >> specific package to the test preconditions, do you have any test >> codes >> that are similar and can be used as a reference? > > Not really, but FWIW it might be convenient to use the > with-environment-variables macro and mock the call to open-pipe* with > the 'mock' macro to make sure that open-pipe* is called with the > $B!F(Bcorrect$B!G(B pager according to PATH (*). Searching for 'mock' with "git > grep -F" should find some examples. > > (*) call-with-temporary-directory + chmod + call-with-output-file may > be useful for setting up a simulated $PATH with a dummy 'less' and/or > 'more'. Thanks for the implementation tips. I will try to implement the test as well, although it will be after tomorrow. Is tests/ui.scm the right place to implement the tests? Thanks, -- Taiju From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 12:47:03 2022 Received: (at 55845) by debbugs.gnu.org; 8 Jun 2022 16:47:03 +0000 Received: from localhost ([127.0.0.1]:44079 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyypf-00027J-4a for submit@debbugs.gnu.org; Wed, 08 Jun 2022 12:47:03 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:46786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyypZ-00022a-Ms for 55845@debbugs.gnu.org; Wed, 08 Jun 2022 12:46:58 -0400 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by xavier.telenet-ops.be with bizsmtp id ggmr2700X4UW6Th01gmri1; Wed, 08 Jun 2022 18:46:52 +0200 Message-ID: <4ee2875e3f4c871779b734c1209a7e952222897d.camel@telenet.be> Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. From: Maxime Devos To: Taiju HIGASHI Date: Wed, 08 Jun 2022 18:46:45 +0200 In-Reply-To: <87k09r18xs.fsf@taiju.info> References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87k09r18xs.fsf@taiju.info> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-EfAK97qtirxDPly7pfNO" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1654706812; bh=PzL9lnzE2XHKovjxnq+iUHZazBZKdclRII6nNxcib9I=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Bb3EjeMRxRb2g9lUvtEMLhxKBA8e3/qEKHrjiVWAgdXFFhFwoxpmlsT666WbTmgWw t1q3WDJVJSI7mDEkZukhSMDBz0+kz7AW4YH6CJB6sQ/XHnXXRPwxLveZ+H959BXH+y aP9QwwKG5Cbh4RDz1/Nwd7hKzXA888MILjt+F83sbE0freG1306lKlpfL+iPayenjO elQmShU7MKBB0QMjSvzJD+IaORdLnAiyAVR6ZczMCg1lb1nDQNyEpEMG1/084PaC0p vqG4cWulyEwF/6Wtvv7O4DoTOxSpPtIRe4f1tb13Q9IsMivSd+MyG/eqWkJFyMv1V7 yrpObMtu080HA== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-EfAK97qtirxDPly7pfNO Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Taiju HIGASHI schreef op do 09-06-2022 om 00:17 [+0900]: > Thanks for the implementation tips. I will try to implement the test as > well, although it will be after tomorrow. Is tests/ui.scm the right > place to implement the tests? Looks like the right location to me ,yes. Greetings, Maxime. --=-EfAK97qtirxDPly7pfNO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYqDSdRccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ks8AQCP2siKdFtNuveWBw9+1YJJRfKb kAKeRgajDDBIUcofHgEAtjJvzMG0okTkLXWk1IrIe6AJ7dSfzMO1g4gDDelL2AI= =JarM -----END PGP SIGNATURE----- --=-EfAK97qtirxDPly7pfNO-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 09 05:52:24 2022 Received: (at 55845) by debbugs.gnu.org; 9 Jun 2022 09:52:24 +0000 Received: from localhost ([127.0.0.1]:45020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzEq0-0000e7-5o for submit@debbugs.gnu.org; Thu, 09 Jun 2022 05:52:24 -0400 Received: from mail-pj1-f50.google.com ([209.85.216.50]:55256) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzEpy-0000dq-Jt for 55845@debbugs.gnu.org; Thu, 09 Jun 2022 05:52:23 -0400 Received: by mail-pj1-f50.google.com with SMTP id j7so20910222pjn.4 for <55845@debbugs.gnu.org>; Thu, 09 Jun 2022 02:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=q8LROpIUUdholOVFd60B/NiHMdYji1JFntLJ2JyRJFY=; b=jTaKVu3EtGawIj6jmkou7PLXQoPSu0pAZul7RRgHbYy54xD90paeg7j+jshu4Na1+X Ssfa6DxmEEu8lme2xetMye42viVJTqcprMoLXIyeN5yhkThzMDayOo69Kov+bJAC4CzI 70v6FmKRx+DLElhMQfB22l/K89sTZoILlxQlRHmyinwDrlI2RKc+S6SzVY0sqJFd5plj x5oNdq1mX0CpOnsIrKJND+pdZR+BylWJx2ZAxYxFb8ahyX1440FUNZv4NLpyoiTbyTD3 QlflvYxcnE2OlYUIZ7V8itB25Bmz1SRa4qRXrp4VfH0bxrfD9z/l+xhut0FQ698LYGLw D9fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=q8LROpIUUdholOVFd60B/NiHMdYji1JFntLJ2JyRJFY=; b=yRu1koX8kEQN7djPIGnvZthNnr3EjU7f1Q78BhYSQsGmtO9xvB2j8eAulGzJksz3XM pWt7QSQVQeTlhzPt3SI/qMZpSKKUbq+BD9NzYDJw+MCCoOpe9dc22BnDb670c67y7net aAhljmW4fiDV1H4Gtp/5VX4viHI4/KpdG4sCPgmH+IWScDHa7dhfF4KiEIdrXwvPgiAM SLFMbFYao1MvrD6ITVdOaWBLIDkESKasXq1IlrnZJoHjsreGtDMDVUeyChqtMi0ethUO ZsGHMG27eb07SnUCfJs4RrC2xMkqwIIXQpgDBBXU2ap+GOd31fpQyAess7nkR+C+4e5W lqTw== X-Gm-Message-State: AOAM530wKA+PjvOjavWY9qBi+k3jihAXxQuw1bIDKRKceUaL8pqM0ENW XJ+Myat6YGFUe6GTo2RAtN7Rr6zu5gkR4pcc X-Google-Smtp-Source: ABdhPJzKX7ux5BY5yap+Gk2xWsX5jo7CBTLRzpO9utjDkKM/T9kqFrgmKBNzvxn3EEXoT4FGypBUKQ== X-Received: by 2002:a17:902:a404:b0:166:1f9b:c63a with SMTP id p4-20020a170902a40400b001661f9bc63amr39122174plq.26.1654768336288; Thu, 09 Jun 2022 02:52:16 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id b4-20020a17090a9bc400b001e86be34c98sm8603730pjw.13.2022.06.09.02.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 02:52:14 -0700 (PDT) From: Taiju HIGASHI To: Maxime Devos , me@tobias.gr Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> Date: Thu, 09 Jun 2022 18:52:11 +0900 In-Reply-To: <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> (Maxime Devos's message of "Wed, 08 Jun 2022 17:08:13 +0200") Message-ID: <87fskexiyc.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hi, I have created a v2 patch and have attached it to this email and also added a unit test for the find-available-pager. --=-=-= Content-Type: text/x-patch; charset=iso-8859-1 Content-Disposition: attachment; filename=v2-0001-ui-Improve-pager-selection-logic-when-less-is-not.patch Content-Transfer-Encoding: quoted-printable Content-Description: v2-patch >From a65818b99ea1b327313fea08cf2db229c55e4b21 Mon Sep 17 00:00:00 2001 From: Taiju HIGASHI Date: Wed, 8 Jun 2022 18:50:28 +0900 Subject: [PATCH v2] ui: Improve pager selection logic when less is not installed. * guix/ui.scm (find-available-pager): New procedure. Return a available pag= er. (call-with-paginated-output-port): Change to use find-available-pager to select pager. * tests/ui.scm: Add tests for find-available-pager. --- guix/ui.scm | 16 ++++++++++++--- tests/ui.scm | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/guix/ui.scm b/guix/ui.scm index cb68a07c6c..93707a7a4b 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -17,6 +17,7 @@ ;;; Copyright =A9 2020 Arun Isaac ;;; Copyright =A9 2020 Maxim Cournoyer ;;; Copyright =A9 2018 Steve Sprang +;;; Copyright =A9 2022 Taiju HIGASHI ;;; ;;; This file is part of GNU Guix. ;;; @@ -1672,11 +1673,20 @@ (define* (pager-wrapped-port #:optional (port (curr= ent-output-port))) (_ #f))) =20 +(define (find-available-pager) + "Returns the program name or path of an available pager. +If neither less nor more is installed, return an empty string so that +call-with-paginated-output-port will not call pager." + (or (getenv "GUIX_PAGER") + (getenv "PAGER") + (which "less") + (which "more") + "" ;; Returns an empty string so that call-with-paginated-output-por= t does not call pager. + )) + (define* (call-with-paginated-output-port proc #:key (less-options "FrX")) - (let ((pager-command-line (or (getenv "GUIX_PAGER") - (getenv "PAGER") - "less"))) + (let ((pager-command-line (find-available-pager))) ;; Setting PAGER to the empty string conventionally disables paging. (if (and (not (string-null? pager-command-line)) (isatty?* (current-output-port))) diff --git a/tests/ui.scm b/tests/ui.scm index 3dc6952e1f..41de3c63da 100644 --- a/tests/ui.scm +++ b/tests/ui.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =A9 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Court= =E8s +;;; Copyright =A9 2022 Taiju HIGASHI ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,6 +25,7 @@ (define-module (test-ui) #:use-module (guix derivations) #:use-module ((gnu packages) #:select (specification->package)) #:use-module (guix tests) + #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-19) @@ -292,4 +294,60 @@ (define guile-2.0.9 (>0 (package-relevance libb2 (map rx '("crypto" "library"))))))) =20 +(define make-dummy-file + (compose + close-port + open-output-file + (cut string-append <> "/" <>))) + +(test-equal "find-available-pager, All environment variables are specified= and both less and more are installed" + "guix-pager" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir) + ("GUIX_PAGER" "guix-pager") + ("PAGER" "pager")) + (make-dummy-file dir "less") + (make-dummy-file dir "more") + ((@@ (guix ui) find-available-pager)))))) + +(test-equal "find-available-pager, GUIX_PAGER is not specified" + "pager" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir) + ("PAGER" "pager")) + (make-dummy-file dir "less") + (make-dummy-file dir "more") + ((@@ (guix ui) find-available-pager)))))) + +(test-equal "find-available-pager, All environment variables are not speci= fied and both less and more are installed" + "less" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir)) + (make-dummy-file dir "less") + (make-dummy-file dir "more") + (basename ((@@ (guix ui) find-available-pager))))))) + +(test-equal "find-available-pager, All environment variables are not speci= fied and more is installed" + "more" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir)) + (make-dummy-file dir "more") + (basename ((@@ (guix ui) find-available-pager))))))) + +(test-equal "find-available-pager, All environment variables are not speci= fied and both less and more are not installed" + "" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir)) + ((@@ (guix ui) find-available-pager)))))) + (test-end "ui") --=20 2.36.1 --=-=-= Content-Type: text/plain Please check it out. Regards, -- Taiju --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 09 06:23:32 2022 Received: (at 55845) by debbugs.gnu.org; 9 Jun 2022 10:23:32 +0000 Received: from localhost ([127.0.0.1]:45065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzFK8-0001UW-J1 for submit@debbugs.gnu.org; Thu, 09 Jun 2022 06:23:32 -0400 Received: from mail-pl1-f171.google.com ([209.85.214.171]:42756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzFK6-0001UH-0Z for 55845@debbugs.gnu.org; Thu, 09 Jun 2022 06:23:31 -0400 Received: by mail-pl1-f171.google.com with SMTP id f8so858902plo.9 for <55845@debbugs.gnu.org>; Thu, 09 Jun 2022 03:23:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=kuah/88OpMtYeQQMMC8Yin+pKGBc2zJA0c3aXe1j98s=; b=u05NTQwdlcnJ+NNqt88rwVxEPq9D2AnIiCXqh4ECRBkpgBjPkZtQ3YXrjgXCoddqFz GVXCjuboDAzTd9hqKUXidubVogYQL/kF43umCIBiMa/2ScMcAfRNqlH/ht6K+V10EmbX lwj2fZxXavYgdz/jxkoR8WGPREeopLSeoAn3EWvOy7OBzUYlFY1BkVZYb+Qel5N2n2Qf 766/cu1O5qoWIt2ML32n34GOTEJxpwwZuY3zj7pHb3A5emrNX2d8JIiAx+4+hPM3h2Qo GAI603+ermICqPSUe7+jDgakAlt/xB9jeRtwgOGAMci0teBVpI0YcuKKtBq7rSJsz36x nqqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=kuah/88OpMtYeQQMMC8Yin+pKGBc2zJA0c3aXe1j98s=; b=Uu3aJi8E4Jx9w2L3CHKnubL6M5qmsMcLm8KdhQKz69Ab9zNGR92o4TmZf8BxIA+5TA vAP41DhYT+sYqKaIZLz03rt82iO95JRIJI75+lq//CkoYxTwGlcUYvZvNx/Yuv49++kO 97LEAvM3VZDja9g4Kj+BnzAnuVzAM/lmoU4w7h0kXUmQaqG6yR/88dqNWHg8DdFzTvNc MKKZ2Vu51QHLKKbQIoixdfeHkFHd/TIuForOIrkj9vmptlNn/hklPMbtkpStei5BmpFs HpotWSWwL5XW00DfO9dmEVjMYu6l6ayD0dMx0lNN3QmPFzQ+WdWcZTBbq0nq7hmiNe3r Yygg== X-Gm-Message-State: AOAM531Jpqsa3NjntbT0JURfxjYwvRyydi0t6VgrENI78I4kkTwl/Xyu M7/xC8K560AqZrhEIxPHLUqNXO5fGRiy4Q42 X-Google-Smtp-Source: ABdhPJzzhX+Q8gG2GOUk8YE7QAxxN7MaHA2mS/fxNIUI3+EMHOtFC8Aik0wMjsKMKz2L2xQLyQQXwQ== X-Received: by 2002:a17:90a:b284:b0:1e3:826b:d11d with SMTP id c4-20020a17090ab28400b001e3826bd11dmr2780847pjr.79.1654770203943; Thu, 09 Jun 2022 03:23:23 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id o4-20020a170902d4c400b0016230703ca3sm16598571plg.231.2022.06.09.03.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 03:23:23 -0700 (PDT) From: Taiju HIGASHI To: Maxime Devos Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> Date: Thu, 09 Jun 2022 19:23:20 +0900 In-Reply-To: <87fskexiyc.fsf@taiju.info> (Taiju HIGASHI's message of "Thu, 09 Jun 2022 18:52:11 +0900") Message-ID: <874k0uxhif.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Maxime, I tried to mock open-pipe* and isatty?* using the mock macro and also add a test to inspect the program coming across to open-pipe*, but gave up because I could not get the return value of the with-paginated-output-port macro. I think we are one step closer, but it is not working. I will share a piece of code in the process of verification just in case. (test-equal "with-paginated-output-port" "less" (call-with-temporary-directory (lambda (dir) (with-environment-variables `(("PATH" ,dir)) (make-dummy-executable-file dir "less") (mock ((ice-9 popen) open-pipe* (lambda (mode command . args) (current-output-port))) (mock ((guix colors) isatty?* (const #t)) (with-paginated-output-port paginated "less"))))))) I have debugged that the return value of dynamic-wind is "less", but I could not successfully use it for assertions. I also tried to inspect the value of the command argument using test-equal in the open-pipe* mock replacement function, but it did not work. Is there a better way to do this? Thanks, -- Taiju From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 09 15:43:27 2022 Received: (at 55845) by debbugs.gnu.org; 9 Jun 2022 19:43:28 +0000 Received: from localhost ([127.0.0.1]:47841 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzO3z-0001l1-LG for submit@debbugs.gnu.org; Thu, 09 Jun 2022 15:43:27 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:59514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzO3w-0001kr-UG for 55845@debbugs.gnu.org; Thu, 09 Jun 2022 15:43:25 -0400 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by michel.telenet-ops.be with bizsmtp id h7jM270024UW6Th067jMLc; Thu, 09 Jun 2022 21:43:23 +0200 Message-ID: <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. From: Maxime Devos To: Taiju HIGASHI Date: Thu, 09 Jun 2022 21:43:11 +0200 In-Reply-To: <874k0uxhif.fsf@taiju.info> References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-SiXOPGSiks623RpUtbtt" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1654803803; bh=Rc7Nh1TXX4u1XxqvAnUNgLABTNZHcrheLka+62RhjFU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=XGrckfMKuMcwzFo8AzsmHQ+uoN9DxqBJSEJtOWuLzpBQf4QEWd4w0G19GN+55/ifB 092FwIcigXwUnHaEOjH48OR1EjblDMgLLK0Jczt0tSJdejETJZbgCJ6LxK1hd75Qfk Bv3Xx2BX7CiuN4oGttKs24tzrpgUDEJ+YN01hxpbC/jBEEmTwk4tCLLOUUte8rIeIo kpzatOrq+4xRCPBti4pZQB7Cp0ji2Fa2XYrK2az8B5bwZDxLntyKhyaxXPV+JdfpW1 tPls8yHJzoFDUsGorT1trpav3cEdBEg6t/tkO37qQH3XAo/By0rKmrePbBqydv9bFb gbXLaqWzlazxw== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-SiXOPGSiks623RpUtbtt Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Taiju HIGASHI schreef op do 09-06-2022 om 19:23 [+0900]: > Hi Maxime, >=20 > I tried to mock open-pipe* and isatty?* using the mock macro and also > add a test to inspect the program coming across to open-pipe*, but gave > up because I could not get the return value of the > with-paginated-output-port macro. The return value of 'with-paginated-output-port' is just whatever the last expression put in that macro evaluates to. Also 'close-pipe' needs to be mocked, otherwise an error will result. Try: (test-assert "with-paginated-output-port: finds less in PATH" (call-with-temporary-directory (lambda (dir) (define used-command #false) (with-environment-variables `(("PATH" ,dir)) (make-dummy-executable-file dir "less") (mock ((ice-9 popen) open-pipe* (lambda (mode command . args) (when used-command ; <--- an extra test (error "open-pipe* should only be called once")) (set! used-command command) ; <--- this captures the passe= d command (%make-void-port ""))) ; return a dummy port (mock ((ice-9 popen) close-pipe (const 'ok)) (mock ((guix colors) isatty?* (const #t)) (with-paginated-output-port port 'ok))))) (and (pk 'used-command used-command dir) ; <-- fails on my computer b= ecause a non-absolute path is passed and I haven't applied our patch (string=3D? (in-vicinity dir "less") used-command))))) Greetings, Maxime. --=-SiXOPGSiks623RpUtbtt Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYqJNTxccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7nF9AP986LcNcjteB3h9iqA1wZE9CG4d n/ttr1mi/ndsa2VRFAEAtgBnEHTdT1TPYRdbePVeQsfsLvKYrhag+OO4vZJsfAY= =YEyy -----END PGP SIGNATURE----- --=-SiXOPGSiks623RpUtbtt-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 09 20:39:53 2022 Received: (at 55845) by debbugs.gnu.org; 10 Jun 2022 00:39:53 +0000 Received: from localhost ([127.0.0.1]:48254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzSgn-0003LX-B5 for submit@debbugs.gnu.org; Thu, 09 Jun 2022 20:39:53 -0400 Received: from mail-pj1-f52.google.com ([209.85.216.52]:41910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzSgX-0003L6-H9 for 55845@debbugs.gnu.org; Thu, 09 Jun 2022 20:39:48 -0400 Received: by mail-pj1-f52.google.com with SMTP id l20-20020a17090a409400b001dd2a9d555bso821909pjg.0 for <55845@debbugs.gnu.org>; Thu, 09 Jun 2022 17:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=ta7+VgfdWAaTYKB0Ky3ekonCxrs93fYzXv4aKxiShUk=; b=Rlca3I7VyGvyQcSwSYyTtFfuVEtXrGn0L+Ryw16bJ2K1rkpll9Sa8Y9+iXQTBlzPZQ m+x5QcyCqbSwirzl+I531XtOtNh6A00t//oMiSbCBxK/WaCnGPA4hV9U6Z0+F6nhTmGy zoKyhubwxT0FOognEjyJuTNulRcIld58G8L3g6+Twk6HEr00V2NxlwS9Kn52nuLUQxKI e96Gn0cBVWS36+hncILxgNiWc56UKAUqe+ho5gNO7axNyEESpa9ZNI95+OcihfuA37Wn fb7uZGTF73xGOLKgrBirOs9PXAaJML/N71eEbUk4gcMFMwzjAK5prnDi+a+j8lbPMgaZ WoKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=ta7+VgfdWAaTYKB0Ky3ekonCxrs93fYzXv4aKxiShUk=; b=0ZZpeibTGq4nKb0DdAM1BdGvp68IDyFCM5lcUTHUZHgQYTkK3QGJaD/U1enUSRzNIP lOwkvblxJej+tpMt5kIjTaPXH5Is5YNDO1a1BWoj3eGvGadYKWbX9cCOVCoFvgNgD1ZL ctXcofpvjTG58LoO7+ccjwXXnzsdFSa+Yd756os3U3kKgDIjt2dyLAJFRWBfaZOU1HtB i6gEc59d1QsB4bJfrD/sYdsJvJcehhRiE85VthVi52s/Q6TFdG2C4HYGJaNUlG8GOaaT vbnALFnZUlLaCERzJ5bi3Bx7UfgkOG2Cv3oDP3TOHqUrU6M0VdXuS+NrXB4hCLrunVsU EQoA== X-Gm-Message-State: AOAM533igEjh5iDFeTCg9SyBN0lCxBNb6dtM0Yy9f7A4fAnQJ9MmwoL0 L3Hw2z0ReCQWVXtNvPcbvCrWx+67xEFmJQay X-Google-Smtp-Source: ABdhPJx+JeX89WFmdggVd+nrRnj4MvZQgW7lHscWcshAxW3f9f3zcCViKSeHm+LQdZC6/CjMLpGBBQ== X-Received: by 2002:a17:90a:6602:b0:1e3:17e:6290 with SMTP id l2-20020a17090a660200b001e3017e6290mr6115708pjj.37.1654821567366; Thu, 09 Jun 2022 17:39:27 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id bt19-20020a056a00439300b0050dc76281f8sm7360513pfb.210.2022.06.09.17.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 17:39:26 -0700 (PDT) From: Taiju HIGASHI To: Maxime Devos Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> Date: Fri, 10 Jun 2022 09:39:24 +0900 In-Reply-To: <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> (Maxime Devos's message of "Thu, 09 Jun 2022 21:43:11 +0200") Message-ID: <87a6alwdvn.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Maxime Devos writes: > Taiju HIGASHI schreef op do 09-06-2022 om 19:23 [+0900]: >> Hi Maxime, >> >> I tried to mock open-pipe* and isatty?* using the mock macro and also >> add a test to inspect the program coming across to open-pipe*, but gave >> up because I could not get the return value of the >> with-paginated-output-port macro. > > The return value of 'with-paginated-output-port' is just whatever the > last expression put in that macro evaluates to. Also 'close-pipe' > needs to be mocked, otherwise an error will result. > > Try: > > (test-assert "with-paginated-output-port: finds less in PATH" > (call-with-temporary-directory > (lambda (dir) > (define used-command #false) > (with-environment-variables > `(("PATH" ,dir)) > (make-dummy-executable-file dir "less") > (mock ((ice-9 popen) open-pipe* > (lambda (mode command . args) > (when used-command ; <--- an extra test > (error "open-pipe* should only be called once")) > (set! used-command command) ; <--- this captures the passed command > (%make-void-port ""))) ; return a dummy port > (mock ((ice-9 popen) close-pipe (const 'ok)) > (mock ((guix colors) isatty?* (const #t)) > (with-paginated-output-port port 'ok))))) > (and (pk 'used-command used-command dir) ; <-- fails on my computer because a non-absolute path is passed and I haven't applied our patch > (string=? (in-vicinity dir "less") used-command))))) Thank you very much! It worked as expected! I made a v3 patch. --=-=-= Content-Type: text/x-patch; charset=iso-8859-1 Content-Disposition: attachment; filename=v3-0001-ui-Improve-pager-selection-logic-when-less-is-not.patch Content-Transfer-Encoding: quoted-printable Content-Description: v3 patch >From b499be5cf73916005150ddf777ae705070f077d1 Mon Sep 17 00:00:00 2001 From: Taiju HIGASHI Date: Wed, 8 Jun 2022 18:50:28 +0900 Subject: [PATCH v3] ui: Improve pager selection logic when less is not installed. * guix/ui.scm (find-available-pager): New procedure. Return a available pag= er. (call-with-paginated-output-port): Change to use find-available-pager to select pager. * tests/ui.scm: Add tests for find-available-pager. --- guix/ui.scm | 16 +++++++-- tests/ui.scm | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 3 deletions(-) diff --git a/guix/ui.scm b/guix/ui.scm index cb68a07c6c..93707a7a4b 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -17,6 +17,7 @@ ;;; Copyright =A9 2020 Arun Isaac ;;; Copyright =A9 2020 Maxim Cournoyer ;;; Copyright =A9 2018 Steve Sprang +;;; Copyright =A9 2022 Taiju HIGASHI ;;; ;;; This file is part of GNU Guix. ;;; @@ -1672,11 +1673,20 @@ (define* (pager-wrapped-port #:optional (port (curr= ent-output-port))) (_ #f))) =20 +(define (find-available-pager) + "Returns the program name or path of an available pager. +If neither less nor more is installed, return an empty string so that +call-with-paginated-output-port will not call pager." + (or (getenv "GUIX_PAGER") + (getenv "PAGER") + (which "less") + (which "more") + "" ;; Returns an empty string so that call-with-paginated-output-por= t does not call pager. + )) + (define* (call-with-paginated-output-port proc #:key (less-options "FrX")) - (let ((pager-command-line (or (getenv "GUIX_PAGER") - (getenv "PAGER") - "less"))) + (let ((pager-command-line (find-available-pager))) ;; Setting PAGER to the empty string conventionally disables paging. (if (and (not (string-null? pager-command-line)) (isatty?* (current-output-port))) diff --git a/tests/ui.scm b/tests/ui.scm index 3dc6952e1f..ca01d8f03d 100644 --- a/tests/ui.scm +++ b/tests/ui.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =A9 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Court= =E8s +;;; Copyright =A9 2022 Taiju HIGASHI ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,6 +25,7 @@ (define-module (test-ui) #:use-module (guix derivations) #:use-module ((gnu packages) #:select (specification->package)) #:use-module (guix tests) + #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-19) @@ -292,4 +294,98 @@ (define guile-2.0.9 (>0 (package-relevance libb2 (map rx '("crypto" "library"))))))) =20 +(define make-dummy-file + (compose + close-port + open-output-file + (cut in-vicinity <> <>))) + +(test-assert "find-available-pager, All environment variables are specifie= d and both less and more are installed" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir) + ("GUIX_PAGER" "guix-pager") + ("PAGER" "pager")) + (make-dummy-file dir "less") + (make-dummy-file dir "more") + (string=3D? ((@@ (guix ui) find-available-pager)) "guix-pager"))))) + +(test-assert "find-available-pager, GUIX_PAGER is not specified" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir) + ("PAGER" "pager")) + (make-dummy-file dir "less") + (make-dummy-file dir "more") + (string=3D? ((@@ (guix ui) find-available-pager)) "pager"))))) + +(test-assert "find-available-pager, All environment variables are not spec= ified and both less and more are installed" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir)) + (make-dummy-file dir "less") + (make-dummy-file dir "more") + (string=3D? ((@@ (guix ui) find-available-pager)) + (in-vicinity dir "less")))))) + +(test-assert "find-available-pager, All environment variables are not spec= ified and more is installed" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir)) + (make-dummy-file dir "more") + (string=3D? ((@@ (guix ui) find-available-pager)) + (in-vicinity dir "more")))))) + +(test-assert "find-available-pager, All environment variables are not spec= ified and both less and more are not installed" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir)) + (string=3D? ((@@ (guix ui) find-available-pager)) ""))))) + + +(test-assert "with-paginated-output-port: finds a pager in enviroment vari= ables" + (call-with-temporary-directory + (lambda (dir) + (define used-command #false) + (with-environment-variables + `(("PATH" ,dir) + ("GUIX_PAGER" "guix-pager") + ("PAGER" "pager")) + (make-dummy-file dir "less") + (make-dummy-file dir "more") + (mock ((ice-9 popen) open-pipe* + (lambda (mode command . args) + (when used-command + (error "open-pipe* should only be called once")) + (set! used-command command) + (%make-void-port ""))) + (mock ((ice-9 popen) close-pipe (const 'ok)) + (mock ((guix colors) isatty?* (const #t)) + (with-paginated-output-port port 'ok))))) + (string=3D? "guix-pager" used-command)))) + +(test-assert "with-paginated-output-port: finds less in PATH" + (call-with-temporary-directory + (lambda (dir) + (define used-command #false) + (with-environment-variables + `(("PATH" ,dir)) + (make-dummy-file dir "less") + (make-dummy-file dir "more") + (mock ((ice-9 popen) open-pipe* + (lambda (mode command . args) + (when used-command + (error "open-pipe* should only be called once")) + (set! used-command command) + (%make-void-port ""))) + (mock ((ice-9 popen) close-pipe (const 'ok)) + (mock ((guix colors) isatty?* (const #t)) + (with-paginated-output-port port 'ok))))) + (string=3D? (in-vicinity dir "less") used-command)))) + (test-end "ui") --=20 2.36.1 --=-=-= Content-Type: text/plain Two tests have been added: one to select pager from the environment variable and the other to select less from the PATH. I also made some improvements to the existing tests based on your answers. There are many ways to do this. I learned a lot. Thanks, -- Taiju --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 09 20:56:05 2022 Received: (at 55845) by debbugs.gnu.org; 10 Jun 2022 00:56:05 +0000 Received: from localhost ([127.0.0.1]:48282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzSwX-0003ne-Bx for submit@debbugs.gnu.org; Thu, 09 Jun 2022 20:56:05 -0400 Received: from mail-pj1-f50.google.com ([209.85.216.50]:35405) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzSwT-0003n5-3F for 55845@debbugs.gnu.org; Thu, 09 Jun 2022 20:56:03 -0400 Received: by mail-pj1-f50.google.com with SMTP id o6-20020a17090a0a0600b001e2c6566046so880617pjo.0 for <55845@debbugs.gnu.org>; Thu, 09 Jun 2022 17:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=9Sv1E0mSgM0LoVnAAGVcXCLo2zF9YMKi92+kcVApwl4=; b=A6NXW39qc0xindLb3o4V0hL3nzeRAESOmgYAF1DyznRehj/cEc53aq4Dtp4FAhCtDJ IYr5Y/jmbx7xIFd6bV8gaZNjkotRYMcH3WFkreAZCLe8awfsKZ/Tnn29fJHBJL2Dhkzg 59BIkaZfOX/V3QH+Fp9hA1TUMJeQ1TJ8ReeqKnz6B3QUhb6xwKeqH6vJMKJCEVcl7hQs NJGdVjRo57/GZQ5B3Ds51KrdIH54JehfztyvM1BzqoUz2OyAVU3fONxQGGal3O6GGvJq JOEZGVKOHO2h+b2YbSlkOkZOpx7bn3UcvLk1DYV4uVfLmpsCe1eQ2atdg36Hf69lntSv PTNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=9Sv1E0mSgM0LoVnAAGVcXCLo2zF9YMKi92+kcVApwl4=; b=LzRJYtnuRHZoXnHZbK2iSe4IxbeiM8Hkh4+DyXd4ojMPJgp36HpEoMztEGeuZwYs+d GerGR2x8iRJPpYJ/lfeDK6jQ0rU403QtQb0BYcwU02+9gccLvz9BnpbHVGyvhjVOhahe tlRQL7LCr0AxDU7NPceTjYNO7w++l+vWE8DiDmg9TRWPxGcSx3jyV4lxCndrG6yVVMJn mh8Xg7R9UovRTJuHGiJIn54LIrO3d+sNwgRXGByzCb6lERFh5K2S5KNhuGFfmpMUS0s8 03+dULLZ6u/l0ZHIO7nUmd5NmHuRV695EMpDOoqYoq7pmaW0cWQDWLCQJkFDT+706n7y krFQ== X-Gm-Message-State: AOAM532ECRqt9EATKmEqHUEuKNCI5gb4ViCAzqd91qa41UwwDWVGG6PG NBx4sLetLPBKA60mQe6HwrUttKcqzoQZlNr7 X-Google-Smtp-Source: ABdhPJwjqW8Y5889Vie0yuFR+qfEUsg7UEQzdIuqhuVREoBVOKzGZjJlSdLn4e2lyCEJ4Jwvb2n0Vw== X-Received: by 2002:a17:902:ce92:b0:167:585b:af40 with SMTP id f18-20020a170902ce9200b00167585baf40mr33147426plg.153.1654822554978; Thu, 09 Jun 2022 17:55:54 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id s17-20020a170902c65100b0015ee60ef65bsm17235948pls.260.2022.06.09.17.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 17:55:54 -0700 (PDT) From: Taiju HIGASHI To: Maxime Devos Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> Date: Fri, 10 Jun 2022 09:55:52 +0900 In-Reply-To: <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> (Maxime Devos's message of "Thu, 09 Jun 2022 21:43:11 +0200") Message-ID: <871qvxwd47.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is off-topic. I feel I have a limited vocabulary available to me in Guile or Scheme (as well as in English...) , but functions like pk were not included in Guile's reference or Scheme's reference, so I thought my chances of knowing them were quite limited. (I didn't know about in-vicinity either, but now that I know it is in SRFI.) Are these the kind of things you learn by reading the source? -- Taiju From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 03:37:57 2022 Received: (at 55845) by debbugs.gnu.org; 10 Jun 2022 07:37:57 +0000 Received: from localhost ([127.0.0.1]:48577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzZDR-0008BT-KM for submit@debbugs.gnu.org; Fri, 10 Jun 2022 03:37:57 -0400 Received: from laurent.telenet-ops.be ([195.130.137.89]:45384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzZDN-0008BI-MN for 55845@debbugs.gnu.org; Fri, 10 Jun 2022 03:37:56 -0400 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by laurent.telenet-ops.be with bizsmtp id hKdp2700P4UW6Th01KdqjX; Fri, 10 Jun 2022 09:37:52 +0200 Message-ID: <41a200f3464dd0d2da12c1fbd4ae2e33e2973075.camel@telenet.be> Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. From: Maxime Devos To: Taiju HIGASHI Date: Fri, 10 Jun 2022 09:37:44 +0200 In-Reply-To: <871qvxwd47.fsf@taiju.info> References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <871qvxwd47.fsf@taiju.info> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-n5zTbZAQcAs+tJxvgVN0" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1654846672; bh=aJWEAU3rsK5KncSZX1E0zUhOCPNz+nAFmiGqHk+a790=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=A+vGcy1hIBqCOGHgcJZmztSi79l0tUs/AG7r2u9m6d9CeVJsqT245n+8xiD9gHp7K /zfBWCRbomlOG3/voEE+BQsL1MpWF6D/6md1fWsSW0OwjxeYVUekswB74spvyo0Len 6/3xcpVFEr6h9lN1omNMnTyN24mMsHX8g6zfy8cul3d8JJg9yON8FQ174vqO2YYaTf Af/t5yTqA8gJih0tSQFDoLojsX3N/Gi1QHPoZW+VHwYkUL2VkAX2kBDip19HIzMoeH m9A8Qls8ZhXv1Uu4WoapMohZz3QdQEu8ImhNdnii/I+U95X8gMyZky2AHk3FO3t3QQ PsgePQgyTtJAQ== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-n5zTbZAQcAs+tJxvgVN0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Taiju HIGASHI schreef op vr 10-06-2022 om 09:55 [+0900]: > I feel I have a limited vocabulary available to me in Guile or Scheme > (as well as in English...) , but functions like pk were not included in > Guile's reference or Scheme's reference, so I thought my chances of > knowing them were quite limited. (I didn't know about in-vicinity > either, but now that I know it is in SRFI.) Didn't know it was part of a SRFI. > Are these the kind of things you learn by reading the source? Yes, some things aren't documented. Though if interested, feel free to doucment them. Greetings, Maxime. --=-n5zTbZAQcAs+tJxvgVN0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYqL0yBccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7vGAAP9M7ckwpnOIeEalT2lifPzXYRo7 l9zyHf3vXJhD8hijxAD+M+lrbBemC7133LgiuNNQJFVRNmtIotHUuEvNVrycFgI= =f0dp -----END PGP SIGNATURE----- --=-n5zTbZAQcAs+tJxvgVN0-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 03:47:34 2022 Received: (at 55845) by debbugs.gnu.org; 10 Jun 2022 07:47:35 +0000 Received: from localhost ([127.0.0.1]:48584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzZMk-0008Oz-Hg for submit@debbugs.gnu.org; Fri, 10 Jun 2022 03:47:34 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:58710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzZMi-0008Oo-Vi for 55845@debbugs.gnu.org; Fri, 10 Jun 2022 03:47:33 -0400 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by michel.telenet-ops.be with bizsmtp id hKnW2700L4UW6Th06KnXMS; Fri, 10 Jun 2022 09:47:31 +0200 Message-ID: Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. From: Maxime Devos To: Taiju HIGASHI Date: Fri, 10 Jun 2022 09:47:30 +0200 In-Reply-To: <87a6alwdvn.fsf@taiju.info> References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-RHvCwQ1DXBJ0WZJ8lW/P" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1654847251; bh=gPhTi8+mjRl2tu5rgXKkdivavKjTM7eP4KpNyD9Bkik=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=b2y3NtiNmT5vJxfX61+zftJ593Ude8V9HEyNU8QoTunYIXPmgoJKXbLjV3eyOalrb vcjnE7so3LhSo69/VNM5xPI1FQnLOzgXeNwS9L4rrKGTDCSa4JOaRVZ9rzNrdOpAUm /mECS49uMHRxlEoPox66zBxtGXokir9SksgrFf8Scx14pzfdrF5AhZKKGfd4ugIw9B ZL1OBRM6e/KJC2nr9TyVVSG2PC7qVVTKBvnkCUC0sSLmpF+nCg6lPsLH3GqCVcQejV wQ4zguFXhlLd3qLhf7PuEYOAinimI+dyUCPHzZgFxVi8+9IDSMlmviEoKQfaj0EIsi PCrdgkdh6GVuw== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-RHvCwQ1DXBJ0WZJ8lW/P Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Taiju HIGASHI schreef op vr 10-06-2022 om 09:39 [+0900]: > +=C2=A0=C2=A0=C2=A0=C2=A0 (with-environment-variables > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `(("PATH" ,dir)) Wait, looking at the definition of with-environment-variables, if PAGER was set when running "make check" (try "GUIX_PAGER=3Dless make check TESTS=3Dtests/ui.scm"), it will still be set when the test is run (unverified). Maybe it should be unset? Proposal: Change (match-lambda ((variable value) (setenv variable value) to (match-lambda ((variable #false) (unsetenv variable)) ((variable value) (setenv variable value) and change the with-environment-variables to (with-environment-variables `(("PATH ,dir) ("PAGER" #false) ("GUIX_PAGER" #false)) [...]). and likewise for the other tests? (string=3D? ((@@ (guix ui) find-available-pager)) "guix-pager"))))) Nitpick: find-available-pager is not an exported procedure, so due to optimisations, it can dissappear (be inlined into call-with-paginated- output-port). So to be 100% robust, it needs to be exported, or a line (set! find-avaible-pager find-available-pager) ; used in tests/ui.scm needs to be added in guix/ui.scm, or the tests needs to be adjusted to always use with-paginated-output-port instead of find-available-pager. Otherwise, tests LGTM. Greetings, Maxime. --=-RHvCwQ1DXBJ0WZJ8lW/P Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYqL3EhccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7kkUAP9jCAz++xtGHHpsixAkmFPt3Rtf xUtx6hAunPPSFicLtAD8CoeegaML7XTCaFl4iLT7+8kzV2w35bN5Q/uLz9EjFgs= =s+3y -----END PGP SIGNATURE----- --=-RHvCwQ1DXBJ0WZJ8lW/P-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 04:40:37 2022 Received: (at 55845) by debbugs.gnu.org; 10 Jun 2022 08:40:37 +0000 Received: from localhost ([127.0.0.1]:48644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzaC5-0003Qc-2k for submit@debbugs.gnu.org; Fri, 10 Jun 2022 04:40:37 -0400 Received: from mail-pf1-f178.google.com ([209.85.210.178]:45811) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzaC2-0003QP-9z for 55845@debbugs.gnu.org; Fri, 10 Jun 2022 04:40:35 -0400 Received: by mail-pf1-f178.google.com with SMTP id x138so1474899pfc.12 for <55845@debbugs.gnu.org>; Fri, 10 Jun 2022 01:40:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=SXkxZCJd4aBq41uITQgN6YFAp+MPbvhsnJjH7tQXLtM=; b=Fp35JjgwoiNTipGjvrW6lKzGoIElezlQhT24zxmuofYAXUjWe5o35S+5ssnAjhPUin IAE56oQHWkw4lCK1wKqMcZrujxHBS3fGSL1tfLDYxL9AUnpmk5j/LX+XaPP+JxA8tZcO /C+6QKggqXdJPQFZ41rYi+eOnCrThsIokf3GNUrl0+WJMmjzCKBSZgHZIXkxWmDtBKRI J2zu8rNMRPMqOYivUHqLA7r6VYO2+ohJCcIxYyh6d/ajBQk2Er+6t2gIG5QXipvIR1hk Y9K76Uq/sYqptgQdVUiqNun7w167ywgdO0e9bfQR/E+iGEhC9m4qOKi0XJ4cOVZUy1V6 gaBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=SXkxZCJd4aBq41uITQgN6YFAp+MPbvhsnJjH7tQXLtM=; b=rg9E9pZ0yTWoLS9N8g2odcFRzUBQqNX4Yy46MXuwd1stxv0Hvg6/461owGKi7uF+pN RsWFHRgpHNawrMBfwD0L6l0rZhC5HGbbvwTKGPGE5V1BthLUzUVYicUmTnbrkp2sgUx6 Pa1ZM51NbmoKJAK3kXQ0Waeuwv2JZ1alsIMVhbvSlQXJMnW3olEfY+zanA/2wa8el8b6 K0ZEsyGPN6ugUoY4lw9BqSteaQhGAxxKUt0DG1S3rQpi5n9MeX4+qm4UjPVdhsKHIEAj MI0wXuzZ7DKOrupDNthnnJSGhH3+jZVGqaF9IvDVDMOkE2cDTzhoypqsQAGTi5VYhlKy llRg== X-Gm-Message-State: AOAM530dQuVpUHsUBU5FHLqvno1oLW8NjSdQ5pR98nsmHPRBGUkMFm99 6laPC10yaxGRf+c80G2PTGIud5/2RUu5k2w9 X-Google-Smtp-Source: ABdhPJx3TKqH0yckv/iRNXLMIfadsEIZ+Jxs315H0FeLjz/WZEal9WmrWi0fSXIhLpWektjxm5fCOA== X-Received: by 2002:aa7:888c:0:b0:505:7832:98fc with SMTP id z12-20020aa7888c000000b00505783298fcmr44408342pfe.0.1654850427969; Fri, 10 Jun 2022 01:40:27 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id e14-20020a170902784e00b001679a4711e5sm6841819pln.108.2022.06.10.01.40.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 01:40:27 -0700 (PDT) From: Taiju HIGASHI To: Maxime Devos Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> Date: Fri, 10 Jun 2022 17:40:24 +0900 In-Reply-To: (Maxime Devos's message of "Fri, 10 Jun 2022 09:47:30 +0200") Message-ID: <87r13wvrlz.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Maxime Devos writes: > Taiju HIGASHI schreef op vr 10-06-2022 om 09:39 [+0900]: >> +=A0=A0=A0=A0 (with-environment-variables >> +=A0=A0=A0=A0=A0=A0=A0=A0 `(("PATH" ,dir)) > > Wait, looking at the definition of with-environment-variables, if PAGER > was set when running "make check" (try "GUIX_PAGER=3Dless make check > TESTS=3Dtests/ui.scm"), it will still be set when the test is run > (unverified). Maybe it should be unset? Proposal: > > Change > > (match-lambda > ((variable value) > (setenv variable value) > > to > > (match-lambda > ((variable #false) > (unsetenv variable)) > ((variable value) > (setenv variable value) > > > and change the with-environment-variables to > > (with-environment-variables > `(("PATH ,dir) > ("PAGER" #false) > ("GUIX_PAGER" #false)) > [...]). > > and likewise for the other tests? Sorry, I easily used with-environment-variable*s* because the interface looked convenient, but perhaps I should have used with-environment-variable defined in guix/tests.scm. However, using this one does not seem to solve the problem. Should I modify with-environment-variable*s*? > (string=3D? ((@@ (guix ui) find-available-pager)) "guix-pager"))))) > > Nitpick: find-available-pager is not an exported procedure, so due to > optimisations, it can dissappear (be inlined into call-with-paginated- > output-port). So to be 100% robust, it needs to be exported, or a line > > (set! find-avaible-pager find-available-pager) ; used in tests/ui.scm > > needs to be added in guix/ui.scm, or the tests needs to be adjusted > to always use with-paginated-output-port instead of > find-available-pager. Thank you. I will modify it in one of the ways you suggested. I did not understand the optimization behavior. Thank you very much. Thanks, --=20 Taiju From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 04:52:52 2022 Received: (at 55845) by debbugs.gnu.org; 10 Jun 2022 08:52:52 +0000 Received: from localhost ([127.0.0.1]:48672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzaNw-0003lX-A4 for submit@debbugs.gnu.org; Fri, 10 Jun 2022 04:52:52 -0400 Received: from mail-pj1-f43.google.com ([209.85.216.43]:42686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzaNu-0003lJ-9q for 55845@debbugs.gnu.org; Fri, 10 Jun 2022 04:52:50 -0400 Received: by mail-pj1-f43.google.com with SMTP id o33-20020a17090a0a2400b001ea806e48c6so670268pjo.1 for <55845@debbugs.gnu.org>; Fri, 10 Jun 2022 01:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=kFD4it1op/iATjbJGSvICXtl+kJHoyQ+3+3au+R3zjk=; b=aJ3f4u3fNp02SDlSaoT1uNkhZgkNu1Iolb1NujPSJ0VxiKcga5MUWtSeQZVgnpQSPz JTmwH2D/q3j+Z+8BY7aPBVwhTxGh6X1qrEpa+LzZNWu3UtnU35Rv4GgYQbfoGX+v4um2 PaK29NNYMswUPS0blK8DwyYaw6NbbBRSWlwhHh9ILnWf5myIu34ob9LRvaLXgNljR29o 1WykX6QvpmSHpTxjivqVB9z//T+sk+pVWfizLjhvr29PGFqKkFFKMnXUY8gbzap2XvQr T4vv37+zwzx+hmIoT9sqMEAlfFBrSbgjl64gjn3QawuXbDfywSSVgkExNg45ZGFCXfRb xrKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=kFD4it1op/iATjbJGSvICXtl+kJHoyQ+3+3au+R3zjk=; b=rm4tItHf/dmeQO1CvWHYQu0WhyugTI9NFcv3g1XBSERDP+1PbhBaZ/NAkRgd2AIQ+r jwN+yPtLfJ5A1zfgqLs+hQcjupAKpgbrvkYc9h8hD4+76ceWT6cKGsJ4+TtPWcPKEo6R GTHMmC7U2OO4mf4UPBQWaYphomBnKiJ79TE5sf1YXcr2zHigYHKbxtv1nbyVtncXvsI1 bcPsMl3ZoGon/fgqIqi8H+sbUpy15R63N87pfZd7WJai47jskZu05tHDb5THU7A0GVaP /ZE9h/K9HjP8mlvJjxsgRU7CO6agHv37Ndp/vDCVf42p4WpXs78/H85pde4tb5uz5Foi ycyQ== X-Gm-Message-State: AOAM533AWJIF13mnwxsj31tdWV6/fscBR5FOgQB+XLG04rlcoZKWffI9 GFHiR+6Iw5UwTHWiYLBCH/iHnKIeIIK4+t0M X-Google-Smtp-Source: ABdhPJw0buhjn2F8AXq5jxuCtdi9//e86PABNUV3DKKBGISusa7iOmwq9biGPmJklmYOSZLqh9SREQ== X-Received: by 2002:a17:90a:e2d3:b0:1e8:ab66:c0be with SMTP id fr19-20020a17090ae2d300b001e8ab66c0bemr7830701pjb.12.1654851163941; Fri, 10 Jun 2022 01:52:43 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id f2-20020a17090a288200b001e2afd35791sm1150523pjd.18.2022.06.10.01.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 01:52:43 -0700 (PDT) From: Taiju HIGASHI To: Maxime Devos Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <871qvxwd47.fsf@taiju.info> <41a200f3464dd0d2da12c1fbd4ae2e33e2973075.camel@telenet.be> Date: Fri, 10 Jun 2022 17:52:40 +0900 In-Reply-To: <41a200f3464dd0d2da12c1fbd4ae2e33e2973075.camel@telenet.be> (Maxime Devos's message of "Fri, 10 Jun 2022 09:37:44 +0200") Message-ID: <87czfgvr1j.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > Taiju HIGASHI schreef op vr 10-06-2022 om 09:55 [+0900]: >> I feel I have a limited vocabulary available to me in Guile or Scheme >> (as well as in English...) , but functions like pk were not included in >> Guile's reference or Scheme's reference, so I thought my chances of >> knowing them were quite limited. (I didn't know about in-vicinity >> either, but now that I know it is in SRFI.) > > Didn't know it was part of a SRFI. Yes, but in Guile it behaves in a way that makes it useful for constructing path strings, but when I checked the SRFI specification[0], the behavior seems to be different from that of the SRFI specification. (in-vicinity = string-append) I wonder if this is a subtle specification, since Gauche, which implements many SRFIs, did not have it either... >> Are these the kind of things you learn by reading the source? > > Yes, some things aren't documented. Though if interested, feel free to > doucment them. Thank you! This is not a complaint about the documentation. I just wanted to know how people as proficient in Guile as you guys learned Guile. I am glad to know that I can learn by getting suggestions for better code implementation through code reviews, etc. But, I thought it would be a good idea to include functions like pk in the documentation, since the efficiency of development depends on knowing them. [0]: https://srfi.schemers.org/srfi-59/srfi-59.html Thanks, -- Taiju From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 11:09:00 2022 Received: (at 55845) by debbugs.gnu.org; 10 Jun 2022 15:09:00 +0000 Received: from localhost ([127.0.0.1]:51008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzgFw-0001XS-DK for submit@debbugs.gnu.org; Fri, 10 Jun 2022 11:09:00 -0400 Received: from albert.telenet-ops.be ([195.130.137.90]:57312) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzgFu-0001XK-SO for 55845@debbugs.gnu.org; Fri, 10 Jun 2022 11:08:59 -0400 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by albert.telenet-ops.be with bizsmtp id hT8x2700Z4UW6Th06T8yF2; Fri, 10 Jun 2022 17:08:58 +0200 Message-ID: <8250aad90dcf563aba4103127df95084a25fbd5d.camel@telenet.be> Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. From: Maxime Devos To: Taiju HIGASHI Date: Fri, 10 Jun 2022 17:08:57 +0200 In-Reply-To: <87r13wvrlz.fsf@taiju.info> References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> <87r13wvrlz.fsf@taiju.info> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-Ebt7C80tsen04ny9n+4G" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1654873738; bh=dBTzuHi29kAzXVcZ3wrUREBfu85cRsArkLvwRJ2kSr8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=iAuHy6A4j0m+o2A6mI/2EC8fGCe9B+Iai5oDXxjzEI/E2v8kTnX4dkJQ5LCySxkxG ZwW/YBbQixx0/C+cigRJSs3R+ooZW/jbbHmPhYtpZbbOOF6z0b5tDDdE5LvjLjG0Ic P2HexazlKWpaIczRkCd9eIpuD3UnwfFSCTHXElVHEIrPflB/Sth8GS1S2vCqlOFR/d vaTbSIBIw6yVV9tiE3xHUYQYO+OwNnwWBTAJAivRkeKqw2bEBfkSr++6tsoaEuOOkV To/j7lFdgony7OiH7hSOHdtZWjNrncXV49c9/k76HDGx/TuvAIO1heWimaaX1XRJqq OB8PDhuD8fBKg== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-Ebt7C80tsen04ny9n+4G Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Taiju HIGASHI schreef op vr 10-06-2022 om 17:40 [+0900]: > Sorry, I easily used with-environment-variable*s* because the interface > looked convenient, but perhaps I should have used > with-environment-variable defined in guix/tests.scm. > However, using this one does not seem to solve the problem. Should I > modify with-environment-variable*s*? I didn't know about 'with-environment-variable' (it already does the unsetenv!). Just use whatever works (a nested with-environment-variable or a modified with-environment-variables), though FWIW I would expect using the modified with-environment-variables to result in more compact code. Greetings, Maxime --=-Ebt7C80tsen04ny9n+4G Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iIwEABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYqNeiRccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7h5hAPdvOG4LHQODwtb20QLtifIFRj/k NAbd2Ie+Uls9qsnMAP4lHfGr7EuTHvdVuZlHjUM3XUxz/kwR47eRigRGkkCbAQ== =1mvq -----END PGP SIGNATURE----- --=-Ebt7C80tsen04ny9n+4G-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 11 07:26:29 2022 Received: (at 55845) by debbugs.gnu.org; 11 Jun 2022 11:26:29 +0000 Received: from localhost ([127.0.0.1]:52031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzzG5-0002me-EX for submit@debbugs.gnu.org; Sat, 11 Jun 2022 07:26:29 -0400 Received: from mail-pg1-f182.google.com ([209.85.215.182]:45878) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzzG3-0002mR-GG for 55845@debbugs.gnu.org; Sat, 11 Jun 2022 07:26:25 -0400 Received: by mail-pg1-f182.google.com with SMTP id 184so1426766pga.12 for <55845@debbugs.gnu.org>; Sat, 11 Jun 2022 04:26:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Ia3Hp9ldNdrnzilBtr9/oTMxC8MihM51qxyWs4LrRwA=; b=lqpQhIspDErcq0siFFms8Ad8wYsvQPy6KdYUWK1PVJOOD9HnGlxZLvGbp/+OJGfB/k 8CXfCkfMTzYTtZWuKTRKrP/UPG1dxMBU5qZZ1bl30soFMQNxjbRJonrKSsLOeDRt0oyi u7KOLhZa2YftBJpx7EXhWzplJVeuHrpgCuvx9FWoPRn9syLFQQxKXU3GMHPaEi/KrkFx +y8VUXkeSF5nOugMYjTr2j8kR6Uko9VOusl/p8+xwE14wMPMXYadjQgXalAZ4hGKv2yR +vA9ypLSCP99ldEo3eUIYehL8/tNGeJkTuSNKH/jalmSgBhcvvlYFO6k8oHZEkkTrJyL 4uFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Ia3Hp9ldNdrnzilBtr9/oTMxC8MihM51qxyWs4LrRwA=; b=ZPjzBDm3z0oX85E4CqSQo04lhhpW68gwOcjo/SkGWHUnHUlEf+4vr50UP7fY1xH7yV Q1ZNnBuG+WY19r5LMQyx+7ioRpZWL4yMnkN+y357Z5ZXr3nsjNj2OYv8KlfUE1pk7zqV YT3VDdHpRo0fvo/Gd2+9JX2peqiJJ4txEGe46VKDRY8Pf/JDNrnMFRI1DqO7d78GapeX CTtBIb/fdFdgsWYWBwM0a8PmGCbbigtdMs2AdeBdCJQW0slwmEF6IHd4Qrr4s8dRRlHp fibMbu6rZb4EzFok3aP1WPYdcbZ0U+ZC/D45526otMsi9aJAl89pZU8gOWfXe6pRTE0H PDDQ== X-Gm-Message-State: AOAM530mw8HE/wv4onqK4VagG+Ag37W05l6/rXzCiz0OOX8PJTe90tpm i2DSXN/2R5JmN5Mh6ym8XVCDf2ZMusYOe0bK X-Google-Smtp-Source: ABdhPJwlgXa5CzHKVgsAHvwd2ucRVmdb/f9gvo/v2gViMk7TRNDxcm0wOXb6wmDW86gXtWeB/jHNlg== X-Received: by 2002:aa7:94a6:0:b0:51b:ddb8:1fcf with SMTP id a6-20020aa794a6000000b0051bddb81fcfmr44337612pfl.23.1654946777196; Sat, 11 Jun 2022 04:26:17 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id l73-20020a63914c000000b003fe4da67980sm1333330pge.68.2022.06.11.04.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jun 2022 04:26:15 -0700 (PDT) From: Taiju HIGASHI To: Maxime Devos Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> <87r13wvrlz.fsf@taiju.info> <8250aad90dcf563aba4103127df95084a25fbd5d.camel@telenet.be> Date: Sat, 11 Jun 2022 20:26:12 +0900 In-Reply-To: <8250aad90dcf563aba4103127df95084a25fbd5d.camel@telenet.be> (Maxime Devos's message of "Fri, 10 Jun 2022 17:08:57 +0200") Message-ID: <87bkuzsap7.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hi Maxime, >> Sorry, I easily used with-environment-variable*s* because the interface >> looked convenient, but perhaps I should have used >> with-environment-variable defined in guix/tests.scm. >> However, using this one does not seem to solve the problem. Should I >> modify with-environment-variable*s*? > > I didn't know about 'with-environment-variable' (it already does the > unsetenv!). Just use whatever works (a nested with-environment-variable > or a modified with-environment-variables), though FWIW I would expect > using the modified with-environment-variables to result in more compact > code. I have attached the v4 patch. --=-=-= Content-Type: text/x-patch; charset=iso-8859-1 Content-Disposition: attachment; filename=v4-0001-ui-Improve-pager-selection-logic-when-less-is-not.patch Content-Transfer-Encoding: quoted-printable Content-Description: v4 patch >From bf557600c549e22a06ccfb288b89b1a0736b0500 Mon Sep 17 00:00:00 2001 From: Taiju HIGASHI Date: Wed, 8 Jun 2022 18:50:28 +0900 Subject: [PATCH v4] ui: Improve pager selection logic when less is not installed. * guix/ui.scm (find-available-pager): New procedure. Return a available pag= er. (call-with-paginated-output-port): Change to use find-available-pager to select pager. * guix/utils.scm (call-with-environment-variables): Allow clearing of specified environment variables. * tests/ui.scm: Add tests for find-available-pager. --- guix/ui.scm | 16 +++++++++-- guix/utils.scm | 3 ++ tests/ui.scm | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 3 deletions(-) diff --git a/guix/ui.scm b/guix/ui.scm index cb68a07c6c..93707a7a4b 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -17,6 +17,7 @@ ;;; Copyright =A9 2020 Arun Isaac ;;; Copyright =A9 2020 Maxim Cournoyer ;;; Copyright =A9 2018 Steve Sprang +;;; Copyright =A9 2022 Taiju HIGASHI ;;; ;;; This file is part of GNU Guix. ;;; @@ -1672,11 +1673,20 @@ (define* (pager-wrapped-port #:optional (port (curr= ent-output-port))) (_ #f))) =20 +(define (find-available-pager) + "Returns the program name or path of an available pager. +If neither less nor more is installed, return an empty string so that +call-with-paginated-output-port will not call pager." + (or (getenv "GUIX_PAGER") + (getenv "PAGER") + (which "less") + (which "more") + "" ;; Returns an empty string so that call-with-paginated-output-por= t does not call pager. + )) + (define* (call-with-paginated-output-port proc #:key (less-options "FrX")) - (let ((pager-command-line (or (getenv "GUIX_PAGER") - (getenv "PAGER") - "less"))) + (let ((pager-command-line (find-available-pager))) ;; Setting PAGER to the empty string conventionally disables paging. (if (and (not (string-null? pager-command-line)) (isatty?* (current-output-port))) diff --git a/guix/utils.scm b/guix/utils.scm index 37b2e29800..5c36b15cfe 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -13,6 +13,7 @@ ;;; Copyright =A9 2021 Chris Marusich ;;; Copyright =A9 2021 Maxime Devos ;;; Copyright =A9 2018 Steve Sprang +;;; Copyright =A9 2022 Taiju HIGASHI ;;; ;;; This file is part of GNU Guix. ;;; @@ -158,6 +159,8 @@ (define (call-with-environment-variables variables thun= k) (dynamic-wind (lambda () (for-each (match-lambda + ((variable #false) + (unsetenv variable)) ((variable value) (setenv variable value))) variables)) diff --git a/tests/ui.scm b/tests/ui.scm index 3dc6952e1f..ff83e66a7e 100644 --- a/tests/ui.scm +++ b/tests/ui.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =A9 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Court= =E8s +;;; Copyright =A9 2022 Taiju HIGASHI ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,6 +25,7 @@ (define-module (test-ui) #:use-module (guix derivations) #:use-module ((gnu packages) #:select (specification->package)) #:use-module (guix tests) + #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-19) @@ -292,4 +294,76 @@ (define guile-2.0.9 (>0 (package-relevance libb2 (map rx '("crypto" "library"))))))) =20 +(define make-dummy-file + (compose + close-port + open-output-file + (cut in-vicinity <> <>))) + +(define (assert-equals-find-available-pager expected) + (define used-command "") + (mock ((ice-9 popen) open-pipe* + (lambda (mode command . args) + (unless (string-null? used-command) + (error "open-pipe* should only be called once")) + (set! used-command command) + (%make-void-port ""))) + (mock ((ice-9 popen) close-pipe (const 'ok)) + (mock ((guix colors) isatty?* (const #t)) + (with-paginated-output-port port 'ok) + (string=3D? expected used-command))))) + + +(test-assert "find-available-pager, All environment variables are specifie= d and both less and more are installed" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir) + ("GUIX_PAGER" "guix-pager") + ("PAGER" "pager")) + (make-dummy-file dir "less") + (make-dummy-file dir "more") + (assert-equals-find-available-pager "guix-pager"))))) + +(test-assert "find-available-pager, GUIX_PAGER is not specified" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir) + ("GUIX_PAGER" #false) + ("PAGER" "pager")) + (make-dummy-file dir "less") + (make-dummy-file dir "more") + (assert-equals-find-available-pager "pager"))))) + +(test-assert "find-available-pager, All environment variables are not spec= ified and both less and more are installed" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir) + ("GUIX_PAGER" #false) + ("PAGER" #false)) + (make-dummy-file dir "less") + (make-dummy-file dir "more") + (assert-equals-find-available-pager (in-vicinity dir "less")))))) + +(test-assert "find-available-pager, All environment variables are not spec= ified and more is installed" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir) + ("GUIX_PAGER" #false) + ("PAGER" #false)) + (make-dummy-file dir "more") + (assert-equals-find-available-pager (in-vicinity dir "more")))))) + +(test-assert "find-available-pager, All environment variables are not spec= ified and both less and more are not installed" + (call-with-temporary-directory + (lambda (dir) + (with-environment-variables + `(("PATH" ,dir) + ("GUIX_PAGER" #false) + ("PAGER" #false)) + (assert-equals-find-available-pager ""))))) + (test-end "ui") --=20 2.36.1 --=-=-= Content-Type: text/plain I decided to fix with-environment-variables. Also, the problem of find-available-pager tests being tests for unexported functions has been changed to tests that use the exported with-paginated-output-port to verify that the command is passed to open-pipe* as expected. Regards, -- Taiju --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 14 19:59:08 2022 Received: (at 55845) by debbugs.gnu.org; 14 Jun 2022 23:59:08 +0000 Received: from localhost ([127.0.0.1]:36075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1GRA-0006gZ-EH for submit@debbugs.gnu.org; Tue, 14 Jun 2022 19:59:08 -0400 Received: from mail-pj1-f42.google.com ([209.85.216.42]:45716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1GR9-0006g8-28 for 55845@debbugs.gnu.org; Tue, 14 Jun 2022 19:59:07 -0400 Received: by mail-pj1-f42.google.com with SMTP id t3-20020a17090a510300b001ea87ef9a3dso479874pjh.4 for <55845@debbugs.gnu.org>; Tue, 14 Jun 2022 16:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=V3SbvPQAojfpj2yFg2RK5AnRUyNscW1xGCZoIUacs+k=; b=RlG9CFb3DNBTrXX+K94a/pERzWbKCizRR8V6vFsWmqLjMhB93UgdvhUHcNWMExmY3z d8H52EF+AjaqKY7Sx34p6Rpb4mn/wYlHupqMO3LAqDk1IGsyfnoui47OQ0QmISG5H7HH dJjzNZO2N5pa/BWPZ2urqifg2+Tp1kcMO5h44o8AqPMb2dB+a+cMMtGhVNgj897TMWp8 ooH4P6+PDhKoYeSAJF199bP0K+X+x1ltLXYiS+I/xw4H8oo5jBOI4DaSJEoVC+T5gI44 hgB1NPJgNL8iiRRmwdzi5/xPSp94+VH8+Ue9sbVu6GAIPbbm3RgYAhvK3gv/B0XciW50 g5Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=V3SbvPQAojfpj2yFg2RK5AnRUyNscW1xGCZoIUacs+k=; b=h1eoQBfQVrNKOpQl1BePJTtJfMpsWl+n89xrP1ZoC3PTOS8jKGyPdtLqr1NM/p8Ji5 yo6ZXHWWz9EGV8ADQjx3SySDQndyZI9jAElnPtYR9bc5HOZ7neba5NTYJS6PDbOfOob8 TgUMraBLHpO6HaYoTIfbzgWAkVycmZuut5X9fPwTvDZLXdQG83hQAmfFY1bHM73Woj5R 9+N1GnV4dJDPtR7Vw4ScwIhCgAgaIwgSAAsT6cOC/KvgTLvblZ6ogE0lW6RFbN0fHIz3 j6BsE3RqdpP9I6FALlpcuwAAb2q9OkfTRfgeDcfiFyDUQmOhlQcRssUm/o27fvg1FPCa 3Yyw== X-Gm-Message-State: AJIora9FheQRWlZFfibDdvtaxceD3EFWJuSBHWoU5pd8UaPpaS2Uwd0u O+RlCsX/dOe6n1XrpNhcY/3Q1iLM1ki+5CYo X-Google-Smtp-Source: AGRyM1unWwToo0T8BwNWjrSg1iG0ejlljSQyA+shOn1e9YYmwLxnWv6nFFZ1NYfYR+Yip/W2tKe3vg== X-Received: by 2002:a17:903:2341:b0:167:4b11:a8e with SMTP id c1-20020a170903234100b001674b110a8emr6524733plh.10.1655251140612; Tue, 14 Jun 2022 16:59:00 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id jg14-20020a17090326ce00b0015ea95948ebsm7857857plb.134.2022.06.14.16.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 16:59:00 -0700 (PDT) From: Taiju HIGASHI To: Maxime Devos Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> <87r13wvrlz.fsf@taiju.info> <8250aad90dcf563aba4103127df95084a25fbd5d.camel@telenet.be> <87bkuzsap7.fsf@taiju.info> Date: Wed, 15 Jun 2022 08:58:57 +0900 In-Reply-To: <87bkuzsap7.fsf@taiju.info> (Taiju HIGASHI's message of "Sat, 11 Jun 2022 20:26:12 +0900") Message-ID: <87k09iiypq.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Maxime, Please let me know if you have any problems with the v4 patch I sent you a few days ago :) Thanks, -- Taiju From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 15 04:02:30 2022 Received: (at 55845) by debbugs.gnu.org; 15 Jun 2022 08:02:30 +0000 Received: from localhost ([127.0.0.1]:36397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1Nyw-0004sO-La for submit@debbugs.gnu.org; Wed, 15 Jun 2022 04:02:30 -0400 Received: from laurent.telenet-ops.be ([195.130.137.89]:40974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1Nyu-0004sE-8n for 55845@debbugs.gnu.org; Wed, 15 Jun 2022 04:02:29 -0400 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by laurent.telenet-ops.be with bizsmtp id jL2T270014UW6Th01L2Tn3; Wed, 15 Jun 2022 10:02:27 +0200 Message-ID: <51d3162e0e9230a7fdb112badb4e99c8c1507ae8.camel@telenet.be> Subject: Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. From: Maxime Devos To: Taiju HIGASHI Date: Wed, 15 Jun 2022 10:02:26 +0200 In-Reply-To: <87k09iiypq.fsf@taiju.info> References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> <87r13wvrlz.fsf@taiju.info> <8250aad90dcf563aba4103127df95084a25fbd5d.camel@telenet.be> <87bkuzsap7.fsf@taiju.info> <87k09iiypq.fsf@taiju.info> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-kTYLRw1CTpbqBgdioXv9" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1655280147; bh=kDgHJ6lysDjK1RArg4NdCrmWmVRXErMEUiiAnrDA0QQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=h/XeyxtAi9HTl3B/W1YW/eiQ3iZmepAttH4V1NHNRSxxfyMOqS8QwRNP3eTkMp6zw kogMEGaoN+dwgX5HqhbXy0AYKGb2YbINfQ/owJHZLWq/ZsiaWSL6U4teMNrOIOSFOa m753JsKBFvPXZJu4h41hzooUCwTktHyyi7s6TGNbtsJUJULIToLuk/5V6xyt9jYsV0 dXJMp5s4FzVJR/AYSyCAbVtJqLfCFWNGRezo13qagOmTPNPqZm679BEUvDwnYuBPo+ uwQfuaJGGXymObbfhZdFGVO/g1+Oqde49+2PTS6tZrrVM/zS4W5L9w1f25yLkELY2u 7jq4iNRPlGj5w== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-kTYLRw1CTpbqBgdioXv9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Taiju HIGASHI schreef op wo 15-06-2022 om 08:58 [+0900]: > =C2=A0Re: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when = less is not installed. (Van: Taiju HIGASHI )Van:Taiju H= IGASHI Aan:Maxime Devos Cc:me@t= obias.gr, 55845@debbugs.gnu.orgOnderwerp:Re: [bug#55845] [PATCH 1/1] ui: Im= prove pager selection logic when less is not installed.Datum:Wed, 15 Jun 20= 22 08:58:57 +0900 (15-06-22 01:58:57) The patches look fine from here (only reading them, not actually running the tests myself). Greetings, MMaxime. --=-kTYLRw1CTpbqBgdioXv9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYqmSEhccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7jBvAQC71D5WezoZwYg98DIJ2jyMOSoH F5V7zCp7mGcKri8YCgD8CEB4G3eoJbZVVl393CbnBGUKNY48l4NzSbl01338DwI= =V5zi -----END PGP SIGNATURE----- --=-kTYLRw1CTpbqBgdioXv9-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 16 17:44:00 2022 Received: (at 55845) by debbugs.gnu.org; 16 Jun 2022 21:44:00 +0000 Received: from localhost ([127.0.0.1]:43268 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1xHU-0005Lo-0G for submit@debbugs.gnu.org; Thu, 16 Jun 2022 17:44:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36000) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1xHP-0005LL-Ko for 55845@debbugs.gnu.org; Thu, 16 Jun 2022 17:43:59 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1xHI-0006uO-Dy; Thu, 16 Jun 2022 17:43:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=acDZ8K3m5coi27/xZ75qXywsHJ97JIPutWBfSy/SmAg=; b=XW4tZOL4NC+EiUWBlYAb Clx4KIFZ+KdOf0H1G3hO0bH4o3tzUeni7306Axi30R/xdr8Hle8V7bINRBdXa7wXp8KgB+44JxEwU paS640uzhXdcxzMPN2VH2siUlht7s5Wc6AyWyxBWZ4KkwlAyf2iQNcFk8HUR+totkt7KOPKnR5R0a gIqczIhZRPYNlhk5L11mYkHO7N6owQEHDE7XtNA9uwOtSqg1DjxqBVw/y2710JcP8aI0shpud5NaY gflWJ25MGkTzvPJ2rjLcvttWRZI2tR+qKvIvWEYFVvvDC5XIY4kevfQuiCbJ73XCYTEHE4U0I22Lx DGw8PGLVL4aW7w==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=42600 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1xHI-0000Ex-1Q; Thu, 16 Jun 2022 17:43:48 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Taiju HIGASHI Subject: Re: bug#55845: [PATCH 0/1] Improve pager selection logic when less is not installed References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> <87r13wvrlz.fsf@taiju.info> <8250aad90dcf563aba4103127df95084a25fbd5d.camel@telenet.be> <87bkuzsap7.fsf@taiju.info> Date: Thu, 16 Jun 2022 23:43:46 +0200 In-Reply-To: <87bkuzsap7.fsf@taiju.info> (Taiju HIGASHI's message of "Sat, 11 Jun 2022 20:26:12 +0900") Message-ID: <87a6acjncd.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr, Maxime Devos X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Taiju HIGASHI skribis: >>>From bf557600c549e22a06ccfb288b89b1a0736b0500 Mon Sep 17 00:00:00 2001 > From: Taiju HIGASHI > Date: Wed, 8 Jun 2022 18:50:28 +0900 > Subject: [PATCH v4] ui: Improve pager selection logic when less is not > installed. > > * guix/ui.scm (find-available-pager): New procedure. Return a available p= ager. > (call-with-paginated-output-port): Change to use find-available-pager to > select pager. > * guix/utils.scm (call-with-environment-variables): Allow clearing of > specified environment variables. > * tests/ui.scm: Add tests for find-available-pager. Applied with the cosmetic changes below, mostly aiming to visually simplify the code and make it consistent with the rest. It=E2=80=99s great that you went to great lengths to implement tests for th= is, as Maxime had suggested. To me, the complexity of a test must be justified by its =E2=80=9Cbug-finding performance=E2=80=9D; in this particu= lar case, I think we=E2=80=99re borderline: the tests are a little bit complex and unli= kely to find new bugs. Thanks for all the work and for your feedback on your experience programming with Guile! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/ui.scm b/guix/ui.scm index 93707a7a4b..a7acd41440 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -1674,15 +1674,13 @@ (define* (pager-wrapped-port #:optional (port (current-output-port))) #f))) (define (find-available-pager) - "Returns the program name or path of an available pager. -If neither less nor more is installed, return an empty string so that -call-with-paginated-output-port will not call pager." + "Return the program name of an available pager or the empty string if none is +available." (or (getenv "GUIX_PAGER") (getenv "PAGER") (which "less") (which "more") - "" ;; Returns an empty string so that call-with-paginated-output-port does not call pager. - )) + "")) (define* (call-with-paginated-output-port proc #:key (less-options "FrX")) diff --git a/tests/ui.scm b/tests/ui.scm index ff83e66a7e..6a25a204ca 100644 --- a/tests/ui.scm +++ b/tests/ui.scm @@ -294,13 +294,12 @@ (define guile-2.0.9 (>0 (package-relevance libb2 (map rx '("crypto" "library"))))))) -(define make-dummy-file - (compose - close-port - open-output-file - (cut in-vicinity <> <>))) +(define (make-empty-file directory file) + ;; Create FILE in DIRECTORY. + (close-port (open-output-file (in-vicinity directory file)))) (define (assert-equals-find-available-pager expected) + ;; Use 'with-paginated-output-port' and return true if it invoked EXPECTED. (define used-command "") (mock ((ice-9 popen) open-pipe* (lambda (mode command . args) @@ -314,56 +313,51 @@ (define used-command "") (string=? expected used-command))))) -(test-assert "find-available-pager, All environment variables are specified and both less and more are installed" +(test-assert "find-available-pager, GUIX_PAGER takes precedence" (call-with-temporary-directory (lambda (dir) - (with-environment-variables - `(("PATH" ,dir) - ("GUIX_PAGER" "guix-pager") - ("PAGER" "pager")) - (make-dummy-file dir "less") - (make-dummy-file dir "more") + (with-environment-variables `(("PATH" ,dir) + ("GUIX_PAGER" "guix-pager") + ("PAGER" "pager")) + (make-empty-file dir "less") + (make-empty-file dir "more") (assert-equals-find-available-pager "guix-pager"))))) -(test-assert "find-available-pager, GUIX_PAGER is not specified" +(test-assert "find-available-pager, PAGER takes precedence" (call-with-temporary-directory (lambda (dir) - (with-environment-variables - `(("PATH" ,dir) - ("GUIX_PAGER" #false) - ("PAGER" "pager")) - (make-dummy-file dir "less") - (make-dummy-file dir "more") + (with-environment-variables `(("PATH" ,dir) + ("GUIX_PAGER" #false) + ("PAGER" "pager")) + (make-empty-file dir "less") + (make-empty-file dir "more") (assert-equals-find-available-pager "pager"))))) -(test-assert "find-available-pager, All environment variables are not specified and both less and more are installed" +(test-assert "find-available-pager, 'less' takes precedence" (call-with-temporary-directory (lambda (dir) - (with-environment-variables - `(("PATH" ,dir) - ("GUIX_PAGER" #false) - ("PAGER" #false)) - (make-dummy-file dir "less") - (make-dummy-file dir "more") + (with-environment-variables `(("PATH" ,dir) + ("GUIX_PAGER" #false) + ("PAGER" #false)) + (make-empty-file dir "less") + (make-empty-file dir "more") (assert-equals-find-available-pager (in-vicinity dir "less")))))) -(test-assert "find-available-pager, All environment variables are not specified and more is installed" +(test-assert "find-available-pager, 'more' takes precedence" (call-with-temporary-directory (lambda (dir) - (with-environment-variables - `(("PATH" ,dir) - ("GUIX_PAGER" #false) - ("PAGER" #false)) - (make-dummy-file dir "more") + (with-environment-variables `(("PATH" ,dir) + ("GUIX_PAGER" #false) + ("PAGER" #false)) + (make-empty-file dir "more") (assert-equals-find-available-pager (in-vicinity dir "more")))))) -(test-assert "find-available-pager, All environment variables are not specified and both less and more are not installed" +(test-assert "find-available-pager, no pager" (call-with-temporary-directory (lambda (dir) - (with-environment-variables - `(("PATH" ,dir) - ("GUIX_PAGER" #false) - ("PAGER" #false)) + (with-environment-variables `(("PATH" ,dir) + ("GUIX_PAGER" #false) + ("PAGER" #false)) (assert-equals-find-available-pager ""))))) (test-end "ui") --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 16 17:44:12 2022 Received: (at control) by debbugs.gnu.org; 16 Jun 2022 21:44:12 +0000 Received: from localhost ([127.0.0.1]:43275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1xHg-0005N7-Ek for submit@debbugs.gnu.org; Thu, 16 Jun 2022 17:44:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1xHd-0005Mu-Jx for control@debbugs.gnu.org; Thu, 16 Jun 2022 17:44:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1xHY-0006vH-Ab for control@debbugs.gnu.org; Thu, 16 Jun 2022 17:44:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:From:To:Date:in-reply-to: references; bh=doj5Om4l5KocKoaqDEevWN21nKhIn2I3yZQPe6uwCPc=; b=bvIk0QAcg0pmWP FdWqQWnCAQaIYcb++M7DSjV9QapdginER3YoeSqHwVbtIRYHiqOryqqxf8cSyd19WaZoSftmFxJAI 8bVqisdUQZV03eeYEL+KjEDNfEuXlBLf3NB07rrVlz6nRZ82C0gltxO0fYoREOwWSDuDlaGv6OXW4 X20k64BJjv5Xbql96CBk30Vk9sLrFU3kgrI/QTtWOlpdzssIH1lMuibWXvXkxBfHL+8dgSfn0i3EP KYZDYaciD/CirhaKUcCtAzOO4IlIRJY9/3L8TP3qHIbrl1G2bTMCoO7XE3in1h0ucyqUqPhiM2FGV RirH3yUqfWd0TpaP3zRA==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=58700 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1xHX-0000Fi-RI for control@debbugs.gnu.org; Thu, 16 Jun 2022 17:44:04 -0400 Date: Thu, 16 Jun 2022 23:44:02 +0200 Message-Id: <878rpwjnbx.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #55845 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 55845 quit From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 16 20:38:32 2022 Received: (at 55845) by debbugs.gnu.org; 17 Jun 2022 00:38:32 +0000 Received: from localhost ([127.0.0.1]:43364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o200J-0003F5-J2 for submit@debbugs.gnu.org; Thu, 16 Jun 2022 20:38:32 -0400 Received: from mail-pl1-f174.google.com ([209.85.214.174]:39554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o200H-0003Et-VT for 55845@debbugs.gnu.org; Thu, 16 Jun 2022 20:38:26 -0400 Received: by mail-pl1-f174.google.com with SMTP id a17so603850pls.6 for <55845@debbugs.gnu.org>; Thu, 16 Jun 2022 17:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=nTTa0HItTyFdhtnN9A1q51E1WTer6WmatWC7mffyROA=; b=DfcJLk02/Z6fKR5JKEDbrjtYmya60Bo9gh2P41uG9cMmzlSzpNKakGLovLh1xoHwG4 4bX0Z3i/GIdP+n9TlUGm+obc939BWc6NRE+mYOoBfJOz99F3rF53X5azX9U7XF5x4vu9 yuKieJFPGIBTdS/FVQS/DCTFkzxFQF0weI6BoCM3rws1W6PVVxYZav3UaFAxLbMSNwZ4 cxKdD+3Smk/a/O7KrgUoVrALB4lxIuFZmUUuYluCaW5YLHXJinVKjf/dCoWn/D+KSy7r avp7kzKULA7WEeUe5K83kqD5jxgHX+sqY0tkABWIufJStgM3ORT3asg2fyNFR3yVoKgg xMDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=nTTa0HItTyFdhtnN9A1q51E1WTer6WmatWC7mffyROA=; b=WcfdOC5aPRS1ht+MA4ejHiIP1H8xYzbXas0mOgJcz0/VzzYu+YCK/ZLNj95K6nZKxg ad3ouooy6BY5ETcIQHdFGBFVzWQWYq4dTtuKevkzNR8KTcQPj6Jv1UD+2dY6opFjf4CS fpnilttpfJphPc56/nWIk8Kcra+uvkokelkZcuWeQ5hcUU4gbmaxoBc5pl95cJ0U65TN 1+QBFynsZAxi4A2dE/NVRgixjjqPMbPbjS7ZxM7T/xlbFhWC7sT8Yo1MFYq6T+hX9pn2 Gyv20SNrxjPB+GkFzbIVq0M1Gs/Xb0O1wS8KbxNPw5IaXwhtZnxE2YFE8ATg9U7SihQl n8WA== X-Gm-Message-State: AJIora8wQagFCAwuJ/bO+mhXlgdB9MjrbrTnAI6Nd2VhwKncoBALkgDT SZIlqAXVp0KFJeZqWiCJmS/8Fw== X-Google-Smtp-Source: AGRyM1vW6X+PpdrUkqdqPmlvrpH7syUIN/usoI7uPJazV5xqFaTpXhAhVTpa0sBbGg0Mdc9FxiJurg== X-Received: by 2002:a17:902:bd83:b0:167:8dd5:6a5a with SMTP id q3-20020a170902bd8300b001678dd56a5amr7247367pls.114.1655426299705; Thu, 16 Jun 2022 17:38:19 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id e23-20020aa78c57000000b0051c15bb876esm2391046pfd.174.2022.06.16.17.38.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 17:38:19 -0700 (PDT) From: Taiju HIGASHI To: Ludovic =?iso-8859-1?Q?Court=E8s?= Subject: Re: bug#55845: [PATCH 0/1] Improve pager selection logic when less is not installed References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> <87r13wvrlz.fsf@taiju.info> <8250aad90dcf563aba4103127df95084a25fbd5d.camel@telenet.be> <87bkuzsap7.fsf@taiju.info> <87a6acjncd.fsf_-_@gnu.org> Date: Fri, 17 Jun 2022 09:38:16 +0900 In-Reply-To: <87a6acjncd.fsf_-_@gnu.org> ("Ludovic =?iso-8859-1?Q?Court=E8?= =?iso-8859-1?Q?s=22's?= message of "Thu, 16 Jun 2022 23:43:46 +0200") Message-ID: <8735g4nmyv.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr, Maxime Devos X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludovic, > Applied with the cosmetic changes below, mostly aiming to visually > simplify the code and make it consistent with the rest. Thank you for the correction and application! > It$B!G(Bs great that you went to great lengths to implement tests for this, > as Maxime had suggested. To me, the complexity of a test must be > justified by its $B!H(Bbug-finding performance$B!I(B; in this particular case, I > think we$B!G(Bre borderline: the tests are a little bit complex and unlikely > to find new bugs. > > Thanks for all the work and for your feedback on your experience > programming with Guile! I only discovered the problem, I was able to implement it mostly thanks to Maxime and Tobias! The code review experience was so good that I even posted the following :) https://fosstodon.org/web/@taiju/108458633893022791 https://fosstodon.org/web/@taiju/108458643302758263 I'd like to know for future contributions. I like functional programming and I love compose, (ice-9 curried-definitions), and SRFI 26 in my programs, but should I use them less in the code I put in Guix? Thanks, -- Taiju From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 17 08:39:48 2022 Received: (at 55845) by debbugs.gnu.org; 17 Jun 2022 12:39:48 +0000 Received: from localhost ([127.0.0.1]:44197 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2BGO-0005ey-IF for submit@debbugs.gnu.org; Fri, 17 Jun 2022 08:39:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2BGM-0005el-RD for 55845@debbugs.gnu.org; Fri, 17 Jun 2022 08:39:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57972) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2BGG-0004LE-C3; Fri, 17 Jun 2022 08:39:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=CXX4CmYVf2CgNqXPCq2/9FtL8H1Uv9o3V/ul0laG5KA=; b=EZN3T8nYMbuTktQw6BBh yB/UCixRqnM6azXmub3AhmR7yw1ckxwvGFr3+Y9xskZGyZxK/pZbirxzdW3VpWpkqmjSDiveft9UM 5r5cWvZ8sTMD8kVs35mGtxGpVuMtTY3asAidJXSbtPc0M+Z+7OpOW9JoiXPuWdKT6zel4/+/jIZdG +rY6hvHN3Et45fC8EaV0n5rJvch21wNGfM2x8JYWQjfTJv6okfHSlv95wNu338iI///0C0CkG5Qfg QHsv180oCt5ZTgwO9IcCVgVRl5/UUIOpOexV1YAWo6nK+zUCEzqQywYKtuOm6IMkVygQJyS+uGMSz UyVSOn9Hcqt75w==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=33148 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2BGF-0003OT-U2; Fri, 17 Jun 2022 08:39:40 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Taiju HIGASHI Subject: Re: bug#55845: [PATCH 0/1] Improve pager selection logic when less is not installed References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> <87r13wvrlz.fsf@taiju.info> <8250aad90dcf563aba4103127df95084a25fbd5d.camel@telenet.be> <87bkuzsap7.fsf@taiju.info> <87a6acjncd.fsf_-_@gnu.org> <8735g4nmyv.fsf@taiju.info> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Nonidi 29 Prairial an 230 de la =?utf-8?Q?R=C3=A9vol?= =?utf-8?Q?ution=2C?= jour de la Pivoine 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: Fri, 17 Jun 2022 14:39:37 +0200 In-Reply-To: <8735g4nmyv.fsf@taiju.info> (Taiju HIGASHI's message of "Fri, 17 Jun 2022 09:38:16 +0900") Message-ID: <87zgibh3au.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr, Maxime Devos X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello, Taiju HIGASHI skribis: > I only discovered the problem, I was able to implement it mostly thanks > to Maxime and Tobias! > The code review experience was so good that I even posted the following > :) > https://fosstodon.org/web/@taiju/108458633893022791 > https://fosstodon.org/web/@taiju/108458643302758263 Heh, good to know that it was a positive experience! > I'd like to know for future contributions. > I like functional programming and I love compose, (ice-9 > curried-definitions), and SRFI 26 in my programs, but should I use them > less in the code I put in Guix? Probably. It=E2=80=99s tempting to use these if you come with a Haskell background, say. But in some cases, they make things less readable; that=E2=80=99s the case with the way =E2=80=98make-dummy-file=E2=80=99 was = written IMO. Guix code uses SRFI-26 in some places; I think (ice-9 curried-definitions) is not used anywhere but I think it=E2=80=99s fine to = use it if it helps. Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 17 09:36:19 2022 Received: (at 55845) by debbugs.gnu.org; 17 Jun 2022 13:36:19 +0000 Received: from localhost ([127.0.0.1]:44446 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2C95-0005Jm-Ke for submit@debbugs.gnu.org; Fri, 17 Jun 2022 09:36:19 -0400 Received: from mail-pl1-f177.google.com ([209.85.214.177]:37712) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2C92-0005JW-TJ for 55845@debbugs.gnu.org; Fri, 17 Jun 2022 09:36:18 -0400 Received: by mail-pl1-f177.google.com with SMTP id t2so3905479pld.4 for <55845@debbugs.gnu.org>; Fri, 17 Jun 2022 06:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=FRR5HKYeb4BWuDWcTbRUyo2tCIv1P7uiIj9nz4l9KGE=; b=F0k6xurBWPn51fk7qSEzaHO9RE+8O20C3rC9SL8pj4hpA7buDOekjTELdJX+44ZvVm 1QBk9bwDDeDmW/G0iCYO4w0zNJJjCW91S+ICRWNxIvXWX2f0NEAmtXONTP3jHDpNAWgw h1kPWsBV/+s34m2I4IeNoiewa82doPeycYPlKLeVMNdwfyoIjCva5c2f8nfkZMRUCl/g Caz+Lp3ervZcaOFkEzGa3IYWtOuvrqR1h5x1NiM+15nqV7C5KbZQyhdzLlmSl6G1Hfn2 Cw31YsdZf1FLs7jTVISW4hFRO/P8jx4IAv9vd4fbtEIP2z3lIe9sZBEPrf/j8VhozA9S xwdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=FRR5HKYeb4BWuDWcTbRUyo2tCIv1P7uiIj9nz4l9KGE=; b=4tAvnWmYjsbfnhStpJ6O5AT0/2zyGBtg4eA3Co4TusBsgn9Gbf7qFowLDc01SiOLEs +8GOvvONfA2Ut8/Do/q+L+dSnBJ5JjNVN4tWRkB0+YO/jCSv2sEDq1xf5EwqG3jF2aVq Z2lnKmPMUpdALT/ERo9uY9K9TZiEucpgok1ZZT93JCYyM4KyTe1DqfrssL7ZklKdAHxc bIEKvomCf62X1kvMBemjDw/k8NUWMgzia+MWU7IvNzheMBAR1qqzVc1xqi8RbQ4cZOsf 7FCErdLePHi5/2XOKEqg4qDWNAHY6teYAJm0wao8QWeWE73trMquZyWs6KIKmcUZdJXi sIww== X-Gm-Message-State: AJIora+1qkb0QUkX01FNOgyeCN7buzGiI8llm+P+OUugc06bmALjmaTk IktjQ5rcuB1ws2Yz4yuGMlD5Ng== X-Google-Smtp-Source: AGRyM1v3zGs4r2zy4u3xOu3oql/jgjqkspgyTfNtMV7xd2hRucOXthVRUjqlsuuvRTAE+DrBpOZuow== X-Received: by 2002:a17:90a:e7c5:b0:1e3:3cf1:6325 with SMTP id kb5-20020a17090ae7c500b001e33cf16325mr10707649pjb.178.1655472970916; Fri, 17 Jun 2022 06:36:10 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id r4-20020a056a00216400b0051bc538baadsm3673985pff.184.2022.06.17.06.36.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 06:36:10 -0700 (PDT) From: Taiju HIGASHI To: Ludovic =?iso-8859-1?Q?Court=E8s?= Subject: Re: bug#55845: [PATCH 0/1] Improve pager selection logic when less is not installed References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> <87r13wvrlz.fsf@taiju.info> <8250aad90dcf563aba4103127df95084a25fbd5d.camel@telenet.be> <87bkuzsap7.fsf@taiju.info> <87a6acjncd.fsf_-_@gnu.org> <8735g4nmyv.fsf@taiju.info> <87zgibh3au.fsf@gnu.org> Date: Fri, 17 Jun 2022 22:36:07 +0900 In-Reply-To: <87zgibh3au.fsf@gnu.org> ("Ludovic =?iso-8859-1?Q?Court=E8s?= =?iso-8859-1?Q?=22's?= message of "Fri, 17 Jun 2022 14:39:37 +0200") Message-ID: <87wndfpg3c.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr, Maxime Devos X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, >> I'd like to know for future contributions. >> I like functional programming and I love compose, (ice-9 >> curried-definitions), and SRFI 26 in my programs, but should I use them >> less in the code I put in Guix? > > Probably. It$B!G(Bs tempting to use these if you come with a Haskell > background, say. But in some cases, they make things less readable; > that$B!G(Bs the case with the way $B!F(Bmake-dummy-file$B!G(B was written IMO. > > Guix code uses SRFI-26 in some places; I think (ice-9 > curried-definitions) is not used anywhere but I think it$B!G(Bs fine to use > it if it helps. Thank you for your answers! I like Haskell and OCaml, but I don't have experience with them much. I like Scheme and Common Lisp more :) The point-free style is beautiful, but it is often just self-satisfaction, so I think after hearing your opinion that better use them less in shared code. However, those features that make it possible are very good, and I will continue to use them in the programs I write for personal use :) Thanks, -- Taiju From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 17 11:12:41 2022 Received: (at 55845) by debbugs.gnu.org; 17 Jun 2022 15:12:41 +0000 Received: from localhost ([127.0.0.1]:46632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2DeK-0002Dg-SI for submit@debbugs.gnu.org; Fri, 17 Jun 2022 11:12:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2DeG-0002DR-1M for 55845@debbugs.gnu.org; Fri, 17 Jun 2022 11:12:39 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36248) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2De9-0008TR-3X; Fri, 17 Jun 2022 11:12:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=wM0v6n6TpyGFSsF1l9ZlebHuqMBzXU9gcQCmTJ08Wr8=; b=RpWo5xKjFmiJDI5QhwoV 1LiRLAsEtfVFEh9mJHx9BDf5quAyECgraFqb73cTPPMiYB3STFXwoR5NdqmuEO9mWUh53bUafybhh fcp3AH4JkQgYA7IlxL9GVCYkdfCu4nMd2l8EZBhb/XYDvKXscIZhYSJ0hG1dUKYZnsJ4TWxZnVrHQ WFHKz16iHXC4syCsBUkkYB7fE1Zh4WB78VFJ8DOXaia6r9sZPgd1LZxTNo8MZKE0UqO1MPns6W+x2 cbrKyRvCzr6FhFPBLvfiuIBB2iwAFiUAXs+D+GktUbSsjZibL81oNzsCzelZMm52ImIZ3yU1FPE/H b/Jxl3oQ0c7uSw==; Received: from [193.50.110.205] (port=47104 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2De8-0007aI-Mj; Fri, 17 Jun 2022 11:12:28 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Taiju HIGASHI Subject: Re: bug#55845: [PATCH 0/1] Improve pager selection logic when less is not installed References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> <87r13wvrlz.fsf@taiju.info> <8250aad90dcf563aba4103127df95084a25fbd5d.camel@telenet.be> <87bkuzsap7.fsf@taiju.info> <87a6acjncd.fsf_-_@gnu.org> <8735g4nmyv.fsf@taiju.info> <87zgibh3au.fsf@gnu.org> <87wndfpg3c.fsf@taiju.info> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Nonidi 29 Prairial an 230 de la =?utf-8?Q?R=C3=A9vol?= =?utf-8?Q?ution=2C?= jour de la Pivoine 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: Fri, 17 Jun 2022 17:12:26 +0200 In-Reply-To: <87wndfpg3c.fsf@taiju.info> (Taiju HIGASHI's message of "Fri, 17 Jun 2022 22:36:07 +0900") Message-ID: <87v8szfhnp.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr, Maxime Devos X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! Taiju HIGASHI skribis: > The point-free style is beautiful, but it is often just > self-satisfaction, so I think after hearing your opinion that better use > them less in shared code. On this topic and others, the manual links to Riastradh=E2=80=99s style gui= de for Scheme (info "(guix) Formatting Code"), which is worth a read! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 18 10:11:59 2022 Received: (at 55845) by debbugs.gnu.org; 18 Jun 2022 14:11:59 +0000 Received: from localhost ([127.0.0.1]:49766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2ZB8-0001qx-Qa for submit@debbugs.gnu.org; Sat, 18 Jun 2022 10:11:58 -0400 Received: from mail-pj1-f45.google.com ([209.85.216.45]:33316) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2ZB7-0001ql-19 for 55845@debbugs.gnu.org; Sat, 18 Jun 2022 10:11:57 -0400 Received: by mail-pj1-f45.google.com with SMTP id hv24-20020a17090ae41800b001e33eebdb5dso9159267pjb.0 for <55845@debbugs.gnu.org>; Sat, 18 Jun 2022 07:11:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=2YrbiUV7CxE56kAHzvwYzEeOQdB/KljvgFidxdfMBFw=; b=4hX+q+Z1uox5T/CiGD0rNfCzWlvzMRl1Z8h6cBQlH+aRceKB5T1o0rhfsHGA4NFS1Q RMDIbh14YtM5H8JajAbIVVq964VJ38VE2eLdZ76jicqt237F4iqCh7Nq5rsZTAZFS1Gd /Acz1qGOoWND+Y+/tNcbBTfnXXBtG5q2DEcPIqTHknrYIiAvm7jHJxjewAmgwIT2Y7gg 9iGpyD/XCxlPr90T/iiPssprjKyhnMMRNmQ/dWKVLQNDMj8aYbdDesDzzBiHtTobwNUr IGDTNBqicuCwxGZgJK+mAu1zEOGc7M5nSwEC6uLQ42mZVtAThdejubOIhszriMer770y 7CiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=2YrbiUV7CxE56kAHzvwYzEeOQdB/KljvgFidxdfMBFw=; b=LikaQqMs5Ks2oU/WL+NNqpMcOmrp4Pqi2/l2orZka47cCnt0hstS4tZlECzMbgDF/T HDmhYCalUIC8cJ/OD1p3t5UsmM+rpvOU+WYLusRVyl9a6rNxTcz/TuiXqDEib01TtvRc dgTQSA3K78Pvfyxp9kXeQvAyHAG5yza3N3IE/zPShFc1BbymPANbG6XOJWt7UWjBq3e4 pO8ZoPnMTBwWG0CxKKnjvWFKxRLhwSmx6PKChAVeNWV266Ol/jQOwIfNsEcahwnawRLH ZTjz+K7uH/O+TO5U7nZh2Cpym3t9cFPzBUSd5GnNTpxa3uOCBDFuAnzc7ch3vx+5cx8f 5H/Q== X-Gm-Message-State: AJIora9NRSsUU0DXrNuSuasd3D4ebYxs4TRe2LIBT/IT0i9iRAQ7UbyQ dG4A4HI6MBdh0x0OLFd28P7Z5Q== X-Google-Smtp-Source: AGRyM1tzYLM34+8VzeEV/Jl5xsVuW+MaZAsezH4kFpQLrRpljC1cCcQxbL7sXyrDN5qvl8Zm9JTs0w== X-Received: by 2002:a17:902:6b8b:b0:14d:66c4:f704 with SMTP id p11-20020a1709026b8b00b0014d66c4f704mr14962326plk.53.1655561511190; Sat, 18 Jun 2022 07:11:51 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id k17-20020a628e11000000b0050dc76281a2sm5594242pfe.124.2022.06.18.07.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jun 2022 07:11:50 -0700 (PDT) From: Taiju HIGASHI To: Ludovic =?iso-8859-1?Q?Court=E8s?= Subject: Re: bug#55845: [PATCH 0/1] Improve pager selection logic when less is not installed References: <20220608102124.14865-1-higashi@taiju.info> <20220608102257.15042-1-higashi@taiju.info> <87leu72sbo.fsf@taiju.info> <55fe6cdbed891707aca419ff4eedd7c37ef3eb03.camel@telenet.be> <87fskexiyc.fsf@taiju.info> <874k0uxhif.fsf@taiju.info> <5ccb68a4dc80a02baaf6d19fd782145b6b62e7b5.camel@telenet.be> <87a6alwdvn.fsf@taiju.info> <87r13wvrlz.fsf@taiju.info> <8250aad90dcf563aba4103127df95084a25fbd5d.camel@telenet.be> <87bkuzsap7.fsf@taiju.info> <87a6acjncd.fsf_-_@gnu.org> <8735g4nmyv.fsf@taiju.info> <87zgibh3au.fsf@gnu.org> <87wndfpg3c.fsf@taiju.info> <87v8szfhnp.fsf@gnu.org> Date: Sat, 18 Jun 2022 23:11:48 +0900 In-Reply-To: <87v8szfhnp.fsf@gnu.org> ("Ludovic =?iso-8859-1?Q?Court=E8s?= =?iso-8859-1?Q?=22's?= message of "Fri, 17 Jun 2022 17:12:26 +0200") Message-ID: <87zgiam57f.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, me@tobias.gr, Maxime Devos X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> The point-free style is beautiful, but it is often just >> self-satisfaction, so I think after hearing your opinion that better use >> them less in shared code. > > On this topic and others, the manual links to Riastradh$B!G(Bs style guide > for Scheme (info "(guix) Formatting Code"), which is worth a read! Thanks for sharing the good information! (I forgot to CC my reply, so I resent it.) -- Taiju From unknown Fri Jun 20 05:31:38 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 17 Jul 2022 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator