17408935 GNU coreutils should be 64-bit
authorRich Burridge <rich.burridge@oracle.com>
Wed, 11 Sep 2013 10:06:27 -0700
changeset 1465 26be70b523fc
parent 1464 ab8a9b7b41e8
child 1466 24d2be32f88c
17408935 GNU coreutils should be 64-bit
components/coreutils/Makefile
components/coreutils/coreutils.p5m
components/coreutils/patches/stdbuf.c.patch
--- a/components/coreutils/Makefile	Wed Sep 11 17:57:53 2013 +0200
+++ b/components/coreutils/Makefile	Wed Sep 11 10:06:27 2013 -0700
@@ -37,21 +37,19 @@
 include ../../make-rules/ips.mk
 
 CONFIGURE_PREFIX	 =	/usr/gnu
+CONFIGURE_OPTIONS	+=	--bindir=/usr/gnu/bin
 CONFIGURE_OPTIONS	+=	--libdir=/usr/lib
 CONFIGURE_OPTIONS	+=	--infodir=$(CONFIGURE_INFODIR)
 CONFIGURE_OPTIONS	+=	CPPFLAGS=-I/usr/include/gmp
 CONFIGURE_OPTIONS	+=	CFLAGS="$(CFLAGS)"
 
-# To allow stdbuf to correctly find /usr/lib/libstdbuf.so
-COMPONENT_BUILD_ARGS += pkglibexecdir=/usr/lib
-
 # Enable ASLR for this component
 ASLR_MODE = $(ASLR_ENABLE)
 
 # common targets
-build:		$(BUILD_32)
+build:		$(BUILD_32_and_64)
 
-install:	$(INSTALL_32)
+install:	$(INSTALL_32_and_64)
 
 # Needed for "gmake test" to work successfully.
 # If SHELLOPTS is exported (as it is by the userland makefiles),
@@ -64,7 +62,10 @@
 # Get the binaries to test from the component proto area.
 COMPONENT_TEST_ENV +=   PATH=$(PROTOUSRSBINDIR):/usr/bin
 
-test:		install $(TEST_32)
+# There are two known test failures:
+# misc/stdbuf             - see CR #15941179
+# misc/timeout-parameters - see CR #17425658
+test:		install $(TEST_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/coreutils/coreutils.p5m	Wed Sep 11 17:57:53 2013 +0200
+++ b/components/coreutils/coreutils.p5m	Wed Sep 11 10:06:27 2013 -0700
@@ -248,7 +248,8 @@
 file path=usr/gnu/share/man/man1/wc.1
 file path=usr/gnu/share/man/man1/who.1
 file path=usr/gnu/share/man/man1/yes.1
-file usr/gnu/libexec/coreutils/libstdbuf.so path=usr/lib/libstdbuf.so
+file $(MACH32)/src/libstdbuf.so path=usr/lib/libstdbuf.so
+file $(MACH64)/src/libstdbuf.so path=usr/lib/$(MACH64)/libstdbuf.so
 file path=usr/share/info/coreutils.info
 file usr/gnu/share/man/man1/base64.1 path=usr/share/man/man1/base64.1
 file usr/gnu/share/man/man1/dir.1 path=usr/share/man/man1/dir.1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/coreutils/patches/stdbuf.c.patch	Wed Sep 11 10:06:27 2013 -0700
@@ -0,0 +1,50 @@
+Changes needed to get stdbuf to successfully preload libstdbuf.so
+for both 32-bit and 64-bit applications. See comment in the patch
+for more details.
+
+--- coreutils-8.16/src/stdbuf.c.orig	2013-09-04 19:05:35.225857588 -0700
++++ coreutils-8.16/src/stdbuf.c	2013-09-04 19:11:51.945113130 -0700
+@@ -195,37 +195,13 @@
+      gcc stdbuf.c -Wl,-rpath,'$ORIGIN' -Wl,-rpath,$PKGLIBEXECDIR
+      However we want the lookup done for the exec'd command not stdbuf.
+ 
+-     Since we don't link against libstdbuf.so add it to PKGLIBEXECDIR
+-     rather than to LIBDIR.  */
+-  char const *const search_path[] = {
+-    program_path,
+-    PKGLIBEXECDIR,
+-    NULL
+-  };
++     Since we don't link against libstdbuf.so, we need to LD_PRELOAD it.
++     As libstdbuf.so lives in /usr/lib and /usr/lib/64, we just use
++     LD_PRELOAD=libstdbuf.so, and ld.so.1 finds the right one associated
++     with the process class. ie. we don't use full path names for the
++     preload names.  */
+ 
+-  char const *const *path = search_path;
+-  char *libstdbuf;
+-
+-  while (true)
+-    {
+-      struct stat sb;
+-
+-      if (!**path)              /* system default  */
+-        {
+-          libstdbuf = xstrdup (LIB_NAME);
+-          break;
+-        }
+-      ret = asprintf (&libstdbuf, "%s/%s", *path, LIB_NAME);
+-      if (ret < 0)
+-        xalloc_die ();
+-      if (stat (libstdbuf, &sb) == 0)   /* file_exists  */
+-        break;
+-      free (libstdbuf);
+-
+-      ++path;
+-      if ( ! *path)
+-        error (EXIT_CANCELED, 0, _("failed to find %s"), quote (LIB_NAME));
+-    }
++  char *libstdbuf = xstrdup (LIB_NAME);
+ 
+   /* FIXME: Do we need to support libstdbuf.dll, c:, '\' separators etc?  */
+