cpio: avoid 'not created: newer or same age file exists' message for dirs
authorPascal Bellard <pascal.bellard@ads-lu.com>
Sun, 17 Oct 2010 22:54:51 +0000 (00:54 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 17 Oct 2010 22:54:51 +0000 (00:54 +0200)
Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
archival/libunarchive/data_extract_all.c
testsuite/cpio.tests

index cc549cd78b9d1d4bab4ec8bd07c08aa563019a6f..5fb1ab2aed36994302982f293f9725eec171fc9b 100644 (file)
@@ -69,7 +69,9 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
                        }
                }
                else if (existing_sb.st_mtime >= file_header->mtime) {
-                       if (!(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET)) {
+                       if (!(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET)
+                        && !S_ISDIR(file_header->mode)
+                       ) {
                                bb_error_msg("%s not created: newer or "
                                        "same age file exists", file_header->name);
                        }
index 05b92dbe4ab1ea97c6d37f8585a0c128baf8c855..4cd441a60db48cb4e1587da41e52c9444c14b384 100755 (executable)
@@ -116,6 +116,16 @@ link
 " "" ""
 SKIP=
 
+# avoid 'not created: newer or same age file exists' message for directories
+rm -rf cpio.testdir cpio.testdir2 2>/dev/null
+mkdir cpio.testdir
+testing "cpio extracts in existing directory" \
+"$ECHO -ne '$hexdump' | bzcat | cpio -id 2>&1; echo \$?" \
+"\
+1 blocks
+0
+" "" ""
+SKIP=
 
 # Clean up
 rm -rf cpio.testdir cpio.testdir2 2>/dev/null