* libarchive/test/test_read_format_mtree.c: Fix typo in test.
* tar/test/test_patterns.c: Ensure tests work without root privilege.
* cpio/test/test_option_f.c: Ditto.
* cpio/test/test_option_m.c: Ditto.
* cpio/test/test_gcpio_compat.c: Ditto.
SVN-Revision: 1219
oldumask = umask(0);
/* Dearchive sample files with a variety of options. */
- unpack_test("test_gcpio_compat_ref.bin", "", "1 block\n");
- unpack_test("test_gcpio_compat_ref.crc", "", "2 blocks\n");
- unpack_test("test_gcpio_compat_ref.newc", "", "2 blocks\n");
+ unpack_test("test_gcpio_compat_ref.bin", "--no-preserve-owner", "1 block\n");
+ unpack_test("test_gcpio_compat_ref.crc", "--no-preserve-owner", "2 blocks\n");
+ unpack_test("test_gcpio_compat_ref.newc", "--no-preserve-owner", "2 blocks\n");
/* gcpio-2.9 only reads 6 blocks here */
- unpack_test("test_gcpio_compat_ref.ustar", "", "7 blocks\n");
+ unpack_test("test_gcpio_compat_ref.ustar", "--no-preserve-owner", "7 blocks\n");
umask(oldumask);
}
DEFINE_TEST(test_option_f)
{
/* Calibrate: No -f option, so everything should be extracted. */
- unpack("t0", "");
+ unpack("t0", "--no-preserve-owner");
assertEqualInt(0, access("t0/a123", F_OK));
assertEqualInt(0, access("t0/a234", F_OK));
assertEqualInt(0, access("t0/b123", F_OK));
/* Don't extract 'a*' files. */
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Single quotes isn't used by command.exe. */
- unpack("t1", "-f a*");
+ unpack("t1", "--no-preserve-owner -f a*");
#else
- unpack("t1", "-f 'a*'");
+ unpack("t1", "--no-preserve-owner -f 'a*'");
#endif
assert(0 != access("t1/a123", F_OK));
assert(0 != access("t1/a234", F_OK));
/* Don't extract 'b*' files. */
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Single quotes isn't used by command.exe. */
- unpack("t2", "-f b*");
+ unpack("t2", "--no-preserve-owner -f b*");
#else
- unpack("t2", "-f 'b*'");
+ unpack("t2", "--no-preserve-owner -f 'b*'");
#endif
assertEqualInt(0, access("t2/a123", F_OK));
assertEqualInt(0, access("t2/a234", F_OK));
assertEqualInt(0, mkdir("without-m", 0755));
assertEqualInt(0, chdir("without-m"));
extract_reference_file("test_option_m.cpio");
- r = systemf("%s -i < test_option_m.cpio >out 2>err", testprog);
+ r = systemf("%s --no-preserve-owner -i < test_option_m.cpio >out 2>err", testprog);
now = time(NULL);
assertEqualInt(r, 0);
assertEmptyFile("out");
assertEqualInt(0, mkdir("with-m", 0755));
assertEqualInt(0, chdir("with-m"));
extract_reference_file("test_option_m.cpio");
- r = systemf("%s -im < test_option_m.cpio >out 2>err", testprog);
+ r = systemf("%s --no-preserve-owner -im < test_option_m.cpio >out 2>err", testprog);
now = time(NULL);
assertEqualInt(r, 0);
assertEmptyFile("out");
"dir type=dir\n"
" file\\040with\\040space type=file uid=18\n"
" ..\n"
- "file\\04with\\040space type=file\n"
+ "file\\040with\\040space type=file\n"
"dir2 type=dir\n"
" dir3a type=dir\n"
" indir3a type=file\n"
assertEqualString(archive_entry_pathname(ae), "dir/file with space");
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
- assertEqualString(archive_entry_pathname(ae), "file\\04with space");
+ assertEqualString(archive_entry_pathname(ae), "file with space");
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualString(archive_entry_pathname(ae), "dir2");
close(fd);
r = systemf("%s cfv tar1.tgz foo > tar1a.out 2> tar1a.err", testprog);
assertEqualInt(r, 0);
- r = systemf("%s xfv tar1.tgz foo bar > tar1b.out 2> tar1b.err", testprog);
+ r = systemf("%s xv --no-same-owner -f tar1.tgz foo bar > tar1b.out 2> tar1b.err", testprog);
failure("tar should return non-zero because a file was given on the command line that's not in the archive");
assert(r != 0);
extract_reference_file(reffile3);
/* Test 3a: Pattern tmp/foo/bar should not match /tmp/foo/bar */
- r = systemf("%s xf %s tmp/foo/bar > tar3a.out 2> tar3a.err",
+ r = systemf("%s x --no-same-owner -f %s tmp/foo/bar > tar3a.out 2> tar3a.err",
testprog, reffile3);
assert(r != 0);
assertEmptyFile("tar3a.out");
/* Test 3b: Pattern /tmp/foo/baz should not match tmp/foo/baz */
assertNonEmptyFile("tar3a.err");
/* Again, with the '/' */
- r = systemf("%s xf %s /tmp/foo/baz > tar3b.out 2> tar3b.err",
+ r = systemf("%s x --no-same-owner -f %s /tmp/foo/baz > tar3b.out 2> tar3b.err",
testprog, reffile3);
assert(r != 0);
assertEmptyFile("tar3b.out");
assertNonEmptyFile("tar3b.err");
/* Test 3c: ./tmp/foo/bar should not match /tmp/foo/bar */
- r = systemf("%s xf %s ./tmp/foo/bar > tar3c.out 2> tar3c.err",
+ r = systemf("%s x --no-same-owner -f %s ./tmp/foo/bar > tar3c.out 2> tar3c.err",
testprog, reffile3);
assert(r != 0);
assertEmptyFile("tar3c.out");
assertNonEmptyFile("tar3c.err");
/* Test 3d: ./tmp/foo/baz should match tmp/foo/baz */
- r = systemf("%s xf %s ./tmp/foo/baz > tar3d.out 2> tar3d.err",
+ r = systemf("%s x --no-same-owner -f %s ./tmp/foo/baz > tar3d.out 2> tar3d.err",
testprog, reffile3);
assertEqualInt(r, 0);
assertEmptyFile("tar3d.out");
*/
extract_reference_file(reffile4);
- r = systemf("%s xf %s -C tmp > tar4.out 2> tar4.err",
+ r = systemf("%s x --no-same-owner -f %s -C tmp > tar4.out 2> tar4.err",
testprog, reffile4);
assert(r != 0);
assertEmptyFile("tar4.out");