[pacman-dev] [PATCH 7/8] validate shell scripts with $(BASH_SHELL) on build

Dave Reisner d at falconindy.com
Fri Apr 13 08:57:48 EDT 2012


On Fri, Apr 13, 2012 at 6:57 AM, Allan McRae <allan at archlinux.org> wrote:

> On 13/04/12 20:49, Florian Pritz wrote:
> > On 13.04.2012 05:30, Allan McRae wrote:
> >> On 13/04/12 00:54, Dave Reisner wrote:
> >>> Pass $(OURSCRIPTS) through the bash parser in read only mode to
> validate
> >>> syntax. Note that this doesn't actually catch all errors, but it might
> >>> be useful for developers working on these scripts.
> >>>
> >>> Signed-off-by: Dave Reisner <dreisner at archlinux.org>
> >>> ---
> >>>  contrib/Makefile.am |    1 +
> >>>  scripts/Makefile.am |    1 +
> >>>  2 files changed, 2 insertions(+)
> >>>
> >>> diff --git a/contrib/Makefile.am b/contrib/Makefile.am
> >>> index eca39e7..2953912 100644
> >>> --- a/contrib/Makefile.am
> >>> +++ b/contrib/Makefile.am
> >>> @@ -55,6 +55,7 @@ $(OURSCRIPTS): Makefile
> >>>     $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
> >>>     $(AM_V_at)chmod +x,a-w $@.tmp
> >>>     $(AM_V_at)mv $@.tmp $@
> >>> +   @$(BASH_SHELL) -O extglob -n $@
> >>
> >> I'm missing why we need extglob here?
> >
> > bacman and paccache use extglobs
> >
>
> Yes...  and every time someone calls one of those scripts they have to
> manually set the extglob?  No... because that would be stupid.
>

It would be stupid, but this is bash... So let's ignore rational thought
for a minute.

$ bash -n ./scripts/repo-add
./scripts/repo-add: line 261: syntax error near unexpected token `('
./scripts/repo-add: line 261: `         *.@(db|files).tar.gz)  TAR_OPT="z"
;;'

no-exec mode really does mean no-exec, including shopts that might change
the behavior of the parser.


More information about the pacman-dev mailing list