summaryrefslogtreecommitdiff
path: root/test/test.d/db-update.sh
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-04-17 12:18:02 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-17 14:46:09 -0400
commit8700e09c4d2ff0a20d5fa3789a6309078bc1ccb6 (patch)
treee8a520abdf54b8e66cf0b37dfc4cf4a46c24781f /test/test.d/db-update.sh
parentdb673811e674dc246fefa432d205f67ef3c56dbc (diff)
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.
Diffstat (limited to 'test/test.d/db-update.sh')
-rwxr-xr-xtest/test.d/db-update.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh
index 48c243d..9e44970 100755
--- a/test/test.d/db-update.sh
+++ b/test/test.d/db-update.sh
@@ -132,7 +132,7 @@ testUpdateSameAnyPackageToDifferentRepositories() {
local arch
for arch in i686 x86_64; do
( [ -r "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" ] \
- && bsdtar -xf "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" -O | grep -q "${pkgbase}") \
+ && bsdtar -xf "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" -O | grep "${pkgbase}" &>/dev/null) \
&& fail "${pkgbase} should not be in testing/os/${arch}/testing${DBEXT%.tar.*}"
done
}
@@ -154,7 +154,7 @@ testAddIncompleteSplitPackage() {
for arch in "${ARCH_BUILD[@]}"; do
( [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" ] \
- && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" -O | grep -q "${pkgbase}") \
+ && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" -O | grep "${pkgbase}" &>/dev/null) \
&& fail "${pkgbase} should not be in ${repo}/os/${arch}/${repo}${DBEXT%.tar.*}"
done
}