bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] maint.mk: Split long argument lists


From: Roman Bolshakov
Subject: Re: [PATCH 1/2] maint.mk: Split long argument lists
Date: Wed, 28 Nov 2018 11:17:00 +0300
User-agent: NeoMutt/20180716

On Tue, Nov 27, 2018 at 07:40:24PM +0100, Bruno Haible wrote:
> Roman Bolshakov wrote:
> >     if test -n "$$files"; then                                              
> > \
> >       if test -n "$$prohibit"; then                                 \
> > -       grep $$with_grep_options $(_ignore_case) -nE "$$prohibit" $$files \
> > +       echo "$$files" | xargs -n $(VC_ARG_MAX)                             
> > \
> > +         grep $$with_grep_options $(_ignore_case) -nE "$$prohibit" \
> >           | grep -vE "$${exclude:-^$$}"                                     
> > \
> >           && { msg="$$halt" $(_sc_say_and_exit) } || :;                     
> > \
> 
> It is incorrect to transform
> 
>   grep OPTIONS FILES
> 
> to
> 
>   echo FILES | xargs -n N grep OPTIONS
> 
> because when the last chunk of FILES consists of just 1 file, 'grep'
> produces different output. Instead, you need to transform it to
> 
>   echo FILES | xargs -n N grep OPTIONS /dev/null
> 
> See:
> 
> $ cd gnulib/modules
> 
> $ grep xalloc *-tests
> acl-tests:xalloc
> copy-file-tests:xalloc
> c-xvasprintf-tests:xalloc
> obstack-printf-tests:xalloc
> regex-quote-tests:xalloc
> userspec-tests:xalloc
> xalloc-die-tests:tests/test-xalloc-die.c
> xalloc-die-tests:tests/test-xalloc-die.sh
> xalloc-die-tests:TESTS += test-xalloc-die.sh
> xalloc-die-tests:check_PROGRAMS += test-xalloc-die
> xalloc-die-tests:test_xalloc_die_LDADD = $(LDADD) @LIBINTL@
> 
> $ echo *-tests | xargs -n 1 grep xalloc
> xalloc
> xalloc
> xalloc
> xalloc
> xalloc
> xalloc
> tests/test-xalloc-die.c
> tests/test-xalloc-die.sh
> TESTS += test-xalloc-die.sh
> check_PROGRAMS += test-xalloc-die
> test_xalloc_die_LDADD = $(LDADD) @LIBINTL@
> 
> $ echo *-tests | xargs -n 1 grep xalloc /dev/null
> acl-tests:xalloc
> copy-file-tests:xalloc
> c-xvasprintf-tests:xalloc
> obstack-printf-tests:xalloc
> regex-quote-tests:xalloc
> userspec-tests:xalloc
> xalloc-die-tests:tests/test-xalloc-die.c
> xalloc-die-tests:tests/test-xalloc-die.sh
> xalloc-die-tests:TESTS += test-xalloc-die.sh
> xalloc-die-tests:check_PROGRAMS += test-xalloc-die
> xalloc-die-tests:test_xalloc_die_LDADD = $(LDADD) @LIBINTL@
> 
> Bruno
> 

Understood, I will add /dev/null as an extra argument.

Thank you,
Roman



reply via email to

[Prev in Thread] Current Thread [Next in Thread]