Subject: bug#20733: coreutils build problem

From: Paul Eggert <[email-masked]>
Date: Thu, 04 Jun 2015 12:17:20 -0700

Let's focus on 8.23 as 8.21 is pretty old....

On 06/04/2015 09:41 AM, Michael Felt wrote:
>   GEN      src/coreutils.h
> /bin/sh: 0403-057 Syntax error at line 1 : `;' is not expected.

Ah, thanks, that's a bug in the build procedure, which I have fixed by 
pushing the attached patch.  Please give it a try.
>From f6dc56f4754838069037a2e03553e8badc065c05 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Thu, 4 Jun 2015 12:15:35 -0700
Subject: [PATCH] build: port single_binary_prog to POSIX shell

Problem reported privately by Michael Felt.
* Makefile.am (install-exec-hook):
* src/local.mk (src/coreutils_symlinks, src/coreutils_shebangs)
(clean-local):
Port to POSIX shell, which doesn't allow 'for i in ; do ...'.
---
 Makefile.am  | 3 ++-
 src/local.mk | 9 ++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 7d7e381..f5543dd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -195,7 +195,8 @@ check-git-hook-script-sync:
 # the selected tools when installing.
 install-exec-hook:
 	$(AM_V_at)ctrans=$$(printf coreutils | sed -e "$(transform)");	\
-	for p in $(single_binary_progs); do				\
+	for p in x $(single_binary_progs); do				\
+	  test $$p = x && continue;					\
 	  ptrans=$$(printf '%s' "$$p" | sed -e "$(transform)");		\
 	  rm -f $(DESTDIR)$(bindir)/$$ptrans$(EXEEXT) || exit $$?;	\
 	  if test "x$(single_binary_install_type)" = xshebangs; then	\
diff --git a/src/local.mk b/src/local.mk
index 5a3b1b3..eaeed08 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -427,7 +427,8 @@ endif SINGLE_BINARY
 CLEANFILES += src/coreutils_symlinks
 src/coreutils_symlinks: Makefile
 	$(AM_V_GEN)touch $@
-	$(AM_V_at)for i in $(single_binary_progs); do \
+	$(AM_V_at)for i in x $(single_binary_progs); do \
+		test $$i = x && continue; \
 		rm -f src/$$i$(EXEEXT) || exit $$?; \
 		$(LN_S) -s coreutils$(EXEEXT) src/$$i$(EXEEXT) || exit $$?; \
 	done
@@ -435,7 +436,8 @@ src/coreutils_symlinks: Makefile
 CLEANFILES += src/coreutils_shebangs
 src/coreutils_shebangs: Makefile
 	$(AM_V_GEN)touch $@
-	$(AM_V_at)for i in $(single_binary_progs); do \
+	$(AM_V_at)for i in x $(single_binary_progs); do \
+		test $$i = x && continue; \
 		rm -f src/$$i$(EXEEXT) || exit $$?; \
 		printf '#!%s --coreutils-prog-shebang=%s\n' \
 			$(abs_top_builddir)/src/coreutils$(EXEEXT) $$i \
@@ -444,7 +446,8 @@ src/coreutils_shebangs: Makefile
 	done
 
 clean-local:
-	$(AM_V_at)for i in $(single_binary_progs); do \
+	$(AM_V_at)for i in x $(single_binary_progs); do \
+		test $$i = x && continue; \
 		rm -f src/$$i$(EXEEXT) || exit $$?; \
 	done
 
-- 
2.1.0