Submitted By: Jim Gifford (patches at jg555 dot com)
Date: 2007-09-01
Initial Package Version: 2.18
Origin: http://ttervo.vectorstar.net/nptl/posix-patches/binutils-2.14.90.0.7-posix-head-tail.patch
Upstream Status: Accepted/but Suspended
Description: Makes Posix Compliant

diff -Naur binutils-2.18.orig/gas/Makefile.am binutils-2.18/gas/Makefile.am
--- binutils-2.18.orig/gas/Makefile.am	2007-08-28 10:19:35.000000000 -0700
+++ binutils-2.18/gas/Makefile.am	2007-09-01 11:36:26.000000000 -0700
@@ -791,13 +791,13 @@
 against=stage2
 
 # This rule is derived from corresponding code in the Makefile.in for gcc.
-# The "tail +16c" is to bypass headers which may include timestamps or
+# The "tail -c +16" is to bypass headers which may include timestamps or
 # temporary assembly file names.
 comparison:
 	x=0 ; \
 	for file in *.o ; do \
-	  tail +16c ./$$file > tmp-foo1; \
-	  if tail +16c ${against}/$$file > tmp-foo2 2>/dev/null ; then \
+	  tail -c +16 ./$$file > tmp-foo1; \
+	  if tail -c +16 ${against}/$$file > tmp-foo2 2>/dev/null ; then \
 	    if cmp tmp-foo1 tmp-foo2 ; then \
 	      true ; \
 	    else \
diff -Naur binutils-2.18.orig/gas/Makefile.in binutils-2.18/gas/Makefile.in
--- binutils-2.18.orig/gas/Makefile.in	2007-08-28 10:19:35.000000000 -0700
+++ binutils-2.18/gas/Makefile.in	2007-09-01 11:36:26.000000000 -0700
@@ -2763,13 +2763,13 @@
 	if [ -f stage3/as-new$(EXEEXT) -a ! -f stage3/as$(EXEEXT) ] ; then (cd stage3 ; ln -s as-new as$(EXEEXT)) ; fi
 
 # This rule is derived from corresponding code in the Makefile.in for gcc.
-# The "tail +16c" is to bypass headers which may include timestamps or
+# The "tail -c +16" is to bypass headers which may include timestamps or
 # temporary assembly file names.
 comparison:
 	x=0 ; \
 	for file in *.o ; do \
-	  tail +16c ./$$file > tmp-foo1; \
-	  if tail +16c ${against}/$$file > tmp-foo2 2>/dev/null ; then \
+	  tail -c +16 ./$$file > tmp-foo1; \
+	  if tail -c +16 ${against}/$$file > tmp-foo2 2>/dev/null ; then \
 	    if cmp tmp-foo1 tmp-foo2 ; then \
 	      true ; \
 	    else \
diff -Naur binutils-2.18.orig/ld/testsuite/ld-bootstrap/bootstrap.exp binutils-2.18/ld/testsuite/ld-bootstrap/bootstrap.exp
--- binutils-2.18.orig/ld/testsuite/ld-bootstrap/bootstrap.exp	2007-08-06 13:00:23.000000000 -0700
+++ binutils-2.18/ld/testsuite/ld-bootstrap/bootstrap.exp	2007-09-01 11:36:26.000000000 -0700
@@ -152,8 +152,8 @@
         # Although this works, a way to set the date would be better.
         # Removing or zeroing the date stamp in the binary produced by
         # the linker is not possible as it is required by the target OS.
-        exec tail +140 tmpdir/ld2 >tmpdir/ld2tail
-        exec tail +140 tmpdir/ld3 >tmpdir/ld3tail
+        exec tail -n +140 tmpdir/ld2 >tmpdir/ld2tail
+        exec tail -n +140 tmpdir/ld3 >tmpdir/ld3tail
         catch "exec cmp tmpdir/ld2tail tmpdir/ld3tail" exec_output
         exec rm tmpdir/ld2tail tmpdir/ld3tail
     } else {
diff -Naur binutils-2.18.orig/src-release binutils-2.18/src-release
--- binutils-2.18.orig/src-release	2007-08-12 12:04:26.000000000 -0700
+++ binutils-2.18/src-release	2007-09-01 11:36:38.000000000 -0700
@@ -73,7 +73,7 @@
 	elif grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
 	  sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'; \
 	elif test -f $(TOOL)/version.in; then \
-	  head -1 $(TOOL)/version.in; \
+	  head -n 1 $(TOOL)/version.in; \
 	elif grep VERSION $(TOOL)/Makefile.in > /dev/null 2>&1; then \
 	  sed < $(TOOL)/Makefile.in -n 's/^VERSION *= *//p'; \
 	else \
