]> wimlib.net Git - wimlib/commitdiff
Miscellaneous fixes and cleanups
authorEric Biggers <ebiggers3@gmail.com>
Thu, 15 Aug 2013 17:12:26 +0000 (12:12 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 15 Aug 2013 17:12:26 +0000 (12:12 -0500)
19 files changed:
Makefile.am
NEWS
doc/imagex.1.in
include/wimlib.h
include/wimlib/dentry.h
include/wimlib/file_io.h
include/wimlib/header.h
include/wimlib/lookup_table.h
programs/imagex.c
rpm/wimlib-without-fuse-or-ntfs-3g.spec [deleted file]
rpm/wimlib.spec [deleted file]
rpm/wimtools.spec [new file with mode: 0644]
src/extract.c
src/mount_image.c
src/ntfs-3g_apply.c
src/resource.c
src/unix_apply.c
src/wim.c
tests/test-imagex

index 4cf31bf9419a300f7eb66e73ba23fab98f5d6df9..6d24bdf1126ad022a72c2e2ed9dd8eb95f8cf1d4 100644 (file)
@@ -186,8 +186,8 @@ install-data-hook:
 
 uninstall-hook:
        if [ "@IMAGEX_PROGNAME@" != imagex ]; then              \
 
 uninstall-hook:
        if [ "@IMAGEX_PROGNAME@" != imagex ]; then              \
-               rm -f $(DESTDIR)$(bindir)/"@IMAGEX_PROGNAME@"   \
-               rm -f $(DESTDIR)$(bindir)/imagex                \
+               rm -f $(DESTDIR)$(bindir)/"@IMAGEX_PROGNAME@";  \
+               rm -f $(DESTDIR)$(bindir)/imagex;               \
        fi
        for cmd in $(imagex_cmds); do                           \
                rm -f $(DESTDIR)$(bindir)/wim$${cmd};           \
        fi
        for cmd in $(imagex_cmds); do                           \
                rm -f $(DESTDIR)$(bindir)/wim$${cmd};           \
diff --git a/NEWS b/NEWS
index 6175eb36d65f1f516b8552314d20b1f6da24013b..23b79dbca29614d7a0ff50e5d4d558e3aa3d4833 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,12 +1,13 @@
 Only the most important changes more recent than version 0.6 are noted here.
 
 Version 1.5.0:
 Only the most important changes more recent than version 0.6 are noted here.
 
 Version 1.5.0:
-       Added support for "pipable" WIMs.  This support allows capturing images
-       to standard output or applying images from standard input, but they are
+       Added support for "pipable" WIMs.  Pipable WIMs allow capturing images
+       to standard output and applying images from standard input, but they are
        not compatible with Microsoft's software and are not created by default.
        not compatible with Microsoft's software and are not created by default.
-       See documentation for --pipable flag of `wimlib-imagex capture' for more
-       information.  Two new functions have been added to the library to fully
-       support this: wimlib_write_to_fd() and wimlib_extract_image_from_pipe().
+       See the documentation for --pipable flag of `wimlib-imagex capture' for
+       more information.  Two new functions have been added to the library to
+       fully support this: wimlib_write_to_fd() and
+       wimlib_extract_image_from_pipe().
 
        wimlib now preserve WIM integrity tables by default, even if
        WIMLIB_WRITE_FLAG_CHECK_INTEGRITY is not specified.  This changes the
 
        wimlib now preserve WIM integrity tables by default, even if
        WIMLIB_WRITE_FLAG_CHECK_INTEGRITY is not specified.  This changes the
@@ -44,6 +45,12 @@ Version 1.5.0:
        and NTFS-3g).  For example, hard-linked extraction mode (--hardlink) is
        now supported on all backends, not just UNIX.
 
        and NTFS-3g).  For example, hard-linked extraction mode (--hardlink) is
        now supported on all backends, not just UNIX.
 
+       The LZX compression and decompression code now compiles correctly on the
+       ARM architecture (where 'char' is unsigned).
+
+       wimlib_split() progress messages now report the total number of parts
+       being written.
+
        A few changes were made to the error codes returned by library routines.
 
        To make wimlib easier to use on Windows, wimlib_global_init() now
        A few changes were made to the error codes returned by library routines.
 
        To make wimlib easier to use on Windows, wimlib_global_init() now
index fc0edd28ebde1ebc5c0af89c556066a6f5004b80..7d4c9afca047a5dfcb56d0d6244d5bf4bd73d143 100644 (file)
@@ -51,31 +51,31 @@ or if you invoke it incorrectly, the full documentation for each
 \fB@IMAGEX_PROGNAME@\fR command can be found in the appropriate manual page.
 .PP
 Note: to save typing, if appropriate hard links or batch files have been
 \fB@IMAGEX_PROGNAME@\fR command can be found in the appropriate manual page.
 .PP
 Note: to save typing, if appropriate hard links or batch files have been
