From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id aKkUIA8NJ2UBGgEA9RJhRA:P1 (envelope-from ) for ; Wed, 11 Oct 2023 23:01:03 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id aKkUIA8NJ2UBGgEA9RJhRA (envelope-from ) for ; Wed, 11 Oct 2023 23:01:03 +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 DFB3A629A8 for ; Wed, 11 Oct 2023 23:01:01 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=fTjFRYPm; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1697058063; 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: content-transfer-encoding:content-transfer-encoding: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=8diD0x38rM4xyOAc7a6oy/XSuSMcGd3c2I2Zq6uK1R0=; b=p5O+f1F5Qd2Wg7U1y0c4H5Irc53s3gHJNFgXLFlN33QSMKDV9KBXDPUuJT/iehkAZMVUBF Garkm8sgTT/38zhuftcMSHECr7qeA0nffr09N4c93K8S7Q/Ot6HwkKXUVzRPzz4v+VKhWa wNqhOXb6Lh0mxylZlDNXj5bQ8Hx+jeAJdZnM0ZoIcuUzmepZvxjiI+SuSCDBasPgGzI4Pf 0AsUXDYtIrduOvv2f3khbt4RildMKHLoqPuZo4Dr7DxefCyGBJkBYti+tFkUo1UaF0Ly7A y87PXqXlY9NFft9VAbFo78OrpUKSLuNAuZXOgvJljCd0Rs+95wQVXug+4ZmqzQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1697058063; a=rsa-sha256; cv=none; b=W+M9mZx32t27/el59vzM7xlz8PtzxP6eR9VdYkdyVmMj7SF5C+uoPyKFPqc7km57HzwP95 wi0OfT/qstOPfJJ3d9jSiZAVaaUZFrRKuxRHuSuYp4C7ij6+vXe9SZLRlUzZRm568CnK/Z q7IA0S5XHn67dfL7QLZtt7WPXAoJJjVsPIUqnFEiEBEP0hIvxz8ItVUtup5h9VfR7F907q Nc0xPP1vUocMOpWLNaIxLC92s9nuyfB7fRpfA3SjgiUnMtQt2F622zohQ2wOr5SHjQf6Vf CEK05yUlzecmcDq2j5uzb/NK1SnrlgKuphNAfkh1VH5LCQSrrWW2AxARjWd9eQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=fTjFRYPm; 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"; dmarc=pass (policy=none) header.from=gnu.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqgJw-0006LL-Sx; Wed, 11 Oct 2023 17:00:44 -0400 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 ) id 1qqgJu-0006L0-P4 for guix-patches@gnu.org; Wed, 11 Oct 2023 17:00:42 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qqgJs-0000fL-O1 for guix-patches@gnu.org; Wed, 11 Oct 2023 17:00:42 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qqgKE-0006tZ-9x for guix-patches@gnu.org; Wed, 11 Oct 2023 17:01:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65546] [PATCH v2] guix: Properly compute progress bar width. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 11 Oct 2023 21:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65546 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Julien Lepiller Cc: Ricardo Wurmus , 65546@debbugs.gnu.org Received: via spool by 65546-submit@debbugs.gnu.org id=B65546.169705805926484 (code B ref 65546); Wed, 11 Oct 2023 21:01:02 +0000 Received: (at 65546) by debbugs.gnu.org; 11 Oct 2023 21:00:59 +0000 Received: from localhost ([127.0.0.1]:40143 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqgKB-0006t4-Be for submit@debbugs.gnu.org; Wed, 11 Oct 2023 17:00:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42712) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqgK6-0006sL-Cb for 65546@debbugs.gnu.org; Wed, 11 Oct 2023 17:00:58 -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 ) id 1qqgJa-0000bV-Ho; Wed, 11 Oct 2023 17:00:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=8diD0x38rM4xyOAc7a6oy/XSuSMcGd3c2I2Zq6uK1R0=; b=fTjFRYPmmWrg3s9+gVPz VTSzI1WHK4l5Rt00ytO8VAtbvxu8d1/dOpWVveRiVg1tX0A8o+wMET+R7yLPA/UHjwyFj2AXW9ZU6 ORNwelxXfijuHQmAmtITKGSYZJVApmTKGSCyRZunyRPuWZ/975OfhYjfdp+FhFuy6zPBBOmNJFwPE pwm7hychznElTlIFwFIz7nKVBvOq1gWZ7nPTOjyYdX16VDwW68mwHEPnuokd/GppizpHIOxVAAPlv +qwWvInSL6J4moT5Yj/4Bj4aqjPJlw24cZn3SloiuRHi67LorwrD/Hir87KFniuDxnTGIhtQPlqnZ ITOakOXqwt1w2g==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <20230909172047.6254-1-julien@lepiller.eu> (Julien Lepiller's message of "Sat, 9 Sep 2023 19:20:42 +0200") References: <20230826063655.2227-1-julien@lepiller.eu> <20230909172047.6254-1-julien@lepiller.eu> Date: Wed, 11 Oct 2023 23:00:07 +0200 Message-ID: <8734ygswmg.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -6.89 X-Migadu-Queue-Id: DFB3A629A8 X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -6.89 X-TUID: ADjU49bNADVl Hi Julien, Julien Lepiller skribis: > * guix/build/syscalls.scm (terminal-width): New procedure. > * guix/progress.scm (progress-reporter/bar): Use it to compute progress > bar width. > * guix/git.scm (show-progress): Use it to compute progress bar width. > * tests/syscalls.scm: Add tests. Others have already said =E2=80=9CLGTM=E2=80=9D, and I concur. I=E2=80=99l= l still make a couple of minor suggestions but that shoudln=E2=80=99t stop you from going ahead (everyone=E2=80=99s waiting for it :-)). > +(define get-wchar-ffi > + (pointer->procedure int > + (dynamic-func "mbstowcs" (dynamic-link)) > + (list '* '* size_t))) > +(define terminal-string-width-ffi > + (pointer->procedure int > + (dynamic-func "wcswidth" (dynamic-link)) > + (list '* size_t))) > + > +(define (terminal-string-width str) > + "Return the width of a string as it would be printed on the terminal. = This > +procedure accounts for characters that have a different width than 1, su= ch as > +CJK double-width characters." I=E2=80=99d suggest following the style of the rest of the file, which is t= o do something like: (define terminal-string-width (let ((mbstowcs (syscall->procedure =E2=80=A6)) (wcswidth (syscall->procedure =E2=80=A6))) (lambda (str) =E2=80=A6))) Ideally the syscalls.scm changes would be in a commit separate from the progress.scm changes. Now we have the problem that OpenJDK unfortunately depends on (guix build syscalls), which makes this change half-of-the-world-rebuild. There=E2=80=99s another pending syscalls.scm change: https://issues.guix.gnu.org/66055 https://issues.guix.gnu.org/66054 Time to create a branch? Ludo=E2=80=99.