all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Thompson, David" <dthompson2@worcester.edu>
To: guix-devel <guix-devel@gnu.org>
Subject: [PATCH] build: Do not clobber existing files when bind mounting.
Date: Fri, 16 Oct 2015 14:36:05 -0400	[thread overview]
Message-ID: <CAJ=RwfYsgGHeX6VwT4kyyywst5uQj4wHxHkWdwQPic+5BMd4sQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 140 bytes --]

This really bit me while trying to wrap up the tests for 'guix
environment --container'.  Thanks to Ludovic for tracking this down!

- Dave

[-- Attachment #2: 0001-build-Do-not-clobber-existing-files-when-bind-mounti.patch --]
[-- Type: text/x-diff, Size: 1103 bytes --]

From 482a31152260f48d1e96ffe74a2b1a9898d5f09c Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Fri, 16 Oct 2015 14:00:00 -0400
Subject: [PATCH] build: Do not clobber existing files when bind mounting.

* gnu/build/file-systems.scm (mount-file-system): Do not touch
  'mount-point' if it already exists.
---
 gnu/build/file-systems.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 377bec2..df6d3da 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -347,7 +347,8 @@ run a file system check."
        ;; Create the mount point.  Most of the time this is a directory, but
        ;; in the case of a bind mount, a regular file may be needed.
        (if (and (= MS_BIND (logand flags MS_BIND))
-                (regular-file? source))
+                (regular-file? source)
+                (not (file-exists? mount-point)))
            (begin
              (mkdir-p (dirname mount-point))
              (call-with-output-file mount-point (const #t)))
-- 
2.5.0


             reply	other threads:[~2015-10-16 18:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16 18:36 Thompson, David [this message]
2015-10-17 13:36 ` [PATCH] build: Do not clobber existing files when bind mounting 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

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

  git send-email \
    --in-reply-to='CAJ=RwfYsgGHeX6VwT4kyyywst5uQj4wHxHkWdwQPic+5BMd4sQ@mail.gmail.com' \
    --to=dthompson2@worcester.edu \
    --cc=guix-devel@gnu.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.