From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eJYvK3lpfWEiPgEAgWs5BA (envelope-from ) for ; Sat, 30 Oct 2021 17:49:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 8Ee/JnlpfWFgDgAAbx9fmQ (envelope-from ) for ; Sat, 30 Oct 2021 15:49:13 +0000 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 3B7BB2C21 for ; Sat, 30 Oct 2021 17:49:13 +0200 (CEST) Received: from localhost ([::1]:52532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgqbX-00080d-0N for larch@yhetil.org; Sat, 30 Oct 2021 11:49:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgqbO-00080U-GH for guix-patches@gnu.org; Sat, 30 Oct 2021 11:49:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46660) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgqbO-0008QO-7o for guix-patches@gnu.org; Sat, 30 Oct 2021 11:49:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mgqbO-0007rT-2U for guix-patches@gnu.org; Sat, 30 Oct 2021 11:49:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Oct 2021 15:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163560893530202 (code B ref 51307); Sat, 30 Oct 2021 15:49:02 +0000 Received: (at 51307) by debbugs.gnu.org; 30 Oct 2021 15:48:55 +0000 Received: from localhost ([127.0.0.1]:58206 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgqbH-0007r4-1i for submit@debbugs.gnu.org; Sat, 30 Oct 2021 11:48:55 -0400 Received: from mail-wr1-f48.google.com ([209.85.221.48]:36413) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgqbF-0007qp-Hm for 51307@debbugs.gnu.org; Sat, 30 Oct 2021 11:48:53 -0400 Received: by mail-wr1-f48.google.com with SMTP id s13so14266471wrb.3 for <51307@debbugs.gnu.org>; Sat, 30 Oct 2021 08:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=wg8lcnmThwI4lkWMat/GkomoUBjNHgc7NwKoOrjIrVY=; b=pn5CJprzeT7KYxHc9jWwauqgxHZ7bWZb5cflsPEDjn0H7sryMwEgXOp4Wiy1J3JW1T 5vlu5+rbOYlTYiZwFLps+cgtzJsNHQsDpTMe7R8VOJuwrk4AHb2Nooy/aRjLYJFY/zdE +93VhUGp+g+jjGbdluyeLfYpywqc0fOf151A8dkE23HkI+MZ/P7vXiExdq19/TqjJAVD Kz8iIt3AmL3EbpTspOrZYunXadgQOC7WDfOVnX3UJd5EM95zBCoxlOB2383kLhGcxIxq 6UmtfH6RdaOVovgbfNaYbevgv0VbkR1F9XHgpO8nHDJl+Tq1tVDS3PIqRunJDS0Vp52U cKfQ== 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:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=wg8lcnmThwI4lkWMat/GkomoUBjNHgc7NwKoOrjIrVY=; b=012U+3jp8+zUxMdS5TmqtmM3PflZ9yphe9JajzEgs/mYvpVv4a//QtaKMXih7DMH0m q6yr+O/LuZwyjPzRw+f6njuqp3q5QMdMTcNUKHpOAxtMb5NOKwTr5zMMWEWxbPjRniqu EnUbiZDNxuzXwOI5/zjTJrtjByc7UQGwlvGgpDfPb94Cr2OvxwML625zYf0aGzQFr98A jdJOeAbujxvpC6vIMmPesRI3/ms4KNTe/4doRqAJfksBBz4huzpdyM7xr2u28HTOvimA vgiq85rO8NruVQ0Iwe2xwbop1dH0rKYwzBJdN5CGbQ6iJy4BTuWwawddTxluieAq1Mqn NDjQ== X-Gm-Message-State: AOAM531lQw7xijqLgLAueGkuEilH0NTiebA1SMLXYTBIKciBxdzXjqzp YygbZQGiTAGW+LsSv2y0h7YnRjNGeZ0= X-Google-Smtp-Source: ABdhPJya8Wq+tPpdkal4oZ3VXPrDkO19KYxJ9kY0O4oVGiJXV6JHxHOzi4o02NGjF2DZ+dtAcwosNA== X-Received: by 2002:a5d:468f:: with SMTP id u15mr9132360wrq.171.1635608927551; Sat, 30 Oct 2021 08:48:47 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id y5sm11007251wrd.75.2021.10.30.08.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Oct 2021 08:48:47 -0700 (PDT) From: zimoun In-Reply-To: <875ytetvt1.fsf_-_@gnu.org> References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <20211020165435.3358398-1-zimon.toutoune@gmail.com> <875ytetvt1.fsf_-_@gnu.org> Date: Sat, 30 Oct 2021 17:40:59 +0200 Message-ID: <86cznmldv8.fsf@gmail.com> 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635608953; 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=wg8lcnmThwI4lkWMat/GkomoUBjNHgc7NwKoOrjIrVY=; b=VOn37zqe8+ztbmuEMfmV5uY/gZ1VqfyDVkACqWLMMI3at7o/f8HTix5oDFPVoWxoDqGafe orrjZcV7yrX15AzL+o9X4GoRcYvO2+Q+1O8b5XbP1sMFghdqnyDSCZv53XYH7J4mH9CgbZ oNUaAJfF3iB8OEx4z80vB3dmXV+sheaatyc/zGGqM06jowotpY0IpvYoOabjyPRDnz9661 84zqBBzRJg6buxBmftjCp5S+GOYdOVqt6i4xJg6mSyKQpS9LzM9siQy+O9Jqip40WPn5wp TxUc0qnToPA/SVWvlLgTiMX0gNnenjmKSXfTx5rxowRle8h4193BK5eDCU4SrQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635608953; a=rsa-sha256; cv=none; b=EwPwjbmX6zjwRHDcgN/nyJ30kUf9Ys6DFyj069Rd6zjZmsoa7L7hDSWLLHXmKsepunIAJf Aza9+zWGez2kHkOjESnTdQ/Uc95HqmsYvxa2S56T3zMm3JnUzJvcaQZVsc/Km+aCTFyd5U cGiSg89steGlSX6uCtwH+zmpJduE8hcHUDb3gYxO7fFMC0EP7DrTblRaCOfRX8D2jeLlhJ iz+64p5zE+fFsnpISUKCoSENcmH6hRf/aekyrsZrmgtuYYz8RZgXIXCEfF0fSJb67Fqz/S DsOB1dyY8eGeV+U732qPcKmCjJqLNh4X4YXSbA89sdwb0D8RS5KmZnpUc/K1bg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=pn5CJprz; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=pn5CJprz; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 3B7BB2C21 X-Spam-Score: -1.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: zZ5tANIYEGar Hi Ludo, On Sat, 30 Oct 2021 at 16:46, Ludovic Court=C3=A8s wrote: > zimoun skribis: > >> * guix/scripts/hash.scm (guix-hash): Allow several files. >> [directory?]: New procedure. >> [file-hash]: Catch system-error. >> [hash-to-display]: New procedure. > > Nice! Could you update guix.texi and tests/guix-hash.texi? I will once we agree and reach consensus. ;-) >> - (with-error-handling >> - (if (assoc-ref opts 'recursive?) >> + (if (and (assoc-ref opts 'recursive?) >> + (directory? file)) > > This change is not related to the main purpose of the patch. > > More importantly, note that =E2=80=98--recursive=E2=80=99 is not limited = to directories: > it preserves file properties (directory, executable, or regular), so > it=E2=80=99s also useful for executable files for instance. It can also = be used > for regular files, even if it=E2=80=99s less useful. I understand. Could you provide concrete examples when it is not directory? In order to see if there is a pattern. >> + (define (hash-to-display thing) >> + (match thing >> + ((? file-exists? file) >> + (fmt (file-hash file))) >> + ("-" (with-error-handling >> + (fmt (port-hash (assoc-ref opts 'hash-algorithm) >> + (current-input-port))))) > > I=E2=80=99d swap the order of the two clauses and remove the call to > =E2=80=98file-exists?=E2=80=99: if the file doesn=E2=80=99t exist, =E2=80= =98file-hash=E2=80=99 will raise an > error. I can swap order but not remove file-exists? Otherwise, the next clause=E2= =80=A6 >> + (x >> + (leave (G_ "wrong argument~%"))))) will never happen. And some tests are failing. >> + (for-each >> + (lambda (arg) >> + (format #t "~a~%" (hash-to-display arg))) > > Or just (compose display hash-to-display) ? > > Maybe s/hash-to-display/formatted-hash/. Thanks. Indeed both are better. :-) > Could you send an updated patch? Yes, but before, from my understanding, we should agree on the goal of such patch. :-) See the two other replies. Cheers, simon