summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-14 10:51:19 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-11 17:36:33 +0200
commitee8601cac4b353e551b238f546a0e7e8fcdcd3be (patch)
treea4acbe3e7de2ff42a6d84986f6810b89516b1e85
parentc2b65dd197a1b2e14d517b0b5ff307b149538917 (diff)
downloadguix-ee8601cac4b353e551b238f546a0e7e8fcdcd3be.tar.gz
Improved error message when encountering unsupported file types
Fixes #269.
-rw-r--r--nix/libstore/local-store.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/nix/libstore/local-store.cc b/nix/libstore/local-store.cc
index ab5b60132e..2f5c0e178f 100644
--- a/nix/libstore/local-store.cc
+++ b/nix/libstore/local-store.cc
@@ -551,9 +551,9 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
     if (lstat(path.c_str(), &st))
         throw SysError(format("getting attributes of path `%1%'") % path);
 
-    /* Really make sure that the path is of a supported type.  This
-       has already been checked in dumpPath(). */
-    assert(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode));
+    /* Really make sure that the path is of a supported type. */
+    if (!(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode)))
+        throw Error(format("file ‘%1%’ has an unsupported type") % path);
 
     /* Fail if the file is not owned by the build user.  This prevents
        us from messing up the ownership/permissions of files