15941179 coreutils "gmake test" failures
authorRich Burridge <rich.burridge@oracle.com>
Wed, 14 May 2014 12:19:10 -0700
changeset 1895 1f133713df64
parent 1894 ac68129fb8d6
child 1896 f83e6dde6c3b
15941179 coreutils "gmake test" failures 18744372 GNU coreutils stdbuf line buffering is broken.
components/coreutils/Makefile
components/coreutils/patches/libstdbuf.c.patch
components/coreutils/patches/stdbuf.c.patch
--- a/components/coreutils/Makefile	Tue May 13 10:00:55 2014 -0700
+++ b/components/coreutils/Makefile	Wed May 14 12:19:10 2014 -0700
@@ -65,8 +65,6 @@
 # Get the binaries to test from the component proto area.
 COMPONENT_TEST_ENV +=   PATH=$(PROTOUSRSBINDIR):/usr/bin
 
-# There is one known test failure:
-# misc/stdbuf             - see CR #15941179
 test:		install $(TEST_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/coreutils/patches/libstdbuf.c.patch	Wed May 14 12:19:10 2014 -0700
@@ -0,0 +1,22 @@
+Changes needed to properly create the libstdbuf.so shared library on Solaris.
+
+This change has been passed upstream.
+
+--- coreutils-8.16/src/libstdbuf.c.orig	2014-05-08 21:41:23.436563716 -0700
++++ coreutils-8.16/src/libstdbuf.c	2014-05-12 17:44:17.575294603 -0700
[email protected]@ -127,7 +127,14 @@
+     }
+ }
+ 
+-__attribute__ ((constructor)) static void
++#if (__GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) \
++     || 0x590 <= __SUNPRO_C)
++/* Explicitly define to avoid otherwise elided __attribute on SUNPRO_C  */
++# define ATTRIBUTE_CONSTRUCTOR __attribute ((constructor))
++#else
++# error "__attribute ((constructor)) support is required"
++#endif
++static void ATTRIBUTE_CONSTRUCTOR
+ stdbuf (void)
+ {
+   char *e_mode = getenv ("_STDBUF_E");
--- a/components/coreutils/patches/stdbuf.c.patch	Tue May 13 10:00:55 2014 -0700
+++ b/components/coreutils/patches/stdbuf.c.patch	Wed May 14 12:19:10 2014 -0700
@@ -1,50 +1,22 @@
-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.
+Change needed to get stdbuf to successfully preload libstdbuf.so
+for both 32-bit and 64-bit applications.
+
+This change has been passed upstream.
 
---- 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
[email protected]@ -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.  */
+--- coreutils-8.16/src/stdbuf.c.orig	2014-05-12 13:48:24.644347899 -0700
++++ coreutils-8.16/src/stdbuf.c	2014-05-14 09:45:52.507614923 -0700
[email protected]@ -200,6 +200,14 @@
+   char const *const search_path[] = {
+     program_path,
+     PKGLIBEXECDIR,
++
++   /* Since we don't link against libstdbuf.so, we need to LD_PRELOAD it.
++      libstdbuf.so lives in /usr/lib and /usr/lib/64, so we just use a
++      search path value of "" and that equates to 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.  */
++
++    "",              /* System default */
+     NULL
+   };
  
--  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?  */
-