# HG changeset patch # User Rich Burridge # Date 1452284318 28800 # Node ID 8a7aa7f8367e63cd2a48b66a4b81d14fe8df78d4 # Parent bb1d032b7f7ef18c1057549ed6109e3c68e0f486 16575074 stat could support birthtime/crtime on ZFS diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/Makefile --- a/components/coreutils/Makefile Fri Jan 08 00:23:49 2016 -0800 +++ b/components/coreutils/Makefile Fri Jan 08 12:18:38 2016 -0800 @@ -18,7 +18,7 @@ # # CDDL HEADER END # -# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. # include ../../make-rules/shared-macros.mk @@ -45,6 +45,9 @@ CONFIGURE_OPTIONS += CPPFLAGS=-I/usr/include/gmp CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" +# Recreate configure and src/Makefile to pick up stat birthtime changes. +COMPONENT_PREP_ACTION = (cd $(@D) ; autoreconf -f && automake) + # Enable ASLR for this component ASLR_MODE = $(ASLR_ENABLE) @@ -66,7 +69,7 @@ # There are two known test failures: # misc/stdbuf - see CR #15941179 -# misc/timeout-parameters - see CR #17425658 +# misc/timeout-parameters - see CR #22485908 test: install $(TEST_64) diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/coreutils.p5m --- a/components/coreutils/coreutils.p5m Fri Jan 08 00:23:49 2016 -0800 +++ b/components/coreutils/coreutils.p5m Fri Jan 08 12:18:38 2016 -0800 @@ -18,7 +18,7 @@ # # CDDL HEADER END # -# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. # default mangler.man.stability uncommitted> @@ -33,7 +33,7 @@ value="org.opensolaris.category.2008:Applications/System Utilities" set name=info.source-url value=$(COMPONENT_ARCHIVE_URL) set name=info.upstream-url value=$(COMPONENT_PROJECT_URL) -set name=org.opensolaris.arc-caseid value=PSARC/2010/170 +set name=org.opensolaris.arc-caseid value=PSARC/2010/170 value=PSARC/2012/170 set name=org.opensolaris.consolidation value=$(CONSOLIDATION) file usr/gnu/bin/base64 path=usr/bin/base64 file usr/gnu/bin/dir path=usr/bin/dir diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/patches/configure.patch --- a/components/coreutils/patches/configure.patch Fri Jan 08 00:23:49 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ ---- coreutils-8.16/configure.orig 2012-04-18 07:35:04.318609521 -0700 -+++ coreutils-8.16/configure 2012-04-18 07:36:27.319985971 -0700 -@@ -62005,7 +62005,6 @@ - } - fi - --# Limit stdbuf to ELF systems with GCC - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether this is an ELF system" >&5 - $as_echo_n "checking whether this is an ELF system... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -@@ -62024,15 +62023,17 @@ - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $elf_sys" >&5 - $as_echo "$elf_sys" >&6; } --if test "$elf_sys" = "yes" && \ -- test "$GCC" = "yes"; then -- { -- if test -z "$optional_bin_progs"; then -- optional_bin_progs=stdbuf -- else -- optional_bin_progs="$optional_bin_progs stdbuf" -- fi --} -+ -+if test -z "$optional_bin_progs"; then -+ optional_bin_progs=stdbuf -+else -+ optional_bin_progs="$optional_bin_progs stdbuf" -+ fi -+ -+if test -z "$optional_pkglib_progs"; then -+ optional_pkglib_progs=libstdbuf.so -+else -+ optional_pkglib_progs="$optional_pkglib_progs libstdbuf.so" - fi - - ############################################################################ diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/patches/install.1.patch --- a/components/coreutils/patches/install.1.patch Fri Jan 08 00:23:49 2016 -0800 +++ b/components/coreutils/patches/install.1.patch Fri Jan 08 12:18:38 2016 -0800 @@ -1,3 +1,9 @@ +Adjust the text used in the install man page to mention the Solaris +specific packaging tool. + +This patch has not been passed upstream yet. It needs to be reworked into +a format that would be acceptable. + *** coreutils-8.5/man/install.1.orig Wed Oct 12 11:00:13 2011 --- coreutils-8.5/man/install.1 Wed Oct 12 11:00:55 2011 *************** diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/patches/manpages.patch --- a/components/coreutils/patches/manpages.patch Fri Jan 08 00:23:49 2016 -0800 +++ b/components/coreutils/patches/manpages.patch Fri Jan 08 12:18:38 2016 -0800 @@ -1,3 +1,10 @@ +Adjust the text used in various man pages to use the Solaris specific +man page section or remove references to commands that are't relevant +to Solaris. + +This patch has not been passed upstream yet. It needs to be reworked into +a format that would be acceptable. + --- coreutils-8.5/man/mkfifo.1.orig Wed Nov 9 09:02:34 2011 +++ coreutils-8.5/man/mkfifo.1 Wed Nov 9 09:10:31 2011 @@ -40,7 +40,7 @@ diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/patches/mountlist.c.patch --- a/components/coreutils/patches/mountlist.c.patch Fri Jan 08 00:23:49 2016 -0800 +++ b/components/coreutils/patches/mountlist.c.patch Fri Jan 08 12:18:38 2016 -0800 @@ -1,3 +1,9 @@ +Properly detect remote mounted file systems with /usr/gnu/bin/df on Solaris. +See the comments in CR# 15595871 for more details. + +This patch has not been passed upstream yet. It needs to be reworked into +a format that would be acceptable. + --- coreutils-8.16/lib/mountlist.c.orig 2012-04-18 07:41:27.645801306 -0700 +++ coreutils-8.16/lib/mountlist.c 2012-04-18 07:42:23.796304225 -0700 @@ -187,10 +187,11 @@ diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/patches/stat-birthtime.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/coreutils/patches/stat-birthtime.patch Fri Jan 08 12:18:38 2016 -0800 @@ -0,0 +1,178 @@ +Changes to implement: +16575074 stat could support birthtime/crtime on ZFS + +These changes have already been accepted upstream. See: +http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=ea916c70a5fc47ee6036a05416bc7462fd8dc1cd + +--- coreutils-8.16/configure.ac.orig 2014-03-18 20:12:23.362356112 -0700 ++++ coreutils-8.16/configure.ac 2014-03-18 20:13:47.327463395 -0700 +@@ -240,6 +240,13 @@ + AC_DEFINE([LOCALTIME_CACHE], [1], [FIXME]) + fi + ++# Assume that if getattrat exists, it's compatible with Solaris 11. ++AC_CHECK_FUNCS([getattrat]) ++if test $ac_cv_func_getattrat = yes; then ++ LIB_NVPAIR=-lnvpair ++ AC_SUBST([LIB_NVPAIR]) ++fi ++ + # SCO-ODT-3.0 is reported to need -los to link programs using initgroups + AC_CHECK_FUNCS([initgroups]) + if test $ac_cv_func_initgroups = no; then +--- coreutils-8.16/src/Makefile.am.orig 2014-03-18 20:19:34.447566111 -0700 ++++ coreutils-8.16/src/Makefile.am 2014-03-18 20:20:20.876086076 -0700 +@@ -326,6 +326,9 @@ + runcon_LDADD += $(LIB_SELINUX) + stat_LDADD += $(LIB_SELINUX) + ++# for nvlist_lookup_uint64_array ++stat_LDADD += $(LIB_NVPAIR) ++ + # for gettime, settime, utimecmp, utimens + copy_LDADD += $(LIB_CLOCK_GETTIME) + date_LDADD += $(LIB_CLOCK_GETTIME) +--- coreutils-8.16/src/stat.c.orig 2014-03-16 16:55:52.605732676 -0700 ++++ coreutils-8.16/src/stat.c 2014-03-18 20:27:04.302699124 -0700 +@@ -148,6 +148,11 @@ + # endif + #endif + ++#if HAVE_GETATTRAT ++# include ++# include ++#endif ++ + /* FIXME: these are used by printf.c, too */ + #define isodigit(c) ('0' <= (c) && (c) <= '7') + #define octtobin(c) ((c) - '0') +@@ -689,7 +694,7 @@ + /* Print statfs info. Return zero upon success, nonzero upon failure. */ + static bool ATTRIBUTE_WARN_UNUSED_RESULT + print_statfs (char *pformat, size_t prefix_len, unsigned int m, +- char const *filename, ++ int fd, char const *filename, + void const *data) + { + STRUCT_STATVFS const *statfsbuf = data; +@@ -861,6 +866,38 @@ + return fail; + } + ++static struct timespec ++get_birthtime (int fd, char const *filename, struct stat const *st) ++{ ++ struct timespec ts = get_stat_birthtime (st); ++ ++#if HAVE_GETATTRAT ++ if (ts.tv_nsec < 0) ++ { ++ nvlist_t *response; ++ if ((fd < 0 ++ ? getattrat (AT_FDCWD, XATTR_VIEW_READWRITE, filename, &response) ++ : fgetattr (fd, XATTR_VIEW_READWRITE, &response)) ++ == 0) ++ { ++ uint64_t *val; ++ uint_t n; ++ if (nvlist_lookup_uint64_array (response, A_CRTIME, &val, &n) == 0 ++ && 2 <= n ++ && val[0] <= TYPE_MAXIMUM (time_t) ++ && val[1] < 1000000000 * 2 /* for leap seconds */) ++ { ++ ts.tv_sec = val[0]; ++ ts.tv_nsec = val[1]; ++ } ++ nvlist_free (response); ++ } ++ } ++#endif ++ ++ return ts; ++} ++ + /* Map a TS with negative TS.tv_nsec to {0,0}. */ + static inline struct timespec + neg_to_zero (struct timespec ts) +@@ -874,7 +911,7 @@ + /* Print stat info. Return zero upon success, nonzero upon failure. */ + static bool + print_stat (char *pformat, size_t prefix_len, unsigned int m, +- char const *filename, void const *data) ++ int fd, char const *filename, void const *data) + { + struct stat *statbuf = (struct stat *) data; + struct passwd *pw_ent; +@@ -967,7 +1004,7 @@ + break; + case 'w': + { +- struct timespec t = get_stat_birthtime (statbuf); ++ struct timespec t = get_birthtime (fd, filename, statbuf); + if (t.tv_nsec < 0) + out_string (pformat, prefix_len, "-"); + else +@@ -976,7 +1013,7 @@ + break; + case 'W': + out_epoch_sec (pformat, prefix_len, statbuf, +- neg_to_zero (get_stat_birthtime (statbuf))); ++ neg_to_zero (get_birthtime (fd, filename, statbuf))); + break; + case 'x': + out_string (pformat, prefix_len, human_time (get_stat_atime (statbuf))); +@@ -1051,9 +1088,9 @@ + calling PRINT_FUNC for each %-directive encountered. + Return zero upon success, nonzero upon failure. */ + static bool ATTRIBUTE_WARN_UNUSED_RESULT +-print_it (char const *format, char const *filename, ++print_it (char const *format, int fd, char const *filename, + bool (*print_func) (char *, size_t, unsigned int, +- char const *, void const *), ++ int, char const *, void const *), + void const *data) + { + bool fail = false; +@@ -1102,7 +1139,8 @@ + putchar ('%'); + break; + default: +- fail |= print_func (dest, len + 1, fmt_code, filename, data); ++ fail |= print_func (dest, len + 1, fmt_code, ++ fd, filename, data); + break; + } + break; +@@ -1185,7 +1223,7 @@ + return false; + } + +- bool fail = print_it (format, filename, print_statfs, &statfsbuf); ++ bool fail = print_it (format, -1, filename, print_statfs, &statfsbuf); + return ! fail; + } + +@@ -1194,11 +1232,12 @@ + do_stat (char const *filename, char const *format, + char const *format2) + { ++ int fd = STREQ (filename, "-") ? 0 : -1; + struct stat statbuf; + +- if (STREQ (filename, "-")) ++ if (0 <= fd) + { +- if (fstat (STDIN_FILENO, &statbuf) != 0) ++ if (fstat (fd, &statbuf) != 0) + { + error (0, errno, _("cannot stat standard input")); + return false; +@@ -1218,7 +1257,7 @@ + if (S_ISBLK (statbuf.st_mode) || S_ISCHR (statbuf.st_mode)) + format = format2; + +- bool fail = print_it (format, filename, print_stat, &statbuf); ++ bool fail = print_it (format, fd, filename, print_stat, &statbuf); + return ! fail; + } + diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/patches/stdbuf-configure.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/coreutils/patches/stdbuf-configure.patch Fri Jan 08 12:18:38 2016 -0800 @@ -0,0 +1,25 @@ +Always build stdbuf irrespective of whether this is an ELF system. + +These changes have already been accepted upstream. + +--- coreutils-8.16/configure.ac.orig 2014-03-18 20:59:59.283886213 -0700 ++++ coreutils-8.16/configure.ac 2014-03-18 21:02:30.881534195 -0700 +@@ -395,16 +395,13 @@ + gl_ADD_PROG([optional_bin_progs], [df]) + fi + +-# Limit stdbuf to ELF systems with GCC + AC_MSG_CHECKING([whether this is an ELF system]) + AC_EGREP_CPP([yes], [#if __ELF__ + yes + #endif], [elf_sys=yes], [elf_sys=no]) + AC_MSG_RESULT([$elf_sys]) +-if test "$elf_sys" = "yes" && \ +- test "$GCC" = "yes"; then +- gl_ADD_PROG([optional_bin_progs], [stdbuf]) +-fi ++gl_ADD_PROG([optional_bin_progs], [stdbuf]) ++gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so]) + + ############################################################################ + mk="$srcdir/src/Makefile.am" diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/patches/stdbuf.c.patch --- a/components/coreutils/patches/stdbuf.c.patch Fri Jan 08 00:23:49 2016 -0800 +++ b/components/coreutils/patches/stdbuf.c.patch Fri Jan 08 12:18:38 2016 -0800 @@ -2,6 +2,9 @@ for both 32-bit and 64-bit applications. See comment in the patch for more details. +This change has been passed upstream, but the GNU coreutils maintainer +turned it into a comment explaining why it's not included by default. + --- 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 @@ diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/patches/tests-misc-expr.patch --- a/components/coreutils/patches/tests-misc-expr.patch Fri Jan 08 00:23:49 2016 -0800 +++ b/components/coreutils/patches/tests-misc-expr.patch Fri Jan 08 12:18:38 2016 -0800 @@ -1,3 +1,16 @@ +The tests/misc/expr test is broken by default in version 8.16. + +Looking at the ChangeLog for GNU coreutils 8.19, I found: + +2012-04-03 Jim Meyering +... + tests: avoid spurious misc/expr failure on AIX 6.1 + * tests/misc/expr: Avoid spurious failure on AIX 6.1 due to + differing regexp diagnostic. Reported by Michael Felt. + +If I use the .../tests/misc/expr test script from 8.19, it works fine. +So I've added the 'tests-misc-expr.patch' file to do just that. + --- coreutils-8.16/tests/misc/expr.orig 2012-09-03 07:18:28.214998564 -0700 +++ coreutils-8.16/tests/misc/expr 2012-09-03 07:22:12.547808280 -0700 @@ -140,7 +140,11 @@ diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/patches/uptime.1.patch --- a/components/coreutils/patches/uptime.1.patch Fri Jan 08 00:23:49 2016 -0800 +++ b/components/coreutils/patches/uptime.1.patch Fri Jan 08 12:18:38 2016 -0800 @@ -1,3 +1,8 @@ +Adjustment to the uptime man page for Solaris specific files. + +This patch has not been passed upstream yet. It needs to be reworked into +a format that would be acceptable. + --- coreutils-8.5/man/uptime.1.orig Tue Nov 22 09:28:45 2011 +++ coreutils-8.5/man/uptime.1 Tue Nov 22 09:30:49 2011 @@ -12,7 +12,7 @@ diff -r bb1d032b7f7e -r 8a7aa7f8367e components/coreutils/patches/who.c.patch --- a/components/coreutils/patches/who.c.patch Fri Jan 08 00:23:49 2016 -0800 +++ b/components/coreutils/patches/who.c.patch Fri Jan 08 12:18:38 2016 -0800 @@ -1,3 +1,9 @@ +Needed so that GNU 'who -r' correctly prints the run-level. +See CR #15651288 for more details. + +This patch has not been passed upstream yet. It needs to be reworked into +a format that would be acceptable. + --- coreutils-8.5/src/who.c.orig Thu Nov 10 07:54:27 2011 +++ coreutils-8.5/src/who.c Thu Nov 10 07:55:13 2011 @@ -524,8 +524,8 @@