cpio_tests.sh: Fix failure with BusyBox cpio
PATCH 1/1 cpio_tests.sh: Fix failure with BusyBox cpio
A very limited BusyBox cpio requires the archive format to be explicitly set to newc when creating an archive.
--- testcases/commands/cpio/cpio_tests.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
testcases/commands/cpio/cpio_tests.sh +7 -1
@@ -8,6 +8,12 @@ TST_NEEDS_TMPDIR=1 TST_NEEDS_CMDS="cpio" . tst_test.sh +ARCHIVE_FORMAT="" + +if cpio 2>&1 | grep -q '\-o\sCreate (requires -H newc)'; then + ARCHIVE_FORMAT="-H newc" +fi + cpio_test() { ROD mkdir "dir"
@@ -16,7 +22,7 @@ cpio_test() done ROD find dir -type f > filelist - EXPECT_PASS cpio -o \> cpio.out \< filelist + EXPECT_PASS cpio -o $ARCHIVE_FORMAT \> cpio.out \< filelist ROD mv "dir" "dir_orig" ROD mkdir "dir" EXPECT_PASS cpio -i \< cpio.out
Signature · 1 line
2.26.2
PATCH 1/1 cpio_tests.sh: Fix failure with BusyBox cpio
Hi Radoslav,
Quoted 2 lines
A very limited BusyBox cpio requires the archive format to be explicitly set to newc when creating an archive.
...
Quoted 1 line
+ARCHIVE_FORMAT=""
ARCHIVE_FORMAT=
(quotes not needed)
Quoted 9 lines
testcases/commands/cpio/cpio_tests.sh +5
-0+ +if cpio 2>&1 | grep -q '\-o\sCreate (requires -H newc)'; then + ARCHIVE_FORMAT="-H newc" +fi + cpio_test() { ROD mkdir "dir"
testcases/commands/cpio/cpio_tests.sh cpio_test() · line 28
Quoted 8 lines
testcases/commands/cpio/cpio_tests.sh +1
-1@@ -16,7 +22,7 @@ cpio_test() done ROD find dir -type f > filelist - EXPECT_PASS cpio -o \> cpio.out \< filelist + EXPECT_PASS cpio -o $ARCHIVE_FORMAT \> cpio.out \< filelist ROD mv "dir" "dir_orig" ROD mkdir "dir" EXPECT_PASS cpio -i \< cpio.out
Kind regards,
Petr
PATCH 1/1 cpio_tests.sh: Fix failure with BusyBox cpio
Hi Radoslav,
...
Quoted 2 lines
testcases/commands/cpio/cpio_tests.sh TST_NEEDS_TMPDIR=1 · line 13
Quoted 2 lines
testcases/commands/cpio/cpio_tests.sh +2
-0+ +if cpio 2>&1 | grep -q '\-o\sCreate (requires -H newc)'; then
Thanks for your fix, merged with these changes:
* grep for BusyBox because some older versions does not contain the hint, but actually require it.
* move things to setup function due my following commit, which cannot be outside API functions (setup/test function):
And check for -o (which is on BusyBox optional).
Kind regards,
Petr
PATCH 1/1 cpio_tests.sh: Fix failure with BusyBox cpio
Hi Petr,
Quoted 9 lines · Petr Vorel
Thanks for your fix, merged with these changes:
* grep for BusyBox because some older versions does not contain the hint, but actually require it.
* move things to setup function due my following commit, which cannot be
outside API functions (setup/test function):
And check for -o (which is on BusyBox optional).
Thanks a lot for the review and fixes!
PATCH 1/1 cpio_tests.sh: Fix failure with BusyBox cpio
In reply to Petr VorelHi Petr
Quoted 7 lines
Hi Radoslav,
...
Quoted 2 lines
testcases/commands/cpio/cpio_tests.sh TST_NEEDS_TMPDIR=1 · line 13
Quoted 2 lines
testcases/commands/cpio/cpio_tests.sh +2
-0+ +if cpio 2>&1 | grep -q '\-o\sCreate (requires -H newc)'; thenThanks for your fix, merged with these changes:
Quoted 6 lines
* grep for BusyBox because some older versions does not contain the hint, but actually require it.
* move things to setup function due my following commit, which cannot be outside API functions (setup/test function):
And check for -o (which is on BusyBox optional).
On my test environment, just executing cpio with no arguments will only output:
cpio: You must specify one of -oipt options.
Try cpio --help' or cpio --usage' for more information.
So the result of cpio01_sh is changed from PASS to CONF after commit 5910bdb65c.
Is there any difference in the output from executing this command on your environment?
Best Regards
Feiyu Zhu
Quoted 4 lines
Kind regards,
Petr
PATCH 1/1 cpio_tests.sh: Fix failure with BusyBox cpio
Hi Zhu,
Quoted 11 lines
Hi Petr
Quoted 9 lines
Hi Radoslav,
...
Quoted 2 lines
testcases/commands/cpio/cpio_tests.sh TST_NEEDS_TMPDIR=1 · line 13
Quoted 2 lines
testcases/commands/cpio/cpio_tests.sh +2
-0+ +if cpio 2>&1 | grep -q '\-o\sCreate (requires -H newc)'; thenThanks for your fix, merged with these changes:
* grep for BusyBox because some older versions does not contain the hint, but actually require it.
Quoted 7 lines
Quoted 3 lines
* move things to setup function due my following commit, which cannot be outside API functions (setup/test function):
And check for -o (which is on BusyBox optional).On my test environment, just executing cpio with no arguments will only output:
cpio: You must specify one of -oipt options.
Trycpio --help' orcpio --usage' for more information.
Thanks for a report and sorry for a regression. I'll fix it with --help (that is compatible for both cpio from GNU and for busybox cpio implementation.
Quoted 10 lines
So the result of
cpio01_shis changed from PASS to CONF after commit5910bdb65c.
Is there any difference in the output from executing this command on your environment?Best Regards
Feiyu ZhuQuoted 2 lines
Kind regards,
Petr
PATCH 1/1 cpio_tests.sh: Fix failure with BusyBox cpio
In reply to Zhu FeiyuHi Zhu,
Quoted 19 lines
Hi Petr
Quoted 7 lines
Hi Radoslav,
...
Quoted 2 lines
testcases/commands/cpio/cpio_tests.sh TST_NEEDS_TMPDIR=1 · line 13
Quoted 2 lines
testcases/commands/cpio/cpio_tests.sh +2
-0+ +if cpio 2>&1 | grep -q '\-o\sCreate (requires -H newc)'; thenThanks for your fix, merged with these changes:
Quoted 6 lines
* grep for BusyBox because some older versions does not contain the hint, but actually require it.
* move things to setup function due my following commit, which cannot be outside API functions (setup/test function):
And check for -o (which is on BusyBox optional).On my test environment, just executing cpio with no arguments will only output:
cpio: You must specify one of -oipt options.
Trycpio --help' orcpio --usage' for more information.
Quoted 4 lines
So the result of
cpio01_shis changed from PASS to CONF after commit5910bdb65c.
Is there any difference in the output from executing this command on your environment?
Fixed in c698801a8 ("cpio: Fix -o compatibility detection").
Thanks a lot for a bug report!
Kind regards,
Petr
Quoted 2 lines
Best Regards
Feiyu Zhu