unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: mhw@netris.org, 17083@debbugs.gnu.org
Cc: guix-devel@gnu.org
Subject: bug#17083: ‘union-build’ does not handle collisions between a leaf and a sub-tree
Date: Mon, 24 Mar 2014 15:15:34 +0100	[thread overview]
Message-ID: <87siq7y96h.fsf@gnu.org> (raw)
In-Reply-To: <87ior4ku41.fsf@yeeloong.lan> (Mark H. Weaver's message of "Mon, 24 Mar 2014 02:07:10 -0400")

(Adding bug-guix.)

Mark H Weaver <mhw@netris.org> skribis:

> On the Loongson 3A machine, I finished building all the packages from
> core-updates that I use in my profile, and then tried installing them.
> I got this:
>
> In /gnu/store/9sqx55rgygyrcyg350cfqwy8wqb4fr69-module-import/guix/build/union.scm:
>  226: 1 [loop # #]
> In unknown file:
>    ?: 0 [mkdir "/gnu/store/c30bsax58scw5qwcnbma16k6z88s1lh3-profile/./include" ...]
>
> ERROR: In procedure mkdir:
> ERROR: In procedure mkdir: File exists
> builder for `/gnu/store/17w6kggffh79drmmrdnxy1yhgr6p2in5-profile.drv' failed with exit code 1
>
> The problem turns out to be that 'libffi' makes 'include' a symlink to
> 'lib/libffi-3.0.13/include', and union.scm cannot cope with conflicts
> between a directory and a symlink.

Ouch, good catch.

I’ve come up with a test that reproduces it:

--8<---------------cut here---------------start------------->8---
(test-assert "union-build with symlink to directory"
  (let* ((builder '(begin
                     (use-modules (guix build union) (guix build utils)
                                  (srfi srfi-26))
                     (mkdir-p "one/foo")
                     (call-with-output-file "one/foo/one"
                       (cut display "one" <>))
                     (mkdir-p "two/bar")
                     (symlink "bar" "two/foo")
                     (call-with-output-file "two/foo/two"
                       (cut display "two" <>))

                     (union-build (assoc-ref %outputs "out") '("one" "two"))))
         (drv
          (build-expression->derivation %store "union-collision-symlink"
                                        builder
                                        #:modules '((guix build union)
                                                    (guix build utils)))))
    (and (build-derivations %store (list drv))
         (with-directory-excursion (derivation->output-path drv)
           (and (file-exists? "one/foo/one")
                (file-exists? "two/foo/two")
                (file-exists? "two/bar/two"))))))
--8<---------------cut here---------------end--------------->8---

Actually union.scm cannot handle collisions between a leaf and a
directory in general, which should be fixed.

I can think of these cases:

  1. If the leaf is a regular file, error out.

  2. If the leaf is a symlink:

     a. If it points to a directory, union the directories.

     b. Otherwise, error out.

Does that make sense?

Do you think you could come up with a patch?  Alternately we could apply
Sree’s proposed workaround as a stopgap measure.

Thanks,
Ludo’.

  parent reply	other threads:[~2014-03-24 14:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24  6:07 libffi cannot be installed in user profile in core-updates Mark H Weaver
2014-03-24  9:52 ` Sree Harsha Totakura
2014-03-24 13:15   ` Mark H Weaver
2014-03-24 14:15 ` Ludovic Courtès [this message]
2014-04-02 21:43   ` bug#17083: ‘union-build’ does not handle collisions between a leaf and a sub-tree Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87siq7y96h.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=17083@debbugs.gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).