public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/coreutils/files/, sys-apps/coreutils/
@ 2016-04-18 15:29 Michael Haubenwallner
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Haubenwallner @ 2016-04-18 15:29 UTC (permalink / raw
  To: gentoo-commits

commit:     c78b8a7c6373927cbc35e0afe0a4771804e6919c
Author:     Michael Haubenwallner <michael.haubenwallner <AT> ssi-schaefer <DOT> com>
AuthorDate: Mon Apr 18 15:28:28 2016 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Apr 18 15:28:28 2016 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=c78b8a7c

coreutils-8.25: add Cygwin patch

 sys-apps/coreutils/Manifest                        |    2 +-
 sys-apps/coreutils/coreutils-8.25.ebuild           |    7 +
 .../coreutils/files/coreutils-8.25-cygwin-3.patch  | 1407 ++++++++++++++++++++
 3 files changed, 1415 insertions(+), 1 deletion(-)

diff --git a/sys-apps/coreutils/Manifest b/sys-apps/coreutils/Manifest
index 0b97bc7..98f2d6b 100644
--- a/sys-apps/coreutils/Manifest
+++ b/sys-apps/coreutils/Manifest
@@ -27,5 +27,5 @@ EBUILD coreutils-8.22-r1.ebuild 6015 SHA256 08c11cfbd5947d24c48ef169ebf0fe2bc87e
 EBUILD coreutils-8.22.ebuild 6317 SHA256 7962673e3eeece23fa543eeec7f4ebc9d3bc14254ddc5c98d1c1778508121b9b SHA512 63203170b5378158fed7fdfdb203e3fddf4ac8be79428e7fe4eb475fc800870a9ecda12dcc63a37dfe811aa57b543b414dad847568b18a00f63bbd5a88446914 WHIRLPOOL 45f47540f7114f3e45e41fa36d4d1cace21bafbadac80d29ad6372487f63d9f36537ee03b7a0a4923e743d3294c17a7e1cb96c8ef42e386706bd152a58d2aa28
 EBUILD coreutils-8.23-r00.1.ebuild 6267 SHA256 53c2a4bef763782b3dc6f9c00a3b32ca37dd9fcc1c8096fd41633e2a91e2eb4e SHA512 dc5f1f83dc592a6e0fbf37afb3494d7300f34f63a9b81f8eee08c6f5d2826487fb1c06d3c94ababd6e3ce4430737ffa917ffa00e77e2e51ed07b156d21b45e6d WHIRLPOOL 49548aad93722d42720dd3bd99fdc6eba76eb272cc320e49875a1dc784cc411eadfe2048d0399e8936c26c360861b30c92a0975186e8de008233ca48bbddd4c3
 EBUILD coreutils-8.24.ebuild 6596 SHA256 1e82dda3c1a0b1b6c47af214dffac24ffee45bc19efdd2c403e05890267d078b SHA512 e78d9f8f6e99a767cbc809126284161643af220808753adff57b52e129686ee3a208e7d1742694fd0dd8f3b28d238df759169866da861b7539e9a79b490bd930 WHIRLPOOL 08e2b1ce22af8a0b3b40b62dfc0b6fb739bd22b5db349874ff2c9b70cb14fa247bbb2c896b4db9564f5e6466d62b2483a96fb3c58c2e781419eedb6373108e37
-EBUILD coreutils-8.25.ebuild 6563 SHA256 7e2d7d2b1f87e0c35c95ab595ddee1c5053a666a93d2de4826fb4c427d034cc7 SHA512 7180fe2b3a446659824226111f24516178dbb8e51ec631c346c2a9fdaab6302ee4353eb3e7c1ff1d1344480ec333438f5c04360af2507400039ea975d4b5120d WHIRLPOOL aceacf2b77b3311d96ea4fc1da77181d0b325a6e54ee4ae7232e5bd48d2505486b2a5046561baa6b4239c64af057d2960785e29624b4a0a519fca90e47bc9759
+EBUILD coreutils-8.25.ebuild 6851 SHA256 d3b1a63c2358050268bd664c688d4aa7fece44df146af9133e52bb23a493f152 SHA512 9726525fa87d75d972c6e29032f63808167f8f6dbc83c0cf658cbb29dd1c12f34e4bcad63697f9b76801d108324036d30f7642bd0a74279e697e3640a9a18b4c
 MISC metadata.xml 668 SHA256 5861c2e0c2723f166f6c52bd9726f5d5020286f6e475c4746516f0cfd59ebe47 SHA512 347e830a93a0fcbaa2ab9104761ad0e0c42dbbe28d4cf29fc953bc21055051afd3c8e0ab0dbecf5c27faf1335f82b3601be78cc8980365b85db5a7a86419bb1c WHIRLPOOL 091d55503649ee267113ab47f3192b5740961b18f1f542d4ffacded2f7ccfff528ac31ac771b9da220d3486dc10812b91c26a8f6859b4cc51a55d2c2648419ea

diff --git a/sys-apps/coreutils/coreutils-8.25.ebuild b/sys-apps/coreutils/coreutils-8.25.ebuild
index ef6ae84..b34f290 100644
--- a/sys-apps/coreutils/coreutils-8.25.ebuild
+++ b/sys-apps/coreutils/coreutils-8.25.ebuild
@@ -67,6 +67,9 @@ src_prepare() {
 			-e "/src_libstdbuf_so_LDFLAGS = -shared/s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/libexec/coreutils/libstdbuf.dylib:" \
 			Makefile.in \
 			|| die
+	elif use elibc_Cygwin ; then
+		epatch "${FILESDIR}"/${P}-cygwin-3.patch
+		sed -i -e 's|\(libstdbuf\.so\)$(EXEEXT)|\1|g' Makefile.in || die
 	fi
 	sed -i \
 		-e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \
@@ -183,6 +186,10 @@ src_install() {
 		rm -rf "${ED}"/usr/share/man
 	fi
 
+	if use elibc_Cygwin ; then
+		! use kill || mv "${ED}"/bin/{,g}kill || die
+		mv "${ED}"/usr/libexec/${PN}/libstdbuf$(get_libname){.exe,} || die
+	fi
 }
 
 pkg_postinst() {

diff --git a/sys-apps/coreutils/files/coreutils-8.25-cygwin-3.patch b/sys-apps/coreutils/files/coreutils-8.25-cygwin-3.patch
new file mode 100644
index 0000000..3319b1b
--- /dev/null
+++ b/sys-apps/coreutils/files/coreutils-8.25-cygwin-3.patch
@@ -0,0 +1,1407 @@
+This is a copy of coreutils-8.25-3.src.patch from the official Cygwin
+coreutils-8.25-3 source package, modified to avoid re-running autotools:
+
+* Hunks for ./configure.ac go to ./configure instead.
+* Hunks for ./lib/local.mk go to ./Makefile.in instead.
+
+--- origsrc/coreutils-8.25/ChangeLog	2016-01-20 03:55:17.000000000 -0700
++++ src/coreutils-8.25/ChangeLog	2016-04-12 12:50:05.042257400 -0600
+@@ -1,3 +1,235 @@
++2016-03-08  Eric Blake <eblake@redhat.com>
++
++	Cygwin release 8.25-1.
++	* lib/set-permissions.c (set_acls_from_mode): Fix missing return.
++
++2015-08-26  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.24-3.
++	* lib/cygwin.c (cygwin_spelling): Fix uninitialized variable that
++	broke 'cp -r' depending on stack contents.
++
++2015-08-26  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.24-2.
++	Enable stdbuf (requires hacks to Makefile.in).
++
++
++2015-08-25  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.24-1.
++
++2014-09-24  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.23-3.
++	* lib/cygwin.c (cygwin_spelling): Skip .exe magic if .exe is
++	already present.  Also honor .exe magic on symlinks.
++	* lib/same.c (same_name): Treat files as same if only difference
++	is .exe magic.
++	* src/copy.c (copy): Move symlink special casing here.
++	* src/install.c (strip): Update caller.
++	* src/ls.c (gobble_file): Likewise.
++	* src/stat.c (do_statfs, do_stat): Likewise.
++
++2014-08-12  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.23-2.
++	Drop hostname.
++
++2014-08-01  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.23-1.
++	* configure.ac: Disable stdbuf.
++	* lib/local.mk: Upstream switched to flat make, impacting how
++	we build local cygwin.c code.
++	* lib/canonicalize.c: Accepted upstream.
++	* lib/file-has-acl.c: Likewise.
++	* src/realpath.c: Likewise.
++	* src/su.c: Upstream dropped su.
++	* src/Makefile.am: Drop su changes.
++	* src/chroot.c: Adapt to new upstream code.
++
++2012-02-04  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.15-1.
++	* lib/fts.c: Early gnulib fix is now upstream.
++	* lib/canonicalize.c: Backport gnulib fix for /// -> /.
++	* src/realpath.c: Backport gnulib fix for --relative-to.
++
++2011-10-27  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.14-1.
++	* lib/ftc.c: Backport gnulib fix to make rm close before rmdir.
++	* lib/cygwin.c (cygwin_spelling): Fix logic when 'f' and 'f.exe'
++	exist but are different files.
++	* src/stat.c: Fix --append-exe.
++
++2011-02-04  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.10-1.
++
++2010-12-24  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.8-1.
++	* lib/mountlist.c (ME_REMOTE): Restore previous cygwin hack to
++	determine remote drives, lost since 6.11-1.
++
++2010-04-29  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.5-1.
++
++2010-03-11  Eric Blake  <eblake@redhat.com>
++
++	Cygwin release 8.4-1.
++	* lib/xfreopen.c (xfreopen): Consolidate workaround for broken
++	freopen usage into one place.
++	* src/copy.c (copy): Reinstate .exe magic handling when copying
++	files with implicit .exe.
++
++2008-12-13  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 7.0-1.
++
++2008-06-02  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 6.12-1.
++
++2008-05-12  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 6.11-1, requires cygwin 1.7.0.
++	* lib/cygwin.h (CYGWIN_APPEND_EXE): Accomodate new PATH_MAX.
++	* lib/cygwin.c (cygwin_spelling): Accomodate new trailing
++	`.' semantics.
++	* lib/same.c (same_name): Accomodate new PATH_MAX.
++
++2008-01-24  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 6.10-1.
++	* lib/hash-triple.c (triple_hash): Hash case-insensitively.
++	* lib/hash-pjw.h (hash_pjw_case): New interface.
++	* lib/hash-pjw.c (hash_pjw_case): New function.
++	* src/chcon.c (main): Support my root_dev_ino tweaks.
++
++2007-08-21  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 6.9-5.
++	* same.c (same_name): Detect same file differing only by case.
++	* src/copy.c (same_file_ok): Add parameter to detect when case
++	change is being attempted.
++	(triple_hash): Hash names case-insensitively.
++	(copy_internal): Accommodate case-change attempts.
++	* src/mv.c (do_move): Allow 'mv foo/ Foo/' as shorthand for
++	'mv -T foo/ Foo/'.
++
++2007-07-23  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 6.9-4.
++	* src/dd.c (main): Fix typo in earlier cygwin patch.
++
++2007-05-29  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 6.9-3.
++	* src/cksum.c (main): Don't lose append mode.
++	* src/md5sum.c (main): Likewise.
++	* src/cat.c (main): Likewise.
++	* src/head.c (main): Likewise.
++	* src/tac.c (main): Likewise.
++	* src/tail.c (main): Likewise.
++	* src/tee.c (main): Likewise.
++	* src/tr.c (main): Likewise.
++
++2006-11-24  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 6.6-2.
++	* lib/cygwin.c (cygwin_spelling): Work even with old-style
++	symlinks, which lacked .lnk suffix.
++
++2006-04-14  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 5.94-5. Experimental only, depends on cygwin
++	snapshot 20060329 or later.
++	* src/dd.c (main): Default to binary mode.
++	* src/system.h (rpl_freopen): Remove this hack, now that cygwin
++	freopen(NULL) works.
++	* lib/quotearg.c (quote_eight_bit): New variable, so I can...
++	(quotearg_buffer_restyled): treat 8-bit	characters as printable
++	when outputting to a terminal.
++	* lib/quote.c (quote_n): Use it.
++
++2006-02-28  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 5.94-4. Experimental only, depends on cygwin
++	snapshot 20060227 or later.
++	* lib/root-dev-ino.h (struct root_dev_ino): New struct.
++	(ROOT_DEV_INO_CHECK, ROOT_DEV_INO_WARN): Also track //.
++	* lib/root-dev-ino.c (get_root_dev_ino): Also track //.
++	* src/chmod.c (root_dev_ino): Use new type.
++	(main): Ditto.
++	* src/chown-core.h (struct Chown_option): Ditto.
++	* src/chown.c (main): Ditto.
++	* src/remove.h (struct rm_options): Ditto.
++	* src/rm.c (main): Ditto.
++	* src/pwd.c (robust_getcwd): Ditto.  Also fix bug when in / or //.
++
++2006-01-24  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 5.93-3, depends on cygwin-1.5.19-1 or later.
++	* src/cksum.c (main): Always output binary files.
++	* src/md5sum.c (main): Likewise.
++	* src/su.c (correct_password): On NT machines, attempt
++	passwordless login first, and give better error message if
++	password check fails.  I still don't know how to distinguish
++	between insufficient privileges vs. incorrect password.
++	* src/dircolors.c (main): Silence warning from tcsh 6.14.00.
++
++2005-10-15  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 5.90-3, depends on snapshot 20051003 or later (will
++	become cygwin 1.5.19).
++	* doc/coreutils.texi (ls invocation, stat invocation): Document
++	--append-exe.
++	* src/ls.c (usage): Ditto.
++	(gobble_file): Append .exe as needed when requested.
++	* src/stat.c (usage): Document --append-exe.
++	(do_stat, do_statfs): Append .exe as needed when requested.
++
++2005-10-08  Eric Blake  <ebb9@byu.net>
++
++	Cygwin release 5.90-2, depends on snapshot 20051003 or later (will
++	become cygwin 1.5.19).
++	* lib/mkdir-p.c (make_dir_parents): Fix bug in last patch.
++	* lib/cygwin.h (CYGWIN_APPEND_EXE): Factor into common macro.
++	* src/copy.c (copy): Use new macro.
++	* src/install.c (strip): Ditto.
++	* src/ln.c (do_link): Ditto.
++
++2005-07-13  Eric Blake  <ebb9@byu.net>
++
++	* doc/coreutils.texi (ln invocation): Document --disable-exe-magic.
++	* src/ln.c (usage): Likewise.
++	(do_link): Skip .exe magic when requested.
++
++2005-07-12  Eric Blake  <ebb9@byu.net>
++
++	* lib/cygwin.c (cygwin_spelling): Don't append .exe to directories.
++	Make sure .exe exists before returning 1, because otherwise
++	virtual directories such as /cygdrive have problems.
++
++2005-07-07  Eric Blake  <ebb9@byu.net>
++
++	* lib/cygwin.h: New file, defining cygwin_spelling.
++	* lib/cygwin.c: New file.
++	* lib/Makefile.am: Compile it.
++	* src/copy.c (copy_internal, copy): Use new cygwin_spelling() to
++	undo .exe magic.
++	* src/link.c (do_link): Likewise.
++	* src/install.c (strip): Likewise.
++
++2005-01-03  Corinna Vinschen  <corinna@vinschen.de>
++
++	* src/install.c (strip): Check for .exe here since strip doesn't.
++
++\f
+ 2016-01-20  Pádraig Brady  <P@draigBrady.com>
+ 
+ 	version 8.25
+--- origsrc/coreutils-8.25/configure.ac	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/configure.ac	2016-04-12 12:49:47.302692100 -0600
+#@@ -468,7 +468,8 @@ gl_WARN_ADD([-Werror], [CFLAGS])
+ gl_WARN_ADD([-errwarn], [CFLAGS])
+ # Put this message here, after gl_WARN_ADD's chatter.
+ AC_MSG_CHECKING([whether this system supports stdbuf])
+-CFLAGS="-fPIC $CFLAGS"
++# -fPIC on cygwin is a warning
++# CFLAGS="-fPIC $CFLAGS"
+ LDFLAGS="-shared $LDFLAGS"
+ stdbuf_supported=no
+ # Note we only LINK here rather than RUN to support cross compilation
+#@@ -486,7 +487,7 @@ AC_LINK_IFELSE(
+   ],
+   [stdbuf_supported=yes])
+ AC_MSG_RESULT([$stdbuf_supported])
+-if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
++if test "$stdbuf_supported" = "yes"; then
+   gl_ADD_PROG([optional_bin_progs], [stdbuf])
+ fi
+ CFLAGS=$ac_save_CFLAGS
+--- origsrc/coreutils-8.25/configure
++++ src/coreutils-8.25/configure
+@@ -63050,7 +63050,8 @@
+ # Put this message here, after gl_WARN_ADD's chatter.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether this system supports stdbuf" >&5
+ $as_echo_n "checking whether this system supports stdbuf... " >&6; }
+-CFLAGS="-fPIC $CFLAGS"
++# -fPIC on cygwin is a warning
++# CFLAGS="-fPIC $CFLAGS"
+ LDFLAGS="-shared $LDFLAGS"
+ stdbuf_supported=no
+ # Note we only LINK here rather than RUN to support cross compilation
+@@ -63082,7 +63083,7 @@
+     conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $stdbuf_supported" >&5
+ $as_echo "$stdbuf_supported" >&6; }
+-if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
++if test "$stdbuf_supported" = "yes"; then
+   {
+   if test -z "$optional_bin_progs"; then
+     optional_bin_progs=stdbuf
+--- origsrc/coreutils-8.25/doc/coreutils.texi	2016-01-13 04:16:39.000000000 -0700
++++ src/coreutils-8.25/doc/coreutils.texi	2016-04-12 12:49:47.318287500 -0600
+@@ -7665,6 +7665,14 @@ These options change how file names them
+ 
+ @table @samp
+ 
++@item --append-exe
++@opindex --append-exe
++@cindex appending exe on cygwin
++Cygwin only: Cygwin normally performs @samp{.exe} magic, where a
++command line argument typed without an .exe extension transparently
++refers to the existing file with an extension.  Specifying this option
++will make the .exe show if cygwin magic was involved.
++
+ @item -b
+ @itemx --escape
+ @itemx --quoting-style=escape
+@@ -11679,6 +11687,14 @@ With this option, @command{stat} acts on
+ by each symbolic link argument.
+ Without it, @command{stat} acts on any symbolic link argument directly.
+ 
++@item --append-exe
++@opindex --append-exe
++@cindex appending exe on cygwin
++Cygwin only: Cygwin normally performs .exe magic, where a command line
++argument typed without an .exe extension transparently refers to the
++existing file with an extension.  Specifying this option will make
++the .exe show if cygwin magic was involved.
++
+ @item -f
+ @itemx --file-system
+ @opindex -f
+--- origsrc/coreutils-8.25/lib/cygwin.c	1969-12-31 17:00:00.000000000 -0700
++++ src/coreutils-8.25/lib/cygwin.c	2016-04-12 12:49:47.318287500 -0600
+@@ -0,0 +1,73 @@
++/* cygwin.c - helper functions unique to Cygwin
++
++   Copyright (C) 2005, 2006, 2008, 2011 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3, or (at your option)
++   any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program; if not, write to the Free Software Foundation,
++   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++   Written by Eric Blake.  */
++
++#include <config.h>
++
++#include "cygwin.h"
++
++#include <errno.h>
++#include <limits.h>
++#include <string.h>
++#include <unistd.h>
++
++/* Return -1 if PATH is not found, 0 if PATH will not have .exe
++   appended (it is possible that a PATH that does not exist still
++   returns 0 instead of -1, or fails for a PATH that exists but cannot
++   be stat'ed), and positive if PATH has ".exe" automatically appended
++   by cygwin (1 if PATH is a symlink, 2 otherwise).  Won't change errno.  */
++
++int
++cygwin_spelling (char const *path)
++{
++  int saved_errno = errno;
++  int result = 0; /* Start with assumption that PATH is okay.  */
++  size_t len;
++  struct stat st1;
++  struct stat st2;
++  char *path_exe;
++
++  /* If PATH will cause EINVAL or ENAMETOOLONG, treat it as missing.  */
++  if (! path || ! *path)
++    return -1;
++  if (PATH_MAX < (len = strlen (path)))
++    return -1;
++  /* Don't change spelling if there is a trailing `/' or '.exe'.  */
++  if (path[len - 1] == '/'
++      || (len > 4 && !strcasecmp (&path[len - 4], ".exe")))
++    return 0;
++  if (lstat (path, &st1) < 0)
++    {
++      errno = saved_errno;
++      return -1;
++    }
++  if (S_ISDIR(st1.st_mode))
++    {
++      errno = saved_errno;
++      return 0;
++    }
++  path_exe = malloca (len + 5); /* adding ".exe" and NUL.  */
++  strcat (stpcpy (path_exe, path), ".exe");
++  if (lstat (path_exe, &st2) == 0 && st1.st_ino == st2.st_ino)
++    result = 1 + !S_ISLNK(st1.st_mode);
++  freea (path_exe);
++
++  errno = saved_errno;
++  return result;
++}
+--- origsrc/coreutils-8.25/lib/cygwin.h	1969-12-31 17:00:00.000000000 -0700
++++ src/coreutils-8.25/lib/cygwin.h	2016-04-12 12:49:47.318287500 -0600
+@@ -0,0 +1,38 @@
++/* cygwin.h - helper functions unique to Cygwin
++
++   Copyright (C) 2005, 2006, 2008, 2010, 2011 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3, or (at your option)
++   any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program; if not, write to the Free Software Foundation,
++   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++   Written by Eric Blake.  */
++
++#ifndef CYGWIN_H
++# define CYGWIN_H 1
++
++#include "malloca.h"
++
++int cygwin_spelling (char const *);
++
++/* Append ".exe" to char *__NAME_ORIG, where __NAME is either NULL or
++   between __NAME_ORIG and the nul terminator.  Both params will be
++   evaluated more than once and assigned the new value.  The user must
++   later call freea(__NAME).  */
++#define CYGWIN_APPEND_EXE(__name, __name_orig)                          \
++  __name_orig = __name =                                                \
++    strcat (strcpy (malloca (strchr (__name ? __name : __name_orig, '\0') \
++                             - (__name_orig) + 5),                      \
++                    __name_orig), ".exe")
++
++#endif /* CYGWIN_H */
+--- origsrc/coreutils-8.25/lib/hash-pjw.c	2016-01-01 06:45:55.000000000 -0700
++++ src/coreutils-8.25/lib/hash-pjw.c	2016-04-12 12:49:47.318287500 -0600
+@@ -19,6 +19,7 @@
+ 
+ #include "hash-pjw.h"
+ 
++#include <ctype.h>
+ #include <limits.h>
+ 
+ #define SIZE_BITS (sizeof (size_t) * CHAR_BIT)
+@@ -38,3 +39,16 @@ hash_pjw (const void *x, size_t tablesiz
+ 
+   return h % tablesize;
+ }
++
++/* Likewise, but case-insensitive.  */
++size_t
++hash_pjw_case (const void *x, size_t tablesize)
++{
++  const unsigned char *s;
++  size_t h = 0;
++
++  for (s = x; *s; s++)
++    h = tolower (*s) + ((h << 9) | (h >> (SIZE_BITS - 9)));
++
++  return h % tablesize;
++}
+--- origsrc/coreutils-8.25/lib/hash-pjw.h	2016-01-01 06:45:55.000000000 -0700
++++ src/coreutils-8.25/lib/hash-pjw.h	2016-04-12 12:49:47.318287500 -0600
+@@ -21,3 +21,4 @@
+    The result is platform dependent: it depends on the size of the 'size_t'
+    type and on the signedness of the 'char' type.  */
+ extern size_t hash_pjw (void const *x, size_t tablesize) _GL_ATTRIBUTE_PURE;
++extern size_t hash_pjw_case (void const *x, size_t tablesize) _GL_ATTRIBUTE_PURE;
+--- origsrc/coreutils-8.25/lib/hash-triple.c	2016-01-01 06:45:55.000000000 -0700
++++ src/coreutils-8.25/lib/hash-triple.c	2016-04-12 12:49:47.318287500 -0600
+@@ -34,7 +34,13 @@ size_t
+ triple_hash (void const *x, size_t table_size)
+ {
+   struct F_triple const *p = x;
++#if !__CYGWIN__
+   size_t tmp = hash_pjw (p->name, table_size);
++#else // cygwin
++  /* Hash case-insensitively, to force collisions on names that differ by
++     case; copy.c can then account for case-insensitive renames. */
++  size_t tmp = hash_pjw_case (p->name, table_size);
++#endif
+ 
+   /* Ignoring the device number here should be fine.  */
+   return (tmp ^ p->st_ino) % table_size;
+--- origsrc/coreutils-8.25/lib/local.mk	2012-11-13 06:51:53.000000000 -0700
++++ src/coreutils-8.25/lib/local.mk	2016-04-12 12:49:47.318287500 -0600
+#@@ -3,3 +3,6 @@ include lib/gnulib.mk
+ # Allow "make distdir" to succeed before "make all" has run.
+ dist-hook: $(noinst_LIBRARIES)
+ .PHONY: dist-hook
++
++# Hook in cygwin helper
++lib_libcoreutils_a_SOURCES += lib/cygwin.c lib/cygwin.h
+--- origsrc/coreutils-8.25/Makefile.in
++++ src/coreutils-8.25/Makefile.in
+@@ -694,7 +694,8 @@
+ 	lib/xstriconv.h lib/xstriconv.c lib/xstrndup.h lib/xstrndup.c \
+ 	lib/xstrtod.c lib/xstrtoimax.c lib/xstrtol.c lib/xstrtoul.c \
+ 	lib/xstrtol-error.c lib/xstrtold.c lib/xstrtoumax.c \
+-	lib/xvasprintf.h lib/xvasprintf.c lib/xasprintf.c lib/yesno.c
++	lib/xvasprintf.h lib/xvasprintf.c lib/xasprintf.c lib/yesno.c \
++	lib/cygwin.c lib/cygwin.h
+ am__dirstamp = $(am__leading_dot)dirstamp
+ @LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE@am__objects_1 = lib/unistr/u8-mbtoucr.$(OBJEXT)
+ @LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE@am__objects_2 = lib/unistr/u8-uctomb.$(OBJEXT) \
+@@ -799,7 +800,8 @@
+ 	lib/xstrtol.$(OBJEXT) lib/xstrtoul.$(OBJEXT) \
+ 	lib/xstrtol-error.$(OBJEXT) lib/xstrtold.$(OBJEXT) \
+ 	lib/xstrtoumax.$(OBJEXT) lib/xvasprintf.$(OBJEXT) \
+-	lib/xasprintf.$(OBJEXT) lib/yesno.$(OBJEXT)
++	lib/xasprintf.$(OBJEXT) lib/yesno.$(OBJEXT) \
++	lib/cygwin.$(OBJEXT)
+ lib_libcoreutils_a_OBJECTS = $(am_lib_libcoreutils_a_OBJECTS)
+ src_libsinglebin___a_AR = $(AR) $(ARFLAGS)
+ src_libsinglebin___a_LIBADD =
+@@ -4215,6 +4217,8 @@
+ #	mv $@-t $@
+ #EXTRA_DIST += script.in
+ #MOSTLYCLEANFILES += script script-t
++
++# Hook in cygwin helper
+ lib_libcoreutils_a_SOURCES = lib/copy-acl.c lib/set-acl.c \
+ 	lib/acl-errno-valid.c lib/acl-internal.c lib/get-permissions.c \
+ 	lib/set-permissions.c lib/allocator.c lib/areadlink.c \
+@@ -4288,7 +4292,8 @@
+ 	lib/xstriconv.h lib/xstriconv.c lib/xstrndup.h lib/xstrndup.c \
+ 	lib/xstrtod.c lib/xstrtoimax.c lib/xstrtol.c lib/xstrtoul.c \
+ 	lib/xstrtol-error.c lib/xstrtold.c lib/xstrtoumax.c \
+-	lib/xvasprintf.h lib/xvasprintf.c lib/xasprintf.c lib/yesno.c
++	lib/xvasprintf.h lib/xvasprintf.c lib/xasprintf.c lib/yesno.c \
++	lib/cygwin.c lib/cygwin.h
+ lib_libcoreutils_a_LIBADD = $(gl_LIBOBJS) @ALLOCA@
+ lib_libcoreutils_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@
+ EXTRA_lib_libcoreutils_a_SOURCES = lib/acl_entries.c lib/alloca.c \
+@@ -6321,6 +6326,8 @@
+ lib/xasprintf.$(OBJEXT): lib/$(am__dirstamp) \
+ 	lib/$(DEPDIR)/$(am__dirstamp)
+ lib/yesno.$(OBJEXT): lib/$(am__dirstamp) lib/$(DEPDIR)/$(am__dirstamp)
++lib/cygwin.$(OBJEXT): lib/$(am__dirstamp) \
++	lib/$(DEPDIR)/$(am__dirstamp)
+ lib/acl_entries.$(OBJEXT): lib/$(am__dirstamp) \
+ 	lib/$(DEPDIR)/$(am__dirstamp)
+ lib/alloca.$(OBJEXT): lib/$(am__dirstamp) \
+@@ -8262,6 +8269,7 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/copy-acl.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/creat-safer.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/cycle-check.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/cygwin.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/di-set.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/diacrit.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/dirchownmod.Po@am__quote@
+--- origsrc/coreutils-8.25/lib/root-dev-ino.c	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/lib/root-dev-ino.c	2016-04-12 12:49:47.318287500 -0600
+@@ -25,13 +25,17 @@
+ /* Call lstat to get the device and inode numbers for '/'.
+    Upon failure, return NULL.  Otherwise, set the members of
+    *ROOT_D_I accordingly and return ROOT_D_I.  */
+-struct dev_ino *
+-get_root_dev_ino (struct dev_ino *root_d_i)
++struct root_dev_ino *
++get_root_dev_ino (struct root_dev_ino *root_d_i)
+ {
+   struct stat statbuf;
+   if (lstat ("/", &statbuf))
+     return NULL;
+-  root_d_i->st_ino = statbuf.st_ino;
+-  root_d_i->st_dev = statbuf.st_dev;
++  root_d_i->single_slash.st_ino = statbuf.st_ino;
++  root_d_i->single_slash.st_dev = statbuf.st_dev;
++  if (lstat ("//", &statbuf))
++    return NULL;
++  root_d_i->double_slash.st_ino = statbuf.st_ino;
++  root_d_i->double_slash.st_dev = statbuf.st_dev;
+   return root_d_i;
+ }
+--- origsrc/coreutils-8.25/lib/root-dev-ino.h	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/lib/root-dev-ino.h	2016-04-12 12:49:47.318287500 -0600
+@@ -21,19 +21,26 @@
+ # include "dev-ino.h"
+ # include "same-inode.h"
+ 
+-struct dev_ino *
+-get_root_dev_ino (struct dev_ino *root_d_i);
++struct root_dev_ino
++{
++  struct dev_ino single_slash;
++  struct dev_ino double_slash;
++};
++
++struct root_dev_ino *
++get_root_dev_ino (struct root_dev_ino *root_d_i);
+ 
+ /* These macros are common to the programs that support the
+    --preserve-root and --no-preserve-root options.  */
+ 
+ # define ROOT_DEV_INO_CHECK(Root_dev_ino, Dir_statbuf) \
+-    (Root_dev_ino && SAME_INODE (*Dir_statbuf, *Root_dev_ino))
++  (Root_dev_ino && (SAME_INODE (*Dir_statbuf, (Root_dev_ino)->single_slash) \
++                    || SAME_INODE (*Dir_statbuf, (Root_dev_ino)->double_slash)))
+ 
+ # define ROOT_DEV_INO_WARN(Dirname)					\
+   do									\
+     {									\
+-      if (STREQ (Dirname, "/"))						\
++      if (STREQ (Dirname, "/") || STREQ (Dirname, "//"))                \
+         error (0, 0, _("it is dangerous to operate recursively on %s"),	\
+                quoteaf (Dirname));					\
+       else								\
+--- origsrc/coreutils-8.25/lib/same.c	2016-01-01 06:45:55.000000000 -0700
++++ src/coreutils-8.25/lib/same.c	2016-04-12 12:49:47.318287500 -0600
+@@ -40,6 +40,13 @@
+ #include "error.h"
+ #include "same-inode.h"
+ 
++#if __CYGWIN__
++# include <sys/cygwin.h>
++# include "cygwin.h"
++# include "malloca.h"
++# include "memcasecmp.h"
++#endif
++
+ #ifndef MIN
+ # define MIN(a, b) ((a) < (b) ? (a) : (b))
+ #endif
+@@ -59,6 +66,45 @@ same_name (const char *source, const cha
+     (source_baselen == dest_baselen
+      && memcmp (source_basename, dest_basename, dest_baselen) == 0);
+   bool compare_dirs = identical_basenames;
++#if __CYGWIN__
++  /* If two names differ case-insensitively by only an '.exe' suffix,
++     do some sleuthing to see if .exe magic matters on the shorter
++     name.  Swapping the longer name to dest avoids duplication.  */
++  if (source_baselen == dest_baselen + 4)
++    {
++      char const *tmp_basename = source_basename;
++      size_t tmp_baselen = source_baselen;
++      source_basename = dest_basename;
++      source_baselen = dest_baselen;
++      dest_basename = tmp_basename;
++      dest_baselen = tmp_baselen;
++    }
++  if (source_baselen + 4 == dest_baselen
++      && !memcasecmp (dest_basename - 4, ".exe", 4)
++      && !memcasecmp (source_basename, dest_basename, source_baselen)
++      && 0 < cygwin_spelling(source))
++    dest_baselen -= 4;
++  /* Some, but not all, files are case-insensitive (depending on mount
++     options, CYGWIN=case settings, and virtual file systems).  Do
++     some sleuthing to decide whether case-insensitivity matters.  */
++  if (! compare_dirs && source_baselen == dest_baselen)
++    {
++      ssize_t wsrclen = cygwin_conv_path (CCP_POSIX_TO_WIN_W,
++                                          source, NULL, 0);
++      ssize_t wdstlen = cygwin_conv_path (CCP_POSIX_TO_WIN_W,
++                                          dest, NULL, 0);
++      char *wsrc = malloca (wsrclen);
++      char *wdst = malloca (wdstlen);
++      if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, source, wsrc, wsrclen))
++        error (EXIT_FAILURE, errno, "unable to convert path name %s", source);
++      if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, dest, wdst, wdstlen))
++        error (EXIT_FAILURE, errno, "unable to convert path name %s", dest);
++      if (wsrclen == wdstlen && memcasecmp (wsrc, wdst, wsrclen) == 0)
++        compare_dirs = true;
++      freea (wsrc);
++      freea (wdst);
++    }
++#endif /* __CYGWIN__ */
+   bool same = false;
+ 
+ #if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX
+--- origsrc/coreutils-8.25/lib/set-permissions.c	2016-01-01 06:45:55.000000000 -0700
++++ src/coreutils-8.25/lib/set-permissions.c	2016-04-12 12:49:47.318287500 -0600
+@@ -269,6 +269,7 @@ set_acls_from_mode (const char *name, in
+ 	  }
+ 	return -1;
+       }
++    return 0;
+   }
+ }
+ 
+@@ -494,7 +495,7 @@ set_acls (struct permission_context *ctx
+ 
+ #   ifndef HAVE_ACL_FROM_TEXT
+ #    error Must have acl_from_text (see POSIX 1003.1e draft 17).
+-#   endif
++ #   endif
+ #   ifndef HAVE_ACL_DELETE_DEF_FILE
+ #    error Must have acl_delete_def_file (see POSIX 1003.1e draft 17).
+ #   endif
+--- origsrc/coreutils-8.25/lib/sys_select.in.h	2016-01-01 07:17:01.000000000 -0700
++++ src/coreutils-8.25/lib/sys_select.in.h	2016-04-12 12:48:36.181822100 -0600
+@@ -81,8 +81,8 @@
+    of 'struct timeval', and no definition of this type.
+    Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select()
+    in <sys/time.h>.
+-   But avoid namespace pollution on glibc systems.  */
+-# ifndef __GLIBC__
++   But avoid namespace pollution on glibc/Cygwin systems.  */
++# if !(defined __GLIBC__ || defined __CYGWIN__)
+ #  include <sys/time.h>
+ # endif
+ 
+@@ -103,7 +103,7 @@
+    But avoid namespace pollution on glibc systems.
+    Do this after the include_next (for the sake of OpenBSD 5.0) but before
+    the split double-inclusion guard (for the sake of Solaris).  */
+-#if !(defined __GLIBC__ && !defined __UCLIBC__)
++#if !((defined __GLIBC__ || defined __CYGWIN__) && !defined __UCLIBC__)
+ # include <signal.h>
+ #endif
+ 
+--- origsrc/coreutils-8.25/lib/xfreopen.c	2016-01-01 06:45:55.000000000 -0700
++++ src/coreutils-8.25/lib/xfreopen.c	2016-04-12 12:49:47.318287500 -0600
+@@ -18,6 +18,7 @@
+ #include "xfreopen.h"
+ 
+ #include <errno.h>
++#include <fcntl.h>
+ #include "error.h"
+ #include "exitfail.h"
+ #include "quote.h"
+@@ -26,9 +27,17 @@
+ #include "gettext.h"
+ #define _(msgid) gettext (msgid)
+ 
++#define STREQ(s1, s2) (strcmp (s1, s2) == 0)
++
+ void
+ xfreopen (char const *filename, char const *mode, FILE *fp)
+ {
++  if (!filename && STREQ (mode, "wb"))
++    {
++      int flag = fcntl (fileno (fp), F_GETFL);
++      if (0 <= flag && (flag & O_APPEND))
++        mode = "ab";
++    }
+   if (!freopen (filename, mode, fp))
+     {
+       char const *f = (filename ? filename
+--- origsrc/coreutils-8.25/src/chcon.c	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/chcon.c	2016-04-12 12:49:47.318287500 -0600
+@@ -47,7 +47,7 @@ static bool verbose;
+ 
+ /* Pointer to the device and inode numbers of '/', when --recursive.
+    Otherwise NULL.  */
+-static struct dev_ino *root_dev_ino;
++static struct root_dev_ino *root_dev_ino;
+ 
+ /* The name of the context file is being given. */
+ static char const *specified_context;
+@@ -569,7 +569,7 @@ main (int argc, char **argv)
+ 
+   if (recurse && preserve_root)
+     {
+-      static struct dev_ino dev_ino_buf;
++      static struct root_dev_ino dev_ino_buf;
+       root_dev_ino = get_root_dev_ino (&dev_ino_buf);
+       if (root_dev_ino == NULL)
+         error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+--- origsrc/coreutils-8.25/src/chgrp.c	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/chgrp.c	2016-04-12 12:49:47.318287500 -0600
+@@ -300,7 +300,7 @@ main (int argc, char **argv)
+ 
+   if (chopt.recurse && preserve_root)
+     {
+-      static struct dev_ino dev_ino_buf;
++      static struct root_dev_ino dev_ino_buf;
+       chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
+       if (chopt.root_dev_ino == NULL)
+         error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+--- origsrc/coreutils-8.25/src/chmod.c	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/chmod.c	2016-04-12 12:49:47.318287500 -0600
+@@ -80,7 +80,7 @@ static enum Verbosity verbosity = V_off;
+ 
+ /* Pointer to the device and inode numbers of '/', when --recursive.
+    Otherwise NULL.  */
+-static struct dev_ino *root_dev_ino;
++static struct root_dev_ino *root_dev_ino;
+ 
+ /* For long options that have no equivalent short option, use a
+    non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
+@@ -551,7 +551,7 @@ main (int argc, char **argv)
+ 
+   if (recurse && preserve_root)
+     {
+-      static struct dev_ino dev_ino_buf;
++      static struct root_dev_ino dev_ino_buf;
+       root_dev_ino = get_root_dev_ino (&dev_ino_buf);
+       if (root_dev_ino == NULL)
+         error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+--- origsrc/coreutils-8.25/src/chown-core.h	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/chown-core.h	2016-04-12 12:49:47.333906200 -0600
+@@ -50,7 +50,7 @@ struct Chown_option
+ 
+   /* Pointer to the device and inode numbers of '/', when --recursive.
+      Need not be freed.  Otherwise NULL.  */
+-  struct dev_ino *root_dev_ino;
++  struct root_dev_ino *root_dev_ino;
+ 
+   /* This corresponds to the --dereference (opposite of -h) option.  */
+   bool affect_symlink_referent;
+--- origsrc/coreutils-8.25/src/chown.c	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/chown.c	2016-04-12 12:49:47.333906200 -0600
+@@ -312,7 +312,7 @@ main (int argc, char **argv)
+ 
+   if (chopt.recurse && preserve_root)
+     {
+-      static struct dev_ino dev_ino_buf;
++      static struct root_dev_ino dev_ino_buf;
+       chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
+       if (chopt.root_dev_ino == NULL)
+         error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+--- origsrc/coreutils-8.25/src/chroot.c	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/chroot.c	2016-04-12 12:49:47.333906200 -0600
+@@ -170,7 +170,8 @@ static bool
+ is_root (const char* dir)
+ {
+   char *resolved = canonicalize_file_name (dir);
+-  bool is_res_root = resolved && STREQ ("/", resolved);
++  bool is_res_root = resolved && (STREQ ("/", resolved)
++				  || STREQ ("//", resolved));
+   free (resolved);
+   return is_res_root;
+ }
+--- origsrc/coreutils-8.25/src/cksum.c	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/cksum.c	2016-04-12 12:49:47.333906200 -0600
+@@ -301,6 +301,9 @@ main (int argc, char **argv)
+ 
+   have_read_stdin = false;
+ 
++  if (O_BINARY)
++    xfreopen (NULL, "wb", stdout);
++
+   if (optind == argc)
+     ok = cksum ("-", false);
+   else
+--- origsrc/coreutils-8.25/src/copy.c	2016-01-16 12:09:33.000000000 -0700
++++ src/coreutils-8.25/src/copy.c	2016-04-12 12:49:47.333906200 -0600
+@@ -74,6 +74,10 @@
+ # include <linux/falloc.h>
+ #endif
+ 
++#if __CYGWIN__
++# include "cygwin.h"
++#endif
++
+ #ifndef HAVE_FCHOWN
+ # define HAVE_FCHOWN false
+ # define fchown(fd, uid, gid) (-1)
+@@ -1416,7 +1420,11 @@ close_src_desc:
+ static bool
+ same_file_ok (char const *src_name, struct stat const *src_sb,
+               char const *dst_name, struct stat const *dst_sb,
+-              const struct cp_options *x, bool *return_now)
++              const struct cp_options *x, bool *return_now
++#if __CYGWIN__
++	      , bool *case_change
++#endif
++	      )
+ {
+   const struct stat *src_sb_link;
+   const struct stat *dst_sb_link;
+@@ -1560,6 +1568,18 @@ same_file_ok (char const *src_name, stru
+       if (S_ISLNK (dst_sb_link->st_mode))
+         return true;
+ 
++#if __CYGWIN__
++      /* If the files have the same name, but differ in case, then let
++	 rename() change the case.  */
++      if (same_link && x->move_mode && same_name (src_name, dst_name)
++	  && memcmp (last_component (src_name), last_component (dst_name),
++		     base_len (src_name)))
++	{
++	  *case_change = true;
++	  return true;
++	}
++#endif /* __CYGWIN__ */
++
+       /* It's not ok if they're distinct hard links to the same file as
+          this causes a race condition and we may lose data in this case.  */
+       if (same_link
+@@ -1907,10 +1927,20 @@ copy_internal (char const *src_name, cha
+          && ! (x->move_mode || x->symbolic_link || x->hard_link
+                || x->backup_type != no_backups
+                || x->unlink_dest_before_opening));
+-      if ((use_stat
+-           ? stat (dst_name, &dst_sb)
+-           : lstat (dst_name, &dst_sb))
+-          != 0)
++      int res = (use_stat
++                 ? stat (dst_name, &dst_sb)
++                 : lstat (dst_name, &dst_sb));
++#if __CYGWIN__
++      /* stat("a") succeeds even if it was really "a.exe".  */
++      if (! res && cygwin_spelling (dst_name) != 0)
++        {
++          /* Only DST_NAME.exe exists, but we want the non-existant
++             DST_NAME.  */
++          res = -1;
++          errno = ENOENT;
++        }
++#endif /* __CYGWIN__ */
++      if (res != 0)
+         {
+           if (errno != ENOENT)
+             {
+@@ -1926,10 +1956,17 @@ copy_internal (char const *src_name, cha
+         { /* Here, we know that dst_name exists, at least to the point
+              that it is stat'able or lstat'able.  */
+           bool return_now;
++#if __CYGWIN__
++	  bool case_change = false;
++#endif /* __CYGWIN__ */
+ 
+           have_dst_lstat = !use_stat;
+           if (! same_file_ok (src_name, &src_sb, dst_name, &dst_sb,
+-                              x, &return_now))
++                              x, &return_now
++#if __CYGWIN__
++			      , &case_change
++#endif /* __CYGWIN__ */
++			      ))
+             {
+               error (0, 0, _("%s and %s are the same file"),
+                      quoteaf_n (0, src_name), quoteaf_n (1, dst_name));
+@@ -1988,6 +2025,9 @@ copy_internal (char const *src_name, cha
+              cp and mv treat -i and -f differently.  */
+           if (x->move_mode)
+             {
++#if __CYGWIN__
++	      if (!case_change)
++#endif /* __CYGWIN__ */
+               if (abandon_move (x, dst_name, &dst_sb))
+                 {
+                   /* Pretend the rename succeeded, so the caller (mv)
+@@ -2144,7 +2184,11 @@ copy_internal (char const *src_name, cha
+                    /* Never unlink dst_name when in move mode.  */
+                    && ! x->move_mode
+                    && (x->unlink_dest_before_opening
+-                       || (x->preserve_links && 1 < dst_sb.st_nlink)
++                       || (x->preserve_links && 1 < dst_sb.st_nlink
++#if __CYGWIN__
++                           && !case_change
++#endif /* __CYGWIN__ */
++			   )
+                        || (x->dereference == DEREF_NEVER
+                            && ! S_ISREG (src_sb.st_mode))
+                        ))
+@@ -2920,6 +2964,21 @@ copy (char const *src_name, char const *
+ {
+   assert (valid_options (options));
+ 
++#if __CYGWIN__
++  /* .exe magic - if src exists with an implicit .exe suffix and is
++     not a symlink, but dst does not exist and was also specified
++     without a suffix, then append .exe to dst.  */
++  int cygwin = cygwin_spelling (src_name);
++  char *p;
++  if (cygwin == 2
++      && ((p = strchr (dst_name, '\0') - 4) <= dst_name
++          || strcasecmp (p, ".exe") != 0))
++    {
++      cygwin = 3;
++      CYGWIN_APPEND_EXE (p, dst_name);
++    }
++#endif /* __CYGWIN__ */
++
+   /* Record the file names: they're used in case of error, when copying
+      a directory into itself.  I don't like to make these tools do *any*
+      extra work in the common case when that work is solely to handle
+@@ -2931,10 +2990,15 @@ copy (char const *src_name, char const *
+   top_level_dst_name = dst_name;
+ 
+   bool first_dir_created_per_command_line_arg = false;
+-  return copy_internal (src_name, dst_name, nonexistent_dst, NULL, NULL,
++  bool result = copy_internal (src_name, dst_name, nonexistent_dst, NULL, NULL,
+                         options, true,
+                         &first_dir_created_per_command_line_arg,
+                         copy_into_self, rename_succeeded);
++#if __CYGWIN__
++  if (cygwin == 3)
++    freea ((char *) dst_name);
++#endif /* __CYGWIN__ */
++  return result;
+ }
+ 
+ /* Set *X to the default options for a value of type struct cp_options.  */
+--- origsrc/coreutils-8.25/src/dd.c	2016-01-13 04:16:39.000000000 -0700
++++ src/coreutils-8.25/src/dd.c	2016-04-12 12:49:47.333906200 -0600
+@@ -36,6 +36,10 @@
+ #include "xstrtol.h"
+ #include "xtime.h"
+ 
++#if __CYGWIN__
++# include <io.h>
++#endif
++
+ /* The official name of this program (e.g., no 'g' prefix).  */
+ #define PROGRAM_NAME "dd"
+ 
+@@ -1984,6 +1988,13 @@ copy_with_unblock (char const *buf, size
+ static void
+ set_fd_flags (int fd, int add_flags, char const *name)
+ {
++#if __CYGWIN__
++  /* Cygwin does not allow fcntl to set the mode.  */
++  int mode_flags = add_flags & (O_BINARY | O_TEXT);
++  add_flags &= ~(O_BINARY | O_TEXT);
++  if (mode_flags && setmode (fd, mode_flags) == -1)
++    error (EXIT_FAILURE, errno, _("setting flags for %s"), quote (name));
++#endif /* __CYGWIN__ */
+   /* Ignore file creation flags that are no-ops on file descriptors.  */
+   add_flags &= ~ (O_NOCTTY | O_NOFOLLOW);
+ 
+@@ -2374,6 +2385,8 @@ main (int argc, char **argv)
+     }
+   else
+     {
++      if ((input_flags & (O_BINARY | O_TEXT)) == 0)
++	input_flags |= O_BINARY;
+       if (ifd_reopen (STDIN_FILENO, input_file, O_RDONLY | input_flags, 0) < 0)
+         error (EXIT_FAILURE, errno, _("failed to open %s"),
+                quoteaf (input_file));
+@@ -2397,6 +2410,8 @@ main (int argc, char **argv)
+            | (conversions_mask & C_NOCREAT ? 0 : O_CREAT)
+            | (conversions_mask & C_EXCL ? O_EXCL : 0)
+            | (seek_records || (conversions_mask & C_NOTRUNC) ? 0 : O_TRUNC));
++      if ((opts & (O_BINARY | O_TEXT)) == 0)
++        opts |= O_BINARY;
+ 
+       /* Open the output file with *read* access only if we might
+          need to read to satisfy a 'seek=' request.  If we can't read
+--- origsrc/coreutils-8.25/src/dircolors.c	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/dircolors.c	2016-04-12 12:49:47.333906200 -0600
+@@ -495,8 +495,12 @@ main (int argc, char **argv)
+             }
+           else
+             {
++              /* tcsh treats LS_COLORS as a magic shell variable for its
++                 builtin ls-F, but does not recognize all the categories
++                 that coreutils ls does.  Therefore, silence stderr to
++                 avoid messages like "Unknown colorls variable `su'.".  */
+               prefix = "setenv LS_COLORS '";
+-              suffix = "'\n";
++              suffix = "' >&/dev/null\n";
+             }
+           fputs (prefix, stdout);
+           fwrite (s, 1, len, stdout);
+--- origsrc/coreutils-8.25/src/install.c	2016-01-03 05:59:44.000000000 -0700
++++ src/coreutils-8.25/src/install.c	2016-04-12 12:49:47.333906200 -0600
+@@ -43,6 +43,10 @@
+ #include "utimens.h"
+ #include "xstrtol.h"
+ 
++#if __CYGWIN__
++# include "cygwin.h"
++#endif
++
+ /* The official name of this program (e.g., no 'g' prefix).  */
+ #define PROGRAM_NAME "install"
+ 
+@@ -531,6 +535,16 @@ strip (char const *name)
+       error (0, errno, _("fork system call failed"));
+       break;
+     case 0:			/* Child. */
++#if __CYGWIN__
++      {
++	/* Check for .exe here, since strip doesn't.  */
++	char *p;
++	if (((p = strchr (name, '\0') - 4) <= name
++	     || strcasecmp (p, ".exe") != 0)
++	    && 0 < cygwin_spelling (name))
++          CYGWIN_APPEND_EXE (p, name);
++      }
++#endif /* __CYGWIN__ */
+       execlp (strip_program, strip_program, name, NULL);
+       error (EXIT_FAILURE, errno, _("cannot run %s"), quoteaf (strip_program));
+       break;
+--- origsrc/coreutils-8.25/src/ls.c	2016-01-14 05:16:23.000000000 -0700
++++ src/coreutils-8.25/src/ls.c	2016-04-12 12:49:47.333906200 -0600
+@@ -117,6 +117,10 @@
+ # include <sys/capability.h>
+ #endif
+ 
++#if __CYGWIN__
++# include "cygwin.h"
++#endif
++
+ #define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \
+                       : (ls_mode == LS_MULTI_COL \
+                          ? "dir" : "vdir"))
+@@ -753,6 +757,11 @@ static char const *long_time_format[2] =
+     N_("%b %e %H:%M")
+   };
+ 
++#if __CYGWIN__
++/* Whether .exe should be appended to command-line args as needed.  */
++static bool append_exe;
++#endif /* __CYGWIN__ */
++
+ /* The set of signals that are caught.  */
+ 
+ static sigset_t caught_signals;
+@@ -788,6 +797,9 @@ enum
+ enum
+ {
+   AUTHOR_OPTION = CHAR_MAX + 1,
++#if __CYGWIN__
++  APPEND_EXE_OPTION,
++#endif /* __CYGWIN__ */
+   BLOCK_SIZE_OPTION,
+   COLOR_OPTION,
+   DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION,
+@@ -849,6 +861,9 @@ static struct option const long_options[
+   {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
+   {"context", no_argument, 0, 'Z'},
+   {"author", no_argument, NULL, AUTHOR_OPTION},
++#if __CYGWIN__
++  {"append-exe", no_argument, NULL, APPEND_EXE_OPTION},
++#endif /* __CYGWIN__ */
+   {GETOPT_HELP_OPTION_DECL},
+   {GETOPT_VERSION_OPTION_DECL},
+   {NULL, 0, NULL, 0}
+@@ -1953,6 +1968,12 @@ decode_switches (int argc, char **argv)
+           print_scontext = true;
+           break;
+ 
++#if __CYGWIN__
++        case APPEND_EXE_OPTION:
++          append_exe = true;
++          break;
++#endif /* __CYGWIN__ */
++
+         case_GETOPT_HELP_CHAR;
+ 
+         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+@@ -2943,6 +2964,12 @@ gobble_file (char const *name, enum file
+   uintmax_t blocks = 0;
+   struct fileinfo *f;
+ 
++#if __CYGWIN__
++  char *name_alt = NULL;
++  if (command_line_arg && append_exe && 0 < cygwin_spelling (name))
++    CYGWIN_APPEND_EXE (name_alt, name);
++#endif /* __CYGWIN__ */
++
+   /* An inode value prior to gobble_file necessarily came from readdir,
+      which is not used for command line arguments.  */
+   assert (! command_line_arg || inode == NOT_AN_INODE_NUMBER);
+@@ -3053,11 +3080,19 @@ gobble_file (char const *name, enum file
+           file_failure (command_line_arg,
+                         _("cannot access %s"), absolute_name);
+           if (command_line_arg)
+-            return 0;
++            {
++#if __CYGWIN__
++              freea (name_alt);
++#endif /* __CYGWIN__ */
++              return 0;
++            }
+ 
+           f->name = xstrdup (name);
+           cwd_n_used++;
+ 
++#if __CYGWIN__
++          freea (name_alt);
++#endif /* __CYGWIN__ */
+           return 0;
+         }
+ 
+@@ -3241,6 +3276,9 @@ gobble_file (char const *name, enum file
+   f->name = xstrdup (name);
+   cwd_n_used++;
+ 
++#if __CYGWIN__
++  freea (name_alt);
++#endif /* __CYGWIN__ */
+   return blocks;
+ }
+ 
+@@ -4961,6 +4999,11 @@ Sort entries alphabetically if none of -
+   -1                         list one file per line.  Avoid '\\n' with -q or -b\
+ \n\
+ "), stdout);
++#if __CYGWIN__
++      fputs (_("\
++      --append-exe           append .exe if cygwin magic was needed\n\
++"), stdout);
++#endif /* __CYGWIN__ */
+       fputs (HELP_OPTION_DESCRIPTION, stdout);
+       fputs (VERSION_OPTION_DESCRIPTION, stdout);
+       emit_size_note ();
+--- origsrc/coreutils-8.25/src/md5sum.c	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/md5sum.c	2016-04-12 12:49:47.333906200 -0600
+@@ -867,6 +867,9 @@ main (int argc, char **argv)
+   if (optind == argc)
+     argv[argc++] = bad_cast ("-");
+ 
++  if (O_BINARY)
++    xfreopen (NULL, "wb", stdout);
++
+   for (; optind < argc; ++optind)
+     {
+       char *file = argv[optind];
+--- origsrc/coreutils-8.25/src/mv.c	2016-01-12 04:41:44.000000000 -0700
++++ src/coreutils-8.25/src/mv.c	2016-04-12 12:49:47.333906200 -0600
+@@ -91,7 +91,7 @@ rm_option_init (struct rm_options *x)
+   x->require_restore_cwd = true;
+ 
+   {
+-    static struct dev_ino dev_ino_buf;
++    static struct root_dev_ino dev_ino_buf;
+     x->root_dev_ino = get_root_dev_ino (&dev_ino_buf);
+     if (x->root_dev_ino == NULL)
+       error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+@@ -466,6 +466,16 @@ main (int argc, char **argv)
+   else if (!target_directory)
+     {
+       assert (2 <= n_files);
++#if __CYGWIN__
++      struct stat s1, s2;
++      if (2 == n_files
++	  && lstat (file[0], &s1) == 0 && lstat (file[1], &s2) == 0
++	  && s1.st_ino == s2.st_ino)
++	{
++	  /* Allow 'mv foo Foo' to change case of the directory foo.  */
++	}
++      else
++#endif /* __CYGWIN__ */
+       if (target_directory_operand (file[n_files - 1]))
+         target_directory = file[--n_files];
+       else if (2 < n_files)
+--- origsrc/coreutils-8.25/src/pwd.c	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/pwd.c	2016-04-12 12:49:47.333906200 -0600
+@@ -268,8 +268,8 @@ static void
+ robust_getcwd (struct file_name *file_name)
+ {
+   size_t height = 1;
+-  struct dev_ino dev_ino_buf;
+-  struct dev_ino *root_dev_ino = get_root_dev_ino (&dev_ino_buf);
++  struct root_dev_ino dev_ino_buf;
++  struct root_dev_ino *root_dev_ino = get_root_dev_ino (&dev_ino_buf);
+   struct stat dot_sb;
+ 
+   if (root_dev_ino == NULL)
+@@ -282,7 +282,7 @@ robust_getcwd (struct file_name *file_na
+   while (1)
+     {
+       /* If we've reached the root, we're done.  */
+-      if (SAME_INODE (dot_sb, *root_dev_ino))
++      if (ROOT_DEV_INO_CHECK (root_dev_ino, &dot_sb))
+         break;
+ 
+       find_dir_entry (&dot_sb, file_name, height++);
+@@ -291,6 +291,9 @@ robust_getcwd (struct file_name *file_na
+   /* See if a leading slash is needed; file_name_prepend adds one.  */
+   if (file_name->start[0] == '\0')
+     file_name_prepend (file_name, "", 0);
++  /* If we aren't in `/', we must be in `//'.  */
++  if (! SAME_INODE (root_dev_ino->single_slash, dot_sb))
++    file_name_prepend (file_name, "", 0);
+ }
+ 
+ 
+--- origsrc/coreutils-8.25/src/remove.h	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/remove.h	2016-04-12 12:49:47.333906200 -0600
+@@ -54,7 +54,7 @@ struct rm_options
+ 
+   /* Pointer to the device and inode numbers of '/', when --recursive
+      and preserving '/'.  Otherwise NULL.  */
+-  struct dev_ino *root_dev_ino;
++  struct root_dev_ino *root_dev_ino;
+ 
+   /* If nonzero, stdin is a tty.  */
+   bool stdin_tty;
+--- origsrc/coreutils-8.25/src/rm.c	2016-01-01 06:48:50.000000000 -0700
++++ src/coreutils-8.25/src/rm.c	2016-04-12 12:49:47.333906200 -0600
+@@ -323,7 +323,7 @@ main (int argc, char **argv)
+ 
+   if (x.recursive && preserve_root)
+     {
+-      static struct dev_ino dev_ino_buf;
++      static struct root_dev_ino dev_ino_buf;
+       x.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
+       if (x.root_dev_ino == NULL)
+         error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+--- origsrc/coreutils-8.25/src/stat.c	2016-01-13 04:16:39.000000000 -0700
++++ src/coreutils-8.25/src/stat.c	2016-04-12 12:49:47.333906200 -0600
+@@ -72,6 +72,13 @@
+ #include "find-mount-point.h"
+ #include "xvasprintf.h"
+ 
++#if __CYGWIN__
++# include "cygwin.h"
++/* Whether .exe should be appended to command-line args as needed.  */
++static bool append_exe;
++# define APPEND_EXE_OPTION 10000
++#endif
++
+ #if USE_STATVFS
+ # define STRUCT_STATXFS_F_FSID_IS_INTEGER STRUCT_STATVFS_F_FSID_IS_INTEGER
+ # define HAVE_STRUCT_STATXFS_F_TYPE HAVE_STRUCT_STATVFS_F_TYPE
+@@ -189,6 +196,9 @@ static struct option const long_options[
+   {"format", required_argument, NULL, 'c'},
+   {"printf", required_argument, NULL, PRINTF_OPTION},
+   {"terse", no_argument, NULL, 't'},
++#if __CYGWIN__
++  {"append-exe", no_argument, NULL, APPEND_EXE_OPTION},
++#endif /* __CYGWIN__ */
+   {GETOPT_HELP_OPTION_DECL},
+   {GETOPT_VERSION_OPTION_DECL},
+   {NULL, 0, NULL, 0}
+@@ -1284,14 +1294,26 @@ do_statfs (char const *filename, char co
+       return false;
+     }
+ 
++#if __CYGWIN__
++  char *name_alt = NULL;
++  if (append_exe && 0 < cygwin_spelling (filename))
++    CYGWIN_APPEND_EXE (name_alt, filename);
++#endif /* __CYGWIN__ */
++
+   if (STATFS (filename, &statfsbuf) != 0)
+     {
+       error (0, errno, _("cannot read file system information for %s"),
+              quoteaf (filename));
++#if __CYGWIN__
++      freea (name_alt);
++#endif /* __CYGWIN__ */
+       return false;
+     }
+ 
+   bool fail = print_it (format, -1, filename, print_statfs, &statfsbuf);
++#if __CYGWIN__
++  freea (name_alt);
++#endif /* __CYGWIN__ */
+   return ! fail;
+ }
+ 
+@@ -1302,6 +1324,7 @@ do_stat (char const *filename, char cons
+ {
+   int fd = STREQ (filename, "-") ? 0 : -1;
+   struct stat statbuf;
++  char *name_alt = NULL;
+ 
+   if (0 <= fd)
+     {
+@@ -1314,18 +1337,28 @@ do_stat (char const *filename, char cons
+   /* We can't use the shorter
+      (follow_links?stat:lstat) (filename, &statbug)
+      since stat might be a function-like macro.  */
+-  else if ((follow_links
+-            ? stat (filename, &statbuf)
+-            : lstat (filename, &statbuf)) != 0)
++  else
+     {
+-      error (0, errno, _("cannot stat %s"), quoteaf (filename));
+-      return false;
++      if ((follow_links
++	   ? stat (filename, &statbuf)
++	   : lstat (filename, &statbuf)) != 0)
++	{
++	  error (0, errno, _("cannot stat %s"), quoteaf (filename));
++	  return false;
++	}
++#if __CYGWIN__
++      if (append_exe && 0 < cygwin_spelling (filename))
++        CYGWIN_APPEND_EXE (name_alt, filename);
++#endif /* __CYGWIN__ */
+     }
+ 
+   if (S_ISBLK (statbuf.st_mode) || S_ISCHR (statbuf.st_mode))
+     format = format2;
+ 
+   bool fail = print_it (format, fd, filename, print_stat, &statbuf);
++#if __CYGWIN__
++  freea (name_alt);
++#endif /* __CYGWIN__ */
+   return ! fail;
+ }
+ 
+@@ -1447,6 +1480,11 @@ Display file or file system status.\n\
+                           if you want a newline, include \\n in FORMAT\n\
+   -t, --terse           print the information in terse form\n\
+ "), stdout);
++#if __CYGWIN__
++      fputs (_("\
++      --append-exe      append .exe if cygwin magic was needed\n\
++"), stdout);
++#endif /* __CYGWIN__ */
+       fputs (HELP_OPTION_DESCRIPTION, stdout);
+       fputs (VERSION_OPTION_DESCRIPTION, stdout);
+ 
+@@ -1567,6 +1605,12 @@ main (int argc, char *argv[])
+           terse = true;
+           break;
+ 
++#if __CYGWIN__
++        case APPEND_EXE_OPTION:
++          append_exe = true;
++          break;
++#endif /* __CYGWIN__ */
++
+         case_GETOPT_HELP_CHAR;
+ 
+         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/coreutils/files/, sys-apps/coreutils/
@ 2017-11-12 13:06 Fabian Groffen
  0 siblings, 0 replies; 7+ messages in thread
From: Fabian Groffen @ 2017-11-12 13:06 UTC (permalink / raw
  To: gentoo-commits

commit:     a17cdcaf7e1ea7eabbdb0331ddee6e6c3a103850
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 12 13:05:58 2017 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Nov 12 13:05:58 2017 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=a17cdcaf

sys-apps/coreutils: sync, pulls in 8.28 which fixes Darwin17

Package-Manager: Portage-2.3.13-prefix, Repoman-2.3.4

 sys-apps/coreutils/Manifest                        |  12 +-
 sys-apps/coreutils/coreutils-8.20.ebuild           | 190 ---------------------
 sys-apps/coreutils/coreutils-8.22-r1.ebuild        | 181 --------------------
 sys-apps/coreutils/coreutils-8.22.ebuild           | 189 --------------------
 ...-8.23-r00.1.ebuild => coreutils-8.28-r1.ebuild} | 157 +++++++++++------
 sys-apps/coreutils/files/coreutils-7.2-mint.patch  | 152 -----------------
 .../coreutils/files/coreutils-7.4-hppa-hpux.patch  |  11 --
 .../files/coreutils-7.5-interix-setgroups.patch    |  15 --
 .../coreutils/files/coreutils-8.23-non-elf.patch   |  37 ----
 .../files/coreutils-8.5-interix-double.patch       |  69 --------
 .../files/coreutils-8.5-interix-warn-mount.patch   |  15 --
 .../coreutils/files/coreutils-8.8-hppa-hpux.patch  |  11 --
 .../coreutils/files/coreutils-8.8-interix.patch    |  18 --
 13 files changed, 106 insertions(+), 951 deletions(-)

diff --git a/sys-apps/coreutils/Manifest b/sys-apps/coreutils/Manifest
index de71b647e9..5d14b1a062 100644
--- a/sys-apps/coreutils/Manifest
+++ b/sys-apps/coreutils/Manifest
@@ -1,15 +1,9 @@
-DIST coreutils-8.20-patches-1.1.tar.xz 19504 SHA256 0a1a3cc578e8872ebc93113edd76d1f1d88fb4d6596a047cfbb6c5fd4e82c22d SHA512 258116ff52d1d28acbedd2383c8d0f488c272b297c4f146231ea45fb76902bb56c9fad2d74d50c22371e67a4178dcff7b65950fcc034f56fc02c3c2ff290224f WHIRLPOOL ae4436a6ae655affbc02ee2d3d6a87345dc7b63b67aaecf01e034d2e40237c6e76b00a909d852f6ea96e348ef43e8e3f6f4c5bdb01aaf6d30a1b51036cbfe31b
-DIST coreutils-8.20.tar.xz 5273788 SHA256 dbcb798764827a0f74be738662ecb516705cf520330cd3d7b2640fdffa499eb2 SHA512 adbeab5af780ae70d2a98a81e96ad2cdfbcbc20153372b0085f6ac75ae9fadff82bd09b460400820057692b4145d7f2d276630b76b0ed509303587972ed175cd WHIRLPOOL 3cf911cf785c6e6acab4f37bc75805687f91fe74d5727782903d242669ee6b7ad444b18395d6808b1f2569703cca1992983d3bfef41f65ea461f6d0aa25908e2
-DIST coreutils-8.22-man-r1.tar.xz 42748 SHA256 eb9882286a6355674e607506318ccc9e361b6a985d64073b797fd56a5e0d256c SHA512 b0123e3c8cd037d006a2bb64e8047636329ac3fd3d685db8e52a19e83df87da0428896af9bdcd8f1208f7aad3665ec2a871bbbfa98cbe5293c697431a23d7b4c WHIRLPOOL 7e705060f5af2d28152531ad3b5ae8e6cca2dabdec7dc1a30bcf7b74951462bb58ee610d1e080abc812e1291fae904b3e931a35d3d2566fb7b85f6a37415e04b
-DIST coreutils-8.22-patches-1.0.tar.xz 6492 SHA256 4a2a32429607e0727d6ae114ee9e543c948d6c7710ef99920901e73784cee3f4 SHA512 daf1c2b85619aa9ff7bae02926be39478f439d5555fd4eb3038b62be6cceb7cc6357b4a77a347cb2b4ee08119aa2c3f7deb63d7179407af03f08459d8de38e0b WHIRLPOOL 845dfbf57269f50486862b6236e2a461bf7bccee383365982d4359895d6c9303e467d359aa9862134a965a96a062fa2c748ceb99390bbee09f9b843dbe5bd1ed
-DIST coreutils-8.22-patches-1.1.tar.xz 7840 SHA256 4c45cca7950bbd278db23318916e503bda2df3be3e11c81cd15b55874007ed16 SHA512 7555544041cf4acf5615df76d6e9f9df157dac66059757d587af8f264597e02e8a395fbb920d42623fd40dab9a5ef1dfae2719e300efe491b0eaa2baa3a91f11 WHIRLPOOL ebc9fa35f40473646c2b826cc1bc57e9012fa37f264eb7e6084c0d2cf04f46827c943f9aa80f779a3d99bc07eeb40ffc4ac09109a6324af9882e2b0630d84253
-DIST coreutils-8.22.tar.xz 5335124 SHA256 5b3e94998152c017e6c75d56b9b994188eb71bf46d4038a642cb9141f6ff1212 SHA512 2f14c2cab7001297309b4774bf3d610ecbaaec7d98d68e3792b24d2b52d319c4e30e55f803e56c48b9b9a1b76eb1c9636be5444fe1dc1dbcdd6150cfcb34847f WHIRLPOOL 1b8e3f1cf12f7975e8d80b9ddab132937b2fffaca8c85ac1fefddb5fe277a63a7aa9c6f0f93d8f5a93d5af378b3cf3573222db8e1da918152b9fb7eff1352238
-DIST coreutils-8.23-man.tar.xz 43060 SHA256 d1b16e74b3dba4f313aeebae2c69da205f7d2e6e1c2aa8d39026c860d314ecca SHA512 db5085c783256e30b9878bdce5cf16063aaa51d800d5b40537d5cdea372d095a391e9986e8680c6d94841bc995ab43ac8bc2d23427e6e96263d24b0b5ccc7d12 WHIRLPOOL ef0cae7c1b752c0f81e6f23b0a792804518a5257740fedf7dd70577ec503a64716156a898ed50045987954a6234ba23c9483772830683bb7e4bd0c8a2ec2c142
-DIST coreutils-8.23-patches-1.1.tar.xz 6480 SHA256 daf5d61b36db61d629bf14bf8f04e878f1205c9ae2af5daf37dca3aad5a6fde4 SHA512 8da5f8e9fc47baa060030076c4a2de90013a0d1faad45fe99545e93d50bc079720281f6db5774590fe842c8c56bd8ae97e1d9bf862fae1896760b5e5b686e7a8 WHIRLPOOL 2a8082975e3627454569e57aecb3d1ac6bdef89e16f4f64a88a4ffcbf2b341fe56874b128485ae540270f7a060f9e0f4bd3eecf68e215fb6a5a1c5ac434f7403
-DIST coreutils-8.23.tar.xz 5375612 SHA256 ec43ca5bcfc62242accb46b7f121f6b684ee21ecd7d075059bf650ff9e37b82d SHA512 a5f4b82ce208cb439d5dbe6f5cf4b19fecff581da210a51c4e3fdd5ffab114d171456d041e20a6996b59185947ac6655096e4b5ca252186e282ae0ae08b7534c WHIRLPOOL 4bd4cd28d6de96218e791c5ed15766e34dfeeb3aeade10e211e3a0e9ffa695e5a716872a915d78b356b3e3635e1e22274d92560301aadaf46a58242dc235d733
 DIST coreutils-8.24-man.tar.xz 42920 SHA256 cf0333b5f134a331e0b46e2ddf90666f8bdc3281c1ca2c7ccbb75b437589ce37 SHA512 9dfe614402bc35c43301ebf97d2d36ac5db1433f48171bda15f2ba76bd9944742665b30a764df0cf773ebcad1845aae57c8e36a1cd3848c1e82a7c996d6cc78a WHIRLPOOL d702a372031fe52262204c00bee641084c099c45150d82abd5915535ab3bbe1efb63c4f00173bb88725ba49126a6ecf368d14b12843b570c08165b757b78710b
 DIST coreutils-8.24-patches-1.1.tar.xz 6688 SHA256 79cb0dc5b58cb97e17b11b5e821ed88fae88f728d9fd07986bbb397824e49c6f SHA512 cf340ccb918e307be8bbfd19a299bcfe5b295a26f59a8eeb8657f5dda1361100a350e996b31097948e63890987a2f83d05d2e7175c6304f4a4812b9974679c2c WHIRLPOOL 3b4d4676b119e4f22a01c8450be13d6eb40720d3c57aac5631454df24814943e6e6024fbdcd27a2b262d42c1446d9c04cbdc163371ff20a4b28d9cd9a77c5c9c
 DIST coreutils-8.24.tar.xz 5649896 SHA256 a2d75286a4b9ef3a13039c2da3868a61be4ee9f17d8ae380a35a97e506972170 SHA512 b42bb233340353647bb9a1c3d9122c1a5379cf3602ba9197c3c935fc899897e7d4685148dfaf93eccc096bee0a9b03416d79dc9bb81d5d2dea6e04ed134a3d1b WHIRLPOOL 68598e0c93375522714b9bc0dd092386a9466725b2b4b5715e2926c5087e1ce887d5e5b8e0b872347a053edcb39ba1f8c6949ee659a06ed554703a0ba07064e2
 DIST coreutils-8.25-man.tar.xz 43420 SHA256 2ee31c3a6d2276f49c5515375d4a0c1047580da6ac10536898e0f0de81707f29 SHA512 412afc9909d30618ab9daba51c965c0fd22420c32f6c5a7e32ba32d957a92e8a65b977bccaba4b76c55d435a57065dc6103ff11c5fa31d02f117c13a2b09f75e WHIRLPOOL f2a9458d71cfbf6227ece5b688adb34653dacda0dfbcfd5332a36e33cda58b081d9b37c4ec910c92feba485e8e182f52327f4860f1ff5e0b0b7ae2f9b82045ee
 DIST coreutils-8.25-patches-1.1.tar.xz 7196 SHA256 68e116eb70a69e94458197cde81165c9902bec0c6661be31f6fffb84ba8d809c SHA512 19326ab7dd8d4515f7239133772f715aac4e722a1e28f4b0f19d8d629abe54a2309fa7c469797dc0f9e88991906883a891622c791ef940b9a5af6608d2e9110e WHIRLPOOL e7931e16e267b817a86f11b9e01d82dfac8144dbabd91d5cea036c819303895bd852809f374a76b6e4e474b559505d6fc907ddcb113ca1915b76d880e291bc76
 DIST coreutils-8.25.tar.xz 5725008 SHA256 31e67c057a5b32a582f26408c789e11c2e8d676593324849dcf5779296cdce87 SHA512 571f95d44987d373081ed4c6ac82155ad3dcd95621d7b1a7163597e80ecbbafef2cd74b2ef594587a443a1a4355083879f898a286bb0230c48112d43d076ccd6 WHIRLPOOL e871e177ffaf96bfdd9e668eb9a09df9fd952ff095796cffd1ac2b8b3943c9c2ae79c31890fa02b5ed2609b6c6c84b64d2292454b043d62260a9560d2f7b9457
+DIST coreutils-8.28-man.tar.xz 43832 SHA256 d72c3fa79ae328a4fd1107102e8946755aa2e908044e1efcf1e71ef206dca042 SHA512 363cf595e0f6fc69eb6a9d1ca258a5f012404cee99887494ab6e40fe2c6de5e49e7cad953aecb394c5612043efe6b407e657811d8251b10e159c97b849dd8b3e WHIRLPOOL 7b10dbde06caf00d4b789cdb60a7d0c73aec65a90e889698daeccd04eefd8df08142261ea5fde8d3d455f35b2eddf07182bf92e2522e63e8ece412379e0cb0d1
+DIST coreutils-8.28-patches-1.1.tar.xz 7336 SHA256 bdd7ed0ef973bc1095df329225659a928ed061695651e2b54de79ac15690f517 SHA512 af47aaa614550e5cd82b2386fafd9f90beb0564b8bbedfe92238906e7c6f040fb7468c1929f0951d4f98038b6e1df7da2408204be78219e6a041658507385957 WHIRLPOOL 4a90ffa0a35b81d3d20c29128b0d39e08136d499201ac875781d9e851142d36c111031b333b6bfb81db692e75e7b3cc9673c4339d8d183d0d8df2371444dca4e
+DIST coreutils-8.28.tar.xz 5252336 SHA256 1117b1a16039ddd84d51a9923948307cfa28c2cea03d1a2438742253df0a0c65 SHA512 1e592d0dd03b9227bf92af9a82bed6dc3bcbee46e984c7fb09833dea0962e86b309aa34d5e43823b73d4522c066bfa5cdc8ec694aa190910fb246ff32ceb63a1 WHIRLPOOL 58bdd9681d07794da70dc012d03de2f791bc8e40a16de85302cbb5ea247f6d81f0a92c3b90d655b9947057c5e5eb99b9347152d41150c1a613dd1f891942a73f

diff --git a/sys-apps/coreutils/coreutils-8.20.ebuild b/sys-apps/coreutils/coreutils-8.20.ebuild
deleted file mode 100644
index 8f87a08bc6..0000000000
--- a/sys-apps/coreutils/coreutils-8.20.ebuild
+++ /dev/null
@@ -1,190 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/coreutils/coreutils-8.20.ebuild,v 1.12 2013/01/01 18:55:02 armin76 Exp $
-
-EAPI="3"
-
-inherit eutils flag-o-matic toolchain-funcs
-
-PATCH_VER="1.1"
-DESCRIPTION="Standard GNU file utilities (chmod, cp, dd, dir, ls...), text utilities (sort, tr, head, wc..), and shell utilities (whoami, who,...)"
-HOMEPAGE="http://www.gnu.org/software/coreutils/"
-SRC_URI="mirror://gnu-alpha/coreutils/${P}.tar.xz
-	mirror://gnu/${PN}/${P}.tar.xz
-	mirror://gentoo/${P}.tar.xz
-	mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz
-	http://dev.gentoo.org/~ryao/dist/${P}-patches-${PATCH_VER}.tar.xz"
-
-LICENSE="GPL-3"
-SLOT="0"
-KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="acl caps gmp nls selinux static userland_BSD vanilla xattr"
-
-LIB_DEPEND="acl? ( sys-apps/acl[static-libs] )
-	caps? ( sys-libs/libcap )
-	gmp? ( dev-libs/gmp[static-libs] )
-	xattr? ( !userland_BSD? ( sys-apps/attr[static-libs] ) )"
-RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs]} )
-	selinux? ( sys-libs/libselinux )
-	nls? ( >=sys-devel/gettext-0.15 )
-	!app-misc/realpath
-	!<sys-apps/util-linux-2.13
-	!sys-apps/stat
-	!net-mail/base64
-	!sys-apps/mktemp
-	!<app-forensics/tct-1.18-r1
-	!<net-fs/netatalk-2.0.3-r4
-	!<sci-chemistry/ccp4-6.1.1"
-DEPEND="${RDEPEND}
-	static? ( ${LIB_DEPEND} )
-	app-arch/xz-utils"
-
-src_prepare() {
-	if ! use vanilla ; then
-		use_if_iuse unicode || rm -f "${WORKDIR}"/patch/000_all_coreutils-i18n.patch
-		EPATCH_SUFFIX="patch" \
-		PATCHDIR="${WORKDIR}/patch" \
-		EPATCH_EXCLUDE="001_all_coreutils-gen-progress-bar.patch" \
-		epatch
-	fi
-
-	epatch "${FILESDIR}"/${PN}-7.2-mint.patch
-
-	# Since we've patched many .c files, the make process will try to
-	# re-build the manpages by running `./bin --help`.  When doing a
-	# cross-compile, we can't do that since 'bin' isn't a native bin.
-	# Also, it's not like we changed the usage on any of these things,
-	# so let's just update the timestamps and skip the help2man step.
-	set -- man/*.x
-	touch ${@/%x/1}
-
-	# Avoid perl dep for compiled in dircolors default #348642
-	if ! has_version dev-lang/perl ; then
-		touch src/dircolors.h
-		touch ${@/%x/1}
-	fi
-}
-
-src_configure() {
-	local myconf=''
-	if tc-is-cross-compiler && [[ ${CHOST} == *linux* ]] ; then
-		export fu_cv_sys_stat_statfs2_bsize=yes #311569
-		export gl_cv_func_realpath_works=yes #416629
-	fi
-
-	export gl_cv_func_mknod_works=yes #409919
-	use static && append-ldflags -static && sed -i '/elf_sys=yes/s:yes:no:' configure #321821
-	use selinux || export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no #301782
-	use userland_BSD && myconf="${myconf} -program-prefix=g --program-transform-name=s/stat/nustat/"
-	# kill/uptime - procps
-	# groups/su   - shadow
-	# hostname    - net-tools
-	if [[ ${CHOST} == *-mint* ]]; then
-		myconf="${myconf} --enable-install-program=arch,hostname,kill,uptime"
-		myconf="${myconf} --enable-no-install-program=groups,su"
-	else
-		myconf="${myconf} --enable-install-program=arch"
-		myconf="${myconf} --enable-no-install-program=groups,hostname,kill,su,uptime"
-	fi
-
-	econf \
-		--with-packager="Gentoo" \
-		--with-packager-version="${PVR} (p${PATCH_VER:-0})" \
-		--with-packager-bug-reports="http://bugs.gentoo.org/" \
-		${myconf} \
-		--enable-largefile \
-		$(use caps || echo --disable-libcap) \
-		$(use_enable nls) \
-		$(use_enable acl) \
-		$(use_enable xattr) \
-		$(use_with gmp) \
-		${myconf}
-}
-
-src_test() {
-	# Non-root tests will fail if the full path isnt
-	# accessible to non-root users
-	chmod -R go-w "${WORKDIR}"
-	chmod a+rx "${WORKDIR}"
-
-	# coreutils tests like to do `mount` and such with temp dirs
-	# so make sure /etc/mtab is writable #265725
-	# make sure /dev/loop* can be mounted #269758
-	mkdir -p "${T}"/mount-wrappers
-	mkwrap() {
-		local w ww
-		for w in "$@" ; do
-			ww="${T}/mount-wrappers/${w}"
-			cat <<-EOF > "${ww}"
-				#!${EPREFIX}/bin/sh
-				exec env SANDBOX_WRITE="\${SANDBOX_WRITE}:/etc/mtab:/dev/loop" $(type -P $w) "\$@"
-			EOF
-			chmod a+rx "${ww}"
-		done
-	}
-	mkwrap mount umount
-
-	addwrite /dev/full
-	#export RUN_EXPENSIVE_TESTS="yes"
-	#export FETISH_GROUPS="portage wheel"
-	env PATH="${T}/mount-wrappers:${PATH}" \
-	emake -j1 -k check || die "make check failed"
-}
-
-src_install() {
-	emake install DESTDIR="${D}" || die
-	dodoc AUTHORS ChangeLog* NEWS README* THANKS TODO
-
-	insinto /etc
-	newins src/dircolors.hin DIR_COLORS || die
-
-	if [[ ${USERLAND} == "GNU" || ${EPREFIX%/} != "" ]] ; then
-		cd "${ED}"/usr/bin
-		dodir /bin
-		# move critical binaries into /bin (required by FHS)
-		local fhs="cat chgrp chmod chown cp date dd df echo false ln ls
-		           mkdir mknod mv pwd rm rmdir stty sync true uname"
-
-		[[ ${CHOST} == *-mint* ]] && fhs="${fhs} hostname"
-
-		mv ${fhs} ../../bin/ || die "could not move fhs bins"
-		# move critical binaries into /bin (common scripts)
-		local com="basename chroot cut dir dirname du env expr head mkfifo
-		           mktemp readlink seq sleep sort tail touch tr tty vdir wc yes"
-		mv ${com} ../../bin/ || die "could not move common bins"
-		# create a symlink for uname in /usr/bin/ since autotools require it
-		local x
-		for x in ${com} uname ; do
-			dosym /bin/${x} /usr/bin/${x} || die
-		done
-	else
-		# For now, drop the man pages, collides with the ones of the system.
-		rm -rf "${ED}"/usr/share/man
-	fi
-
-}
-
-pkg_postinst() {
-	ewarn "Make sure you run 'hash -r' in your active shells."
-	ewarn "You should also re-source your shell settings for LS_COLORS"
-	ewarn "  changes, such as: source /etc/profile"
-
-	# /bin/dircolors sometimes sticks around #224823
-	if [ -e "${EROOT}/usr/bin/dircolors" ] && [ -e "${EROOT}/bin/dircolors" ] ; then
-		if strings "${EROOT}/bin/dircolors" | grep -qs "GNU coreutils" ; then
-			einfo "Deleting orphaned GNU /bin/dircolors for you"
-			rm -f "${EROOT}/bin/dircolors"
-		fi
-	fi
-
-	# Help out users using experimental filesystems
-	if grep -qs btrfs "${EROOT}"/etc/fstab /proc/mounts ; then
-		case $(uname -r) in
-		2.6.[12][0-9]|2.6.3[0-7]*)
-			ewarn "You are running a system with a buggy btrfs driver."
-			ewarn "Please upgrade your kernel to avoid silent corruption."
-			ewarn "See: https://bugs.gentoo.org/353907"
-			;;
-		esac
-	fi
-}

diff --git a/sys-apps/coreutils/coreutils-8.22-r1.ebuild b/sys-apps/coreutils/coreutils-8.22-r1.ebuild
deleted file mode 100644
index 950937359f..0000000000
--- a/sys-apps/coreutils/coreutils-8.22-r1.ebuild
+++ /dev/null
@@ -1,181 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/coreutils/coreutils-8.22-r1.ebuild,v 1.3 2015/02/28 20:15:19 tgall Exp $
-
-EAPI="3"
-
-inherit eutils flag-o-matic toolchain-funcs
-
-PATCH_VER="1.1"
-DESCRIPTION="Standard GNU file utilities (chmod, cp, dd, dir, ls...), text utilities (sort, tr, head, wc..), and shell utilities (whoami, who,...)"
-HOMEPAGE="http://www.gnu.org/software/coreutils/"
-SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
-	mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz
-	http://dev.gentoo.org/~vapier/dist/${P}-patches-${PATCH_VER}.tar.xz
-	mirror://gentoo/${P}-man-r1.tar.xz
-	http://dev.gentoo.org/~vapier/dist/${P}-man-r1.tar.xz"
-
-LICENSE="GPL-3"
-SLOT="0"
-KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="acl caps gmp nls selinux static userland_BSD vanilla xattr"
-
-LIB_DEPEND="acl? ( sys-apps/acl[static-libs] )
-	caps? ( sys-libs/libcap )
-	gmp? ( dev-libs/gmp[static-libs] )
-	xattr? ( !userland_BSD? ( sys-apps/attr[static-libs] ) )"
-RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs]} )
-	selinux? ( sys-libs/libselinux )
-	nls? ( virtual/libintl )
-	!app-misc/realpath
-	!<sys-apps/util-linux-2.13
-	!sys-apps/stat
-	!net-mail/base64
-	!sys-apps/mktemp
-	!<app-forensics/tct-1.18-r1
-	!<net-fs/netatalk-2.0.3-r4
-	!<sci-chemistry/ccp4-6.1.1"
-DEPEND="${RDEPEND}
-	static? ( ${LIB_DEPEND} )
-	app-arch/xz-utils"
-
-src_prepare() {
-	if ! use vanilla ; then
-		use_if_iuse unicode || rm -f "${WORKDIR}"/patch/000_all_coreutils-i18n.patch
-		EPATCH_SUFFIX="patch" \
-		PATCHDIR="${WORKDIR}/patch" \
-		EPATCH_EXCLUDE="001_all_coreutils-gen-progress-bar.patch" \
-		epatch
-	fi
-
-	epatch "${FILESDIR}"/${PN}-8.22-mint.patch
-
-	# Since we've patched many .c files, the make process will try to
-	# re-build the manpages by running `./bin --help`.  When doing a
-	# cross-compile, we can't do that since 'bin' isn't a native bin.
-	# Also, it's not like we changed the usage on any of these things,
-	# so let's just update the timestamps and skip the help2man step.
-	set -- man/*.x
-	touch ${@/%x/1}
-
-	# Avoid perl dep for compiled in dircolors default #348642
-	if ! has_version dev-lang/perl ; then
-		touch src/dircolors.h
-		touch ${@/%x/1}
-	fi
-}
-
-src_configure() {
-	local myconf=''
-	if tc-is-cross-compiler && [[ ${CHOST} == *linux* ]] ; then
-		export fu_cv_sys_stat_statfs2_bsize=yes #311569
-		export gl_cv_func_realpath_works=yes #416629
-	fi
-
-	export gl_cv_func_mknod_works=yes #409919
-	use static && append-ldflags -static && sed -i '/elf_sys=yes/s:yes:no:' configure #321821
-	use selinux || export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no #301782
-	use userland_BSD && myconf="${myconf} -program-prefix=g --program-transform-name=s/stat/nustat/"
-	# kill/uptime - procps
-	# groups/su   - shadow
-	# hostname    - net-tools
-	if [[ ${CHOST} == *-mint* ]]; then
-		myconf="${myconf} --enable-install-program=arch,hostname,kill,uptime"
-		myconf="${myconf} --enable-no-install-program=groups,su"
-	else
-		myconf="${myconf} --enable-install-program=arch"
-		myconf="${myconf} --enable-no-install-program=groups,hostname,kill,su,uptime"
-	fi
-
-	econf \
-		--with-packager="Gentoo" \
-		--with-packager-version="${PVR} (p${PATCH_VER:-0})" \
-		--with-packager-bug-reports="http://bugs.gentoo.org/" \
-		--enable-largefile \
-		$(use caps || echo --disable-libcap) \
-		$(use_enable nls) \
-		$(use_enable acl) \
-		$(use_enable xattr) \
-		$(use_with gmp) \
-		${myconf}
-}
-
-src_test() {
-	# Non-root tests will fail if the full path isnt
-	# accessible to non-root users
-	chmod -R go-w "${WORKDIR}"
-	chmod a+rx "${WORKDIR}"
-
-	# coreutils tests like to do `mount` and such with temp dirs
-	# so make sure /etc/mtab is writable #265725
-	# make sure /dev/loop* can be mounted #269758
-	mkdir -p "${T}"/mount-wrappers
-	mkwrap() {
-		local w ww
-		for w in "$@" ; do
-			ww="${T}/mount-wrappers/${w}"
-			cat <<-EOF > "${ww}"
-				#!${EPREFIX}/bin/sh
-				exec env SANDBOX_WRITE="\${SANDBOX_WRITE}:/etc/mtab:/dev/loop" $(type -P $w) "\$@"
-			EOF
-			chmod a+rx "${ww}"
-		done
-	}
-	mkwrap mount umount
-
-	addwrite /dev/full
-	#export RUN_EXPENSIVE_TESTS="yes"
-	#export FETISH_GROUPS="portage wheel"
-	env PATH="${T}/mount-wrappers:${PATH}" \
-	emake -j1 -k check || die "make check failed"
-}
-
-src_install() {
-	emake install DESTDIR="${D}" || die
-	dodoc AUTHORS ChangeLog* NEWS README* THANKS TODO
-
-	insinto /etc
-	newins src/dircolors.hin DIR_COLORS || die
-
-	if [[ ${USERLAND} == "GNU" ]] ; then
-		cd "${ED}"/usr/bin
-		dodir /bin
-		# move critical binaries into /bin (required by FHS)
-		local fhs="cat chgrp chmod chown cp date dd df echo false ln ls
-		           mkdir mknod mv pwd rm rmdir stty sync true uname"
-
-		[[ ${CHOST} == *-mint* ]] && fhs="${fhs} hostname"
-
-		mv ${fhs} ../../bin/ || die "could not move fhs bins"
-		# move critical binaries into /bin (common scripts)
-		local com="basename chroot cut dir dirname du env expr head mkfifo
-		           mktemp readlink seq sleep sort tail touch tr tty vdir wc yes"
-		mv ${com} ../../bin/ || die "could not move common bins"
-		# create a symlink for uname in /usr/bin/ since autotools require it
-		local x
-		for x in ${com} uname ; do
-			dosym /bin/${x} /usr/bin/${x} || die
-		done
-	else
-		# For now, drop the man pages, collides with the ones of the system.
-		rm -rf "${ED}"/usr/share/man
-	fi
-
-}
-
-pkg_postinst() {
-	ewarn "Make sure you run 'hash -r' in your active shells."
-	ewarn "You should also re-source your shell settings for LS_COLORS"
-	ewarn "  changes, such as: source /etc/profile"
-
-	# Help out users using experimental filesystems
-	if grep -qs btrfs "${EROOT}"/etc/fstab /proc/mounts ; then
-		case $(uname -r) in
-		2.6.[12][0-9]|2.6.3[0-7]*)
-			ewarn "You are running a system with a buggy btrfs driver."
-			ewarn "Please upgrade your kernel to avoid silent corruption."
-			ewarn "See: https://bugs.gentoo.org/353907"
-			;;
-		esac
-	fi
-}

diff --git a/sys-apps/coreutils/coreutils-8.22.ebuild b/sys-apps/coreutils/coreutils-8.22.ebuild
deleted file mode 100644
index 2ba4861314..0000000000
--- a/sys-apps/coreutils/coreutils-8.22.ebuild
+++ /dev/null
@@ -1,189 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/coreutils/coreutils-8.22.ebuild,v 1.4 2014/04/27 19:08:29 vapier Exp $
-
-EAPI="3"
-
-inherit eutils flag-o-matic toolchain-funcs
-
-PATCH_VER="1.0"
-DESCRIPTION="Standard GNU file utilities (chmod, cp, dd, dir, ls...), text utilities (sort, tr, head, wc..), and shell utilities (whoami, who,...)"
-HOMEPAGE="http://www.gnu.org/software/coreutils/"
-SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
-	mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz
-	http://dev.gentoo.org/~vapier/dist/${P}-patches-${PATCH_VER}.tar.xz
-	mirror://gentoo/${P}-man-r1.tar.xz
-	http://dev.gentoo.org/~vapier/dist/${P}-man-r1.tar.xz"
-
-LICENSE="GPL-3"
-SLOT="0"
-KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="acl caps gmp nls selinux static userland_BSD vanilla xattr"
-
-LIB_DEPEND="acl? ( sys-apps/acl[static-libs] )
-	caps? ( sys-libs/libcap )
-	gmp? ( dev-libs/gmp[static-libs] )
-	xattr? ( !userland_BSD? ( sys-apps/attr[static-libs] ) )"
-RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs]} )
-	selinux? ( sys-libs/libselinux )
-	nls? ( virtual/libintl )
-	!app-misc/realpath
-	!<sys-apps/util-linux-2.13
-	!sys-apps/stat
-	!net-mail/base64
-	!sys-apps/mktemp
-	!<app-forensics/tct-1.18-r1
-	!<net-fs/netatalk-2.0.3-r4
-	!<sci-chemistry/ccp4-6.1.1"
-DEPEND="${RDEPEND}
-	static? ( ${LIB_DEPEND} )
-	app-arch/xz-utils"
-
-src_prepare() {
-	if ! use vanilla ; then
-		use_if_iuse unicode || rm -f "${WORKDIR}"/patch/000_all_coreutils-i18n.patch
-		EPATCH_SUFFIX="patch" \
-		PATCHDIR="${WORKDIR}/patch" \
-		EPATCH_EXCLUDE="001_all_coreutils-gen-progress-bar.patch" \
-		epatch
-	fi
-
-	epatch "${FILESDIR}"/${PN}-8.22-mint.patch
-
-	# Since we've patched many .c files, the make process will try to
-	# re-build the manpages by running `./bin --help`.  When doing a
-	# cross-compile, we can't do that since 'bin' isn't a native bin.
-	# Also, it's not like we changed the usage on any of these things,
-	# so let's just update the timestamps and skip the help2man step.
-	set -- man/*.x
-	touch ${@/%x/1}
-
-	# Avoid perl dep for compiled in dircolors default #348642
-	if ! has_version dev-lang/perl ; then
-		touch src/dircolors.h
-		touch ${@/%x/1}
-	fi
-}
-
-src_configure() {
-	local myconf=''
-	if tc-is-cross-compiler && [[ ${CHOST} == *linux* ]] ; then
-		export fu_cv_sys_stat_statfs2_bsize=yes #311569
-		export gl_cv_func_realpath_works=yes #416629
-	fi
-
-	export gl_cv_func_mknod_works=yes #409919
-	use static && append-ldflags -static && sed -i '/elf_sys=yes/s:yes:no:' configure #321821
-	use selinux || export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no #301782
-	use userland_BSD && myconf="${myconf} -program-prefix=g --program-transform-name=s/stat/nustat/"
-	# kill/uptime - procps
-	# groups/su   - shadow
-	# hostname    - net-tools
-	if [[ ${CHOST} == *-mint* ]]; then
-		myconf="${myconf} --enable-install-program=arch,hostname,kill,uptime"
-		myconf="${myconf} --enable-no-install-program=groups,su"
-	else
-		myconf="${myconf} --enable-install-program=arch"
-		myconf="${myconf} --enable-no-install-program=groups,hostname,kill,su,uptime"
-	fi
-
-	econf \
-		--with-packager="Gentoo" \
-		--with-packager-version="${PVR} (p${PATCH_VER:-0})" \
-		--with-packager-bug-reports="http://bugs.gentoo.org/" \
-		--enable-largefile \
-		$(use caps || echo --disable-libcap) \
-		$(use_enable nls) \
-		$(use_enable acl) \
-		$(use_enable xattr) \
-		$(use_with gmp) \
-		${myconf}
-}
-
-src_test() {
-	# Non-root tests will fail if the full path isnt
-	# accessible to non-root users
-	chmod -R go-w "${WORKDIR}"
-	chmod a+rx "${WORKDIR}"
-
-	# coreutils tests like to do `mount` and such with temp dirs
-	# so make sure /etc/mtab is writable #265725
-	# make sure /dev/loop* can be mounted #269758
-	mkdir -p "${T}"/mount-wrappers
-	mkwrap() {
-		local w ww
-		for w in "$@" ; do
-			ww="${T}/mount-wrappers/${w}"
-			cat <<-EOF > "${ww}"
-				#!${EPREFIX}/bin/sh
-				exec env SANDBOX_WRITE="\${SANDBOX_WRITE}:/etc/mtab:/dev/loop" $(type -P $w) "\$@"
-			EOF
-			chmod a+rx "${ww}"
-		done
-	}
-	mkwrap mount umount
-
-	addwrite /dev/full
-	#export RUN_EXPENSIVE_TESTS="yes"
-	#export FETISH_GROUPS="portage wheel"
-	env PATH="${T}/mount-wrappers:${PATH}" \
-	emake -j1 -k check || die "make check failed"
-}
-
-src_install() {
-	emake install DESTDIR="${D}" || die
-	dodoc AUTHORS ChangeLog* NEWS README* THANKS TODO
-
-	insinto /etc
-	newins src/dircolors.hin DIR_COLORS || die
-
-	if [[ ${USERLAND} == "GNU" ]] ; then
-		cd "${ED}"/usr/bin
-		dodir /bin
-		# move critical binaries into /bin (required by FHS)
-		local fhs="cat chgrp chmod chown cp date dd df echo false ln ls
-		           mkdir mknod mv pwd rm rmdir stty sync true uname"
-
-		[[ ${CHOST} == *-mint* ]] && fhs="${fhs} hostname"
-
-		mv ${fhs} ../../bin/ || die "could not move fhs bins"
-		# move critical binaries into /bin (common scripts)
-		local com="basename chroot cut dir dirname du env expr head mkfifo
-		           mktemp readlink seq sleep sort tail touch tr tty vdir wc yes"
-		mv ${com} ../../bin/ || die "could not move common bins"
-		# create a symlink for uname in /usr/bin/ since autotools require it
-		local x
-		for x in ${com} uname ; do
-			dosym /bin/${x} /usr/bin/${x} || die
-		done
-	else
-		# For now, drop the man pages, collides with the ones of the system.
-		rm -rf "${ED}"/usr/share/man
-	fi
-
-}
-
-pkg_postinst() {
-	ewarn "Make sure you run 'hash -r' in your active shells."
-	ewarn "You should also re-source your shell settings for LS_COLORS"
-	ewarn "  changes, such as: source /etc/profile"
-
-	# /bin/dircolors sometimes sticks around #224823
-	if [ -e "${EROOT}/usr/bin/dircolors" ] && [ -e "${EROOT}/bin/dircolors" ] ; then
-		if strings "${EROOT}/bin/dircolors" | grep -qs "GNU coreutils" ; then
-			einfo "Deleting orphaned GNU /bin/dircolors for you"
-			rm -f "${EROOT}/bin/dircolors"
-		fi
-	fi
-
-	# Help out users using experimental filesystems
-	if grep -qs btrfs "${EROOT}"/etc/fstab /proc/mounts ; then
-		case $(uname -r) in
-		2.6.[12][0-9]|2.6.3[0-7]*)
-			ewarn "You are running a system with a buggy btrfs driver."
-			ewarn "Please upgrade your kernel to avoid silent corruption."
-			ewarn "See: https://bugs.gentoo.org/353907"
-			;;
-		esac
-	fi
-}

diff --git a/sys-apps/coreutils/coreutils-8.23-r00.1.ebuild b/sys-apps/coreutils/coreutils-8.28-r1.ebuild
similarity index 52%
rename from sys-apps/coreutils/coreutils-8.23-r00.1.ebuild
rename to sys-apps/coreutils/coreutils-8.28-r1.ebuild
index 36c9c17113..fc63a2986a 100644
--- a/sys-apps/coreutils/coreutils-8.23-r00.1.ebuild
+++ b/sys-apps/coreutils/coreutils-8.28-r1.ebuild
@@ -1,61 +1,100 @@
 # Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/coreutils/coreutils-8.23.ebuild,v 1.11 2015/07/30 12:28:54 ago Exp $
+# $Id$
 
 # To generate the man pages, unpack the upstream tarball and run:
-# ./configure --enable-install-program=arch,coreutils
+# ./configure --enable-install-program=arch,coreutils,hostname,kill
 # make
 # cd ..
 # tar cf - coreutils-*/man/*.[0-9] | xz > coreutils-<ver>-man.tar.xz
 
-EAPI="4"
+EAPI="6"
 
-inherit eutils flag-o-matic toolchain-funcs
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
+
+inherit eutils flag-o-matic python-any-r1 toolchain-funcs multilib
 
 PATCH_VER="1.1"
-DESCRIPTION="Standard GNU file utilities (chmod, cp, dd, dir, ls...), text utilities (sort, tr, head, wc..), and shell utilities (whoami, who,...)"
-HOMEPAGE="http://www.gnu.org/software/coreutils/"
+DESCRIPTION="Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, who,...)"
+HOMEPAGE="https://www.gnu.org/software/coreutils/"
 SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
 	mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz
-	http://dev.gentoo.org/~vapier/dist/${P}-patches-${PATCH_VER}.tar.xz
+	https://dev.gentoo.org/~whissi/dist/${PN}/${P}-patches-${PATCH_VER}.tar.xz
 	mirror://gentoo/${P}-man.tar.xz
-	http://dev.gentoo.org/~vapier/dist/${P}-man.tar.xz"
+	https://dev.gentoo.org/~polynomial-c/dist/${P}-man.tar.xz"
 
 LICENSE="GPL-3"
 SLOT="0"
-KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="acl caps gmp multicall nls selinux static userland_BSD vanilla xattr"
+KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="acl caps elibc_glibc gmp hostname kill multicall nls selinux static +stdbuf test uptime userland_BSD vanilla xattr"
 
 LIB_DEPEND="acl? ( sys-apps/acl[static-libs] )
 	caps? ( sys-libs/libcap )
-	gmp? ( dev-libs/gmp[static-libs] )
-	xattr? ( !userland_BSD? ( sys-apps/attr[static-libs] ) )"
+	gmp? ( dev-libs/gmp:=[static-libs] )
+	xattr? ( !elibc_glibc? ( sys-apps/attr[static-libs] ) )"
 RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs]} )
 	selinux? ( sys-libs/libselinux )
-	nls? ( virtual/libintl )
+	nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+	static? ( ${LIB_DEPEND} )
+	app-arch/xz-utils
+	test? (
+		dev-lang/perl
+		dev-perl/Expect
+		!userland_BSD? (
+			dev-util/strace
+		)
+		${PYTHON_DEPS}
+		$(python_gen_any_dep 'dev-python/pyinotify[${PYTHON_USEDEP}]')
+	)"
+RDEPEND+="
+	hostname? ( !sys-apps/net-tools[hostname] )
+	kill? (
+		!sys-apps/util-linux[kill]
+		!sys-process/procps[kill]
+	)
 	!app-misc/realpath
 	!<sys-apps/util-linux-2.13
+	!<sys-apps/sandbox-2.10-r4
 	!sys-apps/stat
 	!net-mail/base64
 	!sys-apps/mktemp
 	!<app-forensics/tct-1.18-r1
-	!<net-fs/netatalk-2.0.3-r4
-	!<sci-chemistry/ccp4-6.1.1"
-DEPEND="${RDEPEND}
-	static? ( ${LIB_DEPEND} )
-	app-arch/xz-utils"
+	!<net-fs/netatalk-2.0.3-r4"
+
+pkg_setup() {
+	if use test ; then
+		python-any-r1_pkg_setup
+	fi
+}
 
 src_prepare() {
 	if ! use vanilla ; then
 		use_if_iuse unicode || rm -f "${WORKDIR}"/patch/000_all_coreutils-i18n.patch
-		EPATCH_SUFFIX="patch" \
-		PATCHDIR="${WORKDIR}/patch" \
-		EPATCH_EXCLUDE="001_all_coreutils-gen-progress-bar.patch" \
-		epatch
+		#rm "${WORKDIR}"/patch/001_all_coreutils-gen-progress-bar.patch || die
+		eapply "${WORKDIR}"/patch/*.patch
 	fi
 
+	eapply_user
+
 	epatch "${FILESDIR}"/${PN}-8.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-8.23-non-elf.patch
+
+	# fixup libstdbuf non-libtool stuff
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		sed -i \
+			-e "/src_libstdbuf_so_LDFLAGS = -shared/s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/libexec/coreutils/libstdbuf.dylib:" \
+			Makefile.in \
+			|| die
+	elif use elibc_Cygwin ; then
+		epatch "${FILESDIR}"/${P}-cygwin-3.patch
+		sed -i -e 's|\(libstdbuf\.so\)$(EXEEXT)|\1|g' Makefile.in || die
+	fi
+	sed -i \
+		-e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \
+		src/stdbuf.c \
+		Makefile.in \
+		configure \
+		|| die
 
 	# Since we've patched many .c files, the make process will try to
 	# re-build the manpages by running `./bin --help`.  When doing a
@@ -69,13 +108,26 @@ src_prepare() {
 
 	# Avoid perl dep for compiled in dircolors default #348642
 	if ! has_version dev-lang/perl ; then
-		touch src/dircolors.h
+		touch src/{dircolors,fs-is-local,fs}.h # more?
 		touch ${@/%x/1}
 	fi
 }
 
 src_configure() {
-	local myconf=''
+	local myconf=(
+		--with-packager="Gentoo"
+		--with-packager-version="${PVR} (p${PATCH_VER:-0})"
+		--with-packager-bug-reports="https://bugs.gentoo.org/"
+		--enable-install-program="arch,$(usev hostname),$(usev kill),$(usev stdbuf),$(usev uptime)"
+		--enable-no-install-program="groups,$(usev !hostname),$(usev !kill),$(usev !stdbuf),su,$(usev !uptime)"
+		--enable-largefile
+		$(use caps || echo --disable-libcap)
+		$(use_enable nls)
+		$(use_enable acl)
+		$(use_enable multicall single-binary)
+		$(use_enable xattr)
+		$(use_with gmp)
+	)
 	if tc-is-cross-compiler && [[ ${CHOST} == *linux* ]] ; then
 		export fu_cv_sys_stat_statfs2_bsize=yes #311569
 		export gl_cv_func_realpath_works=yes #416629
@@ -84,33 +136,23 @@ src_configure() {
 	export gl_cv_func_mknod_works=yes #409919
 	use static && append-ldflags -static && sed -i '/elf_sys=yes/s:yes:no:' configure #321821
 	use selinux || export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no #301782
-	use userland_BSD && myconf="${myconf} -program-prefix=g --program-transform-name=s/stat/nustat/"
+	use userland_BSD && myconf+=( -program-prefix=g --program-transform-name=s/stat/nustat/ )
 	# kill/uptime - procps
 	# groups/su   - shadow
 	# hostname    - net-tools
-	if [[ ${CHOST} == *-mint* ]]; then
-		myconf="${myconf} --enable-install-program=arch,hostname,kill,uptime"
-		myconf="${myconf} --enable-no-install-program=groups,su,stdbuf"
-	else
-		myconf="${myconf} --enable-install-program=arch"
-		myconf="${myconf} --enable-no-install-program=groups,hostname,kill,su,uptime"
-	fi
-
-	econf \
-		--with-packager="Gentoo" \
-		--with-packager-version="${PVR} (p${PATCH_VER:-0})" \
-		--with-packager-bug-reports="http://bugs.gentoo.org/" \
-		--enable-largefile \
-		$(use caps || echo --disable-libcap) \
-		$(use_enable nls) \
-		$(use_enable acl) \
-		$(use_enable multicall single-binary) \
-		$(use_enable xattr) \
-		$(use_with gmp) \
-		${myconf}
+	econf ${myconf[@]}
 }
 
 src_test() {
+	# Known to fail with FEATURES=usersandbox (bug #439574):
+	#   -  tests/du/long-from-unreadable.sh} (bug #413621)
+	#   -  tests/rm/deep-2.sh (bug #413621)
+	#   -  tests/dd/no-allocate.sh (bug #629660)
+	if has usersandbox $FEATURES ; then
+		ewarn "You are emerging ${P} with 'usersandbox' enabled." \
+			"Expect some test failures or emerge with 'FEATURES=-usersandbox'!"
+	fi
+
 	# Non-root tests will fail if the full path isn't
 	# accessible to non-root users
 	chmod -R go-w "${WORKDIR}"
@@ -147,29 +189,36 @@ src_install() {
 	newins src/dircolors.hin DIR_COLORS
 
 	if [[ ${USERLAND} == "GNU" ]] ; then
-		cd "${ED}"/usr/bin
+		cd "${ED%/}"/usr/bin || die
 		dodir /bin
 		# move critical binaries into /bin (required by FHS)
 		local fhs="cat chgrp chmod chown cp date dd df echo false ln ls
-		           mkdir mknod mv pwd rm rmdir stty sync true uname"
-
-		[[ ${CHOST} == *-mint* ]] && fhs="${fhs} hostname"
-
+		           mkdir mknod mv pwd rm rmdir stty sync true uname
+		           $(usev hostname)"
 		mv ${fhs} ../../bin/ || die "could not move fhs bins"
+		if use kill; then
+			mv kill ../../bin/ || die
+		fi
 		# move critical binaries into /bin (common scripts)
 		local com="basename chroot cut dir dirname du env expr head mkfifo
 		           mktemp readlink seq sleep sort tail touch tr tty vdir wc yes"
 		mv ${com} ../../bin/ || die "could not move common bins"
 		# create a symlink for uname in /usr/bin/ since autotools require it
+		# as long as /bin resolves to a different directory than /usr/bin
 		local x
+		[[ ${EROOT}bin/. -ef ${EROOT}usr/bin/. ]] ||
 		for x in ${com} uname ; do
-			dosym /bin/${x} /usr/bin/${x}
+			dosym ../../bin/${x} /usr/bin/${x}
 		done
 	else
 		# For now, drop the man pages, collides with the ones of the system.
-		rm -rf "${ED}"/usr/share/man
+		rm -rf "${ED%/}"/usr/share/man
 	fi
 
+	if use elibc_Cygwin ; then
+		! use kill || mv "${ED}"/bin/{,g}kill || die
+		mv "${ED}"/usr/libexec/${PN}/libstdbuf$(get_libname){.exe,} || die
+	fi
 }
 
 pkg_postinst() {
@@ -178,7 +227,7 @@ pkg_postinst() {
 	ewarn "  changes, such as: source /etc/profile"
 
 	# Help out users using experimental filesystems
-	if grep -qs btrfs "${EROOT}"/etc/fstab /proc/mounts ; then
+	if grep -qs btrfs "${EROOT%/}"/etc/fstab /proc/mounts ; then
 		case $(uname -r) in
 		2.6.[12][0-9]|2.6.3[0-7]*)
 			ewarn "You are running a system with a buggy btrfs driver."

diff --git a/sys-apps/coreutils/files/coreutils-7.2-mint.patch b/sys-apps/coreutils/files/coreutils-7.2-mint.patch
deleted file mode 100644
index d0defcefcd..0000000000
--- a/sys-apps/coreutils/files/coreutils-7.2-mint.patch
+++ /dev/null
@@ -1,152 +0,0 @@
-http://bugs.gentoo.org/show_bug.cgi?id=260551
-http://bugs.gentoo.org/show_bug.cgi?id=264763
-https://savannah.gnu.org/patch/index.php?6758
-
-diff -u lib/mountlist.c lib/mountlist.c
---- lib/mountlist.c	2009-02-07 09:58:37.000000000 +0000
-+++ lib/mountlist.c	2009-04-08 04:04:19.000000000 +0000
-@@ -336,6 +336,7 @@
-    If NEED_FS_TYPE is true, ensure that the file system type fields in
-    the returned list are valid.  Otherwise, they might not be.  */
- 
-+#ifndef __MINT__
- struct mount_entry *
- read_file_system_list (bool need_fs_type)
- {
-@@ -881,3 +882,82 @@
-     return NULL;
-   }
- }
-+
-+#else /* __MINT__ */
-+
-+#include <mintbind.h>
-+#include <osbind.h>
-+#include <sys/statfs.h>
-+#include <mint/dcntl.h>
-+
-+/* get the list of available drives */
-+static long
-+get_drives(void)
-+{
-+	long drive_bits;
-+	
-+	drive_bits = Dsetdrv(Dgetdrv());
-+	drive_bits &= ~(1|2); /* exclude all floppies */
-+		
-+	return drive_bits;
-+}
-+
-+struct mount_entry *
-+read_file_system_list (bool need_fs_type)
-+{
-+	struct mount_entry *mount_list;
-+	struct mount_entry *me;
-+	struct mount_entry *mtail;
-+	struct statfs fsp;
-+	struct fs_info info;
-+	long drive_bits;
-+	int i, j;
-+	char lw[] = "a:/", str[25];
-+	
-+	/* Start the list off with a dummy entry. */
-+	me = xmalloc (sizeof (*me));
-+	me->me_next = NULL;
-+	mount_list = mtail = me;
-+	
-+	drive_bits = get_drives();
-+	for (i = 0; i < 32; i++)
-+	{
-+		if (drive_bits & (1L << i))
-+		{
-+			if (i < 26)
-+				lw[0] = 'a' + i;
-+			else
-+				lw[0] = '1' + i - 26;
-+			
-+			if(statfs(lw, &fsp) == 0)
-+			{
-+				char name[32];
-+
-+				me = xmalloc (sizeof (*me));
-+				
-+				me->me_devname  = xstrdup(lw);
-+				me->me_mountdir = xstrdup("u:/");
-+				
-+				if (lw[0] < 'a')				/* 1: .. 6: */
-+					me->me_dev = lw[0] - '1' + 27;
-+				else
-+					me->me_dev = lw[0] - 'a';
-+				
-+				get_fsname(lw, NULL, name);
-+				me->me_type = xstrdup(name);
-+				/* Add to the linked list. */
-+				me->me_next = NULL;
-+				mtail->me_next = me;
-+				mtail = me;
-+			}
-+		}
-+	}
-+	
-+	/* Free the dummy head. */
-+	me = mount_list;
-+	mount_list = mount_list->me_next;
-+	free(me);
-+	return mount_list;
-+}
-+
-+#endif /* __MINT__ */
-diff -u src/df.c src/df.c
---- src/df.c	2009-02-14 10:18:27.000000000 +0000
-+++ src/df.c	2009-04-08 04:04:19.000000000 +0000
-@@ -337,7 +337,12 @@
-      It would be better to report on the unmounted file system,
-      but statfs doesn't do that on most systems.  */
-   if (!stat_file)
-+#ifndef __MINT__
-     stat_file = mount_point ? mount_point : disk;
-+#else
-+    /* MiNT: mount_point is always u:/, so use disk */
-+    stat_file = disk;
-+#endif
- 
-   if (force_fsu)
-     fsu = *force_fsu;
-diff -u src/uptime.c src/uptime.c
---- src/uptime.c	2009-01-21 13:33:41.000000000 +0000
-+++ src/uptime.c	2009-04-08 04:04:19.000000000 +0000
-@@ -17,6 +17,9 @@
- /* Created by hacking who.c by Kaveh Ghazi ghazi@caip.rutgers.edu.  */
- 
- #include <config.h>
-+#ifdef __MINT__
-+#define HAVE_PROC_UPTIME 1
-+#endif
- #include <getopt.h>
- #include <stdio.h>
- 
-@@ -62,7 +65,11 @@
- #ifdef HAVE_PROC_UPTIME
-   FILE *fp;
- 
-+#ifdef __MINT__
-+  fp = fopen ("/kern/uptime", "r");
-+#else
-   fp = fopen ("/proc/uptime", "r");
-+#endif
-   if (fp != NULL)
-     {
-       char buf[BUFSIZ];
---- src/timeout.c	2009-04-10 01:37:34.000000000 +0000
-+++ src/timeout.c	2009-04-10 01:38:20.000000000 +0000
-@@ -202,6 +202,10 @@
-   return true;
- }
- 
-+#ifdef __MINT__
-+#define SA_RESTART 0
-+#endif
-+
- static void
- install_signal_handlers (void)
- {

diff --git a/sys-apps/coreutils/files/coreutils-7.4-hppa-hpux.patch b/sys-apps/coreutils/files/coreutils-7.4-hppa-hpux.patch
deleted file mode 100644
index e7ac52058d..0000000000
--- a/sys-apps/coreutils/files/coreutils-7.4-hppa-hpux.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- lib/striconv.c.orig	2009-06-17 16:09:08.000000000 +0200
-+++ lib/striconv.c	2009-06-17 16:09:48.000000000 +0200
-@@ -53,7 +53,7 @@
- 
-   /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug.  */
- # if defined _LIBICONV_VERSION \
--     || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
-+     || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun || (defined __hppa && defined __hpux))
-   /* Set to the initial state.  */
-   iconv (cd, NULL, NULL, NULL, NULL);
- # endif

diff --git a/sys-apps/coreutils/files/coreutils-7.5-interix-setgroups.patch b/sys-apps/coreutils/files/coreutils-7.5-interix-setgroups.patch
deleted file mode 100644
index 1e224682b5..0000000000
--- a/sys-apps/coreutils/files/coreutils-7.5-interix-setgroups.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff -ru -x '*.Po' -x '*.Plo' coreutils-7.5.orig/src/chroot.c coreutils-7.5/src/chroot.c
---- coreutils-7.5.orig/src/chroot.c	2009-08-24 16:15:21 +0200
-+++ coreutils-7.5/src/chroot.c	2009-08-24 16:17:18 +0200
-@@ -103,7 +103,11 @@
- 
-   if (ret == 0)
-     {
-+	  #ifndef __INTERIX
-       ret = setgroups (n_gids, gids);
-+	  #else
-+	  ret = -1;
-+	  #endif
-       if (ret)
-         error (0, errno, _("failed to set additional groups"));
-     }

diff --git a/sys-apps/coreutils/files/coreutils-8.23-non-elf.patch b/sys-apps/coreutils/files/coreutils-8.23-non-elf.patch
deleted file mode 100644
index fb5ee3e222..0000000000
--- a/sys-apps/coreutils/files/coreutils-8.23-non-elf.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 9ab1ca7f8b56d79306a6c2c2b1c3fe45253b2b31 Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
-Date: Wed, 11 Feb 2015 10:38:58 +0100
-Subject: [PATCH] stdbuf: build for ELF systems only (sr#108676)
-
-* configure.ac: Avoid false positive when checking for ELF system.
----
- configure.ac | 2 ++
- 1 file changed, 2 insertions(+)
-
-#diff --git a/configure.ac b/configure.ac
-#index 3918f43..b88e6c0 100644
-#--- a/configure.ac
-#+++ b/configure.ac
-@@ -472,6 +472,8 @@ AC_COMPILE_IFELSE(
-     {
-       #if __ELF__
-         stdbuf = 1;
-+      #else
-+      # error not an ELF system
-       #endif
-     }]],[[
-     return !(stdbuf == 1);]])
--- 
-2.0.5
-
---- a/configure
-+++ b/configure
-@@ -62600,6 +62600,8 @@
-     {
-       #if __ELF__
-         stdbuf = 1;
-+      #else
-+      # error not ELF
-       #endif
-     }
- int

diff --git a/sys-apps/coreutils/files/coreutils-8.5-interix-double.patch b/sys-apps/coreutils/files/coreutils-8.5-interix-double.patch
deleted file mode 100644
index 4507ddfedc..0000000000
--- a/sys-apps/coreutils/files/coreutils-8.5-interix-double.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-Binary files coreutils-8.5.orig/src/seq and coreutils-8.5/src/seq differ
-diff -ru coreutils-8.5.orig/src/seq.c coreutils-8.5/src/seq.c
---- coreutils-8.5.orig/src/seq.c	Mon Oct 18 11:26:56 2010
-+++ coreutils-8.5/src/seq.c	Mon Oct 18 13:03:01 2010
-@@ -245,12 +245,12 @@
- 
-   if (! out_of_range)
-     {
--      long double x = first;
--      long double i;
-+      double x = first;
-+      double i;
- 
-       for (i = 1; ; i++)
-         {
--          long double x0 = x;
-+          double x0 = x;
-           printf (fmt, x);
-           if (out_of_range)
-             break;
-@@ -267,7 +267,7 @@
-                  of stopping at 0.000002.  */
- 
-               bool print_extra_number = false;
--              long double x_val;
-+              double x_val;
-               char *x_str;
-               int x_strlen;
-               setlocale (LC_NUMERIC, "C");
-@@ -277,7 +277,7 @@
-                 xalloc_die ();
-               x_str[x_strlen - layout.suffix_len] = '\0';
- 
--              if (xstrtold (x_str + layout.prefix_len, NULL, &x_val, c_strtold)
-+              if (xstrtod (x_str + layout.prefix_len, NULL, &x_val, c_strtod)
-                   && x_val == last)
-                 {
-                   char *x0_str = NULL;
-@@ -303,7 +303,7 @@
- static char const *
- get_default_format (operand first, operand step, operand last)
- {
--  static char format_buf[sizeof "%0.Lf" + 2 * INT_STRLEN_BOUND (int)];
-+  static char format_buf[sizeof "%0.f" + 2 * INT_STRLEN_BOUND (int)];
- 
-   int prec = MAX (first.precision, step.precision);
- 
-@@ -323,18 +323,18 @@
-           if (width <= INT_MAX)
-             {
-               int w = width;
--              sprintf (format_buf, "%%0%d.%dLf", w, prec);
-+              sprintf (format_buf, "%%0%d.%df", w, prec);
-               return format_buf;
-             }
-         }
-       else
-         {
--          sprintf (format_buf, "%%.%dLf", prec);
-+          sprintf (format_buf, "%%.%df", prec);
-           return format_buf;
-         }
-     }
- 
--  return "%Lg";
-+  return "%g";
- }
- 
- int

diff --git a/sys-apps/coreutils/files/coreutils-8.5-interix-warn-mount.patch b/sys-apps/coreutils/files/coreutils-8.5-interix-warn-mount.patch
deleted file mode 100644
index dc15fe9557..0000000000
--- a/sys-apps/coreutils/files/coreutils-8.5-interix-warn-mount.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Make error about not reading list of mounted filesystems into a warning for interix.
-
-diff -pur coreutils-8.5.orig/configure coreutils-8.5/configure
---- coreutils-8.5.orig/configure
-+++ coreutils-8.5/configure
-@@ -33852,7 +33852,8 @@
- fi
- 
- if test -z "$ac_list_mounted_fs"; then
--  as_fn_error $? "could not determine how to read list of mounted file systems" "$LINENO" 5
-+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not determine how to read list of mounted file systems" >&5
-+$as_echo "$as_me: WARNING: could not determine how to read list of mounted file systems" >&2;}
-   # FIXME -- no need to abort building the whole package
-   # Can't build mountlist.c or anything that needs its functions
- fi

diff --git a/sys-apps/coreutils/files/coreutils-8.8-hppa-hpux.patch b/sys-apps/coreutils/files/coreutils-8.8-hppa-hpux.patch
deleted file mode 100644
index a5e2486ca7..0000000000
--- a/sys-apps/coreutils/files/coreutils-8.8-hppa-hpux.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- coreutils-8.8.orig/lib/striconv.c
-+++ coreutils-8.8/lib/striconv.c
-@@ -53,7 +53,7 @@ mem_cd_iconv (const char *src, size_t sr
-   /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug.  */
- # if defined _LIBICONV_VERSION \
-      || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
--          || defined __sun)
-+          || defined __sun || (defined __hppa && defined __hpux))
-   /* Set to the initial state.  */
-   iconv (cd, NULL, NULL, NULL, NULL);
- # endif

diff --git a/sys-apps/coreutils/files/coreutils-8.8-interix.patch b/sys-apps/coreutils/files/coreutils-8.8-interix.patch
deleted file mode 100644
index 25107afc82..0000000000
--- a/sys-apps/coreutils/files/coreutils-8.8-interix.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-already fixed in gnulib (mountlist support added), should hit coreutils soon.
-see also: http://www.mail-archive.com/bug-gnulib@gnu.org/msg21257.html
-
-diff -ru -x '*.Po' -x '*.Plo' coreutils-8.8.orig/src/stat.c coreutils-8.8/src/stat.c
---- coreutils-8.8.orig/src/stat.c	2011-01-26 11:51:08 +0100
-+++ coreutils-8.8/src/stat.c	2011-01-26 11:59:21 +0100
-@@ -762,7 +762,11 @@
-   static bool tried_mount_list = false;
-   if (!tried_mount_list) /* attempt/warn once per process.  */
-     {
-+      #ifndef __INTERIX
-       if (!(mount_list = read_file_system_list (false)))
-+      #else
-+      mount_list = NULL;
-+      #endif
-         error (0, errno, "%s", _("cannot read table of mounted file systems"));
-       tried_mount_list = true;
-     }


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/coreutils/files/, sys-apps/coreutils/
@ 2020-12-08  3:20 Sam James
  0 siblings, 0 replies; 7+ messages in thread
From: Sam James @ 2020-12-08  3:20 UTC (permalink / raw
  To: gentoo-commits

commit:     4d88e8d35bfd9e93351094ebd2e7237f9034aa36
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  8 03:08:18 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec  8 03:08:18 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=4d88e8d3

sys-apps/coreutils: sync with ::gentoo (bump to 8.32)

I've rebased the MiNT patch too.

Package-Manager: Portage-3.0.12-prefix, Repoman-3.0.2
RepoMan-Options: --force
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/coreutils/Manifest                        |   1 +
 sys-apps/coreutils/coreutils-8.32.ebuild           | 247 +++++++++++++++++++++
 .../coreutils-8.32-ls-restore-8.31-behavior.patch  |  94 ++++++++
 sys-apps/coreutils/files/coreutils-8.32-mint.patch | 155 +++++++++++++
 .../files/coreutils-8.32-sandbox-env-test.patch    |  64 ++++++
 5 files changed, 561 insertions(+)

diff --git a/sys-apps/coreutils/Manifest b/sys-apps/coreutils/Manifest
index fb0c4db2ce..44d2e827af 100644
--- a/sys-apps/coreutils/Manifest
+++ b/sys-apps/coreutils/Manifest
@@ -2,3 +2,4 @@ DIST coreutils-8.29-patches-1.0.tar.xz 5772 BLAKE2B 8f05185404d527ad524684231f0b
 DIST coreutils-8.29.tar.xz 5286588 BLAKE2B cbb66d9054bdd2db5b9a6010876484b16d178f8f4d935836b1e42830178647fac4e0a75052a6e7e2fbc50e74e4e7ff6f8da43f1137b96d0c2d027c4ebac28a98 SHA512 546bbcd5741beae7a68e7c4ca14d6d634f7c8be87feecdeddd00e226f4865bb89d503437c3a95622ba7bb0cb70addbb5bdf3767fa18d0b7410ab90ee53b29dfd
 DIST coreutils-8.30-patches-01.tar.xz 5788 BLAKE2B a41511ce39ac570cb14b7f12d125eebef92217469a9490808719fa0665f5e5c0adb96fbd02c4bac4d280d1502295669575790a81dbc01afe2ca3a9d384cbefb0 SHA512 b1e1933637de4581d5f8c6ede4e80a012435d13f0cf5550a76ab5bbe9441e3c15ce19ef3f78a7ea3b8368d5e9a3bb17c1207c471d26171b59786f38adeba0454
 DIST coreutils-8.30.tar.xz 5359532 BLAKE2B b66ccd112a6c2c8b90e58ff1c3371e7f5827937035769329885e5bdae197466189f3715720b8f8cf0b5047fe16d6c86984dcee994117c2d3c7b8dbd597027255 SHA512 25bc132c0d89ce71c33e417f04649c9fcfce6c5ef8b19f093b2e9e2851bfde9b5a31e20499d9c427332228ba54b88d445ddb445551e1944bb8f5cbff5ffa4eda
+DIST coreutils-8.32.tar.xz 5547836 BLAKE2B 0ad99c176c19ec214fcfd0845523e5362f0151827707c759bd46c0fe8d2501c6ad1c29c5b71266f6525857bc0d56c472db0d7fe29953b6c65e2e6c76bdf3c515 SHA512 1c8f3584efd61b4b02e7ac5db8e103b63cfb2063432caaf1e64cb2dcc56d8c657d1133bbf10bd41468d6a1f31142e6caa81d16ae68fa3e6e84075c253613a145

diff --git a/sys-apps/coreutils/coreutils-8.32.ebuild b/sys-apps/coreutils/coreutils-8.32.ebuild
new file mode 100644
index 0000000000..52bb58d0bc
--- /dev/null
+++ b/sys-apps/coreutils/coreutils-8.32.ebuild
@@ -0,0 +1,247 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+PYTHON_COMPAT=( python3_{6,7,8,9} )
+
+inherit eutils flag-o-matic python-any-r1 toolchain-funcs
+
+PATCH="${PN}-8.30-patches-01"
+DESCRIPTION="Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, who,...)"
+HOMEPAGE="https://www.gnu.org/software/coreutils/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
+	!vanilla? (
+		mirror://gentoo/${PATCH}.tar.xz
+		https://dev.gentoo.org/~polynomial-c/dist/${PATCH}.tar.xz
+	)
+"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="acl caps gmp hostname kill multicall nls selinux +split-usr static test userland_BSD vanilla xattr"
+RESTRICT="!test? ( test )"
+
+LIB_DEPEND="acl? ( sys-apps/acl[static-libs] )
+	caps? ( sys-libs/libcap )
+	gmp? ( dev-libs/gmp:=[static-libs] )
+	xattr? ( !userland_BSD? ( sys-apps/attr[static-libs] ) )"
+RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs]} )
+	selinux? ( sys-libs/libselinux )
+	nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+	static? ( ${LIB_DEPEND} )
+	app-arch/xz-utils
+	test? (
+		dev-lang/perl
+		dev-perl/Expect
+		!userland_BSD? (
+			dev-util/strace
+		)
+		${PYTHON_DEPS}
+		$(python_gen_any_dep 'dev-python/pyinotify[${PYTHON_USEDEP}]')
+	)"
+RDEPEND+="
+	hostname? ( !sys-apps/net-tools[hostname] )
+	kill? (
+		!sys-apps/util-linux[kill]
+		!sys-process/procps[kill]
+	)
+	!app-misc/realpath
+	!<sys-apps/util-linux-2.13
+	!<sys-apps/sandbox-2.10-r4
+	!sys-apps/stat
+	!net-mail/base64
+	!sys-apps/mktemp
+	!<app-forensics/tct-1.18-r1
+	!<net-fs/netatalk-2.0.3-r4"
+
+pkg_setup() {
+	if use test ; then
+		python-any-r1_pkg_setup
+	fi
+}
+
+src_prepare() {
+	local PATCHES=(
+		"${FILESDIR}"/coreutils-8.32-ls-restore-8.31-behavior.patch
+	)
+
+	if ! use vanilla ; then
+		PATCHES+=( "${WORKDIR}"/patch )
+		PATCHES+=( "${FILESDIR}"/${PN}-8.32-sandbox-env-test.patch )
+	fi
+
+	default
+
+	eapply "${FILESDIR}"/${PN}-8.32-mint.patch
+
+	# fixup libstdbuf non-libtool stuff
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		if [[ ${CHOST} == *-darwin9* ]] ; then
+			# we need replacement libs from libcoreutils.a here in order
+			# to finish the linking
+			sed -i \
+				-e "/src_libstdbuf_so_LDADD/s:$: lib/libcoreutils.a:" \
+				Makefile.in \
+				|| die
+			# and we need serial building :(
+			export MAKEOPTS+=" -j1"
+		fi
+		sed -i \
+			-e "/src_libstdbuf_so_LDFLAGS = -shared/s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/libexec/coreutils/libstdbuf.dylib:" \
+			Makefile.in \
+			|| die
+	elif use elibc_Cygwin ; then
+		eapply "${FILESDIR}"/${PN}-8.28-cygwin-8.26-3.patch
+		sed -i -e 's|\(libstdbuf\.so\)$(EXEEXT)|\1|g' Makefile.in || die
+	fi
+	sed -i \
+		-e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \
+		src/stdbuf.c \
+		Makefile.in \
+		configure \
+		|| die
+
+	# Since we've patched many .c files, the make process will try to
+	# re-build the manpages by running `./bin --help`.  When doing a
+	# cross-compile, we can't do that since 'bin' isn't a native bin.
+	# Also, it's not like we changed the usage on any of these things,
+	# so let's just update the timestamps and skip the help2man step.
+	set -- man/*.x
+	touch ${@/%x/1}
+
+	# Avoid perl dep for compiled in dircolors default #348642
+	if ! has_version dev-lang/perl ; then
+		touch src/dircolors.h
+		touch ${@/%x/1}
+	fi
+}
+
+src_configure() {
+	local myconf=(
+		--with-packager="Gentoo"
+		--with-packager-version="${PVR} (p${PATCH_VER:-0})"
+		--with-packager-bug-reports="https://bugs.gentoo.org/"
+		--enable-install-program="arch,$(usev hostname),$(usev kill)"
+		--enable-no-install-program="groups,$(usev !hostname),$(usev !kill),su,uptime"
+		--enable-largefile
+		$(usex caps '' --disable-libcap)
+		$(use_enable nls)
+		$(use_enable acl)
+		$(use_enable multicall single-binary)
+		$(use_enable xattr)
+		$(use_with gmp)
+	)
+	if tc-is-cross-compiler && [[ ${CHOST} == *linux* ]] ; then
+		export fu_cv_sys_stat_statfs2_bsize=yes #311569
+		export gl_cv_func_realpath_works=yes #416629
+	fi
+
+	export gl_cv_func_mknod_works=yes #409919
+	use static && append-ldflags -static && sed -i '/elf_sys=yes/s:yes:no:' configure #321821
+	use selinux || export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no #301782
+	use userland_BSD && myconf+=( -program-prefix=g --program-transform-name=s/stat/nustat/ )
+	# kill/uptime - procps
+	# groups/su   - shadow
+	# hostname    - net-tools
+	econf "${myconf[@]}"
+}
+
+src_test() {
+	# Known to fail with FEATURES=usersandbox (bug #439574):
+	#   -  tests/du/long-from-unreadable.sh} (bug #413621)
+	#   -  tests/rm/deep-2.sh (bug #413621)
+	#   -  tests/dd/no-allocate.sh (bug #629660)
+	if has usersandbox ${FEATURES} ; then
+		ewarn "You are emerging ${P} with 'usersandbox' enabled." \
+			"Expect some test failures or emerge with 'FEATURES=-usersandbox'!"
+	fi
+
+	# Non-root tests will fail if the full path isn't
+	# accessible to non-root users
+	chmod -R go-w "${WORKDIR}"
+	chmod a+rx "${WORKDIR}"
+
+	# coreutils tests like to do `mount` and such with temp dirs
+	# so make sure /etc/mtab is writable #265725
+	# make sure /dev/loop* can be mounted #269758
+	mkdir -p "${T}"/mount-wrappers || die
+	mkwrap() {
+		local w ww
+		for w in "${@}" ; do
+			ww="${T}/mount-wrappers/${w}"
+			cat <<-EOF > "${ww}"
+				#!${EPREFIX}/bin/sh
+				exec env SANDBOX_WRITE="\${SANDBOX_WRITE}:/etc/mtab:/dev/loop" $(type -P ${w}) "\$@"
+			EOF
+			chmod a+rx "${ww}"
+		done
+	}
+	mkwrap mount umount
+
+	addwrite /dev/full
+	#export RUN_EXPENSIVE_TESTS="yes"
+	#export FETISH_GROUPS="portage wheel"
+	env PATH="${T}/mount-wrappers:${PATH}" \
+	emake -j1 -k check
+}
+
+src_install() {
+	default
+
+	insinto /etc
+	newins src/dircolors.hin DIR_COLORS
+
+	if [[ ${USERLAND} == "GNU" ]] ; then
+		cd "${ED%/}"/usr/bin || die
+		dodir /bin
+		# move critical binaries into /bin (required by FHS)
+		local fhs="cat chgrp chmod chown cp date dd df echo false ln ls
+		           mkdir mknod mv pwd rm rmdir stty sync true uname"
+		mv ${fhs} ../../bin/ || die "could not move fhs bins"
+		if use hostname; then
+			mv hostname ../../bin/ || die
+		fi
+		if use kill; then
+			mv kill ../../bin/ || die
+		fi
+		if use split-usr ; then
+			# move critical binaries into /bin (common scripts)
+			local com="basename chroot cut dir dirname du env expr head mkfifo
+			           mktemp readlink seq sleep sort tail touch tr tty vdir wc yes"
+			mv ${com} ../../bin/ || die "could not move common bins"
+			# create a symlink for uname in /usr/bin/ since autotools require it
+			local x
+			for x in ${com} uname ; do
+				dosym ../../bin/${x} /usr/bin/${x}
+			done
+		fi
+	else
+		# For now, drop the man pages, collides with the ones of the system.
+		rm -rf "${ED%/}"/usr/share/man
+	fi
+
+	if use elibc_Cygwin ; then
+		! use kill || mv "${ED}"/bin/{,g}kill || die
+		mv "${ED}"/usr/libexec/${PN}/libstdbuf$(get_libname){.exe,} || die
+	fi
+}
+
+pkg_postinst() {
+	ewarn "Make sure you run 'hash -r' in your active shells."
+	ewarn "You should also re-source your shell settings for LS_COLORS"
+	ewarn "  changes, such as: source /etc/profile"
+
+	# Help out users using experimental filesystems
+	if grep -qs btrfs "${EROOT%/}"/etc/fstab /proc/mounts ; then
+		case $(uname -r) in
+		2.6.[12][0-9]|2.6.3[0-7]*)
+			ewarn "You are running a system with a buggy btrfs driver."
+			ewarn "Please upgrade your kernel to avoid silent corruption."
+			ewarn "See: https://bugs.gentoo.org/353907"
+			;;
+		esac
+	fi
+}

diff --git a/sys-apps/coreutils/files/coreutils-8.32-ls-restore-8.31-behavior.patch b/sys-apps/coreutils/files/coreutils-8.32-ls-restore-8.31-behavior.patch
new file mode 100644
index 0000000000..62a35cd85a
--- /dev/null
+++ b/sys-apps/coreutils/files/coreutils-8.32-ls-restore-8.31-behavior.patch
@@ -0,0 +1,94 @@
+From 10fcb97bd728f09d4a027eddf8ad2900f0819b0a Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Thu, 5 Mar 2020 17:25:29 -0800
+Subject: ls: restore 8.31 behavior on removed directories
+
+* src/ls.c: Do not include <sys/sycall.h>
+(print_dir): Don't worry about whether the directory is removed.
+* tests/ls/removed-directory.sh: Adjust to match new (i.e., old)
+behavior.
+ 
+diff --git a/src/ls.c b/src/ls.c
+index 24b983287..4acf5f44d 100644
+--- a/src/ls.c
++++ b/src/ls.c
+@@ -49,10 +49,6 @@
+ # include <sys/ptem.h>
+ #endif
+ 
+-#ifdef __linux__
+-# include <sys/syscall.h>
+-#endif
+-
+ #include <stdio.h>
+ #include <assert.h>
+ #include <setjmp.h>
+@@ -2896,7 +2892,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
+   struct dirent *next;
+   uintmax_t total_blocks = 0;
+   static bool first = true;
+-  bool found_any_entries = false;
+ 
+   errno = 0;
+   dirp = opendir (name);
+@@ -2972,7 +2967,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
+       next = readdir (dirp);
+       if (next)
+         {
+-          found_any_entries = true;
+           if (! file_ignored (next->d_name))
+             {
+               enum filetype type = unknown;
+@@ -3018,22 +3012,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
+           if (errno != EOVERFLOW)
+             break;
+         }
+-#ifdef __linux__
+-      else if (! found_any_entries)
+-        {
+-          /* If readdir finds no directory entries at all, not even "." or
+-             "..", then double check that the directory exists.  */
+-          if (syscall (SYS_getdents, dirfd (dirp), NULL, 0) == -1
+-              && errno != EINVAL)
+-            {
+-              /* We exclude EINVAL as that pertains to buffer handling,
+-                 and we've passed NULL as the buffer for simplicity.
+-                 ENOENT is returned if appropriate before buffer handling.  */
+-              file_failure (command_line_arg, _("reading directory %s"), name);
+-            }
+-          break;
+-        }
+-#endif
+       else
+         break;
+ 
+diff --git a/tests/ls/removed-directory.sh b/tests/ls/removed-directory.sh
+index e8c835dab..fe8f929a1 100755
+--- a/tests/ls/removed-directory.sh
++++ b/tests/ls/removed-directory.sh
+@@ -26,20 +26,14 @@ case $host_triplet in
+   *) skip_ 'non linux kernel' ;;
+ esac
+ 
+-LS_FAILURE=2
+-
+-cat <<\EOF >exp-err || framework_failure_
+-ls: reading directory '.': No such file or directory
+-EOF
+-
+ cwd=$(pwd)
+ mkdir d || framework_failure_
+ cd d || framework_failure_
+ rmdir ../d || framework_failure_
+ 
+-returns_ $LS_FAILURE ls >../out 2>../err || fail=1
++ls >../out 2>../err || fail=1
+ cd "$cwd" || framework_failure_
+ compare /dev/null out || fail=1
+-compare exp-err err || fail=1
++compare /dev/null err || fail=1
+ 
+ Exit $fail
+-- 
+cgit v1.2.1
+

diff --git a/sys-apps/coreutils/files/coreutils-8.32-mint.patch b/sys-apps/coreutils/files/coreutils-8.32-mint.patch
new file mode 100644
index 0000000000..f02aeb2c9a
--- /dev/null
+++ b/sys-apps/coreutils/files/coreutils-8.32-mint.patch
@@ -0,0 +1,155 @@
+http://bugs.gentoo.org/show_bug.cgi?id=260551
+http://bugs.gentoo.org/show_bug.cgi?id=264763
+http://bugs.gentoo.org/show_bug.cgi?id=497772
+https://savannah.gnu.org/patch/index.php?6758
+
+diff -u lib/mountlist.c lib/mountlist.c
+--- a/lib/mountlist.c	2009-02-07 09:58:37.000000000 +0000
++++ b/lib/mountlist.c	2009-04-08 04:04:19.000000000 +0000
+@@ -387,6 +387,7 @@
+    If NEED_FS_TYPE is true, ensure that the file system type fields in
+    the returned list are valid.  Otherwise, they might not be.  */
+ 
++#ifndef __MINT__
+ struct mount_entry *
+ read_file_system_list (bool need_fs_type)
+ {
+@@ -970,6 +971,84 @@
+     return NULL;
+   }
+ }
++#else /* __MINT__ */
++
++#include <mintbind.h>
++#include <osbind.h>
++#include <sys/statfs.h>
++#include <mint/dcntl.h>
++
++/* get the list of available drives */
++static long
++get_drives(void)
++{
++	long drive_bits;
++	
++	drive_bits = Dsetdrv(Dgetdrv());
++	drive_bits &= ~(1|2); /* exclude all floppies */
++		
++	return drive_bits;
++}
++
++struct mount_entry *
++read_file_system_list (bool need_fs_type)
++{
++	struct mount_entry *mount_list;
++	struct mount_entry *me;
++	struct mount_entry *mtail;
++	struct statfs fsp;
++	struct fs_info info;
++	long drive_bits;
++	int i, j;
++	char lw[] = "a:/", str[25];
++	
++	/* Start the list off with a dummy entry. */
++	me = xmalloc (sizeof (*me));
++	me->me_next = NULL;
++	mount_list = mtail = me;
++	
++	drive_bits = get_drives();
++	for (i = 0; i < 32; i++)
++	{
++		if (drive_bits & (1L << i))
++		{
++			if (i < 26)
++				lw[0] = 'a' + i;
++			else
++				lw[0] = '1' + i - 26;
++			
++			if(statfs(lw, &fsp) == 0)
++			{
++				char name[32];
++
++				me = xmalloc (sizeof (*me));
++				
++				me->me_devname  = xstrdup(lw);
++				me->me_mountdir = xstrdup("u:/");
++				
++				if (lw[0] < 'a')				/* 1: .. 6: */
++					me->me_dev = lw[0] - '1' + 27;
++				else
++					me->me_dev = lw[0] - 'a';
++				
++				get_fsname(lw, NULL, name);
++				me->me_type = xstrdup(name);
++				/* Add to the linked list. */
++				me->me_next = NULL;
++				mtail->me_next = me;
++				mtail = me;
++			}
++		}
++	}
++	
++	/* Free the dummy head. */
++	me = mount_list;
++	mount_list = mount_list->me_next;
++	free(me);
++	return mount_list;
++}
++
++#endif /* __MINT__ */
+ 
+ /* Free a mount entry as returned from read_file_system_list ().  */
+ 
+diff -u src/df.c src/df.c
+--- a/src/df.c	2009-02-14 10:18:27.000000000 +0000
++++ b/src/df.c	2009-04-08 04:04:19.000000000 +0000
+@@ -337,7 +337,12 @@
+      It would be better to report on the unmounted file system,
+      but statfs doesn't do that on most systems.  */
+   if (!stat_file)
++#ifndef __MINT__
+     stat_file = mount_point ? mount_point : disk;
++#else
++    /* MiNT: mount_point is always u:/, so use disk */
++    stat_file = disk;
++#endif
+ 
+   if (force_fsu)
+     fsu = *force_fsu;
+diff -u Makefile.in Makefile.in
+--- a/Makefile.in	2014-01-07 10:01:01.000000000 +0000
++++ b/Makefile.in	2014-01-07 10:36:50.000000000 +0000
+@@ -3310,7 +3310,7 @@
+ # must precede $(LIBINTL) in order to ensure we use GNU getopt.
+ # But libcoreutils.a must also follow $(LIBINTL), since libintl uses
+ # replacement functions defined in libcoreutils.a.
+-LDADD = src/libver.a lib/libcoreutils.a $(LIBINTL) lib/libcoreutils.a
++LDADD = src/libver.a lib/libcoreutils.a $(LIBINTL) lib/libcoreutils.a $(LIB_PTHREAD)
+ 
+ # First, list all programs, to make listing per-program libraries easier.
+ # See [ below.
+diff --git a/src/uptime.c b/src/uptime.c
+index a42e702..638c2d6 100644
+--- a/src/uptime.c
++++ b/src/uptime.c
+@@ -17,6 +17,9 @@
+ /* Created by hacking who.c by Kaveh Ghazi ghazi@caip.rutgers.edu.  */
+ 
+ #include <config.h>
++#ifdef __MINT__
++#define HAVE_PROC_UPTIME 1
++#endif
+ #include <stdio.h>
+ 
+ #include <sys/types.h>
+@@ -62,7 +65,11 @@ print_uptime (size_t n, const STRUCT_UTMP *this)
+ #ifdef HAVE_PROC_UPTIME
+   FILE *fp;
+ 
++#ifdef __MINT__
++  fp = fopen ("/kern/uptime", "r");
++#else
+   fp = fopen ("/proc/uptime", "r");
++#endif
+   if (fp != NULL)
+     {
+       char buf[BUFSIZ];

diff --git a/sys-apps/coreutils/files/coreutils-8.32-sandbox-env-test.patch b/sys-apps/coreutils/files/coreutils-8.32-sandbox-env-test.patch
new file mode 100644
index 0000000000..40b1554d94
--- /dev/null
+++ b/sys-apps/coreutils/files/coreutils-8.32-sandbox-env-test.patch
@@ -0,0 +1,64 @@
+Skip tests known to fail when running under Gentoo sandbox.
+
+--- a/tests/du/long-from-unreadable.sh
++++ b/tests/du/long-from-unreadable.sh
+@@ -29,6 +29,9 @@
+ # unnecessarily to using FTS_NOCHDIR mode in this corner case.
+ 
+ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++# Avoid #413621 until #548250 is resolved
++test -n "$SANDBOX_ACTIVE" && skip_ "Gentoo: Test known bad under sandbox (#413621)"
++
+ print_ver_ du
+ 
+ require_perl_
+--- a/tests/ls/removed-directory.sh
++++ b/tests/ls/removed-directory.sh
+@@ -19,6 +19,9 @@
+ # along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ 
+ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++# Avoid #413621 until #548250 is resolved
++test -n "$SANDBOX_ACTIVE" && skip_ "Gentoo: Test known bad under sandbox (#413621)"
++
+ print_ver_ ls
+ 
+ case $host_triplet in
+--- a/tests/ls/stat-free-symlinks.sh
++++ b/tests/ls/stat-free-symlinks.sh
+@@ -17,6 +17,9 @@
+ # along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ 
+ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++# Avoid #413621 until #548250 is resolved
++test -n "$SANDBOX_ACTIVE" && skip_ "Gentoo: Test known bad under sandbox (#413621)"
++
+ print_ver_ ls
+ require_strace_ stat
+ 
+--- a/tests/misc/env-S.pl
++++ b/tests/misc/env-S.pl
+@@ -30,6 +30,11 @@ $env = $1;
+ # Turn off localization of executable's output.
+ @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
+ 
++# Skip if sandbox is enabled
++if ($ENV{SANDBOX_ACTIVE}) {
++     CuSkip::skip "Gentoo: Test known bad under sandbox (#675802)\n";
++}
++
+ my @Tests =
+     (
+      # Test combination of -S and regular arguments
+--- a/tests/rm/deep-2.sh
++++ b/tests/rm/deep-2.sh
+@@ -17,6 +17,9 @@
+ # along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ 
+ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++# Avoid #413621 until #548250 is resolved
++test -n "$SANDBOX_ACTIVE" && skip_ "Gentoo: Test known bad under sandbox (#413621)"
++
+ print_ver_ rm
+ require_perl_
+ 


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/coreutils/files/, sys-apps/coreutils/
@ 2020-12-27 10:49 Fabian Groffen
  0 siblings, 0 replies; 7+ messages in thread
From: Fabian Groffen @ 2020-12-27 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     770560f712da16a27ee7ba36543340300bf7afb2
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 27 10:48:12 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Dec 27 10:48:12 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=770560f7

sys-apps/coreutils: drop ~m68k-mint

Package-Manager: Portage-3.0.12-prefix, Repoman-3.0.2
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 sys-apps/coreutils/Manifest                        |    1 +
 sys-apps/coreutils/coreutils-8.32.ebuild           |   12 +-
 .../files/coreutils-8.28-cygwin-8.26-3.patch       | 1043 --------------------
 sys-apps/coreutils/files/coreutils-8.32-mint.patch |  155 ---
 4 files changed, 9 insertions(+), 1202 deletions(-)

diff --git a/sys-apps/coreutils/Manifest b/sys-apps/coreutils/Manifest
index 0f0d568b69..23cda18b29 100644
--- a/sys-apps/coreutils/Manifest
+++ b/sys-apps/coreutils/Manifest
@@ -1,2 +1,3 @@
+DIST coreutils-8.28-cygwin-8.26-3.patch 36792 BLAKE2B f494be97595ff9532f57ca3d5386d185d813647fb07480dc1b22434fa5eecfa22acb6940b82cc733ae4448757e5f69cf2c7c746a5752409fe4aa11dd47482e63 SHA512 53d05262118a0063a0b3992b80dcda28256516da4d077a691117384ea808e5468488443d9c4b0e38a4d5148e5e721e733dcb0562dcf23a1370d4090251458951
 DIST coreutils-8.30-patches-01.tar.xz 5788 BLAKE2B a41511ce39ac570cb14b7f12d125eebef92217469a9490808719fa0665f5e5c0adb96fbd02c4bac4d280d1502295669575790a81dbc01afe2ca3a9d384cbefb0 SHA512 b1e1933637de4581d5f8c6ede4e80a012435d13f0cf5550a76ab5bbe9441e3c15ce19ef3f78a7ea3b8368d5e9a3bb17c1207c471d26171b59786f38adeba0454
 DIST coreutils-8.32.tar.xz 5547836 BLAKE2B 0ad99c176c19ec214fcfd0845523e5362f0151827707c759bd46c0fe8d2501c6ad1c29c5b71266f6525857bc0d56c472db0d7fe29953b6c65e2e6c76bdf3c515 SHA512 1c8f3584efd61b4b02e7ac5db8e103b63cfb2063432caaf1e64cb2dcc56d8c657d1133bbf10bd41468d6a1f31142e6caa81d16ae68fa3e6e84075c253613a145

diff --git a/sys-apps/coreutils/coreutils-8.32.ebuild b/sys-apps/coreutils/coreutils-8.32.ebuild
index 6e23e61ae1..302190d759 100644
--- a/sys-apps/coreutils/coreutils-8.32.ebuild
+++ b/sys-apps/coreutils/coreutils-8.32.ebuild
@@ -15,11 +15,14 @@ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
 		mirror://gentoo/${PATCH}.tar.xz
 		https://dev.gentoo.org/~polynomial-c/dist/${PATCH}.tar.xz
 	)
+	elibc_Cygwin? (
+		https://dev.gentoo.org/~grobian/distfiles/${PN}-8.28-cygwin-8.26-3.patch
+	)
 "
 
 LICENSE="GPL-3"
 SLOT="0"
-KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
 IUSE="acl caps gmp hostname kill multicall nls selinux +split-usr static test userland_BSD vanilla xattr"
 RESTRICT="!test? ( test )"
 
@@ -73,9 +76,11 @@ src_prepare() {
 		PATCHES+=( "${FILESDIR}"/${PN}-8.32-sandbox-env-test.patch )
 	fi
 
-	default
+	if use elibc_Cygwin ; then
+		PATCHES+=( "${DISTDIR}"/${PN}-8.28-cygwin-8.26-3.patch )
+	fi
 
-	eapply "${FILESDIR}"/${PN}-8.32-mint.patch
+	default
 
 	# fixup libstdbuf non-libtool stuff
 	if [[ ${CHOST} == *-darwin* ]] ; then
@@ -94,7 +99,6 @@ src_prepare() {
 			Makefile.in \
 			|| die
 	elif use elibc_Cygwin ; then
-		eapply "${FILESDIR}"/${PN}-8.28-cygwin-8.26-3.patch
 		sed -i -e 's|\(libstdbuf\.so\)$(EXEEXT)|\1|g' Makefile.in || die
 	fi
 	sed -i \

diff --git a/sys-apps/coreutils/files/coreutils-8.28-cygwin-8.26-3.patch b/sys-apps/coreutils/files/coreutils-8.28-cygwin-8.26-3.patch
deleted file mode 100644
index 20bfe76b3d..0000000000
--- a/sys-apps/coreutils/files/coreutils-8.28-cygwin-8.26-3.patch
+++ /dev/null
@@ -1,1043 +0,0 @@
-This was a copy of coreutils-8.25-3.src.patch from the official Cygwin
-coreutils-8.25-3 source package, modified to avoid re-running autotools:
-
-* Hunks for ./configure.ac go to ./configure instead.
-* Hunks for ./lib/local.mk go to ./Makefile.in instead.
-
-It has been updated to apply to coreutils-8.28 by Egor Y. Egorov, provided
-in Gentoo Bug report https://bugs.gentoo.org/638816.
-
-Once there is an official Cygwin source package for 8.28 or newer, we
-probably want to import their patch again.
-
---- coreutils-8.28_prep/configure	2017-09-02 07:54:54.000000000 +0600
-+++ coreutils-8.28_prep/configure	2017-11-20 10:58:06.601585900 +0600
-@@ -65498,7 +65498,8 @@ 
- # Put this message here, after gl_WARN_ADD's chatter.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether this system supports stdbuf" >&5
- $as_echo_n "checking whether this system supports stdbuf... " >&6; }
--CFLAGS="-fPIC $CFLAGS"
-+# -fPIC on cygwin is a warning
-+# CFLAGS="-fPIC $CFLAGS"
- LDFLAGS="-shared $LDFLAGS"
- stdbuf_supported=no
- # Note we only LINK here rather than RUN to support cross compilation
-@@ -65530,7 +65531,7 @@ 
-     conftest$ac_exeext conftest.$ac_ext
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $stdbuf_supported" >&5
- $as_echo "$stdbuf_supported" >&6; }
--if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
-+if test "$stdbuf_supported" = "yes"; then
-   {
-   if test -z "$optional_bin_progs"; then
-     optional_bin_progs=stdbuf
---- coreutils-8.28_prep/lib/cygwin.c	1970-01-01 06:00:00.000000000 +0600
-+++ coreutils-8.28_prep/lib/cygwin.c	2017-11-20 15:52:51.569827000 +0600
-@@ -0,0 +1,73 @@ 
-+/* cygwin.c - helper functions unique to Cygwin
-+
-+   Copyright (C) 2005, 2006, 2008, 2011 Free Software Foundation, Inc.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3, or (at your option)
-+   any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program; if not, write to the Free Software Foundation,
-+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+   Written by Eric Blake.  */
-+
-+#include <config.h>
-+
-+#include "cygwin.h"
-+
-+#include <errno.h>
-+#include <limits.h>
-+#include <string.h>
-+#include <unistd.h>
-+
-+/* Return -1 if PATH is not found, 0 if PATH will not have .exe
-+   appended (it is possible that a PATH that does not exist still
-+   returns 0 instead of -1, or fails for a PATH that exists but cannot
-+   be stat'ed), and positive if PATH has ".exe" automatically appended
-+   by cygwin (1 if PATH is a symlink, 2 otherwise).  Won't change errno.  */
-+
-+int
-+cygwin_spelling (char const *path)
-+{
-+  int saved_errno = errno;
-+  int result = 0; /* Start with assumption that PATH is okay.  */
-+  size_t len;
-+  struct stat st1;
-+  struct stat st2;
-+  char *path_exe;
-+
-+  /* If PATH will cause EINVAL or ENAMETOOLONG, treat it as missing.  */
-+  if (! path || ! *path)
-+    return -1;
-+  if (PATH_MAX < (len = strlen (path)))
-+    return -1;
-+  /* Don't change spelling if there is a trailing `/' or '.exe'.  */
-+  if (path[len - 1] == '/'
-+      || (len > 4 && !strcasecmp (&path[len - 4], ".exe")))
-+    return 0;
-+  if (lstat (path, &st1) < 0)
-+    {
-+      errno = saved_errno;
-+      return -1;
-+    }
-+  if (S_ISDIR(st1.st_mode))
-+    {
-+      errno = saved_errno;
-+      return 0;
-+    }
-+  path_exe = malloca (len + 5); /* adding ".exe" and NUL.  */
-+  strcat (stpcpy (path_exe, path), ".exe");
-+  if (lstat (path_exe, &st2) == 0 && st1.st_ino == st2.st_ino)
-+    result = 1 + !S_ISLNK(st1.st_mode);
-+  freea (path_exe);
-+
-+  errno = saved_errno;
-+  return result;
-+}
---- coreutils-8.28_prep/lib/cygwin.h	1970-01-01 06:00:00.000000000 +0600
-+++ coreutils-8.28_prep/lib/cygwin.h	2017-11-20 15:52:51.571832900 +0600
-@@ -0,0 +1,38 @@ 
-+/* cygwin.h - helper functions unique to Cygwin
-+
-+   Copyright (C) 2005, 2006, 2008, 2010, 2011 Free Software Foundation, Inc.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3, or (at your option)
-+   any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program; if not, write to the Free Software Foundation,
-+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+   Written by Eric Blake.  */
-+
-+#ifndef CYGWIN_H
-+# define CYGWIN_H 1
-+
-+#include "malloca.h"
-+
-+int cygwin_spelling (char const *);
-+
-+/* Append ".exe" to char *__NAME_ORIG, where __NAME is either NULL or
-+   between __NAME_ORIG and the nul terminator.  Both params will be
-+   evaluated more than once and assigned the new value.  The user must
-+   later call freea(__NAME).  */
-+#define CYGWIN_APPEND_EXE(__name, __name_orig)                          \
-+  __name_orig = __name =                                                \
-+    strcat (strcpy (malloca (strchr (__name ? __name : __name_orig, '\0') \
-+                             - (__name_orig) + 5),                      \
-+                    __name_orig), ".exe")
-+
-+#endif /* CYGWIN_H */
---- coreutils-8.28_prep/lib/hash-pjw.c	2017-09-01 13:12:43.000000000 +0600
-+++ coreutils-8.28_prep/lib/hash-pjw.c	2017-11-20 10:58:06.617214500 +0600
-@@ -19,6 +19,7 @@ 
- 
- #include "hash-pjw.h"
- 
-+#include <ctype.h>
- #include <limits.h>
- 
- #define SIZE_BITS (sizeof (size_t) * CHAR_BIT)
-@@ -38,3 +39,16 @@ 
- 
-   return h % tablesize;
- }
-+
-+/* Likewise, but case-insensitive.  */
-+size_t
-+hash_pjw_case (const void *x, size_t tablesize)
-+{
-+  const unsigned char *s;
-+  size_t h = 0;
-+
-+  for (s = x; *s; s++)
-+    h = tolower (*s) + ((h << 9) | (h >> (SIZE_BITS - 9)));
-+
-+  return h % tablesize;
-+}
---- coreutils-8.28_prep/lib/hash-pjw.h	2017-09-01 13:12:43.000000000 +0600
-+++ coreutils-8.28_prep/lib/hash-pjw.h	2017-11-20 10:58:06.617214500 +0600
-@@ -21,3 +21,4 @@ 
-    The result is platform dependent: it depends on the size of the 'size_t'
-    type and on the signedness of the 'char' type.  */
- extern size_t hash_pjw (void const *x, size_t tablesize) _GL_ATTRIBUTE_PURE;
-+extern size_t hash_pjw_case (void const *x, size_t tablesize) _GL_ATTRIBUTE_PURE;
---- coreutils-8.28_prep/lib/hash-triple.c	2017-09-01 13:12:43.000000000 +0600
-+++ coreutils-8.28_prep/lib/hash-triple.c	2017-11-20 10:58:06.617214500 +0600
-@@ -34,7 +34,13 @@ 
- triple_hash (void const *x, size_t table_size)
- {
-   struct F_triple const *p = x;
-+#if !__CYGWIN__
-   size_t tmp = hash_pjw (p->name, table_size);
-+#else // cygwin
-+  /* Hash case-insensitively, to force collisions on names that differ by
-+     case; copy.c can then account for case-insensitive renames. */
-+  size_t tmp = hash_pjw_case (p->name, table_size);
-+#endif
- 
-   /* Ignoring the device number here should be fine.  */
-   return (tmp ^ p->st_ino) % table_size;
---- coreutils-8.28_prep/lib/root-dev-ino.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/lib/root-dev-ino.c	2017-11-20 10:58:06.617214500 +0600
-@@ -25,13 +25,17 @@ 
- /* Call lstat to get the device and inode numbers for '/'.
-    Upon failure, return NULL.  Otherwise, set the members of
-    *ROOT_D_I accordingly and return ROOT_D_I.  */
--struct dev_ino *
--get_root_dev_ino (struct dev_ino *root_d_i)
-+struct root_dev_ino *
-+get_root_dev_ino (struct root_dev_ino *root_d_i)
- {
-   struct stat statbuf;
-   if (lstat ("/", &statbuf))
-     return NULL;
--  root_d_i->st_ino = statbuf.st_ino;
--  root_d_i->st_dev = statbuf.st_dev;
-+  root_d_i->single_slash.st_ino = statbuf.st_ino;
-+  root_d_i->single_slash.st_dev = statbuf.st_dev;
-+  if (lstat ("//", &statbuf))
-+    return NULL;
-+  root_d_i->double_slash.st_ino = statbuf.st_ino;
-+  root_d_i->double_slash.st_dev = statbuf.st_dev;
-   return root_d_i;
- }
---- coreutils-8.28_prep/lib/root-dev-ino.h	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/lib/root-dev-ino.h	2017-11-20 10:58:06.617214500 +0600
-@@ -21,19 +21,26 @@ 
- # include "dev-ino.h"
- # include "same-inode.h"
- 
--struct dev_ino *
--get_root_dev_ino (struct dev_ino *root_d_i);
-+struct root_dev_ino
-+{
-+  struct dev_ino single_slash;
-+  struct dev_ino double_slash;
-+};
-+
-+struct root_dev_ino *
-+get_root_dev_ino (struct root_dev_ino *root_d_i);
- 
- /* These macros are common to the programs that support the
-    --preserve-root and --no-preserve-root options.  */
- 
- # define ROOT_DEV_INO_CHECK(Root_dev_ino, Dir_statbuf) \
--    (Root_dev_ino && SAME_INODE (*Dir_statbuf, *Root_dev_ino))
-+  (Root_dev_ino && (SAME_INODE (*Dir_statbuf, (Root_dev_ino)->single_slash) \
-+                    || SAME_INODE (*Dir_statbuf, (Root_dev_ino)->double_slash)))
- 
- # define ROOT_DEV_INO_WARN(Dirname)					\
-   do									\
-     {									\
--      if (STREQ (Dirname, "/"))						\
-+      if (STREQ (Dirname, "/") || STREQ (Dirname, "//"))                \
-         error (0, 0, _("it is dangerous to operate recursively on %s"),	\
-                quoteaf (Dirname));					\
-       else								\
---- coreutils-8.28_prep/lib/same.c	2017-09-01 13:12:43.000000000 +0600
-+++ coreutils-8.28_prep/lib/same.c	2017-11-20 10:58:06.617214500 +0600
-@@ -40,6 +40,13 @@ 
- #include "error.h"
- #include "same-inode.h"
- 
-+#if __CYGWIN__
-+# include <sys/cygwin.h>
-+# include "cygwin.h"
-+# include "malloca.h"
-+# include "memcasecmp.h"
-+#endif
-+
- #ifndef MIN
- # define MIN(a, b) ((a) < (b) ? (a) : (b))
- #endif
-@@ -59,6 +66,45 @@ 
-     (source_baselen == dest_baselen
-      && memcmp (source_basename, dest_basename, dest_baselen) == 0);
-   bool compare_dirs = identical_basenames;
-+#if __CYGWIN__
-+  /* If two names differ case-insensitively by only an '.exe' suffix,
-+     do some sleuthing to see if .exe magic matters on the shorter
-+     name.  Swapping the longer name to dest avoids duplication.  */
-+  if (source_baselen == dest_baselen + 4)
-+    {
-+      char const *tmp_basename = source_basename;
-+      size_t tmp_baselen = source_baselen;
-+      source_basename = dest_basename;
-+      source_baselen = dest_baselen;
-+      dest_basename = tmp_basename;
-+      dest_baselen = tmp_baselen;
-+    }
-+  if (source_baselen + 4 == dest_baselen
-+      && !memcasecmp (dest_basename - 4, ".exe", 4)
-+      && !memcasecmp (source_basename, dest_basename, source_baselen)
-+      && 0 < cygwin_spelling(source))
-+    dest_baselen -= 4;
-+  /* Some, but not all, files are case-insensitive (depending on mount
-+     options, CYGWIN=case settings, and virtual file systems).  Do
-+     some sleuthing to decide whether case-insensitivity matters.  */
-+  if (! compare_dirs && source_baselen == dest_baselen)
-+    {
-+      ssize_t wsrclen = cygwin_conv_path (CCP_POSIX_TO_WIN_W,
-+                                          source, NULL, 0);
-+      ssize_t wdstlen = cygwin_conv_path (CCP_POSIX_TO_WIN_W,
-+                                          dest, NULL, 0);
-+      char *wsrc = malloca (wsrclen);
-+      char *wdst = malloca (wdstlen);
-+      if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, source, wsrc, wsrclen))
-+        error (EXIT_FAILURE, errno, "unable to convert path name %s", source);
-+      if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, dest, wdst, wdstlen))
-+        error (EXIT_FAILURE, errno, "unable to convert path name %s", dest);
-+      if (wsrclen == wdstlen && memcasecmp (wsrc, wdst, wsrclen) == 0)
-+        compare_dirs = true;
-+      freea (wsrc);
-+      freea (wdst);
-+    }
-+#endif /* __CYGWIN__ */
-   bool same = false;
- 
- #if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX
---- coreutils-8.28_prep/Makefile.in	2017-11-20 10:37:56.336452400 +0600
-+++ coreutils-8.28_prep/Makefile.in	2017-11-20 10:58:06.632817000 +0600
-@@ -710,7 +710,8 @@ 
- 	lib/xstrndup.h lib/xstrndup.c lib/xstrtod.c lib/xstrtoimax.c \
- 	lib/xstrtol.c lib/xstrtoul.c lib/xstrtol-error.c \
- 	lib/xstrtold.c lib/xstrtoumax.c lib/xvasprintf.h \
--	lib/xvasprintf.c lib/xasprintf.c lib/yesno.c
-+	lib/xvasprintf.c lib/xasprintf.c lib/yesno.c \
-+	lib/cygwin.c lib/cygwin.h
- am__dirstamp = $(am__leading_dot)dirstamp
- @LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE@am__objects_1 = lib/unistr/u8-mbtoucr.$(OBJEXT)
- @LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE@am__objects_2 = lib/unistr/u8-uctomb.$(OBJEXT) \
-@@ -819,7 +820,8 @@ 
- 	lib/xstrtol.$(OBJEXT) lib/xstrtoul.$(OBJEXT) \
- 	lib/xstrtol-error.$(OBJEXT) lib/xstrtold.$(OBJEXT) \
- 	lib/xstrtoumax.$(OBJEXT) lib/xvasprintf.$(OBJEXT) \
--	lib/xasprintf.$(OBJEXT) lib/yesno.$(OBJEXT)
-+	lib/xasprintf.$(OBJEXT) lib/yesno.$(OBJEXT) \
-+	lib/cygwin.$(OBJEXT)
- lib_libcoreutils_a_OBJECTS = $(am_lib_libcoreutils_a_OBJECTS)
- src_libsinglebin___a_AR = $(AR) $(ARFLAGS)
- src_libsinglebin___a_LIBADD =
-@@ -4289,6 +4291,8 @@ 
- #	mv $@-t $@
- #EXTRA_DIST += script.in
- #MOSTLYCLEANFILES += script script-t
-+
-+# Hook in cygwin helper
- lib_libcoreutils_a_SOURCES = lib/copy-acl.c lib/set-acl.c \
- 	lib/acl-errno-valid.c lib/acl-internal.c lib/get-permissions.c \
- 	lib/set-permissions.c lib/allocator.c lib/areadlink.c \
-@@ -4367,7 +4371,8 @@ 
- 	lib/xstrndup.h lib/xstrndup.c lib/xstrtod.c lib/xstrtoimax.c \
- 	lib/xstrtol.c lib/xstrtoul.c lib/xstrtol-error.c \
- 	lib/xstrtold.c lib/xstrtoumax.c lib/xvasprintf.h \
--	lib/xvasprintf.c lib/xasprintf.c lib/yesno.c
-+	lib/xvasprintf.c lib/xasprintf.c lib/yesno.c \
-+	lib/cygwin.c lib/cygwin.h
- lib_libcoreutils_a_LIBADD = $(gl_LIBOBJS) @ALLOCA@
- lib_libcoreutils_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@
- EXTRA_lib_libcoreutils_a_SOURCES = lib/acl_entries.c lib/alloca.c \
-@@ -6468,6 +6473,8 @@ 
- lib/xasprintf.$(OBJEXT): lib/$(am__dirstamp) \
- 	lib/$(DEPDIR)/$(am__dirstamp)
- lib/yesno.$(OBJEXT): lib/$(am__dirstamp) lib/$(DEPDIR)/$(am__dirstamp)
-+lib/cygwin.$(OBJEXT): lib/$(am__dirstamp) \
-+       lib/$(DEPDIR)/$(am__dirstamp)
- lib/acl_entries.$(OBJEXT): lib/$(am__dirstamp) \
- 	lib/$(DEPDIR)/$(am__dirstamp)
- lib/alloca.$(OBJEXT): lib/$(am__dirstamp) \
-@@ -8473,6 +8480,7 @@ 
- @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/copy-acl.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/creat-safer.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/cycle-check.Po@am__quote@
-+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/cygwin.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/di-set.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/diacrit.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/dirchownmod.Po@am__quote@
---- coreutils-8.28_prep/src/chcon.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/chcon.c	2017-11-20 10:58:06.648439500 +0600
-@@ -48,7 +48,7 @@ 
- 
- /* Pointer to the device and inode numbers of '/', when --recursive.
-    Otherwise NULL.  */
--static struct dev_ino *root_dev_ino;
-+static struct root_dev_ino *root_dev_ino;
- 
- /* The name of the context file is being given. */
- static char const *specified_context;
-@@ -570,7 +570,7 @@ 
- 
-   if (recurse && preserve_root)
-     {
--      static struct dev_ino dev_ino_buf;
-+      static struct root_dev_ino dev_ino_buf;
-       root_dev_ino = get_root_dev_ino (&dev_ino_buf);
-       if (root_dev_ino == NULL)
-         die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
---- coreutils-8.28_prep/src/chgrp.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/chgrp.c	2017-11-20 10:58:06.648439500 +0600
-@@ -301,7 +301,7 @@ 
- 
-   if (chopt.recurse && preserve_root)
-     {
--      static struct dev_ino dev_ino_buf;
-+      static struct root_dev_ino dev_ino_buf;
-       chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
-       if (chopt.root_dev_ino == NULL)
-         die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
---- coreutils-8.28_prep/src/chmod.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/chmod.c	2017-11-20 10:58:06.648439500 +0600
-@@ -81,7 +81,7 @@ 
- 
- /* Pointer to the device and inode numbers of '/', when --recursive.
-    Otherwise NULL.  */
--static struct dev_ino *root_dev_ino;
-+static struct root_dev_ino *root_dev_ino;
- 
- /* For long options that have no equivalent short option, use a
-    non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
-@@ -552,7 +552,7 @@ 
- 
-   if (recurse && preserve_root)
-     {
--      static struct dev_ino dev_ino_buf;
-+      static struct root_dev_ino dev_ino_buf;
-       root_dev_ino = get_root_dev_ino (&dev_ino_buf);
-       if (root_dev_ino == NULL)
-         die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
---- coreutils-8.28_prep/src/chown.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/chown.c	2017-11-20 10:58:06.648439500 +0600
-@@ -313,7 +313,7 @@ 
- 
-   if (chopt.recurse && preserve_root)
-     {
--      static struct dev_ino dev_ino_buf;
-+      static struct root_dev_ino dev_ino_buf;
-       chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
-       if (chopt.root_dev_ino == NULL)
-         die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
---- coreutils-8.28_prep/src/chown-core.h	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/chown-core.h	2017-11-20 10:58:06.648439500 +0600
-@@ -50,7 +50,7 @@ 
- 
-   /* Pointer to the device and inode numbers of '/', when --recursive.
-      Need not be freed.  Otherwise NULL.  */
--  struct dev_ino *root_dev_ino;
-+  struct root_dev_ino *root_dev_ino;
- 
-   /* This corresponds to the --dereference (opposite of -h) option.  */
-   bool affect_symlink_referent;
---- coreutils-8.28_prep/src/chroot.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/chroot.c	2017-11-20 10:58:06.648439500 +0600
-@@ -171,7 +171,8 @@ 
- is_root (const char* dir)
- {
-   char *resolved = canonicalize_file_name (dir);
--  bool is_res_root = resolved && STREQ ("/", resolved);
-+  bool is_res_root = resolved && (STREQ ("/", resolved)
-+				  || STREQ ("//", resolved));
-   free (resolved);
-   return is_res_root;
- }
---- coreutils-8.28_prep/src/cksum.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/cksum.c	2017-11-20 17:26:50.616443600 +0600
-@@ -296,6 +296,9 @@ 
- 
-   have_read_stdin = false;
- 
-+  if (O_BINARY)
-+    xset_binary_mode (STDIN_FILENO, O_BINARY);
-+
-   if (optind == argc)
-     ok = cksum ("-", false);
-   else
---- coreutils-8.28_prep/src/copy.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/copy.c	2017-11-20 10:58:06.668078700 +0600
-@@ -85,6 +85,10 @@ 
- # define FICLONE _IOW (0x94, 9, int)
- #endif
- 
-+#if __CYGWIN__
-+# include "cygwin.h"
-+#endif
-+
- #ifndef HAVE_FCHOWN
- # define HAVE_FCHOWN false
- # define fchown(fd, uid, gid) (-1)
-@@ -1423,7 +1427,11 @@ 
- static bool
- same_file_ok (char const *src_name, struct stat const *src_sb,
-               char const *dst_name, struct stat const *dst_sb,
--              const struct cp_options *x, bool *return_now)
-+              const struct cp_options *x, bool *return_now
-+#if __CYGWIN__
-+	      , bool *case_change
-+#endif
-+	      )
- {
-   const struct stat *src_sb_link;
-   const struct stat *dst_sb_link;
-@@ -1567,6 +1575,18 @@ 
-       if (S_ISLNK (dst_sb_link->st_mode))
-         return true;
- 
-+#if __CYGWIN__
-+      /* If the files have the same name, but differ in case, then let
-+	 rename() change the case.  */
-+      if (same_link && x->move_mode && same_name (src_name, dst_name)
-+	  && memcmp (last_component (src_name), last_component (dst_name),
-+		     base_len (src_name)))
-+	{
-+	  *case_change = true;
-+	  return true;
-+	}
-+#endif /* __CYGWIN__ */
-+
-       /* It's not ok if they're distinct hard links to the same file as
-          this causes a race condition and we may lose data in this case.  */
-       if (same_link
-@@ -1922,10 +1942,20 @@ 
-          && ! (x->move_mode || x->symbolic_link || x->hard_link
-                || x->backup_type != no_backups
-                || x->unlink_dest_before_opening));
--      if ((use_stat
--           ? stat (dst_name, &dst_sb)
--           : lstat (dst_name, &dst_sb))
--          != 0)
-+      int res = (use_stat
-+                 ? stat (dst_name, &dst_sb)
-+                 : lstat (dst_name, &dst_sb));
-+#if __CYGWIN__
-+      /* stat("a") succeeds even if it was really "a.exe".  */
-+      if (! res && cygwin_spelling (dst_name) != 0)
-+        {
-+          /* Only DST_NAME.exe exists, but we want the non-existant
-+             DST_NAME.  */
-+          res = -1;
-+          errno = ENOENT;
-+        }
-+#endif /* __CYGWIN__ */
-+      if (res != 0)
-         {
-           if (errno != ENOENT)
-             {
-@@ -1941,10 +1971,17 @@ 
-         { /* Here, we know that dst_name exists, at least to the point
-              that it is stat'able or lstat'able.  */
-           bool return_now;
-+#if __CYGWIN__
-+	  bool case_change = false;
-+#endif /* __CYGWIN__ */
- 
-           have_dst_lstat = !use_stat;
-           if (! same_file_ok (src_name, &src_sb, dst_name, &dst_sb,
--                              x, &return_now))
-+                              x, &return_now
-+#if __CYGWIN__
-+			      , &case_change
-+#endif /* __CYGWIN__ */
-+			      ))
-             {
-               error (0, 0, _("%s and %s are the same file"),
-                      quoteaf_n (0, src_name), quoteaf_n (1, dst_name));
-@@ -2003,6 +2040,9 @@ 
-              cp and mv treat -i and -f differently.  */
-           if (x->move_mode)
-             {
-+#if __CYGWIN__
-+	      if (!case_change)
-+#endif /* __CYGWIN__ */
-               if (abandon_move (x, dst_name, &dst_sb))
-                 {
-                   /* Pretend the rename succeeded, so the caller (mv)
-@@ -2144,7 +2184,11 @@ 
-                    /* Never unlink dst_name when in move mode.  */
-                    && ! x->move_mode
-                    && (x->unlink_dest_before_opening
--                       || (x->preserve_links && 1 < dst_sb.st_nlink)
-+                       || (x->preserve_links && 1 < dst_sb.st_nlink
-+#if __CYGWIN__
-+                           && !case_change
-+#endif /* __CYGWIN__ */
-+			   )
-                        || (x->dereference == DEREF_NEVER
-                            && ! S_ISREG (src_sb.st_mode))
-                        ))
-@@ -2936,6 +2980,21 @@ 
- {
-   assert (valid_options (options));
- 
-+#if __CYGWIN__
-+  /* .exe magic - if src exists with an implicit .exe suffix and is
-+     not a symlink, but dst does not exist and was also specified
-+     without a suffix, then append .exe to dst.  */
-+  int cygwin = cygwin_spelling (src_name);
-+  char *p;
-+  if (cygwin == 2
-+      && ((p = strchr (dst_name, '\0') - 4) <= dst_name
-+          || strcasecmp (p, ".exe") != 0))
-+    {
-+      cygwin = 3;
-+      CYGWIN_APPEND_EXE (p, dst_name);
-+    }
-+#endif /* __CYGWIN__ */
-+
-   /* Record the file names: they're used in case of error, when copying
-      a directory into itself.  I don't like to make these tools do *any*
-      extra work in the common case when that work is solely to handle
-@@ -2947,10 +3006,15 @@ 
-   top_level_dst_name = dst_name;
- 
-   bool first_dir_created_per_command_line_arg = false;
--  return copy_internal (src_name, dst_name, nonexistent_dst, NULL, NULL,
-+  bool result = copy_internal (src_name, dst_name, nonexistent_dst, NULL, NULL,
-                         options, true,
-                         &first_dir_created_per_command_line_arg,
-                         copy_into_self, rename_succeeded);
-+#if __CYGWIN__
-+  if (cygwin == 3)
-+    freea ((char *) dst_name);
-+#endif /* __CYGWIN__ */
-+  return result;
- }
- 
- /* Set *X to the default options for a value of type struct cp_options.  */
---- coreutils-8.28_prep/src/dd.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/dd.c	2017-11-20 10:58:06.670586400 +0600
-@@ -37,6 +37,10 @@ 
- #include "xstrtol.h"
- #include "xtime.h"
- 
-+#if __CYGWIN__
-+# include <io.h>
-+#endif
-+
- /* The official name of this program (e.g., no 'g' prefix).  */
- #define PROGRAM_NAME "dd"
- 
-@@ -1991,6 +1995,13 @@ 
- static void
- set_fd_flags (int fd, int add_flags, char const *name)
- {
-+#if __CYGWIN__
-+  /* Cygwin does not allow fcntl to set the mode.  */
-+  int mode_flags = add_flags & (O_BINARY | O_TEXT);
-+  add_flags &= ~(O_BINARY | O_TEXT);
-+  if (mode_flags && setmode (fd, mode_flags) == -1)
-+    error (EXIT_FAILURE, errno, _("setting flags for %s"), quote (name));
-+#endif /* __CYGWIN__ */
-   /* Ignore file creation flags that are no-ops on file descriptors.  */
-   add_flags &= ~ (O_NOCTTY | O_NOFOLLOW);
- 
-@@ -2380,6 +2391,8 @@ 
-     }
-   else
-     {
-+      if ((input_flags & (O_BINARY | O_TEXT)) == 0)
-+	input_flags |= O_BINARY;
-       if (ifd_reopen (STDIN_FILENO, input_file, O_RDONLY | input_flags, 0) < 0)
-         die (EXIT_FAILURE, errno, _("failed to open %s"),
-              quoteaf (input_file));
-@@ -2403,6 +2416,8 @@ 
-            | (conversions_mask & C_NOCREAT ? 0 : O_CREAT)
-            | (conversions_mask & C_EXCL ? O_EXCL : 0)
-            | (seek_records || (conversions_mask & C_NOTRUNC) ? 0 : O_TRUNC));
-+      if ((opts & (O_BINARY | O_TEXT)) == 0)
-+        opts |= O_BINARY;
- 
-       /* Open the output file with *read* access only if we might
-          need to read to satisfy a 'seek=' request.  If we can't read
---- coreutils-8.28_prep/src/dircolors.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/dircolors.c	2017-11-20 10:58:06.670586400 +0600
-@@ -496,8 +496,12 @@ 
-             }
-           else
-             {
-+              /* tcsh treats LS_COLORS as a magic shell variable for its
-+                 builtin ls-F, but does not recognize all the categories
-+                 that coreutils ls does.  Therefore, silence stderr to
-+                 avoid messages like "Unknown colorls variable `su'.".  */
-               prefix = "setenv LS_COLORS '";
--              suffix = "'\n";
-+              suffix = "' >&/dev/null\n";
-             }
-           fputs (prefix, stdout);
-           fwrite (s, 1, len, stdout);
---- coreutils-8.28_prep/src/install.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/install.c	2017-11-20 10:58:06.670586400 +0600
-@@ -45,6 +45,10 @@ 
- #include "utimens.h"
- #include "xstrtol.h"
- 
-+#if __CYGWIN__
-+# include "cygwin.h"
-+#endif
-+
- /* The official name of this program (e.g., no 'g' prefix).  */
- #define PROGRAM_NAME "install"
- 
-@@ -556,6 +560,16 @@ 
-       error (0, errno, _("fork system call failed"));
-       break;
-     case 0:			/* Child. */
-+#if __CYGWIN__
-+      {
-+	/* Check for .exe here, since strip doesn't.  */
-+	char *p;
-+	if (((p = strchr (name, '\0') - 4) <= name
-+	     || strcasecmp (p, ".exe") != 0)
-+	    && 0 < cygwin_spelling (name))
-+          CYGWIN_APPEND_EXE (p, name);
-+      }
-+#endif /* __CYGWIN__ */
-       execlp (strip_program, strip_program, name, NULL);
-       die (EXIT_FAILURE, errno, _("cannot run %s"), quoteaf (strip_program));
-     default:			/* Parent. */
---- coreutils-8.28_prep/src/ls.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/ls.c	2017-11-20 10:58:06.670586400 +0600
-@@ -121,6 +121,10 @@ 
- # include <sys/capability.h>
- #endif
- 
-+#if __CYGWIN__
-+# include "cygwin.h"
-+#endif
-+
- #define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \
-                       : (ls_mode == LS_MULTI_COL \
-                          ? "dir" : "vdir"))
-@@ -782,6 +786,11 @@ 
-     N_("%b %e %H:%M")
-   };
- 
-+#if __CYGWIN__
-+/* Whether .exe should be appended to command-line args as needed.  */
-+static bool append_exe;
-+#endif /* __CYGWIN__ */
-+
- /* The set of signals that are caught.  */
- 
- static sigset_t caught_signals;
-@@ -817,6 +826,9 @@ 
- enum
- {
-   AUTHOR_OPTION = CHAR_MAX + 1,
-+#if __CYGWIN__
-+  APPEND_EXE_OPTION,
-+#endif /* __CYGWIN__ */
-   BLOCK_SIZE_OPTION,
-   COLOR_OPTION,
-   DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION,
-@@ -880,6 +892,9 @@ 
-   {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
-   {"context", no_argument, 0, 'Z'},
-   {"author", no_argument, NULL, AUTHOR_OPTION},
-+#if __CYGWIN__
-+  {"append-exe", no_argument, NULL, APPEND_EXE_OPTION},
-+#endif /* __CYGWIN__ */
-   {GETOPT_HELP_OPTION_DECL},
-   {GETOPT_VERSION_OPTION_DECL},
-   {NULL, 0, NULL, 0}
-@@ -2096,6 +2111,12 @@ 
-           print_scontext = true;
-           break;
- 
-+#if __CYGWIN__
-+        case APPEND_EXE_OPTION:
-+          append_exe = true;
-+          break;
-+#endif /* __CYGWIN__ */
-+
-         case_GETOPT_HELP_CHAR;
- 
-         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
-@@ -3107,6 +3128,12 @@ 
-   uintmax_t blocks = 0;
-   struct fileinfo *f;
- 
-+#if __CYGWIN__
-+  char *name_alt = NULL;
-+  if (command_line_arg && append_exe && 0 < cygwin_spelling (name))
-+    CYGWIN_APPEND_EXE (name_alt, name);
-+#endif /* __CYGWIN__ */
-+
-   /* An inode value prior to gobble_file necessarily came from readdir,
-      which is not used for command line arguments.  */
-   assert (! command_line_arg || inode == NOT_AN_INODE_NUMBER);
-@@ -3237,11 +3264,19 @@ 
-           file_failure (command_line_arg,
-                         _("cannot access %s"), full_name);
-           if (command_line_arg)
--            return 0;
-+            {
-+#if __CYGWIN__
-+              freea (name_alt);
-+#endif /* __CYGWIN__ */
-+              return 0;
-+            }
- 
-           f->name = xstrdup (name);
-           cwd_n_used++;
- 
-+#if __CYGWIN__
-+          freea (name_alt);
-+#endif /* __CYGWIN__ */
-           return 0;
-         }
- 
-@@ -3430,6 +3465,9 @@ 
-   f->name = xstrdup (name);
-   cwd_n_used++;
- 
-+#if __CYGWIN__
-+  freea (name_alt);
-+#endif /* __CYGWIN__ */
-   return blocks;
- }
- 
-@@ -5277,6 +5315,11 @@ 
-   -1                         list one file per line.  Avoid '\\n' with -q or -b\
- \n\
- "), stdout);
-+#if __CYGWIN__
-+      fputs (_("\
-+      --append-exe           append .exe if cygwin magic was needed\n\
-+"), stdout);
-+#endif /* __CYGWIN__ */
-       fputs (HELP_OPTION_DESCRIPTION, stdout);
-       fputs (VERSION_OPTION_DESCRIPTION, stdout);
-       emit_size_note ();
---- coreutils-8.28_prep/src/md5sum.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/md5sum.c	2017-11-20 17:27:01.925674000 +0600
-@@ -1019,6 +1019,8 @@ 
-   char **operand_lim = argv + argc;
-   if (optind == argc)
-     *operand_lim++ = bad_cast ("-");
-+  if (O_BINARY)
-+    xset_binary_mode (STDIN_FILENO, O_BINARY);
- 
-   for (char **operandp = argv + optind; operandp < operand_lim; operandp++)
-     {
---- coreutils-8.28_prep/src/mv.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/mv.c	2017-11-20 10:58:06.670586400 +0600
-@@ -92,7 +92,7 @@ 
-   x->require_restore_cwd = true;
- 
-   {
--    static struct dev_ino dev_ino_buf;
-+    static struct root_dev_ino dev_ino_buf;
-     x->root_dev_ino = get_root_dev_ino (&dev_ino_buf);
-     if (x->root_dev_ino == NULL)
-       die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
-@@ -452,6 +452,16 @@ 
-   else if (!target_directory)
-     {
-       assert (2 <= n_files);
-+#if __CYGWIN__
-+      struct stat s1, s2;
-+      if (2 == n_files
-+	  && lstat (file[0], &s1) == 0 && lstat (file[1], &s2) == 0
-+	  && s1.st_ino == s2.st_ino)
-+	{
-+	  /* Allow 'mv foo Foo' to change case of the directory foo.  */
-+	}
-+      else
-+#endif /* __CYGWIN__ */
-       if (target_directory_operand (file[n_files - 1]))
-         target_directory = file[--n_files];
-       else if (2 < n_files)
---- coreutils-8.28_prep/src/pwd.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/pwd.c	2017-11-20 10:58:06.686330400 +0600
-@@ -268,8 +268,8 @@ 
- robust_getcwd (struct file_name *file_name)
- {
-   size_t height = 1;
--  struct dev_ino dev_ino_buf;
--  struct dev_ino *root_dev_ino = get_root_dev_ino (&dev_ino_buf);
-+  struct root_dev_ino dev_ino_buf;
-+  struct root_dev_ino *root_dev_ino = get_root_dev_ino (&dev_ino_buf);
-   struct stat dot_sb;
- 
-   if (root_dev_ino == NULL)
-@@ -282,7 +282,7 @@ 
-   while (1)
-     {
-       /* If we've reached the root, we're done.  */
--      if (SAME_INODE (dot_sb, *root_dev_ino))
-+      if (ROOT_DEV_INO_CHECK (root_dev_ino, &dot_sb))
-         break;
- 
-       find_dir_entry (&dot_sb, file_name, height++);
-@@ -291,6 +291,9 @@ 
-   /* See if a leading slash is needed; file_name_prepend adds one.  */
-   if (file_name->start[0] == '\0')
-     file_name_prepend (file_name, "", 0);
-+  /* If we aren't in `/', we must be in `//'.  */
-+  if (! SAME_INODE (root_dev_ino->single_slash, dot_sb))
-+    file_name_prepend (file_name, "", 0);
- }
- 
- 
---- coreutils-8.28_prep/src/remove.h	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/remove.h	2017-11-20 10:58:06.686330400 +0600
-@@ -54,7 +54,7 @@ 
- 
-   /* Pointer to the device and inode numbers of '/', when --recursive
-      and preserving '/'.  Otherwise NULL.  */
--  struct dev_ino *root_dev_ino;
-+  struct root_dev_ino *root_dev_ino;
- 
-   /* If nonzero, stdin is a tty.  */
-   bool stdin_tty;
---- coreutils-8.28_prep/src/rm.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/rm.c	2017-11-20 10:58:06.686330400 +0600
-@@ -326,7 +326,7 @@ 
- 
-   if (x.recursive && preserve_root)
-     {
--      static struct dev_ino dev_ino_buf;
-+      static struct root_dev_ino dev_ino_buf;
-       x.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
-       if (x.root_dev_ino == NULL)
-         die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
---- coreutils-8.28_prep/src/stat.c	2017-09-01 13:11:03.000000000 +0600
-+++ coreutils-8.28_prep/src/stat.c	2017-11-20 10:58:06.686330400 +0600
-@@ -74,6 +74,13 @@ 
- #include "find-mount-point.h"
- #include "xvasprintf.h"
- 
-+#if __CYGWIN__
-+# include "cygwin.h"
-+/* Whether .exe should be appended to command-line args as needed.  */
-+static bool append_exe;
-+# define APPEND_EXE_OPTION 10000
-+#endif
-+
- #if USE_STATVFS
- # define STRUCT_STATXFS_F_FSID_IS_INTEGER STRUCT_STATVFS_F_FSID_IS_INTEGER
- # define HAVE_STRUCT_STATXFS_F_TYPE HAVE_STRUCT_STATVFS_F_TYPE
-@@ -194,6 +201,9 @@ 
-   {"format", required_argument, NULL, 'c'},
-   {"printf", required_argument, NULL, PRINTF_OPTION},
-   {"terse", no_argument, NULL, 't'},
-+#if __CYGWIN__
-+  {"append-exe", no_argument, NULL, APPEND_EXE_OPTION},
-+#endif /* __CYGWIN__ */
-   {GETOPT_HELP_OPTION_DECL},
-   {GETOPT_VERSION_OPTION_DECL},
-   {NULL, 0, NULL, 0}
-@@ -1345,14 +1355,26 @@ 
-       return false;
-     }
- 
-+#if __CYGWIN__
-+  char *name_alt = NULL;
-+  if (append_exe && 0 < cygwin_spelling (filename))
-+    CYGWIN_APPEND_EXE (name_alt, filename);
-+#endif /* __CYGWIN__ */
-+
-   if (STATFS (filename, &statfsbuf) != 0)
-     {
-       error (0, errno, _("cannot read file system information for %s"),
-              quoteaf (filename));
-+#if __CYGWIN__
-+      freea (name_alt);
-+#endif /* __CYGWIN__ */
-       return false;
-     }
- 
-   bool fail = print_it (format, -1, filename, print_statfs, &statfsbuf);
-+#if __CYGWIN__
-+  freea (name_alt);
-+#endif /* __CYGWIN__ */
-   return ! fail;
- }
- 
-@@ -1363,6 +1385,7 @@ 
- {
-   int fd = STREQ (filename, "-") ? 0 : -1;
-   struct stat statbuf;
-+  char *name_alt = NULL;
- 
-   if (0 <= fd)
-     {
-@@ -1375,18 +1398,28 @@ 
-   /* We can't use the shorter
-      (follow_links?stat:lstat) (filename, &statbug)
-      since stat might be a function-like macro.  */
--  else if ((follow_links
--            ? stat (filename, &statbuf)
--            : lstat (filename, &statbuf)) != 0)
-+  else
-     {
--      error (0, errno, _("cannot stat %s"), quoteaf (filename));
--      return false;
-+      if ((follow_links
-+	   ? stat (filename, &statbuf)
-+	   : lstat (filename, &statbuf)) != 0)
-+	{
-+	  error (0, errno, _("cannot stat %s"), quoteaf (filename));
-+	  return false;
-+	}
-+#if __CYGWIN__
-+      if (append_exe && 0 < cygwin_spelling (filename))
-+        CYGWIN_APPEND_EXE (name_alt, filename);
-+#endif /* __CYGWIN__ */
-     }
- 
-   if (S_ISBLK (statbuf.st_mode) || S_ISCHR (statbuf.st_mode))
-     format = format2;
- 
-   bool fail = print_it (format, fd, filename, print_stat, &statbuf);
-+#if __CYGWIN__
-+  freea (name_alt);
-+#endif /* __CYGWIN__ */
-   return ! fail;
- }
- 
-@@ -1508,6 +1541,11 @@ 
-                           if you want a newline, include \\n in FORMAT\n\
-   -t, --terse           print the information in terse form\n\
- "), stdout);
-+#if __CYGWIN__
-+      fputs (_("\
-+      --append-exe      append .exe if cygwin magic was needed\n\
-+"), stdout);
-+#endif /* __CYGWIN__ */
-       fputs (HELP_OPTION_DESCRIPTION, stdout);
-       fputs (VERSION_OPTION_DESCRIPTION, stdout);
- 
-@@ -1627,6 +1665,12 @@ 
-           terse = true;
-           break;
- 
-+#if __CYGWIN__
-+        case APPEND_EXE_OPTION:
-+          append_exe = true;
-+          break;
-+#endif /* __CYGWIN__ */
-+
-         case_GETOPT_HELP_CHAR;
- 
-         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);

diff --git a/sys-apps/coreutils/files/coreutils-8.32-mint.patch b/sys-apps/coreutils/files/coreutils-8.32-mint.patch
deleted file mode 100644
index f02aeb2c9a..0000000000
--- a/sys-apps/coreutils/files/coreutils-8.32-mint.patch
+++ /dev/null
@@ -1,155 +0,0 @@
-http://bugs.gentoo.org/show_bug.cgi?id=260551
-http://bugs.gentoo.org/show_bug.cgi?id=264763
-http://bugs.gentoo.org/show_bug.cgi?id=497772
-https://savannah.gnu.org/patch/index.php?6758
-
-diff -u lib/mountlist.c lib/mountlist.c
---- a/lib/mountlist.c	2009-02-07 09:58:37.000000000 +0000
-+++ b/lib/mountlist.c	2009-04-08 04:04:19.000000000 +0000
-@@ -387,6 +387,7 @@
-    If NEED_FS_TYPE is true, ensure that the file system type fields in
-    the returned list are valid.  Otherwise, they might not be.  */
- 
-+#ifndef __MINT__
- struct mount_entry *
- read_file_system_list (bool need_fs_type)
- {
-@@ -970,6 +971,84 @@
-     return NULL;
-   }
- }
-+#else /* __MINT__ */
-+
-+#include <mintbind.h>
-+#include <osbind.h>
-+#include <sys/statfs.h>
-+#include <mint/dcntl.h>
-+
-+/* get the list of available drives */
-+static long
-+get_drives(void)
-+{
-+	long drive_bits;
-+	
-+	drive_bits = Dsetdrv(Dgetdrv());
-+	drive_bits &= ~(1|2); /* exclude all floppies */
-+		
-+	return drive_bits;
-+}
-+
-+struct mount_entry *
-+read_file_system_list (bool need_fs_type)
-+{
-+	struct mount_entry *mount_list;
-+	struct mount_entry *me;
-+	struct mount_entry *mtail;
-+	struct statfs fsp;
-+	struct fs_info info;
-+	long drive_bits;
-+	int i, j;
-+	char lw[] = "a:/", str[25];
-+	
-+	/* Start the list off with a dummy entry. */
-+	me = xmalloc (sizeof (*me));
-+	me->me_next = NULL;
-+	mount_list = mtail = me;
-+	
-+	drive_bits = get_drives();
-+	for (i = 0; i < 32; i++)
-+	{
-+		if (drive_bits & (1L << i))
-+		{
-+			if (i < 26)
-+				lw[0] = 'a' + i;
-+			else
-+				lw[0] = '1' + i - 26;
-+			
-+			if(statfs(lw, &fsp) == 0)
-+			{
-+				char name[32];
-+
-+				me = xmalloc (sizeof (*me));
-+				
-+				me->me_devname  = xstrdup(lw);
-+				me->me_mountdir = xstrdup("u:/");
-+				
-+				if (lw[0] < 'a')				/* 1: .. 6: */
-+					me->me_dev = lw[0] - '1' + 27;
-+				else
-+					me->me_dev = lw[0] - 'a';
-+				
-+				get_fsname(lw, NULL, name);
-+				me->me_type = xstrdup(name);
-+				/* Add to the linked list. */
-+				me->me_next = NULL;
-+				mtail->me_next = me;
-+				mtail = me;
-+			}
-+		}
-+	}
-+	
-+	/* Free the dummy head. */
-+	me = mount_list;
-+	mount_list = mount_list->me_next;
-+	free(me);
-+	return mount_list;
-+}
-+
-+#endif /* __MINT__ */
- 
- /* Free a mount entry as returned from read_file_system_list ().  */
- 
-diff -u src/df.c src/df.c
---- a/src/df.c	2009-02-14 10:18:27.000000000 +0000
-+++ b/src/df.c	2009-04-08 04:04:19.000000000 +0000
-@@ -337,7 +337,12 @@
-      It would be better to report on the unmounted file system,
-      but statfs doesn't do that on most systems.  */
-   if (!stat_file)
-+#ifndef __MINT__
-     stat_file = mount_point ? mount_point : disk;
-+#else
-+    /* MiNT: mount_point is always u:/, so use disk */
-+    stat_file = disk;
-+#endif
- 
-   if (force_fsu)
-     fsu = *force_fsu;
-diff -u Makefile.in Makefile.in
---- a/Makefile.in	2014-01-07 10:01:01.000000000 +0000
-+++ b/Makefile.in	2014-01-07 10:36:50.000000000 +0000
-@@ -3310,7 +3310,7 @@
- # must precede $(LIBINTL) in order to ensure we use GNU getopt.
- # But libcoreutils.a must also follow $(LIBINTL), since libintl uses
- # replacement functions defined in libcoreutils.a.
--LDADD = src/libver.a lib/libcoreutils.a $(LIBINTL) lib/libcoreutils.a
-+LDADD = src/libver.a lib/libcoreutils.a $(LIBINTL) lib/libcoreutils.a $(LIB_PTHREAD)
- 
- # First, list all programs, to make listing per-program libraries easier.
- # See [ below.
-diff --git a/src/uptime.c b/src/uptime.c
-index a42e702..638c2d6 100644
---- a/src/uptime.c
-+++ b/src/uptime.c
-@@ -17,6 +17,9 @@
- /* Created by hacking who.c by Kaveh Ghazi ghazi@caip.rutgers.edu.  */
- 
- #include <config.h>
-+#ifdef __MINT__
-+#define HAVE_PROC_UPTIME 1
-+#endif
- #include <stdio.h>
- 
- #include <sys/types.h>
-@@ -62,7 +65,11 @@ print_uptime (size_t n, const STRUCT_UTMP *this)
- #ifdef HAVE_PROC_UPTIME
-   FILE *fp;
- 
-+#ifdef __MINT__
-+  fp = fopen ("/kern/uptime", "r");
-+#else
-   fp = fopen ("/proc/uptime", "r");
-+#endif
-   if (fp != NULL)
-     {
-       char buf[BUFSIZ];


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/coreutils/files/, sys-apps/coreutils/
@ 2021-12-22 23:58 Sam James
  0 siblings, 0 replies; 7+ messages in thread
From: Sam James @ 2021-12-22 23:58 UTC (permalink / raw
  To: gentoo-commits

commit:     5a419fb841222582de4d8945a5b43a93f77d11e5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 22 23:57:38 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 22 23:57:38 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=5a419fb8

sys-apps/coreutils: sync with ::gentoo for chmod patch

Closes: https://bugs.gentoo.org/829836
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/coreutils/coreutils-9.0-r1.ebuild         |  4 ++-
 .../coreutils-9.0-fix-chmod-symlink-exit.patch     | 35 ++++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/sys-apps/coreutils/coreutils-9.0-r1.ebuild b/sys-apps/coreutils/coreutils-9.0-r1.ebuild
index 4bb595cdec..5d2550bf69 100644
--- a/sys-apps/coreutils/coreutils-9.0-r1.ebuild
+++ b/sys-apps/coreutils/coreutils-9.0-r1.ebuild
@@ -67,7 +67,9 @@ pkg_setup() {
 }
 
 src_prepare() {
-	local PATCHES=()
+	local PATCHES=(
+		"${FILESDIR}"/${P}-fix-chmod-symlink-exit.patch
+	)
 
 	if ! use vanilla ; then
 		PATCHES+=( "${WORKDIR}"/patch )

diff --git a/sys-apps/coreutils/files/coreutils-9.0-fix-chmod-symlink-exit.patch b/sys-apps/coreutils/files/coreutils-9.0-fix-chmod-symlink-exit.patch
new file mode 100644
index 0000000000..25b2b72bcb
--- /dev/null
+++ b/sys-apps/coreutils/files/coreutils-9.0-fix-chmod-symlink-exit.patch
@@ -0,0 +1,35 @@
+https://git.savannah.gnu.org/cgit/coreutils.git/patch/?id=e8b56ebd536e82b15542a00c888109471936bfda
+https://lists.gnu.org/archive/html/bug-coreutils/2021-09/msg00031.html
+(and https://lists.gnu.org/archive/html/bug-coreutils/2021-09/msg00035.html)
+
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
+Date: Fri, 24 Sep 2021 20:57:41 +0100
+Subject: chmod: fix exit status when ignoring symlinks
+
+* src/chmod.c: Reorder enum so CH_NOT_APPLIED
+can be treated as a non error.
+* tests/chmod/ignore-symlink.sh: A new test.
+* tests/local.mk: Reference the new test.
+* NEWS: Mention the bug fix.
+Fixes https://bugs.gnu.org/50784
+--- a/src/chmod.c
++++ b/src/chmod.c
+@@ -44,8 +44,8 @@ struct change_status
+   enum
+     {
+       CH_NO_STAT,
+-      CH_NOT_APPLIED,
+       CH_FAILED,
++      CH_NOT_APPLIED,
+       CH_NO_CHANGE_REQUESTED,
+       CH_SUCCEEDED
+     }
+@@ -322,7 +322,7 @@ process_file (FTS *fts, FTSENT *ent)
+   if ( ! recurse)
+     fts_set (fts, ent, FTS_SKIP);
+ 
+-  return CH_NO_CHANGE_REQUESTED <= ch.status;
++  return CH_NOT_APPLIED <= ch.status;
+ }
+ 
+ /* Recursively change the modes of the specified FILES (the last entry


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/coreutils/files/, sys-apps/coreutils/
@ 2023-05-27 11:27 Fabian Groffen
  0 siblings, 0 replies; 7+ messages in thread
From: Fabian Groffen @ 2023-05-27 11:27 UTC (permalink / raw
  To: gentoo-commits

commit:     dc6adf25ba6fd45e278b57817f1e5edf7d608b43
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat May 27 11:26:58 2023 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat May 27 11:26:58 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=dc6adf25

sys-apps/coreutils: sync with gx86

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 sys-apps/coreutils/Manifest                        |  2 +
 sys-apps/coreutils/coreutils-9.1-r2.ebuild         | 20 ++---
 ...utils-9.1-r2.ebuild => coreutils-9.3-r1.ebuild} | 66 +++++++++++------
 ...utils-9.3-cp-parents-preserve-permissions.patch | 86 ++++++++++++++++++++++
 4 files changed, 142 insertions(+), 32 deletions(-)

diff --git a/sys-apps/coreutils/Manifest b/sys-apps/coreutils/Manifest
index 69df2fc021..ed372cdb6a 100644
--- a/sys-apps/coreutils/Manifest
+++ b/sys-apps/coreutils/Manifest
@@ -1,3 +1,5 @@
 DIST coreutils-9.0_p20220409-patches-01.tar.xz 6244 BLAKE2B 8ca9855680719660782931467ec70095c826e66b9850890b8cf456963f8114f63940707386b97c766172d01e55e17b7db2aa1c329208a873a76e2293b29f565f SHA512 4b43c25832122d241f33e6b4eff24bc1fa045b9ca5af45a49d22ecb1fa282986c4e4a045ef24c34b3d94fd9a2247247c42c344261e3f464d881969e6f3351d3f
 DIST coreutils-9.1.tar.xz 5712104 BLAKE2B f5654e4935535275615d44a56c071d1c0746af36cf4615fcc0a5a0d387af9c9023adac31f31a52e16b3d1105b9d4c0fb7ebff9b2862498849f867a866049dd6e SHA512 a6ee2c549140b189e8c1b35e119d4289ec27244ec0ed9da0ac55202f365a7e33778b1dc7c4e64d1669599ff81a8297fe4f5adbcc8a3a2f75c919a43cd4b9bdfa
 DIST coreutils-9.1.tar.xz.sig 833 BLAKE2B e9627a066f3c67596feaa8d43d5785076230f440bacea84d8b5736e51a22787c2d5df1f3e2cd8523d01fb7b468933d3c17fce3cb1fbefef322a0e0d820b81842 SHA512 9f0766531afd4faa3e2c337730f61db55605cf06729e9c61f644594883732c2e0b1ddb0005b492be309c53e6f45b8ff875398163a48699d52517ea49e9bdbc91
+DIST coreutils-9.3.tar.xz 5808696 BLAKE2B 11502cd2dbeef150d0d4cece2546bf6b835941b94456c258f6058338f0477f22e68e88934d075b08fe51ee4d1c0c50cb23d8084ac06a457d6e8975f01643b1cd SHA512 242271f212a6860bdc6c8d7e5c4f85ce66c1b48ef781aca9daa56e0fe7c2b7809ef72b4392120219fe5b687637c83ce89ceef8bb35f6274f43f8f968a6901694
+DIST coreutils-9.3.tar.xz.sig 833 BLAKE2B c45ae10ff706907ae65d31228e432f7d6f34acbdb733bf521437d9e2fc75828a59da9d432d894a1ed8b7341f7e15d0e8d4e816e209c799b75c14d0ec055bfdf2 SHA512 522a2072f8ef940228ccdd856a4041c3c16b98e309168ccf2066fe7c1013685ba6cdea8a7317dfa1f4507b37ca016ecedaf54438d4a5007927b0e1a8fd223eb5

diff --git a/sys-apps/coreutils/coreutils-9.1-r2.ebuild b/sys-apps/coreutils/coreutils-9.1-r2.ebuild
index 19d468c871..0807fff2b9 100644
--- a/sys-apps/coreutils/coreutils-9.1-r2.ebuild
+++ b/sys-apps/coreutils/coreutils-9.1-r2.ebuild
@@ -1,13 +1,13 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
 # Try to keep an eye on Fedora's packaging: https://src.fedoraproject.org/rpms/coreutils
-# The upstream coreutils maintianers also maintain the package in Fedora and may
+# The upstream coreutils maintainers also maintain the package in Fedora and may
 # backport fixes which we want to pick up.
 
-PYTHON_COMPAT=( python3_{8..10} )
+PYTHON_COMPAT=( python3_{9..11} )
 VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/coreutils.asc
 inherit flag-o-matic python-any-r1 toolchain-funcs verify-sig
 
@@ -25,6 +25,7 @@ if [[ ${PV} == *_p* ]] ; then
 else
 	SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
 		verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig )"
+
 	KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
 fi
 
@@ -116,13 +117,14 @@ src_prepare() {
 			-e "/src_libstdbuf_so_LDFLAGS = -shared/s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/libexec/coreutils/libstdbuf.dylib:" \
 			Makefile.in \
 			|| die
+
+		sed -i \
+			-e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \
+			src/stdbuf.c \
+			Makefile.in \
+			configure \
+			|| die
 	fi
-	sed -i \
-		-e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \
-		src/stdbuf.c \
-		Makefile.in \
-		configure \
-		|| die
 
 	# Since we've patched many .c files, the make process will try to
 	# re-build the manpages by running `./bin --help`.  When doing a

diff --git a/sys-apps/coreutils/coreutils-9.1-r2.ebuild b/sys-apps/coreutils/coreutils-9.3-r1.ebuild
similarity index 84%
copy from sys-apps/coreutils/coreutils-9.1-r2.ebuild
copy to sys-apps/coreutils/coreutils-9.3-r1.ebuild
index 19d468c871..1d0172656a 100644
--- a/sys-apps/coreutils/coreutils-9.1-r2.ebuild
+++ b/sys-apps/coreutils/coreutils-9.3-r1.ebuild
@@ -1,13 +1,15 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
 # Try to keep an eye on Fedora's packaging: https://src.fedoraproject.org/rpms/coreutils
-# The upstream coreutils maintianers also maintain the package in Fedora and may
+# The upstream coreutils maintainers also maintain the package in Fedora and may
 # backport fixes which we want to pick up.
+#
+# Also recommend subscribing to the coreutils and bug-coreutils MLs.
 
-PYTHON_COMPAT=( python3_{8..10} )
+PYTHON_COMPAT=( python3_{9..11} )
 VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/coreutils.asc
 inherit flag-o-matic python-any-r1 toolchain-funcs verify-sig
 
@@ -15,16 +17,22 @@ MY_PATCH="${PN}-9.0_p20220409-patches-01"
 DESCRIPTION="Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, who,...)"
 HOMEPAGE="https://www.gnu.org/software/coreutils/"
 
-if [[ ${PV} == *_p* ]] ; then
+if [[ ${PV} == 9999 ]] ; then
+	EGIT_REPO_URI="https://git.savannah.gnu.org/git/coreutils.git"
+	inherit git-r3
+elif [[ ${PV} == *_p* ]] ; then
 	# Note: could put this in devspace, but if it's gone, we don't want
 	# it in tree anyway. It's just for testing.
-	MY_SNAPSHOT="$(ver_cut 1-2).193-54bec"
+	MY_SNAPSHOT="$(ver_cut 1-2).18-ffd62"
 	SRC_URI="https://www.pixelbeat.org/cu/coreutils-${MY_SNAPSHOT}.tar.xz -> ${P}.tar.xz"
 	SRC_URI+=" verify-sig? ( https://www.pixelbeat.org/cu/coreutils-${MY_SNAPSHOT}.tar.xz.sig -> ${P}.tar.xz.sig )"
 	S="${WORKDIR}"/${PN}-${MY_SNAPSHOT}
 else
-	SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
-		verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig )"
+	SRC_URI="
+		mirror://gnu/${PN}/${P}.tar.xz
+		verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig )
+	"
+
 	KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
 fi
 
@@ -35,14 +43,18 @@ SLOT="0"
 IUSE="acl caps gmp hostname kill multicall nls +openssl selinux +split-usr static test vanilla xattr"
 RESTRICT="!test? ( test )"
 
-LIB_DEPEND="acl? ( sys-apps/acl[static-libs] )
+LIB_DEPEND="
+	acl? ( sys-apps/acl[static-libs] )
 	caps? ( sys-libs/libcap )
 	gmp? ( dev-libs/gmp:=[static-libs] )
 	openssl? ( dev-libs/openssl:=[static-libs] )
-	xattr? ( sys-apps/attr[static-libs] )"
-RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs]} )
+	xattr? ( sys-apps/attr[static-libs] )
+"
+RDEPEND="
+	!static? ( ${LIB_DEPEND//\[static-libs]} )
 	selinux? ( sys-libs/libselinux )
-	nls? ( virtual/libintl )"
+	nls? ( virtual/libintl )
+"
 DEPEND="
 	${RDEPEND}
 	static? ( ${LIB_DEPEND} )
@@ -80,7 +92,14 @@ pkg_setup() {
 }
 
 src_unpack() {
-	if use verify-sig ; then
+	if [[ ${PV} == 9999 ]] ; then
+		git-r3_src_unpack
+
+		cd "${S}" || die
+		./bootstrap || die
+
+		sed -i -e "s:submodule-checks ?= no-submodule-changes public-submodule-commit:submodule-checks ?= no-submodule-changes:" gnulib/top/maint.mk || die
+	elif use verify-sig ; then
 		# Needed for downloaded patch (which is unsigned, which is fine)
 		verify-sig_verify_detached "${DISTDIR}"/${P}.tar.xz{,.sig}
 	fi
@@ -91,10 +110,10 @@ src_unpack() {
 src_prepare() {
 	local PATCHES=(
 		# Upstream patches
-		"${FILESDIR}"/${P}-fix-rename-simple-backups.patch
+		"${FILESDIR}"/${P}-cp-parents-preserve-permissions.patch
 	)
 
-	if ! use vanilla ; then
+	if ! use vanilla && [[ -d "${WORKDIR}"/patch ]] ; then
 		PATCHES+=( "${WORKDIR}"/patch )
 	fi
 
@@ -116,13 +135,14 @@ src_prepare() {
 			-e "/src_libstdbuf_so_LDFLAGS = -shared/s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/libexec/coreutils/libstdbuf.dylib:" \
 			Makefile.in \
 			|| die
+
+		sed -i \
+			-e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \
+			src/stdbuf.c \
+			Makefile.in \
+			configure \
+			|| die
 	fi
-	sed -i \
-		-e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \
-		src/stdbuf.c \
-		Makefile.in \
-		configure \
-		|| die
 
 	# Since we've patched many .c files, the make process will try to
 	# re-build the manpages by running `./bin --help`.  When doing a
@@ -150,7 +170,6 @@ src_configure() {
 		# hostname    - net-tools
 		--enable-install-program="arch,$(usev hostname),$(usev kill)"
 		--enable-no-install-program="groups,$(usev !hostname),$(usev !kill),su,uptime"
-		--enable-largefile
 		$(usex caps '' --disable-libcap)
 		$(use_enable nls)
 		$(use_enable acl)
@@ -224,7 +243,8 @@ src_test() {
 	addwrite /dev/full
 	#export RUN_EXPENSIVE_TESTS="yes"
 	#export FETISH_GROUPS="portage wheel"
-	env PATH="${T}/mount-wrappers:${PATH}" emake -k check VERBOSE=yes
+	env PATH="${T}/mount-wrappers:${PATH}" gl_public_submodule_commit= \
+		emake -k check VERBOSE=yes
 }
 
 src_install() {

diff --git a/sys-apps/coreutils/files/coreutils-9.3-cp-parents-preserve-permissions.patch b/sys-apps/coreutils/files/coreutils-9.3-cp-parents-preserve-permissions.patch
new file mode 100644
index 0000000000..c8f2a9bb49
--- /dev/null
+++ b/sys-apps/coreutils/files/coreutils-9.3-cp-parents-preserve-permissions.patch
@@ -0,0 +1,86 @@
+https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=c6b1fe43474b48a6bf5793e11cc1d0d6e895fdf4
+
+From c6b1fe43474b48a6bf5793e11cc1d0d6e895fdf4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
+Date: Wed, 3 May 2023 17:01:37 +0100
+Subject: cp: -p --parents: fix failure to preserve permissions for absolute
+ paths
+
+* src/cp.c (re_protect): Ensure copy_acl() is passed an absolute path.
+* tests/cp/cp-parents.sh: Add a test case.
+* NEWS: Mention the bug.
+Fixes https://bugs.gnu.org/63245
+--- a/src/cp.c
++++ b/src/cp.c
+@@ -296,15 +296,19 @@ regular file.\n\
+    when done.  */
+ 
+ static bool
+-re_protect (char const *const_dst_name, int dst_dirfd, char const *dst_relname,
++re_protect (char const *const_dst_name, int dst_dirfd, char const *dst_fullname,
+             struct dir_attr *attr_list, const struct cp_options *x)
+ {
+   struct dir_attr *p;
+   char *dst_name;		/* A copy of CONST_DST_NAME we can change. */
+-  char *src_name;		/* The source name in 'dst_name'. */
++  char *src_name;		/* The relative source name in 'dst_name'. */
++  char *full_src_name;		/* The full source name in 'dst_name'. */
+ 
+   ASSIGN_STRDUPA (dst_name, const_dst_name);
+-  src_name = dst_name + (dst_relname - const_dst_name);
++  full_src_name = dst_name + (dst_fullname - const_dst_name);
++  src_name = full_src_name;
++  while (*src_name == '/')
++    src_name++;
+ 
+   for (p = attr_list; p; p = p->next)
+     {
+@@ -347,7 +351,7 @@ re_protect (char const *const_dst_name, int dst_dirfd, char const *dst_relname,
+ 
+       if (x->preserve_mode)
+         {
+-          if (copy_acl (src_name, -1, dst_name, -1, p->st.st_mode) != 0)
++          if (copy_acl (full_src_name, -1, dst_name, -1, p->st.st_mode) != 0)
+             return false;
+         }
+       else if (p->restore_mode)
+@@ -687,6 +691,7 @@ do_copy (int n_files, char **file, char const *target_directory,
+           bool parent_exists = true;  /* True if dir_name (dst_name) exists. */
+           struct dir_attr *attr_list;
+           char *arg_in_concat = NULL;
++          char *full_arg_in_concat = NULL;
+           char *arg = file[i];
+ 
+           /* Trailing slashes are meaningful (i.e., maybe worth preserving)
+@@ -719,6 +724,7 @@ do_copy (int n_files, char **file, char const *target_directory,
+                   (x->verbose ? "%s -> %s\n" : NULL),
+                   &attr_list, &new_dst, x));
+ 
++              full_arg_in_concat = arg_in_concat;
+               while (*arg_in_concat == '/')
+                 arg_in_concat++;
+             }
+@@ -747,7 +753,7 @@ do_copy (int n_files, char **file, char const *target_directory,
+                           new_dst, x, &copy_into_self, NULL);
+ 
+               if (parents_option)
+-                ok &= re_protect (dst_name, target_dirfd, arg_in_concat,
++                ok &= re_protect (dst_name, target_dirfd, full_arg_in_concat,
+                                   attr_list, x);
+             }
+ 
+--- a/tests/cp/cp-parents.sh
++++ b/tests/cp/cp-parents.sh
+@@ -66,4 +66,10 @@ p=$(ls -ld g/sym/b/c|cut -b-10); case $p in drwxr-xr-x);; *) fail=1;; esac
+ cp --parents --no-preserve=mode np/b/file np_dest/ || fail=1
+ p=$(ls -ld np_dest/np|cut -b-10); case $p in drwxr-xr-x);; *) fail=1;; esac
+ 
++# coreutils 9.1-9.3 inclusive would fail to copy acls for absolute dirs
++mkdir dest || framework_failure_
++if test -f /bin/ls; then
++  cp -t dest --parents -p /bin/ls || fail=1
++fi
++
+ Exit $fail
+-- 
+cgit v1.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/coreutils/files/, sys-apps/coreutils/
@ 2024-07-26 13:38 Fabian Groffen
  0 siblings, 0 replies; 7+ messages in thread
From: Fabian Groffen @ 2024-07-26 13:38 UTC (permalink / raw
  To: gentoo-commits

commit:     af61f0a4cc9a5ef5ee1bf980c67f75a1cc560f3e
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 26 13:37:50 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Jul 26 13:37:50 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=af61f0a4

sys-apps/coreutils-9.5: version bump, add Solaris fix

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 sys-apps/coreutils/Manifest                        |   3 +
 sys-apps/coreutils/coreutils-9.5.ebuild            | 349 +++++++++++++++++++++
 .../files/coreutils-9.5-skip-readutmp-test.patch   |  13 +
 3 files changed, 365 insertions(+)

diff --git a/sys-apps/coreutils/Manifest b/sys-apps/coreutils/Manifest
index ed372cdb6a..6b82603fbe 100644
--- a/sys-apps/coreutils/Manifest
+++ b/sys-apps/coreutils/Manifest
@@ -3,3 +3,6 @@ DIST coreutils-9.1.tar.xz 5712104 BLAKE2B f5654e4935535275615d44a56c071d1c0746af
 DIST coreutils-9.1.tar.xz.sig 833 BLAKE2B e9627a066f3c67596feaa8d43d5785076230f440bacea84d8b5736e51a22787c2d5df1f3e2cd8523d01fb7b468933d3c17fce3cb1fbefef322a0e0d820b81842 SHA512 9f0766531afd4faa3e2c337730f61db55605cf06729e9c61f644594883732c2e0b1ddb0005b492be309c53e6f45b8ff875398163a48699d52517ea49e9bdbc91
 DIST coreutils-9.3.tar.xz 5808696 BLAKE2B 11502cd2dbeef150d0d4cece2546bf6b835941b94456c258f6058338f0477f22e68e88934d075b08fe51ee4d1c0c50cb23d8084ac06a457d6e8975f01643b1cd SHA512 242271f212a6860bdc6c8d7e5c4f85ce66c1b48ef781aca9daa56e0fe7c2b7809ef72b4392120219fe5b687637c83ce89ceef8bb35f6274f43f8f968a6901694
 DIST coreutils-9.3.tar.xz.sig 833 BLAKE2B c45ae10ff706907ae65d31228e432f7d6f34acbdb733bf521437d9e2fc75828a59da9d432d894a1ed8b7341f7e15d0e8d4e816e209c799b75c14d0ec055bfdf2 SHA512 522a2072f8ef940228ccdd856a4041c3c16b98e309168ccf2066fe7c1013685ba6cdea8a7317dfa1f4507b37ca016ecedaf54438d4a5007927b0e1a8fd223eb5
+DIST coreutils-9.5-patches.tar.xz 5912 BLAKE2B 873fbe1a60f8f8034b3d35796146765ce388952d649c32dc81ca0e4c2823c9f2f00b69bc5cb3af686434867459b6dc378fb9a6d59563d28b87c3ee1eceeedbb3 SHA512 4b4ad356615d046b8d67ea35b789f887a787ab01ece3234f6344518aef33cd30ca364fef5d85e11acfdb24003114c16ffdab82922fb135d5425fbcd541064a76
+DIST coreutils-9.5.tar.xz 6007136 BLAKE2B 6fd3a77697c9e85f31415c6ad66559faf18acc7d346677a89d4a999c2027886551e78842a7283e7b3b44fe8ef2fde04ba2f88df32a7844d5f69d45bcb7a04b6f SHA512 2ca0deac4dc10a80fd0c6fd131252e99d457fd03b7bd626a6bc74fe5a0529c0a3d48ce1f5da1d3b3a7a150a1ce44f0fbb6b68a6ac543dfd5baa3e71f5d65401c
+DIST coreutils-9.5.tar.xz.sig 833 BLAKE2B 37c29984bceee0ff3bffde76712f71dbb118c228e328dc230d5c53c37da12f5ec2130e0123b97fda4a561f556c3be307fdbe1f0c21279db2c84030818386f626 SHA512 029997e0f4ee64e561853cff7c8a124f58cc891598595b44c4a46f9813b4b71c9d677464bc8a26d294e9971832f4b87c23777fea4fac6e8e30f06ad93b9957d5

diff --git a/sys-apps/coreutils/coreutils-9.5.ebuild b/sys-apps/coreutils/coreutils-9.5.ebuild
new file mode 100644
index 0000000000..1152f3d2fd
--- /dev/null
+++ b/sys-apps/coreutils/coreutils-9.5.ebuild
@@ -0,0 +1,349 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# PREFIX LOCAL changes:
+# - Solaris memset_s fix, that depends on coreutils pulling gnulib
+#   https://github.com/coreutils/gnulib/commit/4438332396e6e1f950862a32a71df511865b4069
+#   coreutils 9.6 probably has it as this commit suggests they updated
+#   https://github.com/coreutils/coreutils/commit/ea1fe48b91bfa9e8c4f952faf6b44fc1946e817b
+# - Darwin libstdbuf cruft to fix during bootstrap, and use a correct
+#   install_name
+
+# Try to keep an eye on Fedora's packaging: https://src.fedoraproject.org/rpms/coreutils
+# The upstream coreutils maintainers also maintain the package in Fedora and may
+# backport fixes which we want to pick up.
+#
+# Also recommend subscribing to the coreutils and bug-coreutils MLs.
+
+PYTHON_COMPAT=( python3_{10..12} )
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/coreutils.asc
+inherit flag-o-matic python-any-r1 toolchain-funcs verify-sig
+
+MY_PATCH="${PN}-9.5-patches"
+DESCRIPTION="Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, who,...)"
+HOMEPAGE="https://www.gnu.org/software/coreutils/"
+
+if [[ ${PV} == 9999 ]] ; then
+	EGIT_REPO_URI="https://git.savannah.gnu.org/git/coreutils.git"
+	inherit git-r3
+elif [[ ${PV} == *_p* ]] ; then
+	# Note: could put this in devspace, but if it's gone, we don't want
+	# it in tree anyway. It's just for testing.
+	MY_SNAPSHOT="$(ver_cut 1-2).185-541b02"
+	SRC_URI="https://www.pixelbeat.org/cu/coreutils-${MY_SNAPSHOT}.tar.xz -> ${P}.tar.xz"
+	SRC_URI+=" verify-sig? ( https://www.pixelbeat.org/cu/coreutils-${MY_SNAPSHOT}.tar.xz.sig -> ${P}.tar.xz.sig )"
+	S="${WORKDIR}"/${PN}-${MY_SNAPSHOT}
+else
+	SRC_URI="
+		mirror://gnu/${PN}/${P}.tar.xz
+		verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig )
+	"
+
+	KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+
+SRC_URI+=" !vanilla? ( https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${MY_PATCH}.tar.xz )"
+
+LICENSE="GPL-3+"
+SLOT="0"
+IUSE="acl caps gmp hostname kill multicall nls +openssl selinux +split-usr static test vanilla xattr"
+RESTRICT="!test? ( test )"
+
+LIB_DEPEND="
+	acl? ( sys-apps/acl[static-libs] )
+	caps? ( sys-libs/libcap )
+	gmp? ( dev-libs/gmp:=[static-libs] )
+	openssl? ( dev-libs/openssl:=[static-libs] )
+	xattr? ( sys-apps/attr[static-libs] )
+"
+RDEPEND="
+	!static? ( ${LIB_DEPEND//\[static-libs]} )
+	selinux? ( sys-libs/libselinux )
+	nls? ( virtual/libintl )
+"
+DEPEND="
+	${RDEPEND}
+	static? ( ${LIB_DEPEND} )
+"
+BDEPEND="
+	app-arch/xz-utils
+	dev-lang/perl
+	test? (
+		dev-debug/strace
+		dev-lang/perl
+		dev-perl/Expect
+		${PYTHON_DEPS}
+	)
+	verify-sig? ( sec-keys/openpgp-keys-coreutils )
+"
+RDEPEND+="
+	hostname? ( !sys-apps/net-tools[hostname] )
+	kill? (
+		!sys-apps/util-linux[kill]
+		!sys-process/procps[kill]
+	)
+	!<sys-apps/util-linux-2.13
+	!<sys-apps/sandbox-2.10-r4
+	!sys-apps/stat
+	!net-mail/base64
+	!sys-apps/mktemp
+	!<app-forensics/tct-1.18-r1
+	!<net-fs/netatalk-2.0.3-r4
+"
+
+QA_CONFIG_IMPL_DECL_SKIP=(
+	# gnulib FPs (bug #898370)
+	unreachable MIN alignof static_assert
+	# ... and on musl
+	_exit fpurge statvfs64 re_set_syntax re_compile_pattern re_search re_match
+)
+
+pkg_setup() {
+	if use test ; then
+		python-any-r1_pkg_setup
+	fi
+}
+
+src_unpack() {
+	if [[ ${PV} == 9999 ]] ; then
+		git-r3_src_unpack
+
+		cd "${S}" || die
+		./bootstrap || die
+
+		sed -i -e "s:submodule-checks ?= no-submodule-changes public-submodule-commit:submodule-checks ?= no-submodule-changes:" gnulib/top/maint.mk || die
+	elif use verify-sig ; then
+		# Needed for downloaded patch (which is unsigned, which is fine)
+		verify-sig_verify_detached "${DISTDIR}"/${P}.tar.xz{,.sig}
+	fi
+
+	default
+}
+
+src_prepare() {
+	# TODO: past 2025, we may need to add our own hack for bug #907474.
+	local PATCHES=(
+		# Upstream patches
+	)
+
+	if ! use vanilla && [[ -d "${WORKDIR}"/${MY_PATCH} ]] ; then
+		PATCHES+=(
+			"${WORKDIR}"/${MY_PATCH}
+			"${FILESDIR}"/${PN}-9.5-skip-readutmp-test.patch
+		)
+	fi
+
+	default
+
+	# fixup libstdbuf non-libtool stuff
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		# we need replacement libs from libcoreutils.a here in order
+		# to finish the linking (they try to avoid this, but it doesn't
+		# during bootstrap, a re-install is fine though)
+		sed -i \
+			-e "/src_libstdbuf_so_LDADD/s:$: lib/libcoreutils.a:" \
+			Makefile.in \
+			|| die
+		# and we need serial building :(
+		export MAKEOPTS+=" -j1"
+		# set a proper install_name
+		sed -i \
+			-e "/src_libstdbuf_so_LDFLAGS = -shared/s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/libexec/coreutils/libstdbuf.dylib:" \
+			Makefile.in \
+			|| die
+
+		sed -i \
+			-e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \
+			src/stdbuf.c \
+			Makefile.in \
+			configure \
+			|| die
+	fi
+
+	# should be gone on next release, for memset_s breakage
+	[[ ${CHOST} == *-solaris* ]] && append-cppflags -D__STDC_WANT_LIB_EXT1__=1
+
+	# Since we've patched many .c files, the make process will try to
+	# re-build the manpages by running `./bin --help`.  When doing a
+	# cross-compile, we can't do that since 'bin' isn't a native bin.
+	#
+	# Also, it's not like we changed the usage on any of these things,
+	# so let's just update the timestamps and skip the help2man step.
+	set -- man/*.x
+	touch ${@/%x/1} || die
+
+	# Avoid perl dep for compiled in dircolors default (bug #348642)
+	if ! has_version dev-lang/perl ; then
+		touch src/dircolors.h || die
+		touch ${@/%x/1} || die
+	fi
+}
+
+src_configure() {
+	# TODO: in future (>9.4?), we may want to wire up USE=systemd:
+	# still experimental at the moment, but:
+	# https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=85edb4afbd119fb69a0d53e1beb71f46c9525dd0
+	local myconf=(
+		--with-packager="Gentoo"
+		--with-packager-version="${PVR} (p${PATCH_VER:-0})"
+		--with-packager-bug-reports="https://bugs.gentoo.org/"
+		# kill/uptime - procps
+		# groups/su   - shadow
+		# hostname    - net-tools
+		--enable-install-program="arch,$(usev hostname),$(usev kill)"
+		--enable-no-install-program="groups,$(usev !hostname),$(usev !kill),su,uptime"
+		$(usev !caps --disable-libcap)
+		$(use_enable nls)
+		$(use_enable acl)
+		$(use_enable multicall single-binary)
+		$(use_enable xattr)
+		$(use_with gmp libgmp)
+		$(use_with openssl)
+	)
+
+	if use gmp ; then
+		myconf+=( --with-libgmp-prefix="${ESYSROOT}"/usr )
+	fi
+
+	if tc-is-cross-compiler && [[ ${CHOST} == *linux* ]] ; then
+		# bug #311569
+		export fu_cv_sys_stat_statfs2_bsize=yes
+		# bug #416629
+		export gl_cv_func_realpath_works=yes
+	fi
+
+	# bug #409919
+	export gl_cv_func_mknod_works=yes
+
+	if use static ; then
+		append-ldflags -static
+		# bug #321821
+		sed -i '/elf_sys=yes/s:yes:no:' configure || die
+	fi
+
+	if ! use selinux ; then
+		# bug #301782
+		export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no
+	fi
+
+	econf "${myconf[@]}"
+}
+
+src_test() {
+	# Non-root tests will fail if the full path isn't
+	# accessible to non-root users
+	chmod -R go-w "${WORKDIR}" || die
+	chmod a+rx "${WORKDIR}" || die
+
+	# coreutils tests like to do `mount` and such with temp dirs,
+	# so make sure:
+	# - /etc/mtab is writable (bug #265725)
+	# - /dev/loop* can be mounted (bug #269758)
+	mkdir -p "${T}"/mount-wrappers || die
+	mkwrap() {
+		local w ww
+		for w in "${@}" ; do
+			ww="${T}/mount-wrappers/${w}"
+			cat <<-EOF > "${ww}"
+				#!${EPREFIX}/bin/sh
+				exec env SANDBOX_WRITE="\${SANDBOX_WRITE}:/etc/mtab:/dev/loop" $(type -P ${w}) "\$@"
+			EOF
+			chmod a+rx "${ww}" || die
+		done
+	}
+	mkwrap mount umount
+
+	addwrite /dev/full
+
+	#local -x RUN_EXPENSIVE_TESTS="yes"
+	#local -x COREUTILS_GROUPS="portage wheel"
+	local -x PATH="${T}/mount-wrappers:${PATH}"
+	local -x gl_public_submodule_commit=
+
+	local xfail_tests=(
+		# bug #675802
+		tests/env/env-S
+		tests/env/env-S.pl
+
+		# bug #413621 and bug #548250
+		tests/du/long-from-unreadable.sh
+		tests/ls/removed-directory
+		tests/ls/removed-directory.sh
+		tests/ls/stat-free-symlinks
+		tests/ls/stat-free-symlinks.sh
+		tests/rm/deep-2
+		tests/rm/deep-2.sh
+
+		# We have a patch which fixes this (bug #259876)
+		#tests/touch/not-owner
+		#tests/touch/not-owner.sh
+	)
+
+	# This test is flaky (bug #629660, bug #935367).
+	cat > tests/dd/no-allocate.sh <<-EOF || die
+	#!/bin/sh
+	exit 77;
+	EOF
+
+	# This test is flaky (bug #910640).
+	cat > tests/tty/tty-eof.pl <<-EOF || die
+	#!/usr/bin/perl
+	exit 77;
+	EOF
+
+	# We set DISABLE_HARD_ERRORS because some of the tests hard error-out
+	# because of sandbox. They're skipped above but DISABLE_HARD_ERRORS is needed
+	# to downgrade them to FAIL.
+	emake -k check \
+		VERBOSE=yes \
+		DISABLE_HARD_ERRORS=yes \
+		XFAIL_TESTS="${xfail_tests[*]}"
+}
+
+src_install() {
+	default
+
+	insinto /etc
+	newins src/dircolors.hin DIR_COLORS
+
+	if use split-usr ; then
+		cd "${ED}"/usr/bin || die
+		dodir /bin
+
+		# Move critical binaries into /bin (required by FHS)
+		local fhs="cat chgrp chmod chown cp date dd df echo false ln ls
+		           mkdir mknod mv pwd rm rmdir stty sync true uname"
+		mv ${fhs} ../../bin/ || die "Could not move FHS bins!"
+
+		if use hostname ; then
+			mv hostname ../../bin/ || die
+		fi
+
+		if use kill ; then
+			mv kill ../../bin/ || die
+		fi
+
+		# Move critical binaries into /bin (common scripts)
+		# (Why are these required for booting?)
+		local com="basename chroot cut dir dirname du env expr head mkfifo
+		           mktemp readlink seq sleep sort tail touch tr tty vdir wc yes"
+		mv ${com} ../../bin/ || die "Could not move common bins!"
+
+		# Create a symlink for uname in /usr/bin/ since autotools require it.
+		# (Other than uname, we need to figure out why we are
+		# creating symlinks for these in /usr/bin instead of leaving
+		# the files there in the first place...)
+		local x
+		for x in ${com} uname ; do
+			dosym ../../bin/${x} /usr/bin/${x}
+		done
+	fi
+}
+
+pkg_postinst() {
+	ewarn "Make sure you run 'hash -r' in your active shells."
+	ewarn "You should also re-source your shell settings for LS_COLORS"
+	ewarn "  changes, such as: source /etc/profile"
+}

diff --git a/sys-apps/coreutils/files/coreutils-9.5-skip-readutmp-test.patch b/sys-apps/coreutils/files/coreutils-9.5-skip-readutmp-test.patch
new file mode 100644
index 0000000000..3e7c9cf420
--- /dev/null
+++ b/sys-apps/coreutils/files/coreutils-9.5-skip-readutmp-test.patch
@@ -0,0 +1,13 @@
+https://bugs.gentoo.org/935367
+--- a/gnulib-tests/test-readutmp.c
++++ b/gnulib-tests/test-readutmp.c
+@@ -43,6 +43,9 @@ main (int argc, char *argv[])
+   STRUCT_UTMP *entries;
+   idx_t num_entries;
+ 
++  fprintf (stderr, "Skipping test: Gentoo: examines host entries, so unreliable in ebuild\n");
++  return 77;
++
+   if (read_utmp (UTMP_FILE, &num_entries, &entries, 0) < 0)
+     {
+       #if READ_UTMP_SUPPORTED


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-07-26 13:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-18 15:29 [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/coreutils/files/, sys-apps/coreutils/ Michael Haubenwallner
  -- strict thread matches above, loose matches on Subject: below --
2017-11-12 13:06 Fabian Groffen
2020-12-08  3:20 Sam James
2020-12-27 10:49 Fabian Groffen
2021-12-22 23:58 Sam James
2023-05-27 11:27 Fabian Groffen
2024-07-26 13:38 Fabian Groffen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox