summaryrefslogtreecommitdiff
path: root/harmony/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'harmony/coreutils')
-rw-r--r--harmony/coreutils/051_all_coreutils-mangen.patch120
-rw-r--r--harmony/coreutils/APKBUILD79
-rw-r--r--harmony/coreutils/coreutils.post-deinstall4
-rw-r--r--harmony/coreutils/disable-mbrtowc-test.patch10
-rw-r--r--harmony/coreutils/localename-test-fix.patch34
-rw-r--r--harmony/coreutils/no-doc.patch22
-rw-r--r--harmony/coreutils/printf-musl.patch53
-rw-r--r--harmony/coreutils/seq-write-error.patch45
-rw-r--r--harmony/coreutils/sort-debug-locale.patch79
9 files changed, 446 insertions, 0 deletions
diff --git a/harmony/coreutils/051_all_coreutils-mangen.patch b/harmony/coreutils/051_all_coreutils-mangen.patch
new file mode 100644
index 000000000..388924d06
--- /dev/null
+++ b/harmony/coreutils/051_all_coreutils-mangen.patch
@@ -0,0 +1,120 @@
+--- coreutils-8.27/Makefile.in.old 2017-03-08 23:24:51.000000000 -0600
++++ coreutils-8.27/Makefile.in 2017-08-24 23:01:09.582964705 -0500
+@@ -14647,117 +14647,6 @@
+ distclean-local:
+ test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS)
+
+-$(ALL_MANS): $(mandeps)
+-# Most prog.1 man pages depend on src/prog. List the exceptions:
+-@SINGLE_BINARY_FALSE@man/install.1: src/ginstall$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/test.1: src/[$(EXEEXT)
+-
+-@SINGLE_BINARY_FALSE@man/arch.1: src/arch$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/b2sum.1: src/b2sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/base32.1: src/base32$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/base64.1: src/base64$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/basename.1: src/basename$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/cat.1: src/cat$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/chcon.1: src/chcon$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/chgrp.1: src/chgrp$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/chmod.1: src/chmod$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/chown.1: src/chown$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/chroot.1: src/chroot$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/cksum.1: src/cksum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/comm.1: src/comm$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/coreutils.1: src/coreutils$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/cp.1: src/cp$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/csplit.1: src/csplit$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/cut.1: src/cut$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/date.1: src/date$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/dd.1: src/dd$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/df.1: src/df$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/dir.1: src/dir$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/dircolors.1: src/dircolors$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/dirname.1: src/dirname$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/du.1: src/du$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/echo.1: src/echo$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/env.1: src/env$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/expand.1: src/expand$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/expr.1: src/expr$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/factor.1: src/factor$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/false.1: src/false$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/fmt.1: src/fmt$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/fold.1: src/fold$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/groups.1: src/groups$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/head.1: src/head$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/hostid.1: src/hostid$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/hostname.1: src/hostname$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/id.1: src/id$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/join.1: src/join$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/kill.1: src/kill$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/link.1: src/link$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/ln.1: src/ln$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/logname.1: src/logname$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/ls.1: src/ls$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/md5sum.1: src/md5sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/mkdir.1: src/mkdir$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/mkfifo.1: src/mkfifo$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/mknod.1: src/mknod$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/mktemp.1: src/mktemp$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/mv.1: src/mv$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/nice.1: src/nice$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/nl.1: src/nl$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/nohup.1: src/nohup$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/nproc.1: src/nproc$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/numfmt.1: src/numfmt$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/od.1: src/od$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/paste.1: src/paste$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/pathchk.1: src/pathchk$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/pinky.1: src/pinky$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/pr.1: src/pr$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/printenv.1: src/printenv$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/printf.1: src/printf$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/ptx.1: src/ptx$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/pwd.1: src/pwd$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/readlink.1: src/readlink$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/realpath.1: src/realpath$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/rm.1: src/rm$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/rmdir.1: src/rmdir$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/runcon.1: src/runcon$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/seq.1: src/seq$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sha1sum.1: src/sha1sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sha224sum.1: src/sha224sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sha256sum.1: src/sha256sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sha384sum.1: src/sha384sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sha512sum.1: src/sha512sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/shred.1: src/shred$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/shuf.1: src/shuf$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sleep.1: src/sleep$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sort.1: src/sort$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/split.1: src/split$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/stat.1: src/stat$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/stdbuf.1: src/stdbuf$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/stty.1: src/stty$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sum.1: src/sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sync.1: src/sync$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tac.1: src/tac$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tail.1: src/tail$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tee.1: src/tee$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/timeout.1: src/timeout$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/touch.1: src/touch$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tr.1: src/tr$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/true.1: src/true$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/truncate.1: src/truncate$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tsort.1: src/tsort$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tty.1: src/tty$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/uname.1: src/uname$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/unexpand.1: src/unexpand$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/uniq.1: src/uniq$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/unlink.1: src/unlink$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/uptime.1: src/uptime$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/users.1: src/users$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/vdir.1: src/vdir$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/wc.1: src/wc$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/who.1: src/who$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/whoami.1: src/whoami$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/yes.1: src/yes$(EXEEXT)
+-
+ .x.1:
+ $(AM_V_GEN)name=`echo $@ | sed 's|.*/||; s|\.1$$||'` || exit 1; \
+ case $$name in \
diff --git a/harmony/coreutils/APKBUILD b/harmony/coreutils/APKBUILD
new file mode 100644
index 000000000..c92568720
--- /dev/null
+++ b/harmony/coreutils/APKBUILD
@@ -0,0 +1,79 @@
+# Contributor: Valery Kartel <valery.kartel@gmail.com>
+# Contributor: Michael Mason <ms13sp@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=coreutils
+pkgver=8.28
+pkgrel=0
+pkgdesc="The basic file, shell and text manipulation utilities"
+url="http://www.gnu.org/software/coreutils/"
+arch="all"
+license="GPL3+"
+options="!checkroot"
+makedepends="bash acl-dev attr-dev gettext-dev"
+[ ${CBUILD} == ${CHOST} ] && makedepends="$makedepends perl"
+subpackages="$pkgname-doc"
+[ ${CBUILD} == ${CHOST} ] && subpackages="$subpackages $pkgname-lang"
+install="$pkgname.post-deinstall"
+source="http://ftp.gnu.org/gnu/coreutils/$pkgname-$pkgver.tar.xz
+ disable-mbrtowc-test.patch
+ localename-test-fix.patch
+ "
+[ ${CBUILD} != ${CHOST} ] && source="$source
+ 051_all_coreutils-mangen.patch
+ "
+
+builddir="$srcdir"/$pkgname-$pkgver
+
+build() {
+ cd "$builddir"
+ LIBS="-lrt" ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --enable-nls \
+ --without-gmp \
+ --enable-no-install-program=hostname,su,kill,uptime \
+ --with-packager="Adélie" \
+ --with-packager-bug-reports="https://bts.adelielinux.org/"
+ if [ ${CBUILD} != ${CHOST} ]; then
+ set -- man/*.x
+ touch ${@/%x/1}
+ fi
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+
+ rm -rf "$pkgdir"/usr/lib/charset.alias
+ rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
+
+ install -d "$pkgdir"/bin "$pkgdir"/usr/sbin
+ cd "$pkgdir"/usr/bin/
+
+ # binaries that busybox puts in /bin
+ mv base64 cat chgrp chmod chown cp date dd df 'echo' false ln ls \
+ mkdir mknod mktemp mv nice printenv pwd rm rmdir sleep stat \
+ stty sync touch true uname \
+ "$pkgdir"/bin
+
+ mv chroot "$pkgdir"/usr/sbin/
+}
+
+sha512sums="1e592d0dd03b9227bf92af9a82bed6dc3bcbee46e984c7fb09833dea0962e86b309aa34d5e43823b73d4522c066bfa5cdc8ec694aa190910fb246ff32ceb63a1 coreutils-8.28.tar.xz
+532ef8210261437855ba3e2fc72ec57b0e0252b2b0f7817990c9629613ece2cdd86cf30aa049f3cff6fbda12ed3bb9a0db3a3642475378ae44ce319bdf005d9b disable-mbrtowc-test.patch
+00a517c7e3e2206ba7a60f9126d28ae1d549e86da62b48f32250d49c2caf896c53fc3d803729b544a1cfb1609dd8cb7cb4b3473defef5d1e2c154ed1de6bc5de localename-test-fix.patch"
+
+[ ${CBUILD} != ${CHOST} ] && sha512sums="$sha512sums
+bae804f057252c25452ac178c545dc2c4b4775cbfbdcfd4775edd1a4ed6507882bfac39e2b11ad01b74230ca48d761bf62f11bde5bcbc35a6e5a61cbe4a46e36 051_all_coreutils-mangen.patch
+"
+return 0
diff --git a/harmony/coreutils/coreutils.post-deinstall b/harmony/coreutils/coreutils.post-deinstall
new file mode 100644
index 000000000..24e0bdf25
--- /dev/null
+++ b/harmony/coreutils/coreutils.post-deinstall
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# other post scripts might need rm so we don't wait for the trigger
+exec /bin/busybox --install -s
diff --git a/harmony/coreutils/disable-mbrtowc-test.patch b/harmony/coreutils/disable-mbrtowc-test.patch
new file mode 100644
index 000000000..d338e0324
--- /dev/null
+++ b/harmony/coreutils/disable-mbrtowc-test.patch
@@ -0,0 +1,10 @@
+--- coreutils-8.27/gnulib-tests/test-mbrtowc5.sh.old 2016-12-31 13:54:43.000000000 +0000
++++ coreutils-8.27/gnulib-tests/test-mbrtowc5.sh 2017-07-30 17:29:50.879924130 +0000
+@@ -1,6 +1,2 @@
+ #!/bin/sh
+-# Test whether the POSIX locale has encoding errors.
+-LC_ALL=C \
+-./test-mbrtowc${EXEEXT} 5 || exit
+-LC_ALL=POSIX \
+-./test-mbrtowc${EXEEXT} 5
++exit 77
diff --git a/harmony/coreutils/localename-test-fix.patch b/harmony/coreutils/localename-test-fix.patch
new file mode 100644
index 000000000..f90d11866
--- /dev/null
+++ b/harmony/coreutils/localename-test-fix.patch
@@ -0,0 +1,34 @@
+--- coreutils-8.27/gnulib-tests/localename.c.old 2016-12-31 13:54:43.000000000 +0000
++++ coreutils-8.27/gnulib-tests/localename.c 2017-07-30 16:40:47.098541270 +0000
+@@ -40,7 +40,7 @@
+ # if defined __APPLE__ && defined __MACH__
+ # include <xlocale.h>
+ # endif
+-# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || defined __CYGWIN__
++# if (defined __linux__ && !defined __UCLIBC__) || defined __CYGWIN__
+ # include <langinfo.h>
+ # endif
+ # if !defined IN_LIBINTL
+@@ -2692,16 +2692,19 @@
+ locale_t thread_locale = uselocale (NULL);
+ if (thread_locale != LC_GLOBAL_LOCALE)
+ {
+-# if __GLIBC__ >= 2 && !defined __UCLIBC__
++# if defined(_NL_LOCALE_NAME)
++ const char *name = nl_langinfo(_NL_LOCALE_NAME(category));
++# if __GLIBC__ >= 2 && !defined __UCLIBC__
+ /* Work around an incorrect definition of the _NL_LOCALE_NAME macro in
+ glibc < 2.12.
+ See <http://sourceware.org/bugzilla/show_bug.cgi?id=10968>. */
+- const char *name =
+- nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1)));
++ if (name[0] == '\0')
++ name = nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1)));
+ if (name[0] == '\0')
+ /* Fallback code for glibc < 2.4, which did not implement
+ nl_langinfo (_NL_LOCALE_NAME (category)). */
+ name = thread_locale->__names[category];
++# endif
+ return name;
+ # elif defined __FreeBSD__ || (defined __APPLE__ && defined __MACH__)
+ /* FreeBSD, Mac OS X */
diff --git a/harmony/coreutils/no-doc.patch b/harmony/coreutils/no-doc.patch
new file mode 100644
index 000000000..a1d74623b
--- /dev/null
+++ b/harmony/coreutils/no-doc.patch
@@ -0,0 +1,22 @@
+--- coreutils-8.27/Makefile.in.old 2017-03-09 05:24:51.000000000 +0000
++++ coreutils-8.27/Makefile.in 2017-06-22 03:07:59.568716258 +0000
+@@ -2363,7 +2363,7 @@
+ }
+ man1dir = $(mandir)/man1
+ NROFF = nroff
+-MANS = $(man1_MANS)
++MANS =
+ HEADERS = $(noinst_HEADERS)
+ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+--- coreutils-8.27/Makefile.in.old 2017-06-22 03:08:55.821951666 +0000
++++ coreutils-8.27/Makefile.in 2017-06-22 03:19:51.770820411 +0000
+@@ -12192,7 +12192,7 @@
+
+ info-am: $(INFO_DEPS)
+
+-install-data-am: install-info-am install-man
++install-data-am: install-info-am
+
+ install-dvi: install-dvi-recursive
+
diff --git a/harmony/coreutils/printf-musl.patch b/harmony/coreutils/printf-musl.patch
new file mode 100644
index 000000000..28a951635
--- /dev/null
+++ b/harmony/coreutils/printf-musl.patch
@@ -0,0 +1,53 @@
+From ad5c14dcadd4603363e68da960ed0101b61439bd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
+Date: Sat, 12 Aug 2017 23:53:33 -0700
+Subject: [PATCH] tests: fix false failure with large printf formats
+
+* tests/misc/printf-surprise.sh: With musl libc the
+large printf format does succeed, outputting data.
+To avoid SIGPIPE being generated we ignore that signal
+and then handle the subsequent EPIPE error.
+Reported by A. Wilcox
+---
+ tests/misc/printf-surprise.sh | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/tests/misc/printf-surprise.sh b/tests/misc/printf-surprise.sh
+index 2edd34c..46c0d8f 100755
+--- a/tests/misc/printf-surprise.sh
++++ b/tests/misc/printf-surprise.sh
+@@ -50,6 +50,9 @@ vm=$(get_min_ulimit_v_ env $prog %20f 0) \
+
+ mkfifo_or_skip_ fifo
+
++(trap '' PIPE && yes | :) 2>&1 | grep -qF 'Broken pipe' ||
++ skip_ 'trapping SIGPIPE is not supported'
++
+ # Disable MALLOC_PERTURB_, to avoid triggering this bug
+ # https://bugs.debian.org/481543#77
+ export MALLOC_PERTURB_=0
+@@ -60,11 +63,11 @@ cleanup_() { kill $pid 2>/dev/null && wait $pid; }
+ head -c 10 fifo > out & pid=$!
+
+ # Trigger large mem allocation failure
+-( ulimit -v $vm && env $prog %20000000f 0 2>err-msg > fifo )
++( trap '' PIPE && ulimit -v $vm && env $prog %20000000f 0 2>err-msg > fifo )
+ exit=$?
+
+ # Map this longer, and rarer, diagnostic to the common one.
+-# printf: cannot perform formatted output: Cannot allocate memory" \
++# printf: cannot perform formatted output: Cannot allocate memory"
+ sed 's/cannot perform .*/write error/' err-msg > k && mv k err-msg
+ err_msg=$(tr '\n' : < err-msg)
+
+@@ -81,6 +84,7 @@ n_out=$(wc -c < out)
+
+ case $n_out:$diagnostic:$exit in
+ 10:n:0) ;; # ok, succeeds w/no diagnostic: FreeBSD 6.1
++ 10:y:1) ;; # ok, fails with EPIPE diagnostic: musl libc
+ 0:y:1) ;; # ok, glibc-2.8 and newer, when printf(3) fails with ENOMEM
+
+ # With MALLOC_PERTURB_=0, this no longer happens.
+--
+2.9.3
+
diff --git a/harmony/coreutils/seq-write-error.patch b/harmony/coreutils/seq-write-error.patch
new file mode 100644
index 000000000..4892a82ec
--- /dev/null
+++ b/harmony/coreutils/seq-write-error.patch
@@ -0,0 +1,45 @@
+From 1e1dbbe0f95c7170009f3ba4d8380c1b98ff53c8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
+Date: Sun, 13 Aug 2017 00:18:43 -0700
+Subject: [PATCH] seq: produce consistent error messages upon write error
+
+* src/seq.c (io_error): Use the same error message as would
+be generated at exit time when closing the stdout stream.
+The inconsistency was added with commit v8.25-26-gc92585b.
+This was noticed due to an inconsistency in the expected
+error message generated by seq on musl libc.
+Reported by A. Wilcox.
+---
+ src/seq.c | 2 +-
+ tests/misc/seq-epipe.sh | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/seq.c b/src/seq.c
+index bb191ba..5e5b381 100644
+--- a/src/seq.c
++++ b/src/seq.c
+@@ -284,7 +284,7 @@ io_error (void)
+ {
+ /* FIXME: consider option to silently ignore errno=EPIPE */
+ clearerr (stdout);
+- die (EXIT_FAILURE, errno, _("standard output"));
++ die (EXIT_FAILURE, errno, _("write error"));
+ }
+
+ /* Actually print the sequence of numbers in the specified range, with the
+diff --git a/tests/misc/seq-epipe.sh b/tests/misc/seq-epipe.sh
+index edbd563..69dd75d 100755
+--- a/tests/misc/seq-epipe.sh
++++ b/tests/misc/seq-epipe.sh
+@@ -33,7 +33,7 @@ compare exp code || fail=1
+
+ # The error message must begin with "standard output:"
+ # (but don't hard-code the strerror text)
+-grep '^seq: standard output: ' err \
++grep '^seq: write error: ' err \
+ || { warn_ "seq emitted incorrect error on EPIPE"; \
+ cat err;\
+ fail=1; }
+--
+2.9.3
+
diff --git a/harmony/coreutils/sort-debug-locale.patch b/harmony/coreutils/sort-debug-locale.patch
new file mode 100644
index 000000000..27921abbd
--- /dev/null
+++ b/harmony/coreutils/sort-debug-locale.patch
@@ -0,0 +1,79 @@
+From b938d8966c3d1afec9730d403fd6a6eb4d856b85 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
+Date: Sun, 13 Aug 2017 00:45:32 -0700
+Subject: [PATCH] sort: handle musl locale differences in --debug reporting
+
+* src/sort.c (main): Don't assume hard_LC_COLLATE implies
+a successful setting of the locale as musl defaults to
+UTF8 when failing to set the specified locale.
+* tests/misc/sort-debug-warn.sh: Adjust for the now
+separated locale debug info and map the musl specific
+message back to the common case.
+Reported by A. Wilcox.
+---
+ src/sort.c | 17 +++++++++--------
+ tests/misc/sort-debug-warn.sh | 9 +++++++--
+ 2 files changed, 16 insertions(+), 10 deletions(-)
+
+diff --git a/src/sort.c b/src/sort.c
+index 015e40e..ba6ceac 100644
+--- a/src/sort.c
++++ b/src/sort.c
+@@ -4675,18 +4675,19 @@ main (int argc, char **argv)
+
+ /* Always output the locale in debug mode, since this
+ is such a common source of confusion. */
++
++ /* OpenBSD can only set some categories with LC_ALL above,
++ so set LC_COLLATE explicitly to flag errors. */
++ if (locale_ok)
++ locale_ok = !! setlocale (LC_COLLATE, "");
++ if (! locale_ok)
++ error (0, 0, "%s", _("failed to set locale"));
+ if (hard_LC_COLLATE)
+ error (0, 0, _("using %s sorting rules"),
+ quote (setlocale (LC_COLLATE, NULL)));
+ else
+- {
+- /* OpenBSD can only set some categories with LC_ALL above,
+- so set LC_COLLATE explicitly to flag errors. */
+- if (locale_ok)
+- locale_ok = !! setlocale (LC_COLLATE, "");
+- error (0, 0, "%s%s", locale_ok ? "" : _("failed to set locale; "),
+- _("using simple byte comparison"));
+- }
++ error (0, 0, "%s", _("using simple byte comparison"));
++
+ key_warnings (&gkey, gkey_only);
+ }
+
+diff --git a/tests/misc/sort-debug-warn.sh b/tests/misc/sort-debug-warn.sh
+index 3602c84..8119693 100755
+--- a/tests/misc/sort-debug-warn.sh
++++ b/tests/misc/sort-debug-warn.sh
+@@ -71,7 +71,8 @@ sort: using simple byte comparison
+ 17
+ sort: using simple byte comparison
+ 18
+-sort: failed to set locale; using simple byte comparison
++sort: failed to set locale
++sort: using simple byte comparison
+ EOF
+
+ echo 1 >> out
+@@ -109,7 +110,11 @@ sort -rM --debug /dev/null 2>>out #no warning
+ echo 17 >> out
+ sort -rM -k1,1 --debug /dev/null 2>>out #no warning
+ echo 18 >> out
+-LC_ALL=missing sort --debug /dev/null 2>>out
++LC_ALL=missing sort --debug /dev/null 2>>out.t
++# musl libc accepts "missing" and implicitly uses UTF8,
++# so adjust the expected message accordingly.
++sed 's/using .*missing.* sorting rules/using simple byte comparison/' \
++ out.t >>out
+
+ compare exp out || fail=1
+
+--
+2.9.3
+