]> wimlib.net Git - wimlib/blobdiff - src/extract.c
extract.c: recommend --unix-data mode when appropriate
[wimlib] / src / extract.c
index a39c1c02210815b503f9c29e81a1806eda1a114c..f59cffb55347acc014da0feb0aad58f42d2150b8 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2012-2016 Eric Biggers
+ * Copyright (C) 2012-2017 Eric Biggers
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -63,6 +63,7 @@
 #include "wimlib/unix_data.h"
 #include "wimlib/wim.h"
 #include "wimlib/win32.h" /* for realpath() equivalent */
+#include "wimlib/xattr.h"
 #include "wimlib/xml.h"
 
 #define WIMLIB_EXTRACT_FLAG_FROM_PIPE   0x80000000
@@ -1224,6 +1225,8 @@ inode_tally_features(const struct wim_inode *inode,
                features->unix_data++;
        if (inode_has_object_id(inode))
                features->object_ids++;
+       if (inode_has_linux_xattrs(inode))
+               features->linux_xattrs++;
 }
 
 /* Tally features necessary to extract a dentry and the corresponding inode.  */
@@ -1361,19 +1364,31 @@ do_feature_check(const struct wim_features *required_features,
                WARNING("Ignoring Windows NT security descriptors of %lu files",
                        required_features->security_descriptors);
 
-       /* UNIX data.  */
-       if ((extract_flags & WIMLIB_EXTRACT_FLAG_UNIX_DATA) &&
-           required_features->unix_data && !supported_features->unix_data)
+       /* Standard UNIX metadata */
+       if (required_features->unix_data &&
+           (!supported_features->unix_data ||
+            !(extract_flags & WIMLIB_EXTRACT_FLAG_UNIX_DATA)))
        {
-               ERROR("Extraction backend does not support UNIX data!");
-               return WIMLIB_ERR_UNSUPPORTED;
+               if (extract_flags & WIMLIB_EXTRACT_FLAG_UNIX_DATA) {
+                       ERROR("Requested UNIX metadata extraction, but "
+                             "extraction backend does not support it!");
+                       return WIMLIB_ERR_UNSUPPORTED;
+               }
+               WARNING("Ignoring UNIX metadata (uid/gid/mode/rdev) of %lu files%"TS,
+                       required_features->unix_data,
+                       (supported_features->unix_data ?
+                        T("\n          (use --unix-data mode to extract these)") : T("")));
        }
 
-       if (required_features->unix_data &&
-           !(extract_flags & WIMLIB_EXTRACT_FLAG_UNIX_DATA))
+       /* Linux-style extended attributes */
+       if (required_features->linux_xattrs &&
+           (!supported_features->linux_xattrs ||
+            !(extract_flags & WIMLIB_EXTRACT_FLAG_UNIX_DATA)))
        {
-               WARNING("Ignoring UNIX metadata of %lu files",
-                       required_features->unix_data);
+               WARNING("Ignoring Linux-style extended attributes of %lu files%"TS,
+                       required_features->linux_xattrs,
+                       (supported_features->linux_xattrs ?
+                        T("\n          (use --unix-data mode to extract these)") : T("")));
        }
 
        /* Object IDs.  */