From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id WCVPOKe+oGKSdQEAbAwnHQ (envelope-from ) for ; Wed, 08 Jun 2022 17:22:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id iJlqN6e+oGIcFgEAG6o9tA (envelope-from ) for ; Wed, 08 Jun 2022 17:22:15 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 77E6538CE9 for ; Wed, 8 Jun 2022 17:22:15 +0200 (CEST) Received: from localhost ([::1]:44776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyxVe-0005Ch-7P for larch@yhetil.org; Wed, 08 Jun 2022 11:22:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyxJs-0001TC-DJ for guix-patches@gnu.org; Wed, 08 Jun 2022 11:10:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50087) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyxJq-0000AX-Cy for guix-patches@gnu.org; Wed, 08 Jun 2022 11:10:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nyxJq-0006On-6t for guix-patches@gnu.org; Wed, 08 Jun 2022 11:10:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed Resent-From: Taiju HIGASHI Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 08 Jun 2022 15:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55845 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Tobias Geerinckx-Rice Cc: 55845@debbugs.gnu.org X-Debbugs-Original-Cc: 55845@debbugs.gnu.org, guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165470097024552 (code B ref -1); Wed, 08 Jun 2022 15:10:02 +0000 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 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1654701735; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=D84by1sZDsvs54XAGDpfLyQuUma/2NsiOPYV9yhoGgU=; b=mu+RQp0dt3IFGqQip0/Pg+UUFrGvvTYMWcT+nMP2UVt9p9vop0+f8MBb2z8SZbclt5nM3a cC0w+ocd909A7aljhm+9ZkjDJMEdAAUpHJ2GG5N0rvmMXDZU1MhQWlGvM9p6umU26fcyn1 wj4kzDx/Ml+94xQuPRWXilMePTjtivBQ/TLOCbVXmJlVDRxScyWl2NwgtQPFqnBTrtZpEN eEfppDj5sQQPtjr2jE+zxhHrLju86SwG9bkLzw2DdsRhFd4rwF5TCQmPLg2ry6zl3zJgUq 1FqnHnp8/Ejes8Thv3BkhxkJ2G6V5MNilDWTRvLs1591eDHsbMfi7z+04GRdRg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654701735; a=rsa-sha256; cv=none; b=aZzTx1gfXQeSlpCUejhWGMjsxD3qqYv4SoSjWkK/UBOI+lpCWz+WtIXaYhgptcBVEDWkWb we/NZEHDITkdWMHR7iqceCpRtvSTXjr3XLetlgx0k/Rygn8yz52A2xvOtozexOMuDJzuKW 893+AmX+vxBokidSaftF5/+a4DJ47EzuygScAgiVIwo1nEojaxdL7Fcve5JwMaCd/49uyT jjs3G0HiI1vllHiXK+/CFYpKn9zxezRLq38PXqpYBKaokNVPFoZbJz9tvGlp7xEGEdj4hR u/rvpJxtnG7WQ+DP87Fmtd9luyx5+ba4SXzsDcKkhAx/5H3/scC3yEhpaGY2CQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=taiju-info.20210112.gappssmtp.com header.s=20210112 header.b=GlXp3Mhy; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -0.10 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=taiju-info.20210112.gappssmtp.com header.s=20210112 header.b=GlXp3Mhy; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 77E6538CE9 X-Spam-Score: -0.10 X-Migadu-Scanner: scn0.migadu.com X-TUID: YDuVmixH/SwW Hi Tobias, Thank you kindly for your detailed explanation. Tobias Geerinckx-Rice writes: > Hi again, > > Taiju HIGASHI 写道: >> 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… 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 ‘guix pull’ as I reply to multiple mails, on > battery…] > > 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 ― 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