verify_dentry(): Allow multiple DOS names per inode (for UDF)
authorEric Biggers <ebiggers3@gmail.com>
Tue, 21 May 2013 01:18:18 +0000 (20:18 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 21 May 2013 01:18:18 +0000 (20:18 -0500)
include/wimlib/dentry.h
src/ntfs-3g_apply.c
src/verify.c
src/win32_apply.c

index e515abe..3b0de79 100644 (file)
@@ -157,10 +157,13 @@ struct wim_dentry {
        /* Does this dentry need to be extracted? */
        u8 needs_extraction : 1;
 
+       u8 not_extracted : 1;
+
        /* Only used during NTFS capture */
        u8 is_win32_name : 1;
 
-       u8 not_extracted : 1;
+       /* Set to 1 if an inode has multiple DOS names. */
+       u8 dos_name_invalid : 1;
 
        /* Temporary list */
        struct list_head tmp_list;
index ffe3a8b..0de2bb0 100644 (file)
@@ -458,7 +458,8 @@ do_apply_dentry_ntfs(struct wim_dentry *dentry, ntfs_inode *dir_ni,
        }
 
        /* Set DOS (short) name if given */
-       if (dentry_has_short_name(dentry)) {
+       if (dentry_has_short_name(dentry) && !dentry->dos_name_invalid)
+       {
                char *short_name_mbs;
                size_t short_name_mbs_nbytes;
                ret = utf16le_to_tstr(dentry->short_name,
index 56e77ef..a4be1f8 100644 (file)
@@ -104,11 +104,19 @@ verify_inode(struct wim_inode *inode, const WIMStruct *w)
        inode_for_each_dentry(dentry, inode) {
                if (dentry_has_short_name(dentry)) {
                        if (dentry_with_dos_name) {
+                               /* This was previously an error, but if we
+                                * capture a WIM from UDF on Windows, hard links
+                                * are supported but DOS names are automatically
+                                * generated for all names for an inode.  */
+                       #if 0
                                ERROR("Hard-linked file has a DOS name at "
                                      "both `%"TS"' and `%"TS"'",
                                      dentry_full_path(dentry_with_dos_name),
                                      dentry_full_path(dentry));
                                return WIMLIB_ERR_INVALID_DENTRY;
+                       #else
+                               dentry->dos_name_invalid = 1;
+                       #endif
                        }
                        dentry_with_dos_name = dentry;
                }
index 972224e..f022e1d 100644 (file)
@@ -734,7 +734,7 @@ win32_finish_extract_stream(HANDLE h, const struct wim_dentry *dentry,
                                return ret;
                }
 
-               if (dentry_has_short_name(dentry))
+               if (dentry_has_short_name(dentry) && !dentry->dos_name_invalid)
                        SetFileShortNameW(h, dentry->short_name);
                else if (running_on_windows_7_or_later())
                        SetFileShortNameW(h, L"");