GNU bug report logs - #48698
[PATCH] git-download: Fix 'git-predicate' handling of deleted files.

Previous Next

Package: guix-patches;

Reported by: Andrew Whatson <whatson <at> gmail.com>

Date: Thu, 27 May 2021 14:19:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48698 in the body.
You can then email your comments to 48698 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#48698; Package guix-patches. (Thu, 27 May 2021 14:19:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrew Whatson <whatson <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 27 May 2021 14:19:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrew Whatson <whatson <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Andrew Whatson <whatson <at> gmail.com>
Subject: [PATCH] git-download: Fix 'git-predicate' handling of deleted files.
Date: Fri, 28 May 2021 00:17:59 +1000
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





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Fri, 28 May 2021 10:11:01 GMT) Full text and rfc822 format available.

Notification sent to Andrew Whatson <whatson <at> gmail.com>:
bug acknowledged by developer. (Fri, 28 May 2021 10:11:01 GMT) Full text and rfc822 format available.

Message #10 received at 48698-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Andrew Whatson <whatson <at> gmail.com>
Cc: 48698-done <at> debbugs.gnu.org
Subject: Re: bug#48698: [PATCH] git-download: Fix 'git-predicate' handling
 of deleted files.
Date: Fri, 28 May 2021 12:10:09 +0200
Hi Andrew,

Andrew Whatson <whatson <at> gmail.com> 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
‘stat’ call induced by ‘file-exists?’.

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 25 Jun 2021 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 278 days ago.

Previous Next


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