From 23c403cbda90ba592397f8837ed4d31d8c6560e1 Mon Sep 17 00:00:00 2001 From: kientzle Date: Fri, 22 Aug 2008 02:27:06 +0000 Subject: Comment a couple of places where bsdcpio and gcpio 2.9 disagree. The number of blocks read from ustar archives is just an implementation difference. The failure of bsdcpio to emit a block count to stderr in -p mode is a real bug in bsdcpio. --- usr.bin/cpio/test/test_basic.c | 9 +++++++-- usr.bin/cpio/test/test_gcpio_compat.c | 2 ++ usr.bin/cpio/test/test_option_a.c | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/usr.bin/cpio/test/test_basic.c b/usr.bin/cpio/test/test_basic.c index 7f1fe6d..67381ce 100644 --- a/usr.bin/cpio/test/test_basic.c +++ b/usr.bin/cpio/test/test_basic.c @@ -141,7 +141,7 @@ passthrough(const char *target) /* * Use cpio passthrough mode to copy files to another directory. */ - r = systemf("%s -p -W quiet %s %s/stdout 2>%s/stderr", + r = systemf("%s -p %s %s/stdout 2>%s/stderr", testprog, target, target, target); failure("Error invoking %s -p", testprog); assertEqualInt(r, 0); @@ -151,7 +151,10 @@ passthrough(const char *target) /* Verify stderr. */ failure("Error invoking %s -p in dir %s", testprog, target); - assertEmptyFile("stderr"); + /* gcpio 2.9 writes "1 block" to stderr */ + /* assertFileContents("1 block\n", 8, "stderr"); */ + /* bsdcpio writes nothing to stderr for passthrough mode */ + assertFileContents("", 0, "stderr"); verify_files(target); chdir(".."); @@ -196,6 +199,8 @@ DEFINE_TEST(test_basic) basic_cpio("copy_odc", "--format=odc", "", "1 block\n"); basic_cpio("copy_newc", "-H newc", "", "2 blocks\n"); basic_cpio("copy_cpio", "-H odc", "", "1 block\n"); + /* For some reason, gcpio 2.9 writes 7 blocks but only reads 6? */ + /* bsdcpio writes 7 blocks and reads 7 blocks. */ basic_cpio("copy_ustar", "-H ustar", "", "7 blocks\n"); /* Copy in one step using -p */ passthrough("passthrough"); diff --git a/usr.bin/cpio/test/test_gcpio_compat.c b/usr.bin/cpio/test/test_gcpio_compat.c index 4c69abb..4b97c82 100644 --- a/usr.bin/cpio/test/test_gcpio_compat.c +++ b/usr.bin/cpio/test/test_gcpio_compat.c @@ -48,6 +48,7 @@ unpack_test(const char *from, const char *options, const char *se) assertEqualInt(r, 0); /* Verify that nothing went to stderr. */ + failure("Error invoking %s -i %s < %s", testprog, options, from); assertFileContents(se, strlen(se), "unpack.err"); /* @@ -121,6 +122,7 @@ DEFINE_TEST(test_gcpio_compat) 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"); + /* gcpio-2.9 only reads 6 blocks here */ unpack_test("test_gcpio_compat_ref.ustar", "", "7 blocks\n"); umask(oldumask); diff --git a/usr.bin/cpio/test/test_option_a.c b/usr.bin/cpio/test/test_option_a.c index c063280..fd416bb 100644 --- a/usr.bin/cpio/test/test_option_a.c +++ b/usr.bin/cpio/test/test_option_a.c @@ -118,6 +118,7 @@ DEFINE_TEST(test_option_a) /* Copy the file without -a; should change the atime. */ r = systemf("echo %s | %s -pd copy-no-a > copy-no-a.out 2>copy-no-a.err", files[1].name, testprog); assertEqualInt(r, 0); + /* bsdcpio writes nothing to stderr in -p mode */ assertEmptyFile("copy-no-a.err"); assertEmptyFile("copy-no-a.out"); assertEqualInt(0, stat(files[1].name, &st)); -- cgit v1.1