diff options
author | anthraxx <anthraxx@archlinux.org> | 2018-09-03 13:50:16 +0200 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2018-09-09 12:32:10 -0400 |
commit | 0b630e25a3181d5228cbd99c9041a04b6514fc81 (patch) | |
tree | e74257a316347dee22b67daa3a73b85310d07138 | |
parent | 57a307d6620d8fbf3bf1c7d01e621022da4f3f29 (diff) |
fix potential bsdtar stream close error by greparchlinux
This silences a useless error message that confuses the user.
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 stderr , we find all matches
with grep, then use a second pass with `tail` to find only the last
match, which ensures the stream remains open for bsdtar but we may still
catch and see useful messages on stderr.
This works because tail has the useful property of not closing early.
-rw-r--r-- | db-functions | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/db-functions b/db-functions index 0491c22..6d6084a 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 | grep "^${2} = " | tail -1)" 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 | grep "^${2} = " | tail -1)" echo "${_ret#${2} = }" } |