Re: [PATCH 1/4] test: Add target test-lint-shell-syntax
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 3, 2013, 00:16 UTC
- Message-ID
- <7vlicbyvc2.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <50E4C9B5.8070308@web.de>
Torsten Bögershausen <tboegi@web.de> writes:
Show 13 quoted lines
> At least on my system the following combination works: > > git diff > diff --git a/t/Makefile b/t/Makefile > index f8f8c54..391a5ca 100644 > --- a/t/Makefile > +++ b/t/Makefile > @@ -8,7 +8,7 @@ > > #GIT_TEST_OPTS = --verbose --debug > SHELL_PATH ?= $(SHELL) > -PERL_PATH ?= /usr/bin/perl > +PERL_PATH = "/Users/tb/projects/git/tb/pe rl"
I do not think that will fly. Having that in the main Makefile where the existing users of the symbol relies on it without any surrounding quotes, e.g.
$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl GIT-VERSION-FILE
$(QUIET_GEN)$(RM) $@ $@+ && \
INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
sed -e '1{' \
-e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
-e ' h' \
-e ' s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'"));=' \
-e ' H' \
-e ' x' \
-e '}' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
$@.perl >$@+ && \
chmod +x $@+ && \
mv $@+ $@where $(PERL_PATH_SQ) is defined to replace each ' in $(PERL_PATH) with '\'' so that '$(PERL_PATH_SQ)' becomes a shell-safe way to quote the value of PERL_PATH without quotes, your definition will look for a relative path that is inside a directory named '"' (that's a single double-quote).