GNU bug report logs -
#76143
[PATCH] gnu: Canonicalize paths before comparing.
Previous Next
Full log
Message #26 received at 76143 <at> debbugs.gnu.org (full text, mbox):
Ludovic Courtès <ludo <at> gnu.org> writes:
> Hi,
>
> Noé Lopez <noe <at> noé.eu> skribis:
>
>> The problem I faced was that I needed to create environment variables by
>> hand so that I could load guile code (including guix’s) in a C program
>> with no external environment (the packagekit daemon). It would fail
>> because of not finding patches since I had a trailing slash in my path.
>
> I don’t fully understand the situation. My suggestion (but perhaps
> you’re already doing that) would be for PackageKit to invoke ‘guix
> repl’, not ‘guile’. The raison d’être of ‘guix repl’ was precisely to
> have the load path for Guix and all its dependencies properly set up.
>
Let me try to explain the situation better:
The Guix channel has a special case for where it stores its patches, so
guix needs to detect whether a directory is the Guix source to append
"/gnu/packages/patches" to it:
gnu/packages.scm(166)
(define %patch-path
(make-parameter
(map (lambda (directory)
(if (string=? directory %distro-root-directory)
(string-append directory "/gnu/packages/patches")
directory))
%load-path)))
The comparison is done with string=?, which is a very weak way of
comparing directories, as you know. But the directory list is supplied
by the environment, so its up to the user to set the path exactly equal
to %distro-root-directory.
Obviously, this can fail in many ways if the user is not using guix
through pre-inst-env or guix repl. My patch fixes that by comparing
with stat, making sure all paths to the guix source work.
For PackageKit specifically, I am using guix through guile’s C api and
needed to set the environment by hand, I fixed it by removing the
trailing slash.
Is that clearer?
All the best,
Noé
This bug report was last modified 118 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.