From ba2b4d7c592266539dfea2eed964fe50f5cc12c2 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Fri, 2 Jul 2010 11:50:28 -0700 Subject: Makefile: remove some unnecessary curly braces Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index b18768e..53bb903 100644 --- a/Makefile +++ b/Makefile @@ -2004,19 +2004,19 @@ endif test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \ ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \ cp "$$bindir/git$X" "$$execdir/git$X"; } ; } && \ - { for p in $(BUILT_INS); do \ + for p in $(BUILT_INS); do \ $(RM) "$$execdir/$$p" && \ ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \ ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \ cp "$$execdir/git$X" "$$execdir/$$p" || exit; \ - done; } && \ + done && \ { test x"$(REMOTE_CURL_ALIASES)" = x || \ - { for p in $(REMOTE_CURL_ALIASES); do \ + for p in $(REMOTE_CURL_ALIASES); do \ $(RM) "$$execdir/$$p" && \ ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \ - done; } ; } && \ + done; } && \ ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X" install-doc: -- cgit v0.10.2-6-g49f6 From 49a43f5468b5dbf41236a59a663e593e5432db15 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Tue, 6 Jul 2010 14:56:51 -0700 Subject: Makefile: work around ksh's failure to handle missing list argument to for loop ksh does not like it when the list argument is missing in a 'for' loop. This can happen when NO_CURL is set which causes REMOTE_CURL_ALIASES to be unset. In this case, the 'for' loop in the Makefile is expanded to look like this: for p in ; do and ksh complains like this: /bin/ksh: syntax error at line 15 : `;' unexpected The existing attempt to work around this issue, introduced by 70b89f87, tried to protect the 'for' loop by first testing whether REMOTE_CURL_ALIASES was empty, but this does not work since, as Johannes Sixt explains, "Before the test for emptyness can happen, the complete statement must be parsed, but ksh finds a syntax error in the statement and, therefore, cannot even begin to execute the statement. (ksh doesn't follow POSIX in this regard, where this would not be a syntax error.)". Make's $(foreach) function could be used to avoid this shell glitch, but since it has already caused a problem once before by generating a command line that exceeded the maximum argument list length on IRIX, let's adopt Bruce Stephens's suggestion for working around this issue in the same way the OpenSSL folks have done it. This solution first assigns the contents of the REMOTE_CURL_ALIASES make variable to a shell variable and then supplies the shell variable as the list argument in the 'for' loop. This satisfies ksh and has the expected behavior even if $(REMOTE_CURL_ALIASES) is empty. Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index 53bb903..78f2cd6 100644 --- a/Makefile +++ b/Makefile @@ -2010,13 +2010,13 @@ endif ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \ cp "$$execdir/git$X" "$$execdir/$$p" || exit; \ done && \ - { test x"$(REMOTE_CURL_ALIASES)" = x || \ - for p in $(REMOTE_CURL_ALIASES); do \ + remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \ + for p in $$remote_curl_aliases; do \ $(RM) "$$execdir/$$p" && \ ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \ - done; } && \ + done && \ ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X" install-doc: -- cgit v0.10.2-6-g49f6