GNU logs - #62056, boring messages


Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#62056] [PATCH] guix: Only issue erase-current-line sequence for ttys.
Resent-From: Bruno Victal <mirai@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 08 Mar 2023 15:57:01 +0000
Resent-Message-ID: <handler.62056.B.167829098832227 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 62056
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 62056 <at> debbugs.gnu.org
Cc: Bruno Victal <mirai@HIDDEN>
X-Debbugs-Original-To: guix-patches@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.167829098832227
          (code B ref -1); Wed, 08 Mar 2023 15:57:01 +0000
Received: (at submit) by debbugs.gnu.org; 8 Mar 2023 15:56:28 +0000
Received: from localhost ([127.0.0.1]:50001 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pZw9T-0008Ni-Pa
	for submit <at> debbugs.gnu.org; Wed, 08 Mar 2023 10:56:28 -0500
Received: from lists.gnu.org ([209.51.188.17]:34510)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mirai@HIDDEN>) id 1pZw9S-0008Na-40
 for submit <at> debbugs.gnu.org; Wed, 08 Mar 2023 10:56:26 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mirai@HIDDEN>) id 1pZw9R-0005UF-QG
 for guix-patches@HIDDEN; Wed, 08 Mar 2023 10:56:25 -0500
Received: from smtpm5.myservices.hosting ([185.26.105.236])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mirai@HIDDEN>) id 1pZw9P-0001mk-B9
 for guix-patches@HIDDEN; Wed, 08 Mar 2023 10:56:25 -0500
Received: from mail1.netim.hosting (unknown [185.26.106.173])
 by smtpm5.myservices.hosting (Postfix) with ESMTP id B269020CB7
 for <guix-patches@HIDDEN>; Wed,  8 Mar 2023 16:56:07 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
 by mail1.netim.hosting (Postfix) with ESMTP id 5D5E8800A4;
 Wed,  8 Mar 2023 16:56:07 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting
Received: from mail1.netim.hosting ([127.0.0.1])
 by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 5MDkHJYR6CN5; Wed,  8 Mar 2023 16:56:04 +0100 (CET)
Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177])
 (Authenticated sender: lumen@HIDDEN)
 by mail1.netim.hosting (Postfix) with ESMTPSA id 13C5B8009E;
 Wed,  8 Mar 2023 16:56:04 +0100 (CET)
From: Bruno Victal <mirai@HIDDEN>
Date: Wed,  8 Mar 2023 15:55:56 +0000
Message-Id: <6a78ee837fe579d6b1beaeda54beddba3c05fd2e.1678290800.git.mirai@HIDDEN>
X-Mailer: git-send-email 2.39.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=185.26.105.236; envelope-from=mirai@HIDDEN;
 helo=smtpm5.myservices.hosting
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, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

* guix/progress.scm (erase-current-line): Only issue erase-current-line sequence for ttys.
---

