File 0572-lsinitrd-no-more-cat-write-error-Broken-pipe.patch of Package dracut.12460

From b2e09d1d444e771493c26c576256f962bd8869f3 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 16 Jan 2018 12:14:15 +0100
Subject: [PATCH 1/2] lsinitrd: no more cat: write error: Broken pipe

silence the cat
---
 lsinitrd.sh | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lsinitrd.sh b/lsinitrd.sh
index 1e4d99ac..9c7a178b 100755
--- a/lsinitrd.sh
+++ b/lsinitrd.sh
@@ -120,7 +120,7 @@ extract_files()
     for f in "${!filenames[@]}"; do
         [[ $nofileinfo ]] || echo "initramfs:/$f"
         [[ $nofileinfo ]] || echo "========================================================================"
-        $CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
+        $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
         ((ret+=$?))
         [[ $nofileinfo ]] || echo "========================================================================"
         [[ $nofileinfo ]] || echo
@@ -139,15 +139,14 @@ list_files()
 {
     echo "========================================================================"
     if [ "$sorted" -eq 1 ]; then
-        $CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
+        $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
     else
-        $CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
+        $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
     fi
     ((ret+=$?))
     echo "========================================================================"
 }
 
-
 if (( ${#filenames[@]} <= 0 )); then
     echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)"
     echo "========================================================================"
-- 
2.16.3

openSUSE Build Service is sponsored by