]> wimlib.net Git - wimlib/commitdiff
Exclude unsupported files from capture
authorEric Biggers <ebiggers3@gmail.com>
Sat, 17 Aug 2013 18:03:04 +0000 (13:03 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 17 Aug 2013 18:03:04 +0000 (13:03 -0500)
include/wimlib.h
programs/imagex.c
src/ntfs-3g_capture.c
src/unix_capture.c
src/util.c
src/win32_capture.c

index 8ba217580067d014e4ea1331541c321649cd53d6..eb8a33ba27fe05f10b01afa5dc1baccf7874c00b 100644 (file)
@@ -421,9 +421,19 @@ union wimlib_progress_info {
                 * */
                const wimlib_tchar *cur_path;
 
                 * */
                const wimlib_tchar *cur_path;
 
-               /** True iff @p cur_path is being excluded from the image
-                * capture due to the capture configuration file. */
-               bool excluded;
+               enum {
+                       /** File or directory looks okay and will be captured.  */
+                       WIMLIB_SCAN_DENTRY_OK = 0,
+
+                       /** File or directory is being excluded from capture due
+                        * to the capture configuration file.  */
+                       WIMLIB_SCAN_DENTRY_EXCLUDED,
+
+                       /** File or directory is being excluded from capture due
+                        * to being unsupported (e.g. an encrypted or device
+                        * file).  */
+                       WIMLIB_SCAN_DENTRY_UNSUPPORTED,
+               } status;
 
                /** Target path in the WIM.  Only valid on messages
                 * ::WIMLIB_PROGRESS_MSG_SCAN_BEGIN and
 
                /** Target path in the WIM.  Only valid on messages
                 * ::WIMLIB_PROGRESS_MSG_SCAN_BEGIN and
@@ -1373,7 +1383,6 @@ enum wimlib_error_code {
        WIMLIB_ERR_SET_SECURITY,
        WIMLIB_ERR_SET_SHORT_NAME,
        WIMLIB_ERR_SET_TIMESTAMPS,
        WIMLIB_ERR_SET_SECURITY,
        WIMLIB_ERR_SET_SHORT_NAME,
        WIMLIB_ERR_SET_TIMESTAMPS,
-       WIMLIB_ERR_SPECIAL_FILE,
        WIMLIB_ERR_SPLIT_INVALID,
        WIMLIB_ERR_SPLIT_UNSUPPORTED,
        WIMLIB_ERR_STAT,
        WIMLIB_ERR_SPLIT_INVALID,
        WIMLIB_ERR_SPLIT_UNSUPPORTED,
        WIMLIB_ERR_STAT,
index 90b53dd6bd815165ca30cb6ede5ee4b29d400338..9f3939c38550e9afbe6e4bbdc8367a92ef3f5269 100644 (file)
@@ -1032,10 +1032,18 @@ imagex_progress_func(enum wimlib_progress_msg msg,
                }
                break;
        case WIMLIB_PROGRESS_MSG_SCAN_DENTRY:
                }
                break;
        case WIMLIB_PROGRESS_MSG_SCAN_DENTRY:
-               if (info->scan.excluded)
-                       imagex_printf(T("Excluding \"%"TS"\" from capture\n"), info->scan.cur_path);
-               else
+               switch (info->scan.status) {
+               case WIMLIB_SCAN_DENTRY_OK:
                        imagex_printf(T("Scanning \"%"TS"\"\n"), info->scan.cur_path);
                        imagex_printf(T("Scanning \"%"TS"\"\n"), info->scan.cur_path);
+                       break;
+               case WIMLIB_SCAN_DENTRY_EXCLUDED:
+                       imagex_printf(T("Excluding \"%"TS"\" from capture\n"), info->scan.cur_path);
+                       break;
+               case WIMLIB_SCAN_DENTRY_UNSUPPORTED:
+                       imagex_printf(T("WARNING: Excluding unsupported file or directory\n"
+                                       "         \"%"TS"\" from capture\n"), info->scan.cur_path);
+                       break;
+               }
                break;
        case WIMLIB_PROGRESS_MSG_VERIFY_INTEGRITY:
                unit_shift = get_unit(info->integrity.total_bytes, &unit_name);
                break;
        case WIMLIB_PROGRESS_MSG_VERIFY_INTEGRITY:
                unit_shift = get_unit(info->integrity.total_bytes, &unit_name);
index 10d4bcc5a02e709f68ac44aa3bf1083053932687..27c446a05b3a787c6c51ac2314fdef5cb93f5b61 100644 (file)
@@ -557,7 +557,7 @@ build_dentry_tree_ntfs_recursive(struct wim_dentry **root_ret,
                {
                        union wimlib_progress_info info;
                        info.scan.cur_path = path;
                {
                        union wimlib_progress_info info;
                        info.scan.cur_path = path;
-                       info.scan.excluded = true;
+                       info.scan.status = WIMLIB_SCAN_DENTRY_EXCLUDED;
                        params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
                }
                root = NULL;
                        params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
                }
                root = NULL;
@@ -572,12 +572,28 @@ build_dentry_tree_ntfs_recursive(struct wim_dentry **root_ret,
                return WIMLIB_ERR_NTFS_3G;
        }
 
                return WIMLIB_ERR_NTFS_3G;
        }
 
+       if ((attributes & (FILE_ATTRIBUTE_DIRECTORY |
+                          FILE_ATTRIBUTE_ENCRYPTED)) == FILE_ATTRIBUTE_ENCRYPTED)
+       {
+               if ((params->add_flags & WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE)
+                   && params->progress_func)
+               {
+                       union wimlib_progress_info info;
+                       info.scan.cur_path = path;
+                       info.scan.status = WIMLIB_SCAN_DENTRY_UNSUPPORTED;
+                       params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
+               }
+               root = NULL;
+               ret = 0;
+               goto out;
+       }
+
        if ((params->add_flags & WIMLIB_ADD_FLAG_VERBOSE)
            && params->progress_func)
        {
                union wimlib_progress_info info;
                info.scan.cur_path = path;
        if ((params->add_flags & WIMLIB_ADD_FLAG_VERBOSE)
            && params->progress_func)
        {
                union wimlib_progress_info info;
                info.scan.cur_path = path;
-               info.scan.excluded = false;
+               info.scan.status = WIMLIB_SCAN_DENTRY_OK;
                params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
        }
 
                params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
        }
 
index 906920a86144dc9549b58975e694691d6c8563ee..a080e8cb074cd1ac419c312ab991ef68ab7c51b9 100644 (file)
@@ -210,7 +210,7 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret,
                {
                        union wimlib_progress_info info;
                        info.scan.cur_path = path;
                {
                        union wimlib_progress_info info;
                        info.scan.cur_path = path;
-                       info.scan.excluded = true;
+                       info.scan.status = WIMLIB_SCAN_DENTRY_EXCLUDED;
                        params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
                }
                goto out;
                        params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
                }
                goto out;
@@ -221,7 +221,7 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret,
        {
                union wimlib_progress_info info;
                info.scan.cur_path = path;
        {
                union wimlib_progress_info info;
                info.scan.cur_path = path;
-               info.scan.excluded = false;
+               info.scan.status = WIMLIB_SCAN_DENTRY_OK;
                params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
        }
 
                params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
        }
 
@@ -241,9 +241,14 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret,
        }
        if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)
            && !S_ISLNK(stbuf.st_mode)) {
        }
        if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)
            && !S_ISLNK(stbuf.st_mode)) {
-               ERROR("`%s' is not a regular file, directory, or symbolic link.",
-                     path);
-               ret = WIMLIB_ERR_SPECIAL_FILE;
+               if ((params->add_flags & WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE)
+                   && params->progress_func)
+               {
+                       union wimlib_progress_info info;
+                       info.scan.cur_path = path;
+                       info.scan.status = WIMLIB_SCAN_DENTRY_UNSUPPORTED;
+                       params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
+               }
                goto out;
        }
 
                goto out;
        }
 
index 640f8b32ea1791dfd8db1f233cef4f584d971355..8cb5777d0a0e58a89954f0473b38844f7aa8eeb9 100644 (file)
@@ -390,8 +390,6 @@ static const tchar *error_strings[] = {
                = T("Failed to set short name on extracted file"),
        [WIMLIB_ERR_SET_TIMESTAMPS]
                = T("Failed to set timestamps on extracted file"),
                = T("Failed to set short name on extracted file"),
        [WIMLIB_ERR_SET_TIMESTAMPS]
                = T("Failed to set timestamps on extracted file"),
-       [WIMLIB_ERR_SPECIAL_FILE]
-               = T("Encountered a special file that cannot be archived"),
        [WIMLIB_ERR_SPLIT_INVALID]
                = T("The WIM is part of an invalid split WIM"),
        [WIMLIB_ERR_SPLIT_UNSUPPORTED]
        [WIMLIB_ERR_SPLIT_INVALID]
                = T("The WIM is part of an invalid split WIM"),
        [WIMLIB_ERR_SPLIT_UNSUPPORTED]
index 9b16796a5e4bb6f0ac6e0e9fde4f86bbf339f580..cf116399f0447bdb661745a2479a84ae5d02f668 100644 (file)
@@ -944,7 +944,7 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret,
                {
                        union wimlib_progress_info info;
                        info.scan.cur_path = path;
                {
                        union wimlib_progress_info info;
                        info.scan.cur_path = path;
-                       info.scan.excluded = true;
+                       info.scan.status = WIMLIB_SCAN_DENTRY_EXCLUDED;
                        params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
                }
                ret = 0;
                        params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
                }
                ret = 0;
@@ -968,7 +968,7 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret,
        {
                union wimlib_progress_info info;
                info.scan.cur_path = path;
        {
                union wimlib_progress_info info;
                info.scan.cur_path = path;
-               info.scan.excluded = false;
+               info.scan.status = WIMLIB_SCAN_DENTRY_OK;
                params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
        }
 
                params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
        }