[arch-projects] [dbscripts] [PATCH 1/2] Don't quote $PKGEXT

Dave Reisner d at falconindy.com
Thu Feb 15 20:48:33 UTC 2018


On Thu, Feb 15, 2018 at 03:14:19PM -0500, Eli Schwartz via arch-projects wrote:
> On 02/15/2018 03:11 PM, Dave Reisner wrote:
> > 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.
> 
> That was my first inclination, my second was to stop allowing people to
> upload *.kz compressed packages for giggles.
> 
> If we absolutely need to glob anything there, we should use bash
> extended globs to match @(g|z) and whatever else we actually want. This
> would work in [[ ]]
> 

Nope, changing the kind of glob doesn't work here. There's simply no
glob expansion of any kind inside [[ -f  ]] (or any other stat-like
check).


More information about the arch-projects mailing list