-installed, a command \fB@IMAGEX_PROGNAME@ \fICOMMAND\fR can be accessed as
+installed, a command \fB@IMAGEX_PROGNAME@ \fICOMMAND\fR can also be accessed as
 simply \fBwim\fICOMMAND\fR; for example, \fBwimapply\fR for \fB@IMAGEX_PROGNAME@
 apply\fR.
 .SH SUPPORTED FEATURES
 The following are some of the main features currently supported by
 \fB@IMAGEX_PROGNAME@\fR, and pointers to the relevant commands:
 .IP \[bu] 4
 simply \fBwim\fICOMMAND\fR; for example, \fBwimapply\fR for \fB@IMAGEX_PROGNAME@
 apply\fR.
 .SH SUPPORTED FEATURES
 The following are some of the main features currently supported by
 \fB@IMAGEX_PROGNAME@\fR, and pointers to the relevant commands:
 .IP \[bu] 4
-Create a stand-alone WIM from a directory or NTFS volume (\fB@IMAGEX_PROGNAME@ capture\fR)
+Create a standalone WIM from a directory or NTFS volume (\fB@IMAGEX_PROGNAME@ capture\fR)
 .IP \[bu]
 Capture a WIM image directly to standard output in a special pipable format
 (\fB@IMAGEX_PROGNAME@ capture\fR)
 .IP \[bu]
 .IP \[bu]
 Capture a WIM image directly to standard output in a special pipable format
 (\fB@IMAGEX_PROGNAME@ capture\fR)
 .IP \[bu]
-Append a directory or NTFS volume onto a stand-alone WIM as a new image (\fB@IMAGEX_PROGNAME@
+Append a directory or NTFS volume onto a standalone WIM as a new image (\fB@IMAGEX_PROGNAME@
 append\fR)
 .IP \[bu]
 append\fR)
 .IP \[bu]
-Apply an image from a stand-alone or split WIM to a directory or NTFS volume
+Apply an image from a standalone or split WIM to a directory or NTFS volume
 (\fB@IMAGEX_PROGNAME@ apply\fR)
 .IP \[bu]
 Apply an image from a special pipable WIM format sent over standard input
 (\fB@IMAGEX_PROGNAME@ apply\fR)
 .IP \[bu]
 (\fB@IMAGEX_PROGNAME@ apply\fR)
 .IP \[bu]
 Apply an image from a special pipable WIM format sent over standard input
 (\fB@IMAGEX_PROGNAME@ apply\fR)
 .IP \[bu]
-Mount an image from a stand-alone or split WIM read-only (\fB@IMAGEX_PROGNAME@
+Mount an image from a standalone or split WIM read-only (\fB@IMAGEX_PROGNAME@
 mount\fR) (not available on Windows)
 .IP \[bu]
 mount\fR) (not available on Windows)
 .IP \[bu]
-Mount an image from a stand-alone WIM read-write (\fB@IMAGEX_PROGNAME@
+Mount an image from a standalone WIM read-write (\fB@IMAGEX_PROGNAME@
 mountrw\fR) (not available on Windows)
 .IP \[bu]
 Extract individual files or directories from a WIM without mounting it
 mountrw\fR) (not available on Windows)
 .IP \[bu]
 Extract individual files or directories from a WIM without mounting it
@@ -83,9 +83,9 @@ Extract individual files or directories from a WIM without mounting it
 .IP \[bu]
 Make changes to a WIM image without mounting it (\fB@IMAGEX_PROGNAME@ update\fR)
 .IP \[bu]
 .IP \[bu]
 Make changes to a WIM image without mounting it (\fB@IMAGEX_PROGNAME@ update\fR)
 .IP \[bu]
-Delete image(s) from a stand-alone WIM (\fB@IMAGEX_PROGNAME@ delete\fR)
+Delete image(s) from a standalone WIM (\fB@IMAGEX_PROGNAME@ delete\fR)
 .IP \[bu]
 .IP \[bu]
-Export image(s) from a stand-alone or split WIM (\fB@IMAGEX_PROGNAME@ export\fR)
+Export image(s) from a standalone or split WIM (\fB@IMAGEX_PROGNAME@ export\fR)
 .IP \[bu]
 Display information about a WIM file (\fB@IMAGEX_PROGNAME@ info\fR, \fB@IMAGEX_PROGNAME@ dir\fR)
 .IP \[bu]
 .IP \[bu]
 Display information about a WIM file (\fB@IMAGEX_PROGNAME@ info\fR, \fB@IMAGEX_PROGNAME@ dir\fR)
 .IP \[bu]
