]> wimlib.net Git - wimlib/commitdiff
tree-cmp without xattr
authorEric Biggers <ebiggers3@gmail.com>
Mon, 29 Oct 2012 00:01:24 +0000 (19:01 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 29 Oct 2012 00:01:24 +0000 (19:01 -0500)
config.h.in
configure.ac
src/extract.c
tests/common_tests.sh
tests/test-imagex
tests/test-imagex-capture_and_apply
tests/test-imagex-mount
tests/test-imagex-ntfs
tests/tree-cmp.c

index 72d81e681ad53e5bba7d3db36fb4a60d2dfe9f47..be7c1d6822ee60a4361cc354a80bdd361f68057f 100644 (file)
@@ -30,6 +30,9 @@
 /* Define to 1 if you have the <alloca.h> header file. */
 #undef HAVE_ALLOCA_H
 
+/* Define to 1 if you have the <attr/xattr.h> header file. */
+#undef HAVE_ATTR_XATTR_H
+
 /* Define to 1 if you have the <byteswap.h> header file. */
 #undef HAVE_BYTESWAP_H
 
index 6396002cd90d6e11a9654b26ca391579a0d47584..b76a5b0db56d52ccbd7ce646509b208bb5854b5b 100644 (file)
@@ -33,7 +33,7 @@ AM_PROG_CC_C_O
 AC_CHECK_FUNCS([utimensat])
 AC_CHECK_HEADERS([endian.h byteswap.h sys/byteorder.h sys/endian.h \
                  sys/param.h machine/endian.h alloca.h stdlib.h stdarg.h \
-                 errno.h])
+                 errno.h attr/xattr.h])
 
 
 AM_ICONV
index 14accdac3119c6d4241ca6d86b4c9a0934d4b69e..054984920de7188ea688dd3d075aadafaff3d62a 100644 (file)
@@ -280,6 +280,7 @@ struct extract_args {
        WIMStruct *w;
        int extract_flags;
        const char *output_dir;
+       unsigned num_lutimes_warnings;
 };
 
 /*
@@ -327,8 +328,11 @@ static int apply_dentry_timestamps(struct dentry *dentry, void *arg)
        wim_timestamp_to_timeval(dentry->d_inode->last_access_time, &tv[0]);
        wim_timestamp_to_timeval(dentry->d_inode->last_write_time, &tv[1]);
        if (lutimes(output_path, tv) != 0) {
-               WARNING("Failed to set timestamp on file `%s': %s",
-                       output_path, strerror(errno));
+               if (errno != ENOSYS || args->num_lutimes_warnings < 10) {
+                       WARNING("Failed to set timestamp on file `%s': %s",
+                               output_path, strerror(errno));
+                       args->num_lutimes_warnings++;
+               }
        }
        return 0;
 }
@@ -345,9 +349,10 @@ static int extract_single_image(WIMStruct *w, int image,
                return ret;
 
        struct extract_args args = {
-               .w = w,
-               .extract_flags = extract_flags,
-               .output_dir = output_dir,
+               .w                    = w,
+               .extract_flags        = extract_flags,
+               .output_dir           = output_dir,
+               .num_lutimes_warnings = 0,
        };
 
        ret = for_dentry_in_tree(wim_root_dentry(w), extract_dentry, &args);
index 6e585a8afbf1942a6c667122380d0cafeaa7224a..240f9a5714f014041cdd78626ec4e6629f01d663 100644 (file)
@@ -49,7 +49,7 @@ do_test 'echo 888 > file;
         echo 888 > file3'
 
 msg "C source code of wimlib"
-do_test 'cp $srcdir/src/*.{c,h} .'
+do_test 'cp ../$srcdir/src/*.{c,h} .'
 
 msg "tons of random stuff"
 do_test 'echo -n 8 > file;
index bd107e2158ee0fc51dc4c607505ee7f46df64944..85689e5deb44531c90147b3eb2656672f662dad4 100755 (executable)
@@ -4,9 +4,8 @@
 # tests every aspect of wimlib comprehensively.
 
 set -e
-srcdir=${srcdir:-.}
-srcdir=`realpath $srcdir`
 cd tests
+srcdir=..
 
 imagex() {
        echo "imagex $@"
index 08fe6f623c3b6bf4b0a7faaef4b6cb4b02021c6f..fcac5cee4a36096ca1b817f178a7a40eb66f76ed 100755 (executable)
@@ -9,9 +9,8 @@
 # Also, test if the capture configuration file works correctly.
 
 set -e
-srcdir=${srcdir:-.}
-srcdir=`realpath $srcdir`
 cd tests
+srcdir=..
 
 imagex() {
        echo "imagex $@"
index ee8501f195b0a8be15ffd41e6353d1f213c0d479..21702c0797214d45c84872a74697ea813d978191 100755 (executable)
@@ -3,9 +3,8 @@
 # Test WIM mounting
 
 set -e
-srcdir=${srcdir:-.}
-srcdir=`realpath $srcdir`
 cd tests
+srcdir=..
 
 imagex() {
        echo "imagex $@"
index 40c005cc9feccf943d2033d98454c9263e332c19..a129a70fcf7ea5e8439bf2771434788398fca6e2 100755 (executable)
@@ -9,9 +9,8 @@
 # remain mounted.
 
 set -e
-srcdir=${srcdir:-.}
-srcdir=`realpath $srcdir`
 cd tests
+srcdir=..
 
 imagex() {
        ../imagex $@ > /dev/null
index aed6ecb18358fb779bc833bcca91f7354f3c13e9..0b56d20eaf3cdeddf883c3f5b2b069fde8da57b7 100644 (file)
@@ -13,6 +13,9 @@
  * files are expected to be hard linked together in the other directory tree.
  */
 
