From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 867501382C5 for ; Sun, 27 Dec 2020 10:49:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CCECFE0C12; Sun, 27 Dec 2020 10:49:26 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A860FE0C12 for ; Sun, 27 Dec 2020 10:49:26 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 791F43415FD for ; Sun, 27 Dec 2020 10:49:25 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1C69F4B for ; Sun, 27 Dec 2020 10:49:24 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1609066092.770560f712da16a27ee7ba36543340300bf7afb2.grobian@gentoo> Subject: [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/coreutils/files/, sys-apps/coreutils/ X-VCS-Repository: repo/proj/prefix X-VCS-Files: sys-apps/coreutils/Manifest sys-apps/coreutils/coreutils-8.32.ebuild sys-apps/coreutils/files/coreutils-8.28-cygwin-8.26-3.patch sys-apps/coreutils/files/coreutils-8.32-mint.patch X-VCS-Directories: sys-apps/coreutils/files/ sys-apps/coreutils/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 770560f712da16a27ee7ba36543340300bf7afb2 X-VCS-Branch: master Date: Sun, 27 Dec 2020 10:49:24 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 60d0921b-e0b4-441b-9c22-424ac15e1ec4 X-Archives-Hash: 0d9194e42245f3d5a5239ba6f8f43c84 commit: 770560f712da16a27ee7ba36543340300bf7afb2 Author: Fabian Groffen gentoo org> AuthorDate: Sun Dec 27 10:48:12 2020 +0000 Commit: Fabian Groffen gentoo 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 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 -+ -+#include "cygwin.h" -+ -+#include -+#include -+#include -+#include -+ -+/* 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 - #include - - #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 -+# 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 -+#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 - #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 -+#include -+#include -+#include -+ -+/* 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 -+#ifdef __MINT__ -+#define HAVE_PROC_UPTIME 1 -+#endif - #include - - #include -@@ -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];