[arch-projects] [dbscripts] [PATCH 2/2] fixup: fix potential bsdtar stream close error by grep

anthraxx at archlinux.org anthraxx at archlinux.org
Mon Sep 3 11:50:16 UTC 2018


From: anthraxx <anthraxx at archlinux.org>

bsdtar doesn't like it when the stream gets closed before it finishes
which may be the case when grep found its match on potentially huge
archives. Instead of suppressing the whole strerr , we just pipe
the output through cat which ensures the stream remains open for bsdtar
but we may still catch and see useful messages on stderr.
---
 db-functions | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/db-functions b/db-functions
index 0491c22..f0a6453 100644
--- a/db-functions
+++ b/db-functions
@@ -174,7 +174,7 @@ repo_unlock () { #repo_unlock <repo-name> <arch>
 _grep_pkginfo() {
 	local _ret
 
-	_ret="$(/usr/bin/bsdtar -xOqf "$1" .PKGINFO | grep -m 1 "^${2} = ")"
+	_ret="$(/usr/bin/bsdtar -xOqf "$1" .PKGINFO | cat | grep -m 1 "^${2} = ")"
 	echo "${_ret#${2} = }"
 }
 
@@ -182,7 +182,7 @@ _grep_pkginfo() {
 _grep_buildinfo() {
 	local _ret
 
-	_ret="$(/usr/bin/bsdtar -xOqf "$1" .BUILDINFO | grep -m 1 "^${2} = ")"
+	_ret="$(/usr/bin/bsdtar -xOqf "$1" .BUILDINFO | cat | grep -m 1 "^${2} = ")"
 	echo "${_ret#${2} = }"
 }
 
-- 
2.18.0


More information about the arch-projects mailing list