+#include "config.h"
+
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -24,7 +27,9 @@
 #include <unistd.h>
 #include <stdbool.h>
 #include <sys/stat.h>
+#ifdef HAVE_ATTR_XATTR_H
 #include <attr/xattr.h>
+#endif
 #include <assert.h>
 
 typedef uint64_t u64;
@@ -160,6 +165,7 @@ static void cmp(const char *file1, const char *file2, size_t size)
        close(fd2);
 }
 
+#ifdef HAVE_ATTR_XATTR_H
 /* Compares an extended attribute of the files. */
 static void cmp_xattr(const char *file1, const char *file2,
                      const char *xattr_name, ssize_t max_size,
@@ -216,6 +222,9 @@ static void cmp_xattr(const char *file1, const char *file2,
        }
        free(buf1);
        free(buf2);
+       fprintf(stderr, "tree-cmp: Warning: cannot compare xattrs of `%s' and `%s'\n",
+                       file1, file2);
+       fprintf(stderr, "          You need to install the attr development files for this.\n");
 }
 
 /* Compares all alternate data streams of the files */
@@ -264,17 +273,24 @@ static void cmp_ads(const char *file1, const char *file2)
                free(list2);
        }
 }
+#endif
 
 /* Compares special NTFS data of the files, as accessed through extended
  * attributes. */
 static void special_cmp(const char *file1, const char *file2)
 {
+#ifdef HAVE_ATTR_XATTR_H
        cmp_xattr(file1, file2, "system.ntfs_acl", 0, false);
        cmp_xattr(file1, file2, "system.ntfs_attrib", 0, false);
        cmp_xattr(file1, file2, "system.ntfs_dos_name", 0, true);
        cmp_xattr(file1, file2, "system.ntfs_reparse_data", 0, true);
        cmp_xattr(file1, file2, "system.ntfs_times", 16, false);
        cmp_ads(file1, file2);
+#else
+       fprintf(stderr, "tree-cmp: Warning: cannot compare xattrs of `%s' and `%s'\n",
+                       file1, file2);
+       fprintf(stderr, "          You need to install the attr development files for this.\n");
+#endif
 }
 
 
@@ -302,6 +318,7 @@ static void tree_cmp(char file1[], int file1_len, char file2[], int file2_len)
        if (S_ISREG(st1.st_mode) && st1.st_size != st2.st_size)
                difference("Sizes of `%s' and `%s' are not the same",
                           file1, file2);
+#if 0
        if (ntfs_mode && st1.st_atime != st2.st_atime)
                difference("Access times of `%s' and `%s' are not the same",
                           file1, file2);
@@ -309,7 +326,6 @@ static void tree_cmp(char file1[], int file1_len, char file2[], int file2_len)
                difference("Modification times of `%s' (%x) and `%s' (%x) are "
                           "not the same",
                           file1, st1.st_mtime, file2, st2.st_mtime);
-#if 0
        if (st1.st_ctime != st2.st_ctime)
                difference("Status change times of `%s' and `%s' are not the same",
                           file1, file2);