All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] cpio_tests.sh: Fix failure with BusyBox cpio
@ 2020-12-21 11:01 Radoslav Kolev
  2020-12-22 17:10 ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Radoslav Kolev @ 2020-12-21 11:01 UTC (permalink / raw)
  To: ltp

A very limited BusyBox cpio requires the archive format to be
explicitly set to newc when creating an archive.

Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
---
 testcases/commands/cpio/cpio_tests.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/testcases/commands/cpio/cpio_tests.sh b/testcases/commands/cpio/cpio_tests.sh
index a1469d873..57b6d983c 100755
--- a/testcases/commands/cpio/cpio_tests.sh
+++ b/testcases/commands/cpio/cpio_tests.sh
@@ -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
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] cpio_tests.sh: Fix failure with BusyBox cpio
  2020-12-21 11:01 [LTP] [PATCH] cpio_tests.sh: Fix failure with BusyBox cpio Radoslav Kolev
@ 2020-12-22 17:10 ` Petr Vorel
  2021-01-05 11:12   ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2020-12-22 17:10 UTC (permalink / raw)
  To: ltp

Hi Radoslav,

> A very limited BusyBox cpio requires the archive format to be
> explicitly set to newc when creating an archive.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

...

> +ARCHIVE_FORMAT=""
ARCHIVE_FORMAT=
(quotes not needed)

> +
> +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

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] cpio_tests.sh: Fix failure with BusyBox cpio
  2020-12-22 17:10 ` Petr Vorel
@ 2021-01-05 11:12   ` Petr Vorel
  2021-01-05 12:04     ` Radoslav Kolev
  2021-01-20  7:19     ` Zhu Feiyu
  0 siblings, 2 replies; 7+ messages in thread
From: Petr Vorel @ 2021-01-05 11:12 UTC (permalink / raw)
  To: ltp

Hi Radoslav,

...
> > +
> > +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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] cpio_tests.sh: Fix failure with BusyBox cpio
  2021-01-05 11:12   ` Petr Vorel
@ 2021-01-05 12:04     ` Radoslav Kolev
  2021-01-20  7:19     ` Zhu Feiyu
  1 sibling, 0 replies; 7+ messages in thread
From: Radoslav Kolev @ 2021-01-05 12:04 UTC (permalink / raw)
  To: ltp


Hi Petr, 

On Tue, 2021-01-05 at 12:12 +0100, Petr Vorel wrote:
> 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!



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] cpio_tests.sh: Fix failure with BusyBox cpio
  2021-01-05 11:12   ` Petr Vorel
  2021-01-05 12:04     ` Radoslav Kolev
@ 2021-01-20  7:19     ` Zhu Feiyu
  2021-01-20  9:39       ` Petr Vorel
  2021-01-20 11:00       ` Petr Vorel
  1 sibling, 2 replies; 7+ messages in thread
From: Zhu Feiyu @ 2021-01-20  7:19 UTC (permalink / raw)
  To: ltp

Hi Petr
> Hi Radoslav,
>
> ...
>>> +
>>> +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).
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
>
> Kind regards,
> Petr
>




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] cpio_tests.sh: Fix failure with BusyBox cpio
  2021-01-20  7:19     ` Zhu Feiyu
@ 2021-01-20  9:39       ` Petr Vorel
  2021-01-20 11:00       ` Petr Vorel
  1 sibling, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2021-01-20  9:39 UTC (permalink / raw)
  To: ltp

Hi Zhu,

> Hi Petr
> > Hi Radoslav,

> > ...
> > > > +
> > > > +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).
> 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.
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.

> 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

> > Kind regards,
> > Petr





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] cpio_tests.sh: Fix failure with BusyBox cpio
  2021-01-20  7:19     ` Zhu Feiyu
  2021-01-20  9:39       ` Petr Vorel
@ 2021-01-20 11:00       ` Petr Vorel
  1 sibling, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2021-01-20 11:00 UTC (permalink / raw)
  To: ltp

Hi Zhu,

> Hi Petr
> > Hi Radoslav,

> > ...
> > > > +
> > > > +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).
> 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?

Fixed in c698801a8 ("cpio: Fix -o compatibility detection").

Thanks a lot for a bug report!

Kind regards,
Petr


> Best Regards
> Feiyu Zhu

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-20 11:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 11:01 [LTP] [PATCH] cpio_tests.sh: Fix failure with BusyBox cpio Radoslav Kolev
2020-12-22 17:10 ` Petr Vorel
2021-01-05 11:12   ` Petr Vorel
2021-01-05 12:04     ` Radoslav Kolev
2021-01-20  7:19     ` Zhu Feiyu
2021-01-20  9:39       ` Petr Vorel
2021-01-20 11:00       ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.