Avoids cluttering log lines with �[K when output is logged to a file.

 guix/progress.scm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/guix/progress.scm b/guix/progress.scm
index 33cf6f4a1a..a1cdd25557 100644
--- a/guix/progress.scm
+++ b/guix/progress.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2015 Steve Sprang <scs@HIDDEN>
 ;;; Copyright © 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@HIDDEN>
 ;;; Copyright © 2018 Clément Lassieur <clement@HIDDEN>
+;;; Copyright © 2023 Bruno Victal <mirai@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -209,9 +210,12 @@ (define* (progress-bar % #:optional (bar-width 20))
                    (string (progress-bar-style-stop bar-style)))))
 
 (define (erase-current-line port)
-  "Write an ANSI erase-current-line sequence to PORT to erase the whole line and
-move the cursor to the beginning of the line."
-  (display "\r\x1b[K" port))
+  "When @var{port} is interactive, write an ANSI erase-current-line sequence
+to erase the whole line and move the cursor to the beginning of the line,
+otherwise write a newline."
+  (if (isatty? port)
+      (display "\r\x1b[K" port)
+      (newline port)))
 
 (define* (display-download-progress file size
                                     #:key

base-commit: 85d4e8af5baf9b0a9cadf95d802674d0254433da
-- 
2.39.1





Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Bruno Victal <mirai@HIDDEN>
Subject: bug#62056: Acknowledgement ([PATCH] guix: Only issue
 erase-current-line sequence for ttys.)
Message-ID: <handler.62056.B.167829098832227.ack <at> debbugs.gnu.org>
References: <6a78ee837fe579d6b1beaeda54beddba3c05fd2e.1678290800.git.mirai@HIDDEN>
X-Gnu-PR-Message: ack 62056
X-Gnu-PR-Package: guix-patches
X-Gnu-PR-Keywords: patch
Reply-To: 62056 <at> debbugs.gnu.org
Date: Wed, 08 Mar 2023 15:57:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 guix-patches@HIDDEN

If you wish to submit further information on this problem, please
send it to 62056 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
62056: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D62056
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#62056] [PATCH] guix: Only issue erase-current-line sequence for ttys.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 16 Mar 2023 21:31:02 +0000
Resent-Message-ID: <handler.62056.B62056.167900221927489 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 62056
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Bruno Victal <mirai@HIDDEN>
Cc: 62056 <at> debbugs.gnu.org
Received: via spool by 62056-submit <at> debbugs.gnu.org id=B62056.167900221927489
          (code B ref 62056); Thu, 16 Mar 2023 21:31:02 +0000
Received: (at 62056) by debbugs.gnu.org; 16 Mar 2023 21:30:19 +0000
Received: from localhost ([127.0.0.1]:43220 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pcvAw-00079J-R3
	for submit <at> debbugs.gnu.org; Thu, 16 Mar 2023 17:30:19 -0400
Received: from eggs.gnu.org ([209.51.188.92]:53290)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1pcvAv-000794-7U
 for 62056 <at> debbugs.gnu.org; Thu, 16 Mar 2023 17:30:17 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pcvAp-0000hh-FZ; Thu, 16 Mar 2023 17:30:11 -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=njsiV8XOvVzCfV4gD5oyzlPAERY60yuyAAuQ8ajIPWc=; b=i9toqJQN9Vp+devztrlg
 PrOOSvePw91S0i54TNY+RZeTpT93hQrhEeciCmjS8PrzCRyybgfBlaP7QHjQOrd0RZax64F2KFux7
 nwq42q1dT3URgTHLCIKnQE6ABfNuGdVsu8NqWUmw4oVV1zrEq+v+Dyr3QdMx/pnAvFjyzSOR6sqWc
 lafcbd5jP11gfQfxizGnVEsFdVCOcq71lBxVN9n8kCq00AqGSnOZAlP1BqceFcA1jGNUxLze1kTYc
 bA4ameTtP9YVd6sERXGGG4Ng4ie5Ea2arZtN3UNLOvu2h7AblhZy6LuQ3GZcoc2CtsUjbcX3KJ5pC
 AV9la0qBlj5KCA==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pcvAo-0001DH-12; Thu, 16 Mar 2023 17:30:10 -0400
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
References: <6a78ee837fe579d6b1beaeda54beddba3c05fd2e.1678290800.git.mirai@HIDDEN>
Date: Thu, 16 Mar 2023 22:30:06 +0100
In-Reply-To: <6a78ee837fe579d6b1beaeda54beddba3c05fd2e.1678290800.git.mirai@HIDDEN>
 (Bruno Victal's message of "Wed, 8 Mar 2023 15:55:56 +0000")
Message-ID: <874jqkbd0h.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Bruno Victal <mirai@HIDDEN> skribis:

> * guix/progress.scm (erase-current-line): Only issue erase-current-line s=
equence for ttys.
> ---
>
> Avoids cluttering log lines with =EF=BF=BD[K when output is logged to a f=
ile.

+1!

>  (define (erase-current-line port)
> -  "Write an ANSI erase-current-line sequence to PORT to erase the whole =
line and
> -move the cursor to the beginning of the line."
> -  (display "\r\x1b[K" port))
> +  "When @var{port} is interactive, write an ANSI erase-current-line sequ=
ence
> +to erase the whole line and move the cursor to the beginning of the line,
> +otherwise write a newline."
> +  (if (isatty? port)
> +      (display "\r\x1b[K" port)
> +      (newline port)))

We should avoid calling =E2=80=98isatty?=E2=80=99 every time, it=E2=80=99s =
too costly, which is
why there=E2=80=99s also =E2=80=98isatty?*=E2=80=99 somewhere that memoizes=
 things.

However, it seems up to the caller to check that before calling
=E2=80=98erase-current-line=E2=80=99.  That seems to be the case within pro=
gress.scm and
in (guix status).

Could you see which use of =E2=80=98erase-current-line=E2=80=99 is causing =
problems?

TIA,
Ludo=E2=80=99.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#62056] [PATCH] guix: Only issue erase-current-line sequence for ttys.
Resent-From: Bruno Victal <mirai@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sat, 18 Mar 2023 11:45:01 +0000
Resent-Message-ID: <handler.62056.B62056.167913987925714 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 62056
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Cc: 62056 <at> debbugs.gnu.org
Received: via spool by 62056-submit <at> debbugs.gnu.org id=B62056.167913987925714
          (code B ref 62056); Sat, 18 Mar 2023 11:45:01 +0000
Received: (at 62056) by debbugs.gnu.org; 18 Mar 2023 11:44:39 +0000
Received: from localhost ([127.0.0.1]:46453 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdUzH-0006gg-1m
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 07:44:39 -0400
Received: from smtpm4.myservices.hosting ([185.26.105.235]:55646)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mirai@HIDDEN>) id 1pdUzF-0006gX-Bl
 for 62056 <at> debbugs.gnu.org; Sat, 18 Mar 2023 07:44:38 -0400
Received: from mail1.netim.hosting (unknown [185.26.106.173])
 by smtpm4.myservices.hosting (Postfix) with ESMTP id EE33820BF0;
 Sat, 18 Mar 2023 12:44:32 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
 by mail1.netim.hosting (Postfix) with ESMTP id 795788009A;
 Sat, 18 Mar 2023 12:27:21 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting
Received: from mail1.netim.hosting ([127.0.0.1])
 by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 3-SRC-LaPyqj; Sat, 18 Mar 2023 12:27:20 +0100 (CET)
Received: from [192.168.1.239] (unknown [10.192.1.83])
 (Authenticated sender: lumen@HIDDEN)
 by mail1.netim.hosting (Postfix) with ESMTPSA id ABFF580098;
 Sat, 18 Mar 2023 12:27:20 +0100 (CET)
Message-ID: <99afbc21-920c-1867-e368-d541ae524283@HIDDEN>
Date: Sat, 18 Mar 2023 11:27:12 +0000
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.8.0
Content-Language: en-US
References: <6a78ee837fe579d6b1beaeda54beddba3c05fd2e.1678290800.git.mirai@HIDDEN>
 <874jqkbd0h.fsf@HIDDEN>
From: Bruno Victal <mirai@HIDDEN>
In-Reply-To: <874jqkbd0h.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.1 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

Hi Ludo’,

On 2023-03-16 21:30, Ludovic Courtès wrote:
> Bruno Victal <mirai@HIDDEN> skribis:
>>  (define (erase-current-line port)
>> -  "Write an ANSI erase-current-line sequence to PORT to erase the whole line and
>> -move the cursor to the beginning of the line."
>> -  (display "\r\x1b[K" port))
>> +  "When @var{port} is interactive, write an ANSI erase-current-line sequence
>> +to erase the whole line and move the cursor to the beginning of the line,
>> +otherwise write a newline."
>> +  (if (isatty? port)
>> +      (display "\r\x1b[K" port)
>> +      (newline port)))
> 
> We should avoid calling ‘isatty?’ every time, it’s too costly, which is
> why there’s also ‘isatty?*’ somewhere that memoizes things.
> 
> However, it seems up to the caller to check that before calling
> ‘erase-current-line’.  That seems to be the case within progress.scm and
> in (guix status).

guix/status.scm:471 defines a erase-current-line* which calls isatty?*.
Does this mean that erase-current-line has to be “wrapped” every time
we want it to have tty awareness?

If that's not the case, perhaps we could change the signature of erase-current-line to:
(define* (erase-current-line port #:optional tty?)


> Could you see which use of ‘erase-current-line’ is causing problems?

guix/scripts/substitute.scm:318


Cheers,
Bruno





Last modified: Sat, 18 Mar 2023 11:45:01 UTC

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