From unknown Mon Jun 23 18:33:00 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48698] [PATCH] git-download: Fix 'git-predicate' handling of deleted files. Resent-From: Andrew Whatson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 27 May 2021 14:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48698 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48698@debbugs.gnu.org Cc: Andrew Whatson X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162212509919136 (code B ref -1); Thu, 27 May 2021 14:19:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 May 2021 14:18:19 +0000 Received: from localhost ([127.0.0.1]:52478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmGq0-0004yW-8C for submit@debbugs.gnu.org; Thu, 27 May 2021 10:18:19 -0400 Received: from lists.gnu.org ([209.51.188.17]:37424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmGpz-0004yP-8j for submit@debbugs.gnu.org; Thu, 27 May 2021 10:18:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmGpy-0008MF-JL for guix-patches@gnu.org; Thu, 27 May 2021 10:18:14 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:45993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmGpw-0000b4-SP for guix-patches@gnu.org; Thu, 27 May 2021 10:18:14 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d16so665018pfn.12 for ; Thu, 27 May 2021 07:18:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VvEyl9tq2PGwVwMrXDTE5Udjt28S7nZlhG0UKQwCeT4=; b=HfWVtHT+fJf+JLXmz38jvwRWi7zBURBoPFmsLLu0/6Xz8zke0Pk3u18GNwzbJxeqt+ QDtEfc99StyctkZBd9a2/JC8j4xyu4kmNvFPJY2d16Q9Yoq/LR+apmVCGmFiuAz6eaLP qpYNAZhQqSRKvlaUf/o8h1+i8hgM/LmxGXRV5jLvW+gGcQsTtuBJetIj7Yhy4CVL28/m Sx8cWLdUdDCYFpjnQ6HgM1apU+X8lj89gK1m1dotArW/hqEv5Bqq1IVy4p3y/wj54z4k KPbhjv92qbj0Ogov3i0P8OZ3cmE5XY1XfXo/o+kwgTTUxM4aFZ6SvwOe+C3rh50NnzUw ZdYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VvEyl9tq2PGwVwMrXDTE5Udjt28S7nZlhG0UKQwCeT4=; b=uQqVznVorxnZ+rlv3RUfQZfVHHwNAcXUBeCUp3i7Ho5QGQIiOhWIh8S258dnFHkNy4 3i7Kmpa8EF7OpGzUkAVRuojR1MehoQ481QKgfASc3SBGMxJJApSMEiSA2NA1v3HOPlBB tgUc9kI7sy6vVSaKf1a+D2z8bUx9/6scTcaAx54D4kTfCG1FIwTsmzejQ3NQlMUB0w3+ pG555gkpes8c5Lb2P9FFWygDQIp2Q2KCf2CGPU+PERYRCtP69OAm9Hw51wBUR+XjuowA vfPp6rcDc8tFdBuj66pcP48Xbft9kGWb4fxrYQcAWduoAFeiqga5b5Bwu31HevS7Vu4h exeg== X-Gm-Message-State: AOAM533jGA3mLkegooSnXMgp4r9o2pKne2q7mynG3oppxxc8m7qECUYn PNvHer7T2v+op1p6l6chtr6O0Rspdk0= X-Google-Smtp-Source: ABdhPJz//v30l4KkRZnGZ9Y32UvWkGk+6tz2eV93F6jel+owB6rltuh8bqQKgiOAQd6Ir9lEAxfh8w== X-Received: by 2002:aa7:9a8e:0:b029:2e7:e3fd:4fa4 with SMTP id w14-20020aa79a8e0000b02902e7e3fd4fa4mr3972455pfi.63.1622125090148; Thu, 27 May 2021 07:18:10 -0700 (PDT) Received: from muon.fritz.box ([203.221.113.127]) by smtp.gmail.com with ESMTPSA id d18sm2060648pgm.93.2021.05.27.07.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 07:18:09 -0700 (PDT) From: Andrew Whatson Date: Fri, 28 May 2021 00:17:59 +1000 Message-Id: <20210527141759.2868127-1-whatson@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=whatson@gmail.com; helo=mail-pf1-x42f.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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@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 (---) When git-predicate is used on an active worktree, some files in the index might not exist on the filesystem. Instead of failing with "No such file or directory", these should be ignored. * guix/git-download.scm (git-predicate): Skip missing files. --- guix/git-download.scm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/guix/git-download.scm b/guix/git-download.scm index 199effece5..8d8e1c865f 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -231,11 +231,13 @@ absolute file name and STAT is the result of 'lstat'." (lambda () (let* ((files (git-file-list directory)) (inodes (fold (lambda (file result) - (let ((stat - (lstat (string-append directory "/" - file)))) - (vhash-consv (stat:ino stat) (stat:dev stat) - result))) + (let* ((path (string-append directory "/" file)) + (stat (and (file-exists? path) + (lstat path)))) + (if stat + (vhash-consv (stat:ino stat) + (stat:dev stat) result) + result))) vlist-null files))) (lambda (file stat) -- 2.31.1 From unknown Mon Jun 23 18:33:00 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Andrew Whatson Subject: bug#48698: closed (Re: bug#48698: [PATCH] git-download: Fix 'git-predicate' handling of deleted files.) Message-ID: References: <87v973i2ym.fsf@gnu.org> <20210527141759.2868127-1-whatson@gmail.com> X-Gnu-PR-Message: they-closed 48698 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 48698@debbugs.gnu.org Date: Fri, 28 May 2021 10:11:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1622196661-12167-1" This is a multi-part message in MIME format... ------------=_1622196661-12167-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #48698: [PATCH] git-download: Fix 'git-predicate' handling of deleted files. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 48698@debbugs.gnu.org. --=20 48698: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D48698 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1622196661-12167-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 48698-done) by debbugs.gnu.org; 28 May 2021 10:10:19 +0000 Received: from localhost ([127.0.0.1]:53669 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmZRb-00038e-AU for submit@debbugs.gnu.org; Fri, 28 May 2021 06:10:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44552) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmZRY-00038D-Be for 48698-done@debbugs.gnu.org; Fri, 28 May 2021 06:10:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34712) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lmZRT-0005Ru-62; Fri, 28 May 2021 06:10:11 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=36942 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmZRS-0003JM-U4; Fri, 28 May 2021 06:10:11 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Andrew Whatson Subject: Re: bug#48698: [PATCH] git-download: Fix 'git-predicate' handling of deleted files. References: <20210527141759.2868127-1-whatson@gmail.com> Date: Fri, 28 May 2021 12:10:09 +0200 In-Reply-To: <20210527141759.2868127-1-whatson@gmail.com> (Andrew Whatson's message of "Fri, 28 May 2021 00:17:59 +1000") Message-ID: <87v973i2ym.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.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-Debbugs-Envelope-To: 48698-done Cc: 48698-done@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: -3.3 (---) Hi Andrew, Andrew Whatson skribis: > When git-predicate is used on an active worktree, some files in the > index might not exist on the filesystem. Instead of failing with "No > such file or directory", these should be ignored. > > * guix/git-download.scm (git-predicate): Skip missing files. I pushed a slightly different version as 50d5bb1f3e3f080212436db1b8666d061a8ae1d2, mostly avoiding the extra =E2=80=98stat=E2=80=99 call induced by =E2=80=98file-exists?=E2=80=99. Thanks, Ludo=E2=80=99. ------------=_1622196661-12167-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 May 2021 14:18:19 +0000 Received: from localhost ([127.0.0.1]:52478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmGq0-0004yW-8C for submit@debbugs.gnu.org; Thu, 27 May 2021 10:18:19 -0400 Received: from lists.gnu.org ([209.51.188.17]:37424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmGpz-0004yP-8j for submit@debbugs.gnu.org; Thu, 27 May 2021 10:18:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmGpy-0008MF-JL for guix-patches@gnu.org; Thu, 27 May 2021 10:18:14 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:45993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmGpw-0000b4-SP for guix-patches@gnu.org; Thu, 27 May 2021 10:18:14 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d16so665018pfn.12 for ; Thu, 27 May 2021 07:18:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VvEyl9tq2PGwVwMrXDTE5Udjt28S7nZlhG0UKQwCeT4=; b=HfWVtHT+fJf+JLXmz38jvwRWi7zBURBoPFmsLLu0/6Xz8zke0Pk3u18GNwzbJxeqt+ QDtEfc99StyctkZBd9a2/JC8j4xyu4kmNvFPJY2d16Q9Yoq/LR+apmVCGmFiuAz6eaLP qpYNAZhQqSRKvlaUf/o8h1+i8hgM/LmxGXRV5jLvW+gGcQsTtuBJetIj7Yhy4CVL28/m Sx8cWLdUdDCYFpjnQ6HgM1apU+X8lj89gK1m1dotArW/hqEv5Bqq1IVy4p3y/wj54z4k KPbhjv92qbj0Ogov3i0P8OZ3cmE5XY1XfXo/o+kwgTTUxM4aFZ6SvwOe+C3rh50NnzUw ZdYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VvEyl9tq2PGwVwMrXDTE5Udjt28S7nZlhG0UKQwCeT4=; b=uQqVznVorxnZ+rlv3RUfQZfVHHwNAcXUBeCUp3i7Ho5QGQIiOhWIh8S258dnFHkNy4 3i7Kmpa8EF7OpGzUkAVRuojR1MehoQ481QKgfASc3SBGMxJJApSMEiSA2NA1v3HOPlBB tgUc9kI7sy6vVSaKf1a+D2z8bUx9/6scTcaAx54D4kTfCG1FIwTsmzejQ3NQlMUB0w3+ pG555gkpes8c5Lb2P9FFWygDQIp2Q2KCf2CGPU+PERYRCtP69OAm9Hw51wBUR+XjuowA vfPp6rcDc8tFdBuj66pcP48Xbft9kGWb4fxrYQcAWduoAFeiqga5b5Bwu31HevS7Vu4h exeg== X-Gm-Message-State: AOAM533jGA3mLkegooSnXMgp4r9o2pKne2q7mynG3oppxxc8m7qECUYn PNvHer7T2v+op1p6l6chtr6O0Rspdk0= X-Google-Smtp-Source: ABdhPJz//v30l4KkRZnGZ9Y32UvWkGk+6tz2eV93F6jel+owB6rltuh8bqQKgiOAQd6Ir9lEAxfh8w== X-Received: by 2002:aa7:9a8e:0:b029:2e7:e3fd:4fa4 with SMTP id w14-20020aa79a8e0000b02902e7e3fd4fa4mr3972455pfi.63.1622125090148; Thu, 27 May 2021 07:18:10 -0700 (PDT) Received: from muon.fritz.box ([203.221.113.127]) by smtp.gmail.com with ESMTPSA id d18sm2060648pgm.93.2021.05.27.07.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 07:18:09 -0700 (PDT) From: Andrew Whatson To: guix-patches@gnu.org Subject: [PATCH] git-download: Fix 'git-predicate' handling of deleted files. Date: Fri, 28 May 2021 00:17:59 +1000 Message-Id: <20210527141759.2868127-1-whatson@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=whatson@gmail.com; helo=mail-pf1-x42f.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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-Debbugs-Envelope-To: submit Cc: Andrew Whatson 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 (---) When git-predicate is used on an active worktree, some files in the index might not exist on the filesystem. Instead of failing with "No such file or directory", these should be ignored. * guix/git-download.scm (git-predicate): Skip missing files. --- guix/git-download.scm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/guix/git-download.scm b/guix/git-download.scm index 199effece5..8d8e1c865f 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -231,11 +231,13 @@ absolute file name and STAT is the result of 'lstat'." (lambda () (let* ((files (git-file-list directory)) (inodes (fold (lambda (file result) - (let ((stat - (lstat (string-append directory "/" - file)))) - (vhash-consv (stat:ino stat) (stat:dev stat) - result))) + (let* ((path (string-append directory "/" file)) + (stat (and (file-exists? path) + (lstat path)))) + (if stat + (vhash-consv (stat:ino stat) + (stat:dev stat) result) + result))) vlist-null files))) (lambda (file stat) -- 2.31.1 ------------=_1622196661-12167-1--