On Thu, Feb 15, 2018 at 02:49:45PM -0500, Luke Shumaker wrote:
From: Luke Shumaker <lukeshu@parabola.nu>
This partially reverts commit b61a7148eaf546a31597b74d9dd8948e4a39dea1.
In dbscripts, PKGEXT is a glob pattern--it needs to be "unquoted"; and The magic-quoting done by `[[ ... ]]` breaks that. The closing-quote coming before ${PKGEXT} was quite intentional. --- db-functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/db-functions b/db-functions index e8949d7..93a5af3 100644 --- a/db-functions +++ b/db-functions @@ -374,8 +374,8 @@ 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
Rather than making this stand out like a sore thumb for the next person to trip over, why don't we just define a "file_exists" function? file_exists() { [[ -f $1 ]] } Now you're free to do this: file_exists "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} && return 1 Expansion is taken care of by the shell before you pass to exists, and the check does what you'd expect.
[[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/} ]] && return 1 [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}.sig ]] && return 1
-- 2.16.1