[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#903931: Neither zcat nor xzcat should be used in scripts



As advised in the xz man page:

When writing scripts that need to decompress files, it is recommended to always use the name xz with appropriate arguments (xz -d or xz -dc) instead of the names unxz and xzcat.

Patch follows:

diff -urdN initramfs-tools.orig/unmkinitramfs initramfs-tools/unmkinitramfs
--- initramfs-tools.orig/unmkinitramfs  2018-07-18 06:50:17.000000000 +0200
+++ initramfs-tools/unmkinitramfs       2018-07-27 09:17:07.000000000 +0200
@@ -14,10 +14,10 @@
        dir="$2"
        shift 2

-       if zcat -t "$archive" >/dev/null 2>&1 ; then
-               zcat "$archive"
-       elif xzcat -t "$archive" >/dev/null 2>&1 ; then
-               xzcat "$archive"
+       if gzip -t "$archive" >/dev/null 2>&1 ; then
+               gzip -c -d "$archive"
+       elif xz -t "$archive" >/dev/null 2>&1 ; then
+               xz -c -d "$archive"
        elif lz4cat -t "$archive" >/dev/null 2>&1 ; then
                lz4cat "$archive"
        elif bzip2 -t "$archive" >/dev/null 2>&1 ; then


Best regards,
Antonio.


Reply to: