On Thu, 15 Feb 2018 10:48:11 -0500, Eli Schwartz via arch-projects wrote:
commit b61a7148eaf546a31597b74d9dd8948e4a39dea1 Author: Eli Schwartz <eschwartz@archlinux.org> Date: Mon Feb 12 20:50:57 2018 -0500
Use more bashisms
Fix numerous instances of POSIX `[ ... ]`, including reliance on ugly deprecated constructs like POSIX `-a`. Since we require bash regardless, it makes sense to take full advantage of it.
bash `[[ ... ]]` does not require quoting variables as the shell natively recognizes them as variables rather than expanded strings.
Use shell arithmetic rather than test, when checking numerical values.
diff --git a/db-functions b/db-functions index d66955b..c0af03c 100644 --- a/db-functions +++ b/db-functions @@ -381,10 +380,10 @@ check_pkgrepos() { local pkgver="$(getpkgver ${pkgfile})" || return 1 local pkgarch="$(getpkgarch ${pkgfile})" || return 1
- [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} ] && return 1 - [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && return 1 + [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT} ]] && return 1 + [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT}.sig ]] && return 1
You don't want to do that here. In dbscripts, PKGEXT is a glob pattern--it needs to be "unquoted"; and `[[ ... ]]`'s magic-quoting breaks that. The closing-quote coming before ${PKGEXT} was quite intentional. -- Happy hacking, ~ Luke Shumaker