unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] git-download: Fix 'git-predicate' to use absolute paths.
@ 2017-05-25 15:58 Christopher Baines
  2017-05-30 10:52 ` Christopher Baines
  2017-05-30 14:50 ` Ludovic Courtès
  0 siblings, 2 replies; 3+ messages in thread
From: Christopher Baines @ 2017-05-25 15:58 UTC (permalink / raw)
  To: guix-devel

git ls-files will return paths relative to the repository directory. This
commit prepends the repository directory to those paths when calling lstat,
such that 'git-predicate' works if the current working directory is not the
repository directory.

* guix/git-download.scm (git-predicate): Prepend repository directory to the
  file path when calling lstat.
---
 guix/git-download.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/guix/git-download.scm b/guix/git-download.scm
index 9f6d20ee3..316835502 100644
--- a/guix/git-download.scm
+++ b/guix/git-download.scm
@@ -146,7 +146,8 @@ absolute file name and STAT is the result of 'lstat'."
                           (line
                            (loop (cons line lines))))))
          (inodes      (map (lambda (file)
-                             (let ((stat (lstat file)))
+                             (let ((stat (lstat
+                                          (string-append directory "/" file))))
                                (cons (stat:dev stat) (stat:ino stat))))
                            files))
          (status      (close-pipe pipe)))
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] git-download: Fix 'git-predicate' to use absolute paths.
  2017-05-25 15:58 [PATCH] git-download: Fix 'git-predicate' to use absolute paths Christopher Baines
@ 2017-05-30 10:52 ` Christopher Baines
  2017-05-30 14:50 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Christopher Baines @ 2017-05-30 10:52 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 684 bytes --]

On 25/05/17 16:58, Christopher Baines wrote:
> git ls-files will return paths relative to the repository directory. This
> commit prepends the repository directory to those paths when calling lstat,
> such that 'git-predicate' works if the current working directory is not the
> repository directory.

I've just hit this issue again, but in a different way. This way is easy
to reproduce though.

  guix build -e "(begin (use-modules (gnu packages package-management))
(current-guix))"

If you run that while the current working directory is not the root of
the repository, you should get:

  ERROR: In procedure lstat: No such file or directory: ".dir-locals.el"



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 858 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] git-download: Fix 'git-predicate' to use absolute paths.
  2017-05-25 15:58 [PATCH] git-download: Fix 'git-predicate' to use absolute paths Christopher Baines
  2017-05-30 10:52 ` Christopher Baines
@ 2017-05-30 14:50 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2017-05-30 14:50 UTC (permalink / raw)
  To: Christopher Baines; +Cc: guix-devel

Christopher Baines <mail@cbaines.net> skribis:

> git ls-files will return paths relative to the repository directory. This
> commit prepends the repository directory to those paths when calling lstat,
> such that 'git-predicate' works if the current working directory is not the
> repository directory.
>
> * guix/git-download.scm (git-predicate): Prepend repository directory to the
>   file path when calling lstat.

Good catch!  Applied, thanks.

Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-30 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-25 15:58 [PATCH] git-download: Fix 'git-predicate' to use absolute paths Christopher Baines
2017-05-30 10:52 ` Christopher Baines
2017-05-30 14:50 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).