From 8700e09c4d2ff0a20d5fa3789a6309078bc1ccb6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 17 Apr 2016 12:18:02 -0400 Subject: Use `grep &>/dev/null` instead of `grep -q` when operating on piped stdin. `grep -q` may exit as soon as it finds a match; this is a good optimization for when the input is a file. However, if the input is the output of another program, then that other program will receive SIGPIPE, and further writes will fail. When this happens, it might (bsdtar does) print a message about a "write error" to stderr. Which is going to confuse and alarm the user. I'll add that this is not purely hypothetical--it has happened to me while running the test suite. --- db-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'db-functions') diff --git a/db-functions b/db-functions index 5fe86b6..4eebf4a 100644 --- a/db-functions +++ b/db-functions @@ -364,7 +364,7 @@ check_pkgfile() { in_array "${pkgarch}" "${ARCHES[@]}" 'any' || return 1 - if echo "${pkgfile##*/}" | grep -q "${pkgname}-${pkgver}-${pkgarch}"; then + if echo "${pkgfile##*/}" | grep "${pkgname}-${pkgver}-${pkgarch}" &>/dev/null; then return 0 else return 1 -- cgit v1.2.3