[LTP] [PATCH] cpio_tests.sh: Fix failure with BusyBox cpio

Petr Vorel
2020-12-22T17:10:33Z

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