@@ -93,9 +93,9 @@ Change the name or description of an image in the WIM (\fB@IMAGEX_PROGNAME@ info
 .IP \[bu]
 Change which image in a WIM is bootable (\fB@IMAGEX_PROGNAME@ info\fR)
 .IP \[bu]
 .IP \[bu]
 Change which image in a WIM is bootable (\fB@IMAGEX_PROGNAME@ info\fR)
 .IP \[bu]
-Combine split WIMs into one stand-alone WIM (\fB@IMAGEX_PROGNAME@ join\fR)
+Combine split WIMs into one standalone WIM (\fB@IMAGEX_PROGNAME@ join\fR)
 .IP \[bu]
 .IP \[bu]
-Split a stand-alone WIM into multiple parts (\fB@IMAGEX_PROGNAME@ split\fR)
+Split a standalone WIM into multiple parts (\fB@IMAGEX_PROGNAME@ split\fR)
 .IP \[bu]
 Support for all WIM compression types, both compression and decompression (LZX,
 XPRESS, and none)
 .IP \[bu]
 Support for all WIM compression types, both compression and decompression (LZX,
 XPRESS, and none)
index af167428bde155541d3fcbfaba720afc85818756..a7e068aee74f09149bbf3d58d15d062ec42ea260 100644 (file)
@@ -1856,10 +1856,9 @@ wimlib_extract_files(WIMStruct *wim,
  *     Failed to set security descriptor on a file
  *     (only if ::WIMLIB_EXTRACT_FLAG_STRICT_ACLS) specified in @p
  *     extract_flags.
  *     Failed to set security descriptor on a file
  *     (only if ::WIMLIB_EXTRACT_FLAG_STRICT_ACLS) specified in @p
  *     extract_flags.
- * @retval ::WIMLIB_ERR_SET_SECURITY
- *     Failed to set security descriptor on a file
- *     (only if ::WIMLIB_EXTRACT_FLAG_STRICT_ACLS) specified in @p
- *     extract_flags.
+ * @retval ::WIMLIB_ERR_SET_TIMESTAMPS
+ *     Failed to set timestamps on a file (only if
+ *     ::WIMLIB_EXTRACT_FLAG_STRICT_TIMESTAMPS) specified in @p extract_flags.
  * @retval ::WIMLIB_ERR_SPLIT_INVALID
  *     The WIM is a split WIM, but the parts specified do not form a complete
  *     split WIM because they do not include all the parts of the original WIM,
  * @retval ::WIMLIB_ERR_SPLIT_INVALID
  *     The WIM is a split WIM, but the parts specified do not form a complete
  *     split WIM because they do not include all the parts of the original WIM,
index 6d8c557ee0b1bb7a752f1c922780ff50738152b7..ad8b03286dc6473da9391b065eaa57e4acb4697b 100644 (file)
@@ -575,7 +575,7 @@ inode_get_unix_data(const struct wim_inode *inode,
 extern int
 inode_set_unix_data(struct wim_inode *inode, uid_t uid, gid_t gid, mode_t mode,
                    struct wim_lookup_table *lookup_table, int which);
 extern int
 inode_set_unix_data(struct wim_inode *inode, uid_t uid, gid_t gid, mode_t mode,
                    struct wim_lookup_table *lookup_table, int which);
-#endif /* __WIN32__ */
+#endif /* !__WIN32__ */
 
 extern bool
 inode_has_unix_data(const struct wim_inode *inode);
 
 extern bool
 inode_has_unix_data(const struct wim_inode *inode);
index de59cfa07d8b9be48d0a1efcb123c1b5f1723c91..85f293f13a1023e6c21dcf639880b91dbe3353ce 100644 (file)
@@ -4,6 +4,9 @@
 #include <stddef.h>
 #include <sys/types.h>
 
 #include <stddef.h>
 #include <sys/types.h>
 
+/* Wrapper around a file descriptor that keeps track of offset (including in
+ * pipes, which don't support lseek()) and a cached flag that tells whether the
+ * file descriptor is a pipe or not.  */
 struct filedes {
        int fd;
        unsigned int is_pipe : 1;
 struct filedes {
        int fd;
        unsigned int is_pipe : 1;
index 238b6b22122858bd3ba8fe2870484b6062089c5e..637a4fef9f807f40a1c21dd63a05e36d950cd78e 100644 (file)
@@ -16,8 +16,9 @@
  * compatibility with Microsoft's software is desired).  */
 #define WIM_CHUNK_SIZE 32768
 
  * compatibility with Microsoft's software is desired).  */
 #define WIM_CHUNK_SIZE 32768
 
-/* Version of the WIM file.  There is an older version, but wimlib doesn't
- * support it.  The differences between the versions are undocumented.  */
+/* Version of the WIM file.  There is an older version (used for prerelease
+ * versions of Windows Vista), but wimlib doesn't support it.  The differences
+ * between the versions are undocumented.  */
 #define WIM_VERSION 0x10d00
 
 /* WIM magic characters, translated to a single 64-bit little endian number.  */
 #define WIM_VERSION 0x10d00
 
 /* WIM magic characters, translated to a single 64-bit little endian number.  */
index e9532971748f96717d8086c7c710c293da7a6e6a..28862d5a3b9b753ea53e88c87881f923bfe38782 100644 (file)
@@ -237,6 +237,9 @@ struct wim_lookup_table_entry {
                /* Used temporarily during WIM file writing  */
                struct {
                        struct hlist_node hash_list_2;
                /* Used temporarily during WIM file writing  */
                struct {
                        struct hlist_node hash_list_2;
+
+                       /* Links streams being written to the WIM.  */
+                       struct list_head write_streams_list;
                };
 
                /* Used temporarily during WIM file writing (after above)  */
                };
 
                /* Used temporarily during WIM file writing (after above)  */
@@ -281,9 +284,6 @@ struct wim_lookup_table_entry {
        /* Links streams that are still unhashed after being been added
         * to a WIM.  */
        struct list_head unhashed_list;
        /* Links streams that are still unhashed after being been added
         * to a WIM.  */
        struct list_head unhashed_list;
-
-       /* Links streams being written to the WIM.  */
-       struct list_head write_streams_list;
 };
 
 static inline u64
 };
 
 static inline u64
index c97f2d73acdbbd98652176a5dae60777fd9de022..e99202b1effdbf659a43b4b38096844bfeca8570 100644 (file)
@@ -3562,9 +3562,9 @@ static const tchar *get_cmd_string(int cmd, bool nospace)
 static void
 version(void)
 {
 static void
 version(void)
 {
-       static const tchar *format =
+       static const tchar *s =
        T(
        T(
-"%"TS" (" PACKAGE ") " PACKAGE_VERSION "\n"
+IMAGEX_PROGNAME " (" PACKAGE ") " PACKAGE_VERSION "\n"
 "Copyright (C) 2012, 2013 Eric Biggers\n"
 "License GPLv3+; GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n"
 "This is free software: you are free to change and redistribute it.\n"
 "Copyright (C) 2012, 2013 Eric Biggers\n"
 "License GPLv3+; GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n"
 "This is free software: you are free to change and redistribute it.\n"
@@ -3572,7 +3572,7 @@ version(void)
 "\n"
 "Report bugs to "PACKAGE_BUGREPORT".\n"
        );
 "\n"
 "Report bugs to "PACKAGE_BUGREPORT".\n"
        );
-       tprintf(format, invocation_name);
+       tfputs(s, stdout);
 }
 
 
 }
 
 
diff --git a/rpm/wimlib-without-fuse-or-ntfs-3g.spec b/rpm/wimlib-without-fuse-or-ntfs-3g.spec
deleted file mode 100644 (file)
index 81761f9..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-Summary:   Library to extract, create, modify, and mount WIM files
-Name:      wimlib
-Version:   1.5.0
-Release:   1
-License:   GPLv3+
-Group:     System/Libraries
-URL:       http://sourceforge.net/projects/wimlib
-Packager:  Eric Biggers <ebiggers3@gmail.com>
-Source:    http://downloads.sourceforge.net/wimlib/wimlib-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-
-Requires: libxml2, openssl
-BuildRequires: libxml2-devel, openssl-devel
-%description
-wimlib is a C library for creating, extracting, modifying, and mounting files in
-the Windows Imaging Format (WIM files).  It is similar to Microsoft's WIMGAPI
-but is designed for both UNIX and Windows.
-
-%package devel
-Summary:  Development files for wimlib
-Group:    Development/Libraries
-Requires: %{name} = %{version}-%{release}
-%description devel
-Development files for wimlib
-
-%package -n wimtools
-Summary: Tools to create, extract, modify, and mount WIM files
-Group:    Applications/System
-Requires: %{name} = %{version}-%{release}
-%description -n wimtools
-Tools to create, extract, modify, and mount files in the Windows Imaging Format
-(WIM files).  These files are normally created by using the `imagex.exe' utility
-on Windows, but this package contains a free implementation of ImageX called
-"wimlib-imagex" that is designed to work on both UNIX and Windows.
-
-%prep
-%setup -q -n %{name}-%{version}
-
-%build
-%configure --prefix=/usr               \
-           --disable-rpath             \
-          --with-libcrypto             \
-          --without-ntfs-3g            \
-          --without-fuse               \
-          --disable-xattr
-make %{?_smp_mflags}
-
-%check
-make check
-
-%install
-rm -rf %{buildroot}
-make DESTDIR=%{buildroot} install
-
-%clean
-rm -rf %{buildroot}
-
-%post -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
-
-%files
-%defattr(-, root, root)
-%doc AUTHORS COPYING README
-%{_libdir}/libwim.so.*
-
-%files -n wimtools
-%defattr(-, root, root)
-%{_bindir}/wimlib-imagex
-%{_bindir}/mkwinpeimg
-%doc %{_mandir}/man1/*.1.gz
-
-%files devel
-%defattr(-, root, root)
-%{_libdir}/libwim.a
-%{_libdir}/libwim.so
-%exclude %{_libdir}/libwim.la
-%{_includedir}/wimlib.h
-%{_libdir}/pkgconfig/wimlib.pc
diff --git a/rpm/wimlib.spec b/rpm/wimlib.spec
deleted file mode 100644 (file)
index 7ea2f06..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-Summary:   Library to extract, create, modify, and mount WIM files
-Name:      wimlib
-Version:   1.5.0
-Release:   1
-License:   GPLv3+
-Group:     System/Libraries
-URL:       http://sourceforge.net/projects/wimlib
-Packager:  Eric Biggers <ebiggers3@gmail.com>
-Source:    http://downloads.sourceforge.net/wimlib/wimlib-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-
-Requires: libxml2, fuse-libs, fuse, openssl
-Requires: ntfs-3g >= 2:2011.4.12
-BuildRequires: libxml2-devel, fuse, fuse-devel, openssl-devel, libattr-devel
-BuildRequires: ntfs-3g-devel >= 2:2011.4.12, ntfsprogs
-%description
-wimlib is a C library for creating, extracting, modifying, and mounting files in
-the Windows Imaging Format (WIM files).  It is similar to Microsoft's WIMGAPI
-but is designed for both UNIX and Windows.
-
-%package devel
-Summary:  Development files for wimlib
-Group:    Development/Libraries
-Requires: %{name} = %{version}-%{release}
-%description devel
-Development files for wimlib
-
-%package -n wimtools
-Summary: Tools to create, extract, modify, and mount WIM files
-Group:    Applications/System
-Requires: %{name} = %{version}-%{release}
-%description -n wimtools
-Tools to create, extract, modify, and mount files in the Windows Imaging Format
-(WIM files).  These files are normally created by using the `imagex.exe' utility
-on Windows, but this package contains a free implementation of ImageX called
-"wimlib-imagex" that is designed to work on both UNIX and Windows.
-
-%prep
-%setup -q -n %{name}-%{version}
-
-%build
-%configure --prefix=/usr               \
-           --disable-rpath             \
-          --with-libcrypto             \
-          --with-ntfs-3g               \
-          --with-fuse                  \
-          --enable-xattr
-make %{?_smp_mflags}
-
-%check
-make check
-
-%install
-rm -rf %{buildroot}
-make DESTDIR=%{buildroot} install
-
-%clean
-rm -rf %{buildroot}
-
-%post -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
-
-%files
-%defattr(-, root, root)
-%doc AUTHORS COPYING README
-%{_libdir}/libwim.so.*
-
-%files -n wimtools
-%defattr(-, root, root)
-%{_bindir}/wimlib-imagex
-%{_bindir}/mkwinpeimg
-%doc %{_mandir}/man1/*.1.gz
-
-%files devel
-%defattr(-, root, root)
-%{_libdir}/libwim.a
-%{_libdir}/libwim.so
-%exclude %{_libdir}/libwim.la
-%{_includedir}/wimlib.h
-%{_libdir}/pkgconfig/wimlib.pc
diff --git a/rpm/wimtools.spec b/rpm/wimtools.spec
new file mode 100644 (file)
index 0000000..d457f9a
--- /dev/null
@@ -0,0 +1,98 @@
+Summary:   Library to extract, create, modify, and mount WIM files
+Name:      wimtools
+Version:   1.5.0
+Release:   1
+License:   GPLv3+
+URL:       http://sourceforge.net/projects/wimlib
+Packager:  Eric Biggers <ebiggers3@gmail.com>
+Source:    http://downloads.sourceforge.net/wimlib/wimlib-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+Requires: libxml2, libfuse2, fuse, openssl
+Requires: ntfs-3g
+BuildRequires: libxml2-devel, fuse, fuse-devel, openssl-devel, libattr-devel
+BuildRequires: ntfs-3g-devel, ntfsprogs, libtool, pkg-config
+
+Summary: Tools to create, extract, modify, and mount WIM files
+Group:    Applications/System
+Requires: libwim9
+%description
+Tools to extract, create, modify, and mount WIM (Windows Imaging) files.  WIM is
+an archive format designed primarily for archiving Windows filesystems.  It
+features single-instancing and LZ77-based compression and is used by Microsoft
+to distribute and deploy Windows Vista and later.  WIM files are normally
+created by using the `imagex.exe' utility on Windows, but this package contains
+a free implementation of ImageX called "wimlib-imagex" that is designed to work
+on both UNIX and Windows.
+
+In addition to the usual extract/create/update support, wimlib-imagex allows you
+to mount WIM images readonly or read-write, and it even allows you to extract or
+create a WIM image directly to/from an unmounted NTFS volume.  This makes it
+possible to, from Linux, back up or deploy a Windows OS directly to or from a
+WIM file, such as the install.wim distributed on the Windows installation media.
+
+This package also contains a script to make a customized Windows PE image based
+on the capabilities provided by wimlib-imagex.
+
+%package devel
+Summary:  Development files for wimlib
+Group:     System/Libraries
+%description devel
+Development files for wimlib
+
+%package -n libwim9
+Summary:   Library to extract, create, modify, and mount WIM files
+Group:    Development/Libraries
+%description -n libwim9
+wimlib is a C library for extracting, creating, modifying, and mounting WIM
+(Windows Imaging) files.  WIM is an archive format designed primarily for
+archiving Windows filesystems.  It features single-instancing and LZ77-based
+compression, and is used by Microsoft to distribute and deploy Windows Vista and
+later.  wimlib is an independent implementation of an API for handling WIM
+files, available on both UNIX and Windows, that provides features similar to
+Microsoft's WIMGAPI, as well as additional features such as support for pipable
+WIM files and programatically making changes to WIM images without mounting
+them.
+%post -n libwim9 -p /sbin/ldconfig
+%postun -n libwim9 -p /sbin/ldconfig
+
+%prep
+%setup -q -n wimlib-%{version}
+
+%build
+autoreconf -i -f
+%configure --prefix=/usr               \
+           --disable-rpath             \
+          --with-libcrypto             \
+          --with-ntfs-3g               \
+          --with-fuse                  \
+          --enable-xattr
+make %{?_smp_mflags}
+
+%install
+rm -rf %{buildroot}
+make DESTDIR=%{buildroot} install
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-, root, root)
+%{_bindir}/*
+%doc %{_mandir}/man1/*.1.gz
+%doc %{_mandir}/man1/*.1
+
+%files devel
+%defattr(-, root, root)
+%{_libdir}/libwim.a
+%{_libdir}/libwim.so
+%exclude %{_libdir}/libwim.la
+%{_includedir}/wimlib.h
+%{_libdir}/pkgconfig/wimlib.pc
+%doc AUTHORS COPYING README
+
+%files -n libwim9
+%defattr(-, root, root)
+%{_libdir}/libwim.so.*
+
index 092c8c4033a26659ee270ddf406d5d63d328bd1a..b96367b6a1d934ef879584ee9e53878f46ce2d81 100644 (file)
@@ -1203,8 +1203,7 @@ extract_stream_list(struct apply_ctx *ctx)
        bool can_seek;
        int ret;
 
        bool can_seek;
        int ret;
 
-       can_seek = !(lseek(ctx->wim->in_fd.fd, 0, SEEK_CUR) == (off_t)-1 &&
-                    errno == ESPIPE);
+       can_seek = (lseek(ctx->wim->in_fd.fd, 0, SEEK_CUR) != -1);
        list_for_each_entry(lte, &ctx->stream_list, extraction_list) {
                ret = extract_stream_instances(lte, ctx, can_seek);
                if (ret)
        list_for_each_entry(lte, &ctx->stream_list, extraction_list) {
                ret = extract_stream_instances(lte, ctx, can_seek);
                if (ret)
@@ -2022,8 +2021,7 @@ extract_tree(WIMStruct *wim, const tchar *wim_source_path, const tchar *target,
         * output.  In that case, "root" should be a single file, not a
         * directory tree.  (If not, extract_dentry_to_stdout() will
         * return an error.)  */
         * output.  In that case, "root" should be a single file, not a
         * directory tree.  (If not, extract_dentry_to_stdout() will
         * return an error.)  */
-       if (extract_flags & WIMLIB_EXTRACT_FLAG_TO_STDOUT &&
-           !(extract_flags & WIMLIB_EXTRACT_FLAG_FROM_PIPE)) {
+       if (extract_flags & WIMLIB_EXTRACT_FLAG_TO_STDOUT) {
                ret = extract_dentry_to_stdout(root);
                goto out_teardown_stream_list;
        }
                ret = extract_dentry_to_stdout(root);
                goto out_teardown_stream_list;
        }
@@ -2276,8 +2274,7 @@ do_wimlib_extract_files(WIMStruct *wim,
                return ret;
 
        /* Make sure there are no streams in the WIM that have not been
                return ret;
 
        /* Make sure there are no streams in the WIM that have not been
-        * checksummed yet.  Needed at least because 'unhashed_list' aliases
-        * 'extraction_list' in `struct wim_lookup_table_entry'.  */
+        * checksummed yet.  */
        ret = wim_checksum_unhashed_streams(wim);
        if (ret)
                return ret;
        ret = wim_checksum_unhashed_streams(wim);
        if (ret)
                return ret;
@@ -2461,12 +2458,10 @@ extract_all_images(WIMStruct *wim,
 
        extract_flags |= WIMLIB_EXTRACT_FLAG_MULTI_IMAGE;
 
 
        extract_flags |= WIMLIB_EXTRACT_FLAG_MULTI_IMAGE;
 
-#ifdef WITH_NTFS_3G
        if (extract_flags & WIMLIB_EXTRACT_FLAG_NTFS) {
                ERROR("Cannot extract multiple images in NTFS extraction mode.");
                return WIMLIB_ERR_INVALID_PARAM;
        }
        if (extract_flags & WIMLIB_EXTRACT_FLAG_NTFS) {
                ERROR("Cannot extract multiple images in NTFS extraction mode.");
                return WIMLIB_ERR_INVALID_PARAM;
        }
-#endif
 
        if (tstat(target, &stbuf)) {
                if (errno == ENOENT) {
 
        if (tstat(target, &stbuf)) {
                if (errno == ENOENT) {
index d54fd23671389adc861dc4db9e5309e0371e5bd3..12b193e3ad1081f6ba2f73bfbd9f12e8b1004361 100644 (file)
@@ -567,7 +567,8 @@ extract_resource_to_staging_dir(struct wim_inode *inode,
 
        /* Extract the stream to the staging file (possibly truncated) */
        if (old_lte) {
 
        /* Extract the stream to the staging file (possibly truncated) */
        if (old_lte) {
-               struct filedes wimlib_fd = {.fd = fd};
+               struct filedes wimlib_fd;
+               filedes_init(&wimlib_fd, fd);
                extract_size = min(wim_resource_size(old_lte), size);
                ret = extract_wim_resource_to_fd(old_lte, &wimlib_fd,
                                                 extract_size);
                extract_size = min(wim_resource_size(old_lte), size);
                ret = extract_wim_resource_to_fd(old_lte, &wimlib_fd,
                                                 extract_size);
@@ -1667,9 +1668,12 @@ wimfs_getxattr(const char *path, const char *name, char *value,
                return -ERANGE;
 
        ret = read_full_resource_into_buf(lte, value);
                return -ERANGE;
 
        ret = read_full_resource_into_buf(lte, value);
-       if (ret)
-               return -errno;
-
+       if (ret) {
+               if (errno)
+                       return -errno;
+               else
+                       return -EIO;
+       }
        return res_size;
 }
 #endif
        return res_size;
 }
 #endif
@@ -2192,7 +2196,7 @@ wimfs_truncate(const char *path, off_t size)
        if (lte == NULL && size == 0)
                return 0;
 
        if (lte == NULL && size == 0)
                return 0;
 
-       if (lte->resource_location == RESOURCE_IN_STAGING_FILE) {
+       if (lte != NULL && lte->resource_location == RESOURCE_IN_STAGING_FILE) {
                ret = truncate(lte->staging_file_name, size);
                if (ret)
                        ret = -errno;
                ret = truncate(lte->staging_file_name, size);
                if (ret)
                        ret = -errno;
index 39509fc1d5157f5ae338237d6864596c28b33177..b8aabe866e3c2f68d9fc284553e7d89c4065c9fa 100644 (file)
 #include <ntfs-3g/security.h>
 #include <errno.h>
 
 #include <ntfs-3g/security.h>
 #include <errno.h>
 
+#ifdef HAVE_ALLOCA_H
+#  include <alloca.h>
+#else
+#  include <stdlib.h>
+#endif
+
 #include "wimlib/apply.h"
 #include "wimlib/encoding.h"
 #include "wimlib/error.h"
 #include "wimlib/apply.h"
 #include "wimlib/encoding.h"
 #include "wimlib/error.h"
@@ -86,18 +92,13 @@ ntfs_3g_extract_wim_chunk(const void *buf, size_t len, void *_ctx)
 static ntfs_inode *
 ntfs_3g_open_parent_inode(const char *path, ntfs_volume *vol)
 {
 static ntfs_inode *
 ntfs_3g_open_parent_inode(const char *path, ntfs_volume *vol)
 {
-       char orig, *p;
+       char *p;
        ntfs_inode *dir_ni;
 
        ntfs_inode *dir_ni;
 
-       p = strchr(path, '\0');
-       do {
-               p--;
-       } while (*p != '/');
-
-       orig = *p;
+       p = strrchr(path, '/');
        *p = '\0';
        dir_ni = ntfs_pathname_to_inode(vol, NULL, path);
        *p = '\0';
        dir_ni = ntfs_pathname_to_inode(vol, NULL, path);
-       *p = orig;
+       *p = '/';
        return dir_ni;
 }
 
        return dir_ni;
 }
 
@@ -177,7 +178,6 @@ ntfs_3g_create_hardlink(const char *oldpath, const char *newpath,
                              &name_utf16le, &name_utf16le_nbytes);
        if (ret)
                goto out_close_dir_ni;
                              &name_utf16le, &name_utf16le_nbytes);
        if (ret)
                goto out_close_dir_ni;
-
        ret = 0;
        if (ntfs_link(ni, dir_ni, name_utf16le, name_utf16le_nbytes / 2))
                ret = WIMLIB_ERR_NTFS_3G;
        ret = 0;
        if (ntfs_link(ni, dir_ni, name_utf16le, name_utf16le_nbytes / 2))
                ret = WIMLIB_ERR_NTFS_3G;
@@ -196,7 +196,7 @@ out:
  * Extract a stream (default or alternate data) to an attribute of a NTFS file.
  */
 static int
  * Extract a stream (default or alternate data) to an attribute of a NTFS file.
  */
 static int
-ntfs_3g_extract_stream(const char *path, const utf16lechar *stream_name,
+ntfs_3g_extract_stream(const char *path, const utf16lechar *raw_stream_name,
                       size_t stream_name_nchars,
                       struct wim_lookup_table_entry *lte, struct apply_ctx *ctx)
 {
                       size_t stream_name_nchars,
                       struct wim_lookup_table_entry *lte, struct apply_ctx *ctx)
 {
@@ -204,11 +204,16 @@ ntfs_3g_extract_stream(const char *path, const utf16lechar *stream_name,
        ntfs_attr *na;
        int ret;
        struct ntfs_attr_extract_ctx extract_ctx;
        ntfs_attr *na;
        int ret;
        struct ntfs_attr_extract_ctx extract_ctx;
-       utf16lechar stream_name_copy[stream_name_nchars + 1];
-
-       memcpy(stream_name_copy, stream_name,
-              stream_name_nchars * sizeof(utf16lechar));
-       stream_name_copy[stream_name_nchars] = 0;
+       utf16lechar *stream_name;
+
+       if (stream_name_nchars == 0) {
+               stream_name = AT_UNNAMED;
+       } else {
+               stream_name = alloca((stream_name_nchars + 1) * sizeof(utf16lechar));
+               memcpy(stream_name, raw_stream_name,
+                      stream_name_nchars * sizeof(utf16lechar));
+               stream_name[stream_name_nchars] = 0;
+       }
 
        ret = 0;
        if (!stream_name_nchars && !lte)
 
        ret = 0;
        if (!stream_name_nchars && !lte)
@@ -223,7 +228,7 @@ ntfs_3g_extract_stream(const char *path, const utf16lechar *stream_name,
        /* Add the stream if it's not the default (unnamed) stream.  */
        ret = WIMLIB_ERR_NTFS_3G;
        if (stream_name_nchars)
        /* Add the stream if it's not the default (unnamed) stream.  */
        ret = WIMLIB_ERR_NTFS_3G;
        if (stream_name_nchars)
-               if (ntfs_attr_add(ni, AT_DATA, stream_name_copy,
+               if (ntfs_attr_add(ni, AT_DATA, stream_name,
                                  stream_name_nchars, NULL, 0))
                        goto out_close;
 
                                  stream_name_nchars, NULL, 0))
                        goto out_close;
 
@@ -234,7 +239,7 @@ ntfs_3g_extract_stream(const char *path, const utf16lechar *stream_name,
 
        /* Open the stream (NTFS attribute).  */
        ret = WIMLIB_ERR_NTFS_3G;
 
        /* Open the stream (NTFS attribute).  */
        ret = WIMLIB_ERR_NTFS_3G;
-       na = ntfs_attr_open(ni, AT_DATA, stream_name_copy, stream_name_nchars);
+       na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_nchars);
        if (!na)
                goto out_close;
 
        if (!na)
                goto out_close;
 
index 03d6e0c47d35aeaef0d3160b3be5115c8ec5c965..bb3dda97aca9099ae35727bc64905c961fd9ca62 100644 (file)
@@ -400,6 +400,7 @@ read_compressed_resource(const struct wim_lookup_table_entry *lte,
                                                    uncompressed_buf,
                                                    uncompressed_chunk_size);
                                if (ret) {
                                                    uncompressed_buf,
                                                    uncompressed_chunk_size);
                                if (ret) {
+                                       ERROR("Failed to decompress data.");
                                        ret = WIMLIB_ERR_DECOMPRESSION;
                                        errno = EINVAL;
                                        goto out_free_chunk_offsets;
                                        ret = WIMLIB_ERR_DECOMPRESSION;
                                        errno = EINVAL;
                                        goto out_free_chunk_offsets;
@@ -412,6 +413,7 @@ read_compressed_resource(const struct wim_lookup_table_entry *lte,
                                                    out_p,
                                                    uncompressed_chunk_size);
                                if (ret) {
                                                    out_p,
                                                    uncompressed_chunk_size);
                                if (ret) {
+                                       ERROR("Failed to decompress data.");
                                        ret = WIMLIB_ERR_DECOMPRESSION;
                                        errno = EINVAL;
                                        goto out_free_chunk_offsets;
                                        ret = WIMLIB_ERR_DECOMPRESSION;
                                        errno = EINVAL;
                                        goto out_free_chunk_offsets;
@@ -618,10 +620,11 @@ invalid:
  *
  * Return values:
  *     WIMLIB_ERR_SUCCESS (0)
  *
  * Return values:
  *     WIMLIB_ERR_SUCCESS (0)
- *     WIMLIB_ERR_READ                 (errno set)
- *     WIMLIB_ERR_NOMEM                (errno set to ENOMEM)
- *     WIMLIB_ERR_DECOMPRESSION        (errno set to EINVAL)
- *     WIMLIB_ERR_INVALID_PIPABLE_WIM  (errno set to EINVAL)
+ *     WIMLIB_ERR_READ                   (errno set)
+ *     WIMLIB_ERR_UNEXPECTED_END_OF_FILE (errno set to 0)
+ *     WIMLIB_ERR_NOMEM                  (errno set to ENOMEM)
+ *     WIMLIB_ERR_DECOMPRESSION          (errno set to EINVAL)
+ *     WIMLIB_ERR_INVALID_PIPABLE_WIM    (errno set to EINVAL)
  *     
  *     or other error code returned by the @cb function.
  */
  *     
  *     or other error code returned by the @cb function.
  */
index e27accff294769c9e95b2114ce0b963d81e3a9f7..fd5d972d404de454bef7dbb28d5a6b26d06977a0 100644 (file)
@@ -124,7 +124,7 @@ unix_set_unix_data(const tchar *path, const struct wimlib_unix_data *data,
        struct stat stbuf;
 
        if (lstat(path, &stbuf))
        struct stat stbuf;
 
        if (lstat(path, &stbuf))
-               return WIMLIB_ERR_STAT;
+               return WIMLIB_ERR_SET_SECURITY;
        if (!S_ISLNK(stbuf.st_mode))
                if (chmod(path, data->mode))
                        return WIMLIB_ERR_SET_SECURITY;
        if (!S_ISLNK(stbuf.st_mode))
                if (chmod(path, data->mode))
                        return WIMLIB_ERR_SET_SECURITY;
index ee28a58131fef944a5a5f68b5af7462cf8ac127c..bf382a6413205c67debe283dafff3d419f60e26e 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
@@ -869,10 +869,10 @@ wimlib_free(WIMStruct *wim)
 
        if (!wim)
                return;
 
        if (!wim)
                return;
-       if (wim->in_fd.fd != -1)
-               close(wim->in_fd.fd);
-       if (wim->out_fd.fd != -1)
-               close(wim->out_fd.fd);
+       if (filedes_valid(&wim->in_fd))
+               filedes_close(&wim->in_fd);
+       if (filedes_valid(&wim->out_fd))
+               filedes_close(&wim->out_fd);
 
        free_lookup_table(wim->lookup_table);
 
 
        free_lookup_table(wim->lookup_table);
 
index c523b12d24f2e26f3b390d52e5e1efd4df17bd3c..177cd2b3aa89a9553607108c7a88d2014f063647 100755 (executable)
@@ -429,7 +429,7 @@ if test "`imagex info new.wim | grep 'Image Count' | awk '{print $3}'`" != 2; th
        error "Exporting single image to existing WIM wasn't done correctly"
 fi
 echo "Testing export of single image to existing WIM using wrong compression type"
        error "Exporting single image to existing WIM wasn't done correctly"
 fi
 echo "Testing export of single image to existing WIM using wrong compression type"
-if imagex export dir.wim dir2 new.wim newname --compress=maximum; then
+if imagex export dir.wim dir2 new.wim newname --compress=xpress; then
        error "Successfully exported image using wrong compression type"
 fi
 rm -f new.wim
        error "Successfully exported image using wrong compression type"
 fi
 rm -f new.wim