Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #61645

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

From Antonio Diaz Diaz <antonio@gnu.org>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#903931: Neither zcat nor xzcat should be used in scripts
Date 2018-07-27 09:50 +0200
Message-ID <wg5FE-5kk-5@gated-at.bofh.it> (permalink)
References <wcii6-89r-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


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.

Back to linux.debian.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Bug#903931: [initramfs-tools-core] unmkinitramfs uses "-t" for zcat like it was a "test integrity" option (it's not and it causes crashes) john terragon <terragonjohn@yahoo.com> - 2018-07-16 22:30 +0200
  Processed: Re: [initramfs-tools-core] unmkinitramfs uses "-t" for  zcat like it was a "test integrity" option (it's not and it causes  crashes) "Debian Bug Tracking System" <owner@bugs.debian.org> - 2018-07-18 07:10 +0200
  Bug#903931: [initramfs-tools-core] unmkinitramfs uses "-t" for zcat like it was a "test integrity" option (it's not and it causes crashes) Ben Hutchings <ben@decadent.org.uk> - 2018-07-18 07:10 +0200
  Bug#903931: Neither zcat nor xzcat should be used in scripts Antonio Diaz Diaz <antonio@gnu.org> - 2018-07-27 09:50 +0200
  Bug#903931: Maybe trailing garbage or data in an unsupported format is causing the problem? Antonio Diaz Diaz <antonio@gnu.org> - 2018-07-30 00:50 +0200

csiph-web