Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/coreutils/files/, sys-apps/coreutils/
Date: Sun, 27 Dec 2020 10:49:27
Message-Id: 1609066092.770560f712da16a27ee7ba36543340300bf7afb2.grobian@gentoo
1 commit: 770560f712da16a27ee7ba36543340300bf7afb2
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 27 10:48:12 2020 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 27 10:48:12 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=770560f7
7
8 sys-apps/coreutils: drop ~m68k-mint
9
10 Package-Manager: Portage-3.0.12-prefix, Repoman-3.0.2
11 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
12
13 sys-apps/coreutils/Manifest | 1 +
14 sys-apps/coreutils/coreutils-8.32.ebuild | 12 +-
15 .../files/coreutils-8.28-cygwin-8.26-3.patch | 1043 --------------------
16 sys-apps/coreutils/files/coreutils-8.32-mint.patch | 155 ---
17 4 files changed, 9 insertions(+), 1202 deletions(-)
18
19 diff --git a/sys-apps/coreutils/Manifest b/sys-apps/coreutils/Manifest
20 index 0f0d568b69..23cda18b29 100644
21 --- a/sys-apps/coreutils/Manifest
22 +++ b/sys-apps/coreutils/Manifest
23 @@ -1,2 +1,3 @@
24 +DIST coreutils-8.28-cygwin-8.26-3.patch 36792 BLAKE2B f494be97595ff9532f57ca3d5386d185d813647fb07480dc1b22434fa5eecfa22acb6940b82cc733ae4448757e5f69cf2c7c746a5752409fe4aa11dd47482e63 SHA512 53d05262118a0063a0b3992b80dcda28256516da4d077a691117384ea808e5468488443d9c4b0e38a4d5148e5e721e733dcb0562dcf23a1370d4090251458951
25 DIST coreutils-8.30-patches-01.tar.xz 5788 BLAKE2B a41511ce39ac570cb14b7f12d125eebef92217469a9490808719fa0665f5e5c0adb96fbd02c4bac4d280d1502295669575790a81dbc01afe2ca3a9d384cbefb0 SHA512 b1e1933637de4581d5f8c6ede4e80a012435d13f0cf5550a76ab5bbe9441e3c15ce19ef3f78a7ea3b8368d5e9a3bb17c1207c471d26171b59786f38adeba0454
26 DIST coreutils-8.32.tar.xz 5547836 BLAKE2B 0ad99c176c19ec214fcfd0845523e5362f0151827707c759bd46c0fe8d2501c6ad1c29c5b71266f6525857bc0d56c472db0d7fe29953b6c65e2e6c76bdf3c515 SHA512 1c8f3584efd61b4b02e7ac5db8e103b63cfb2063432caaf1e64cb2dcc56d8c657d1133bbf10bd41468d6a1f31142e6caa81d16ae68fa3e6e84075c253613a145
27
28 diff --git a/sys-apps/coreutils/coreutils-8.32.ebuild b/sys-apps/coreutils/coreutils-8.32.ebuild
29 index 6e23e61ae1..302190d759 100644
30 --- a/sys-apps/coreutils/coreutils-8.32.ebuild
31 +++ b/sys-apps/coreutils/coreutils-8.32.ebuild
32 @@ -15,11 +15,14 @@ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
33 mirror://gentoo/${PATCH}.tar.xz
34 https://dev.gentoo.org/~polynomial-c/dist/${PATCH}.tar.xz
35 )
36 + elibc_Cygwin? (
37 + https://dev.gentoo.org/~grobian/distfiles/${PN}-8.28-cygwin-8.26-3.patch
38 + )
39 "
40
41 LICENSE="GPL-3"
42 SLOT="0"
43 -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
44 +KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
45 IUSE="acl caps gmp hostname kill multicall nls selinux +split-usr static test userland_BSD vanilla xattr"
46 RESTRICT="!test? ( test )"
47
48 @@ -73,9 +76,11 @@ src_prepare() {
49 PATCHES+=( "${FILESDIR}"/${PN}-8.32-sandbox-env-test.patch )
50 fi
51
52 - default
53 + if use elibc_Cygwin ; then
54 + PATCHES+=( "${DISTDIR}"/${PN}-8.28-cygwin-8.26-3.patch )
55 + fi
56
57 - eapply "${FILESDIR}"/${PN}-8.32-mint.patch
58 + default
59
60 # fixup libstdbuf non-libtool stuff
61 if [[ ${CHOST} == *-darwin* ]] ; then
62 @@ -94,7 +99,6 @@ src_prepare() {
63 Makefile.in \
64 || die
65 elif use elibc_Cygwin ; then
66 - eapply "${FILESDIR}"/${PN}-8.28-cygwin-8.26-3.patch
67 sed -i -e 's|\(libstdbuf\.so\)$(EXEEXT)|\1|g' Makefile.in || die
68 fi
69 sed -i \
70
71 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
72 deleted file mode 100644
73 index 20bfe76b3d..0000000000
74 --- a/sys-apps/coreutils/files/coreutils-8.28-cygwin-8.26-3.patch
75 +++ /dev/null
76 @@ -1,1043 +0,0 @@
77 -This was a copy of coreutils-8.25-3.src.patch from the official Cygwin
78 -coreutils-8.25-3 source package, modified to avoid re-running autotools:
79 -
80 -* Hunks for ./configure.ac go to ./configure instead.
81 -* Hunks for ./lib/local.mk go to ./Makefile.in instead.
82 -
83 -It has been updated to apply to coreutils-8.28 by Egor Y. Egorov, provided
84 -in Gentoo Bug report https://bugs.gentoo.org/638816.
85 -
86 -Once there is an official Cygwin source package for 8.28 or newer, we
87 -probably want to import their patch again.
88 -
89 ---- coreutils-8.28_prep/configure 2017-09-02 07:54:54.000000000 +0600
90 -+++ coreutils-8.28_prep/configure 2017-11-20 10:58:06.601585900 +0600
91 -@@ -65498,7 +65498,8 @@
92 - # Put this message here, after gl_WARN_ADD's chatter.
93 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether this system supports stdbuf" >&5
94 - $as_echo_n "checking whether this system supports stdbuf... " >&6; }
95 --CFLAGS="-fPIC $CFLAGS"
96 -+# -fPIC on cygwin is a warning
97 -+# CFLAGS="-fPIC $CFLAGS"
98 - LDFLAGS="-shared $LDFLAGS"
99 - stdbuf_supported=no
100 - # Note we only LINK here rather than RUN to support cross compilation
101 -@@ -65530,7 +65531,7 @@
102 - conftest$ac_exeext conftest.$ac_ext
103 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $stdbuf_supported" >&5
104 - $as_echo "$stdbuf_supported" >&6; }
105 --if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
106 -+if test "$stdbuf_supported" = "yes"; then
107 - {
108 - if test -z "$optional_bin_progs"; then
109 - optional_bin_progs=stdbuf
110 ---- coreutils-8.28_prep/lib/cygwin.c 1970-01-01 06:00:00.000000000 +0600
111 -+++ coreutils-8.28_prep/lib/cygwin.c 2017-11-20 15:52:51.569827000 +0600
112 -@@ -0,0 +1,73 @@
113 -+/* cygwin.c - helper functions unique to Cygwin
114 -+
115 -+ Copyright (C) 2005, 2006, 2008, 2011 Free Software Foundation, Inc.
116 -+
117 -+ This program is free software; you can redistribute it and/or modify
118 -+ it under the terms of the GNU General Public License as published by
119 -+ the Free Software Foundation; either version 3, or (at your option)
120 -+ any later version.
121 -+
122 -+ This program is distributed in the hope that it will be useful,
123 -+ but WITHOUT ANY WARRANTY; without even the implied warranty of
124 -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
125 -+ GNU General Public License for more details.
126 -+
127 -+ You should have received a copy of the GNU General Public License
128 -+ along with this program; if not, write to the Free Software Foundation,
129 -+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
130 -+
131 -+ Written by Eric Blake. */
132 -+
133 -+#include <config.h>
134 -+
135 -+#include "cygwin.h"
136 -+
137 -+#include <errno.h>
138 -+#include <limits.h>
139 -+#include <string.h>
140 -+#include <unistd.h>
141 -+
142 -+/* Return -1 if PATH is not found, 0 if PATH will not have .exe
143 -+ appended (it is possible that a PATH that does not exist still
144 -+ returns 0 instead of -1, or fails for a PATH that exists but cannot
145 -+ be stat'ed), and positive if PATH has ".exe" automatically appended
146 -+ by cygwin (1 if PATH is a symlink, 2 otherwise). Won't change errno. */
147 -+
148 -+int
149 -+cygwin_spelling (char const *path)
150 -+{
151 -+ int saved_errno = errno;
152 -+ int result = 0; /* Start with assumption that PATH is okay. */
153 -+ size_t len;
154 -+ struct stat st1;
155 -+ struct stat st2;
156 -+ char *path_exe;
157 -+
158 -+ /* If PATH will cause EINVAL or ENAMETOOLONG, treat it as missing. */
159 -+ if (! path || ! *path)
160 -+ return -1;
161 -+ if (PATH_MAX < (len = strlen (path)))
162 -+ return -1;
163 -+ /* Don't change spelling if there is a trailing `/' or '.exe'. */
164 -+ if (path[len - 1] == '/'
165 -+ || (len > 4 && !strcasecmp (&path[len - 4], ".exe")))
166 -+ return 0;
167 -+ if (lstat (path, &st1) < 0)
168 -+ {
169 -+ errno = saved_errno;
170 -+ return -1;
171 -+ }
172 -+ if (S_ISDIR(st1.st_mode))
173 -+ {
174 -+ errno = saved_errno;
175 -+ return 0;
176 -+ }
177 -+ path_exe = malloca (len + 5); /* adding ".exe" and NUL. */
178 -+ strcat (stpcpy (path_exe, path), ".exe");
179 -+ if (lstat (path_exe, &st2) == 0 && st1.st_ino == st2.st_ino)
180 -+ result = 1 + !S_ISLNK(st1.st_mode);
181 -+ freea (path_exe);
182 -+
183 -+ errno = saved_errno;
184 -+ return result;
185 -+}
186 ---- coreutils-8.28_prep/lib/cygwin.h 1970-01-01 06:00:00.000000000 +0600
187 -+++ coreutils-8.28_prep/lib/cygwin.h 2017-11-20 15:52:51.571832900 +0600
188 -@@ -0,0 +1,38 @@
189 -+/* cygwin.h - helper functions unique to Cygwin
190 -+
191 -+ Copyright (C) 2005, 2006, 2008, 2010, 2011 Free Software Foundation, Inc.
192 -+
193 -+ This program is free software; you can redistribute it and/or modify
194 -+ it under the terms of the GNU General Public License as published by
195 -+ the Free Software Foundation; either version 3, or (at your option)
196 -+ any later version.
197 -+
198 -+ This program is distributed in the hope that it will be useful,
199 -+ but WITHOUT ANY WARRANTY; without even the implied warranty of
200 -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
201 -+ GNU General Public License for more details.
202 -+
203 -+ You should have received a copy of the GNU General Public License
204 -+ along with this program; if not, write to the Free Software Foundation,
205 -+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
206 -+
207 -+ Written by Eric Blake. */
208 -+
209 -+#ifndef CYGWIN_H
210 -+# define CYGWIN_H 1
211 -+
212 -+#include "malloca.h"
213 -+
214 -+int cygwin_spelling (char const *);
215 -+
216 -+/* Append ".exe" to char *__NAME_ORIG, where __NAME is either NULL or
217 -+ between __NAME_ORIG and the nul terminator. Both params will be
218 -+ evaluated more than once and assigned the new value. The user must
219 -+ later call freea(__NAME). */
220 -+#define CYGWIN_APPEND_EXE(__name, __name_orig) \
221 -+ __name_orig = __name = \
222 -+ strcat (strcpy (malloca (strchr (__name ? __name : __name_orig, '\0') \
223 -+ - (__name_orig) + 5), \
224 -+ __name_orig), ".exe")
225 -+
226 -+#endif /* CYGWIN_H */
227 ---- coreutils-8.28_prep/lib/hash-pjw.c 2017-09-01 13:12:43.000000000 +0600
228 -+++ coreutils-8.28_prep/lib/hash-pjw.c 2017-11-20 10:58:06.617214500 +0600
229 -@@ -19,6 +19,7 @@
230 -
231 - #include "hash-pjw.h"
232 -
233 -+#include <ctype.h>
234 - #include <limits.h>
235 -
236 - #define SIZE_BITS (sizeof (size_t) * CHAR_BIT)
237 -@@ -38,3 +39,16 @@
238 -
239 - return h % tablesize;
240 - }
241 -+
242 -+/* Likewise, but case-insensitive. */
243 -+size_t
244 -+hash_pjw_case (const void *x, size_t tablesize)
245 -+{
246 -+ const unsigned char *s;
247 -+ size_t h = 0;
248 -+
249 -+ for (s = x; *s; s++)
250 -+ h = tolower (*s) + ((h << 9) | (h >> (SIZE_BITS - 9)));
251 -+
252 -+ return h % tablesize;
253 -+}
254 ---- coreutils-8.28_prep/lib/hash-pjw.h 2017-09-01 13:12:43.000000000 +0600
255 -+++ coreutils-8.28_prep/lib/hash-pjw.h 2017-11-20 10:58:06.617214500 +0600
256 -@@ -21,3 +21,4 @@
257 - The result is platform dependent: it depends on the size of the 'size_t'
258 - type and on the signedness of the 'char' type. */
259 - extern size_t hash_pjw (void const *x, size_t tablesize) _GL_ATTRIBUTE_PURE;
260 -+extern size_t hash_pjw_case (void const *x, size_t tablesize) _GL_ATTRIBUTE_PURE;
261 ---- coreutils-8.28_prep/lib/hash-triple.c 2017-09-01 13:12:43.000000000 +0600
262 -+++ coreutils-8.28_prep/lib/hash-triple.c 2017-11-20 10:58:06.617214500 +0600
263 -@@ -34,7 +34,13 @@
264 - triple_hash (void const *x, size_t table_size)
265 - {
266 - struct F_triple const *p = x;
267 -+#if !__CYGWIN__
268 - size_t tmp = hash_pjw (p->name, table_size);
269 -+#else // cygwin
270 -+ /* Hash case-insensitively, to force collisions on names that differ by
271 -+ case; copy.c can then account for case-insensitive renames. */
272 -+ size_t tmp = hash_pjw_case (p->name, table_size);
273 -+#endif
274 -
275 - /* Ignoring the device number here should be fine. */
276 - return (tmp ^ p->st_ino) % table_size;
277 ---- coreutils-8.28_prep/lib/root-dev-ino.c 2017-09-01 13:11:03.000000000 +0600
278 -+++ coreutils-8.28_prep/lib/root-dev-ino.c 2017-11-20 10:58:06.617214500 +0600
279 -@@ -25,13 +25,17 @@
280 - /* Call lstat to get the device and inode numbers for '/'.
281 - Upon failure, return NULL. Otherwise, set the members of
282 - *ROOT_D_I accordingly and return ROOT_D_I. */
283 --struct dev_ino *
284 --get_root_dev_ino (struct dev_ino *root_d_i)
285 -+struct root_dev_ino *
286 -+get_root_dev_ino (struct root_dev_ino *root_d_i)
287 - {
288 - struct stat statbuf;
289 - if (lstat ("/", &statbuf))
290 - return NULL;
291 -- root_d_i->st_ino = statbuf.st_ino;
292 -- root_d_i->st_dev = statbuf.st_dev;
293 -+ root_d_i->single_slash.st_ino = statbuf.st_ino;
294 -+ root_d_i->single_slash.st_dev = statbuf.st_dev;
295 -+ if (lstat ("//", &statbuf))
296 -+ return NULL;
297 -+ root_d_i->double_slash.st_ino = statbuf.st_ino;
298 -+ root_d_i->double_slash.st_dev = statbuf.st_dev;
299 - return root_d_i;
300 - }
301 ---- coreutils-8.28_prep/lib/root-dev-ino.h 2017-09-01 13:11:03.000000000 +0600
302 -+++ coreutils-8.28_prep/lib/root-dev-ino.h 2017-11-20 10:58:06.617214500 +0600
303 -@@ -21,19 +21,26 @@
304 - # include "dev-ino.h"
305 - # include "same-inode.h"
306 -
307 --struct dev_ino *
308 --get_root_dev_ino (struct dev_ino *root_d_i);
309 -+struct root_dev_ino
310 -+{
311 -+ struct dev_ino single_slash;
312 -+ struct dev_ino double_slash;
313 -+};
314 -+
315 -+struct root_dev_ino *
316 -+get_root_dev_ino (struct root_dev_ino *root_d_i);
317 -
318 - /* These macros are common to the programs that support the
319 - --preserve-root and --no-preserve-root options. */
320 -
321 - # define ROOT_DEV_INO_CHECK(Root_dev_ino, Dir_statbuf) \
322 -- (Root_dev_ino && SAME_INODE (*Dir_statbuf, *Root_dev_ino))
323 -+ (Root_dev_ino && (SAME_INODE (*Dir_statbuf, (Root_dev_ino)->single_slash) \
324 -+ || SAME_INODE (*Dir_statbuf, (Root_dev_ino)->double_slash)))
325 -
326 - # define ROOT_DEV_INO_WARN(Dirname) \
327 - do \
328 - { \
329 -- if (STREQ (Dirname, "/")) \
330 -+ if (STREQ (Dirname, "/") || STREQ (Dirname, "//")) \
331 - error (0, 0, _("it is dangerous to operate recursively on %s"), \
332 - quoteaf (Dirname)); \
333 - else \
334 ---- coreutils-8.28_prep/lib/same.c 2017-09-01 13:12:43.000000000 +0600
335 -+++ coreutils-8.28_prep/lib/same.c 2017-11-20 10:58:06.617214500 +0600
336 -@@ -40,6 +40,13 @@
337 - #include "error.h"
338 - #include "same-inode.h"
339 -
340 -+#if __CYGWIN__
341 -+# include <sys/cygwin.h>
342 -+# include "cygwin.h"
343 -+# include "malloca.h"
344 -+# include "memcasecmp.h"
345 -+#endif
346 -+
347 - #ifndef MIN
348 - # define MIN(a, b) ((a) < (b) ? (a) : (b))
349 - #endif
350 -@@ -59,6 +66,45 @@
351 - (source_baselen == dest_baselen
352 - && memcmp (source_basename, dest_basename, dest_baselen) == 0);
353 - bool compare_dirs = identical_basenames;
354 -+#if __CYGWIN__
355 -+ /* If two names differ case-insensitively by only an '.exe' suffix,
356 -+ do some sleuthing to see if .exe magic matters on the shorter
357 -+ name. Swapping the longer name to dest avoids duplication. */
358 -+ if (source_baselen == dest_baselen + 4)
359 -+ {
360 -+ char const *tmp_basename = source_basename;
361 -+ size_t tmp_baselen = source_baselen;
362 -+ source_basename = dest_basename;
363 -+ source_baselen = dest_baselen;
364 -+ dest_basename = tmp_basename;
365 -+ dest_baselen = tmp_baselen;
366 -+ }
367 -+ if (source_baselen + 4 == dest_baselen
368 -+ && !memcasecmp (dest_basename - 4, ".exe", 4)
369 -+ && !memcasecmp (source_basename, dest_basename, source_baselen)
370 -+ && 0 < cygwin_spelling(source))
371 -+ dest_baselen -= 4;
372 -+ /* Some, but not all, files are case-insensitive (depending on mount
373 -+ options, CYGWIN=case settings, and virtual file systems). Do
374 -+ some sleuthing to decide whether case-insensitivity matters. */
375 -+ if (! compare_dirs && source_baselen == dest_baselen)
376 -+ {
377 -+ ssize_t wsrclen = cygwin_conv_path (CCP_POSIX_TO_WIN_W,
378 -+ source, NULL, 0);
379 -+ ssize_t wdstlen = cygwin_conv_path (CCP_POSIX_TO_WIN_W,
380 -+ dest, NULL, 0);
381 -+ char *wsrc = malloca (wsrclen);
382 -+ char *wdst = malloca (wdstlen);
383 -+ if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, source, wsrc, wsrclen))
384 -+ error (EXIT_FAILURE, errno, "unable to convert path name %s", source);
385 -+ if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, dest, wdst, wdstlen))
386 -+ error (EXIT_FAILURE, errno, "unable to convert path name %s", dest);
387 -+ if (wsrclen == wdstlen && memcasecmp (wsrc, wdst, wsrclen) == 0)
388 -+ compare_dirs = true;
389 -+ freea (wsrc);
390 -+ freea (wdst);
391 -+ }
392 -+#endif /* __CYGWIN__ */
393 - bool same = false;
394 -
395 - #if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX
396 ---- coreutils-8.28_prep/Makefile.in 2017-11-20 10:37:56.336452400 +0600
397 -+++ coreutils-8.28_prep/Makefile.in 2017-11-20 10:58:06.632817000 +0600
398 -@@ -710,7 +710,8 @@
399 - lib/xstrndup.h lib/xstrndup.c lib/xstrtod.c lib/xstrtoimax.c \
400 - lib/xstrtol.c lib/xstrtoul.c lib/xstrtol-error.c \
401 - lib/xstrtold.c lib/xstrtoumax.c lib/xvasprintf.h \
402 -- lib/xvasprintf.c lib/xasprintf.c lib/yesno.c
403 -+ lib/xvasprintf.c lib/xasprintf.c lib/yesno.c \
404 -+ lib/cygwin.c lib/cygwin.h
405 - am__dirstamp = $(am__leading_dot)dirstamp
406 - @LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR_TRUE@am__objects_1 = lib/unistr/u8-mbtoucr.$(OBJEXT)
407 - @LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB_TRUE@am__objects_2 = lib/unistr/u8-uctomb.$(OBJEXT) \
408 -@@ -819,7 +820,8 @@
409 - lib/xstrtol.$(OBJEXT) lib/xstrtoul.$(OBJEXT) \
410 - lib/xstrtol-error.$(OBJEXT) lib/xstrtold.$(OBJEXT) \
411 - lib/xstrtoumax.$(OBJEXT) lib/xvasprintf.$(OBJEXT) \
412 -- lib/xasprintf.$(OBJEXT) lib/yesno.$(OBJEXT)
413 -+ lib/xasprintf.$(OBJEXT) lib/yesno.$(OBJEXT) \
414 -+ lib/cygwin.$(OBJEXT)
415 - lib_libcoreutils_a_OBJECTS = $(am_lib_libcoreutils_a_OBJECTS)
416 - src_libsinglebin___a_AR = $(AR) $(ARFLAGS)
417 - src_libsinglebin___a_LIBADD =
418 -@@ -4289,6 +4291,8 @@
419 - # mv $@-t $@
420 - #EXTRA_DIST += script.in
421 - #MOSTLYCLEANFILES += script script-t
422 -+
423 -+# Hook in cygwin helper
424 - lib_libcoreutils_a_SOURCES = lib/copy-acl.c lib/set-acl.c \
425 - lib/acl-errno-valid.c lib/acl-internal.c lib/get-permissions.c \
426 - lib/set-permissions.c lib/allocator.c lib/areadlink.c \
427 -@@ -4367,7 +4371,8 @@
428 - lib/xstrndup.h lib/xstrndup.c lib/xstrtod.c lib/xstrtoimax.c \
429 - lib/xstrtol.c lib/xstrtoul.c lib/xstrtol-error.c \
430 - lib/xstrtold.c lib/xstrtoumax.c lib/xvasprintf.h \
431 -- lib/xvasprintf.c lib/xasprintf.c lib/yesno.c
432 -+ lib/xvasprintf.c lib/xasprintf.c lib/yesno.c \
433 -+ lib/cygwin.c lib/cygwin.h
434 - lib_libcoreutils_a_LIBADD = $(gl_LIBOBJS) @ALLOCA@
435 - lib_libcoreutils_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@
436 - EXTRA_lib_libcoreutils_a_SOURCES = lib/acl_entries.c lib/alloca.c \
437 -@@ -6468,6 +6473,8 @@
438 - lib/xasprintf.$(OBJEXT): lib/$(am__dirstamp) \
439 - lib/$(DEPDIR)/$(am__dirstamp)
440 - lib/yesno.$(OBJEXT): lib/$(am__dirstamp) lib/$(DEPDIR)/$(am__dirstamp)
441 -+lib/cygwin.$(OBJEXT): lib/$(am__dirstamp) \
442 -+ lib/$(DEPDIR)/$(am__dirstamp)
443 - lib/acl_entries.$(OBJEXT): lib/$(am__dirstamp) \
444 - lib/$(DEPDIR)/$(am__dirstamp)
445 - lib/alloca.$(OBJEXT): lib/$(am__dirstamp) \
446 -@@ -8473,6 +8480,7 @@
447 - @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/copy-acl.Po@am__quote@
448 - @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/creat-safer.Po@am__quote@
449 - @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/cycle-check.Po@am__quote@
450 -+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/cygwin.Po@am__quote@
451 - @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/di-set.Po@am__quote@
452 - @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/diacrit.Po@am__quote@
453 - @AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/dirchownmod.Po@am__quote@
454 ---- coreutils-8.28_prep/src/chcon.c 2017-09-01 13:11:03.000000000 +0600
455 -+++ coreutils-8.28_prep/src/chcon.c 2017-11-20 10:58:06.648439500 +0600
456 -@@ -48,7 +48,7 @@
457 -
458 - /* Pointer to the device and inode numbers of '/', when --recursive.
459 - Otherwise NULL. */
460 --static struct dev_ino *root_dev_ino;
461 -+static struct root_dev_ino *root_dev_ino;
462 -
463 - /* The name of the context file is being given. */
464 - static char const *specified_context;
465 -@@ -570,7 +570,7 @@
466 -
467 - if (recurse && preserve_root)
468 - {
469 -- static struct dev_ino dev_ino_buf;
470 -+ static struct root_dev_ino dev_ino_buf;
471 - root_dev_ino = get_root_dev_ino (&dev_ino_buf);
472 - if (root_dev_ino == NULL)
473 - die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
474 ---- coreutils-8.28_prep/src/chgrp.c 2017-09-01 13:11:03.000000000 +0600
475 -+++ coreutils-8.28_prep/src/chgrp.c 2017-11-20 10:58:06.648439500 +0600
476 -@@ -301,7 +301,7 @@
477 -
478 - if (chopt.recurse && preserve_root)
479 - {
480 -- static struct dev_ino dev_ino_buf;
481 -+ static struct root_dev_ino dev_ino_buf;
482 - chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
483 - if (chopt.root_dev_ino == NULL)
484 - die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
485 ---- coreutils-8.28_prep/src/chmod.c 2017-09-01 13:11:03.000000000 +0600
486 -+++ coreutils-8.28_prep/src/chmod.c 2017-11-20 10:58:06.648439500 +0600
487 -@@ -81,7 +81,7 @@
488 -
489 - /* Pointer to the device and inode numbers of '/', when --recursive.
490 - Otherwise NULL. */
491 --static struct dev_ino *root_dev_ino;
492 -+static struct root_dev_ino *root_dev_ino;
493 -
494 - /* For long options that have no equivalent short option, use a
495 - non-character as a pseudo short option, starting with CHAR_MAX + 1. */
496 -@@ -552,7 +552,7 @@
497 -
498 - if (recurse && preserve_root)
499 - {
500 -- static struct dev_ino dev_ino_buf;
501 -+ static struct root_dev_ino dev_ino_buf;
502 - root_dev_ino = get_root_dev_ino (&dev_ino_buf);
503 - if (root_dev_ino == NULL)
504 - die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
505 ---- coreutils-8.28_prep/src/chown.c 2017-09-01 13:11:03.000000000 +0600
506 -+++ coreutils-8.28_prep/src/chown.c 2017-11-20 10:58:06.648439500 +0600
507 -@@ -313,7 +313,7 @@
508 -
509 - if (chopt.recurse && preserve_root)
510 - {
511 -- static struct dev_ino dev_ino_buf;
512 -+ static struct root_dev_ino dev_ino_buf;
513 - chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
514 - if (chopt.root_dev_ino == NULL)
515 - die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
516 ---- coreutils-8.28_prep/src/chown-core.h 2017-09-01 13:11:03.000000000 +0600
517 -+++ coreutils-8.28_prep/src/chown-core.h 2017-11-20 10:58:06.648439500 +0600
518 -@@ -50,7 +50,7 @@
519 -
520 - /* Pointer to the device and inode numbers of '/', when --recursive.
521 - Need not be freed. Otherwise NULL. */
522 -- struct dev_ino *root_dev_ino;
523 -+ struct root_dev_ino *root_dev_ino;
524 -
525 - /* This corresponds to the --dereference (opposite of -h) option. */
526 - bool affect_symlink_referent;
527 ---- coreutils-8.28_prep/src/chroot.c 2017-09-01 13:11:03.000000000 +0600
528 -+++ coreutils-8.28_prep/src/chroot.c 2017-11-20 10:58:06.648439500 +0600
529 -@@ -171,7 +171,8 @@
530 - is_root (const char* dir)
531 - {
532 - char *resolved = canonicalize_file_name (dir);
533 -- bool is_res_root = resolved && STREQ ("/", resolved);
534 -+ bool is_res_root = resolved && (STREQ ("/", resolved)
535 -+ || STREQ ("//", resolved));
536 - free (resolved);
537 - return is_res_root;
538 - }
539 ---- coreutils-8.28_prep/src/cksum.c 2017-09-01 13:11:03.000000000 +0600
540 -+++ coreutils-8.28_prep/src/cksum.c 2017-11-20 17:26:50.616443600 +0600
541 -@@ -296,6 +296,9 @@
542 -
543 - have_read_stdin = false;
544 -
545 -+ if (O_BINARY)
546 -+ xset_binary_mode (STDIN_FILENO, O_BINARY);
547 -+
548 - if (optind == argc)
549 - ok = cksum ("-", false);
550 - else
551 ---- coreutils-8.28_prep/src/copy.c 2017-09-01 13:11:03.000000000 +0600
552 -+++ coreutils-8.28_prep/src/copy.c 2017-11-20 10:58:06.668078700 +0600
553 -@@ -85,6 +85,10 @@
554 - # define FICLONE _IOW (0x94, 9, int)
555 - #endif
556 -
557 -+#if __CYGWIN__
558 -+# include "cygwin.h"
559 -+#endif
560 -+
561 - #ifndef HAVE_FCHOWN
562 - # define HAVE_FCHOWN false
563 - # define fchown(fd, uid, gid) (-1)
564 -@@ -1423,7 +1427,11 @@
565 - static bool
566 - same_file_ok (char const *src_name, struct stat const *src_sb,
567 - char const *dst_name, struct stat const *dst_sb,
568 -- const struct cp_options *x, bool *return_now)
569 -+ const struct cp_options *x, bool *return_now
570 -+#if __CYGWIN__
571 -+ , bool *case_change
572 -+#endif
573 -+ )
574 - {
575 - const struct stat *src_sb_link;
576 - const struct stat *dst_sb_link;
577 -@@ -1567,6 +1575,18 @@
578 - if (S_ISLNK (dst_sb_link->st_mode))
579 - return true;
580 -
581 -+#if __CYGWIN__
582 -+ /* If the files have the same name, but differ in case, then let
583 -+ rename() change the case. */
584 -+ if (same_link && x->move_mode && same_name (src_name, dst_name)
585 -+ && memcmp (last_component (src_name), last_component (dst_name),
586 -+ base_len (src_name)))
587 -+ {
588 -+ *case_change = true;
589 -+ return true;
590 -+ }
591 -+#endif /* __CYGWIN__ */
592 -+
593 - /* It's not ok if they're distinct hard links to the same file as
594 - this causes a race condition and we may lose data in this case. */
595 - if (same_link
596 -@@ -1922,10 +1942,20 @@
597 - && ! (x->move_mode || x->symbolic_link || x->hard_link
598 - || x->backup_type != no_backups
599 - || x->unlink_dest_before_opening));
600 -- if ((use_stat
601 -- ? stat (dst_name, &dst_sb)
602 -- : lstat (dst_name, &dst_sb))
603 -- != 0)
604 -+ int res = (use_stat
605 -+ ? stat (dst_name, &dst_sb)
606 -+ : lstat (dst_name, &dst_sb));
607 -+#if __CYGWIN__
608 -+ /* stat("a") succeeds even if it was really "a.exe". */
609 -+ if (! res && cygwin_spelling (dst_name) != 0)
610 -+ {
611 -+ /* Only DST_NAME.exe exists, but we want the non-existant
612 -+ DST_NAME. */
613 -+ res = -1;
614 -+ errno = ENOENT;
615 -+ }
616 -+#endif /* __CYGWIN__ */
617 -+ if (res != 0)
618 - {
619 - if (errno != ENOENT)
620 - {
621 -@@ -1941,10 +1971,17 @@
622 - { /* Here, we know that dst_name exists, at least to the point
623 - that it is stat'able or lstat'able. */
624 - bool return_now;
625 -+#if __CYGWIN__
626 -+ bool case_change = false;
627 -+#endif /* __CYGWIN__ */
628 -
629 - have_dst_lstat = !use_stat;
630 - if (! same_file_ok (src_name, &src_sb, dst_name, &dst_sb,
631 -- x, &return_now))
632 -+ x, &return_now
633 -+#if __CYGWIN__
634 -+ , &case_change
635 -+#endif /* __CYGWIN__ */
636 -+ ))
637 - {
638 - error (0, 0, _("%s and %s are the same file"),
639 - quoteaf_n (0, src_name), quoteaf_n (1, dst_name));
640 -@@ -2003,6 +2040,9 @@
641 - cp and mv treat -i and -f differently. */
642 - if (x->move_mode)
643 - {
644 -+#if __CYGWIN__
645 -+ if (!case_change)
646 -+#endif /* __CYGWIN__ */
647 - if (abandon_move (x, dst_name, &dst_sb))
648 - {
649 - /* Pretend the rename succeeded, so the caller (mv)
650 -@@ -2144,7 +2184,11 @@
651 - /* Never unlink dst_name when in move mode. */
652 - && ! x->move_mode
653 - && (x->unlink_dest_before_opening
654 -- || (x->preserve_links && 1 < dst_sb.st_nlink)
655 -+ || (x->preserve_links && 1 < dst_sb.st_nlink
656 -+#if __CYGWIN__
657 -+ && !case_change
658 -+#endif /* __CYGWIN__ */
659 -+ )
660 - || (x->dereference == DEREF_NEVER
661 - && ! S_ISREG (src_sb.st_mode))
662 - ))
663 -@@ -2936,6 +2980,21 @@
664 - {
665 - assert (valid_options (options));
666 -
667 -+#if __CYGWIN__
668 -+ /* .exe magic - if src exists with an implicit .exe suffix and is
669 -+ not a symlink, but dst does not exist and was also specified
670 -+ without a suffix, then append .exe to dst. */
671 -+ int cygwin = cygwin_spelling (src_name);
672 -+ char *p;
673 -+ if (cygwin == 2
674 -+ && ((p = strchr (dst_name, '\0') - 4) <= dst_name
675 -+ || strcasecmp (p, ".exe") != 0))
676 -+ {
677 -+ cygwin = 3;
678 -+ CYGWIN_APPEND_EXE (p, dst_name);
679 -+ }
680 -+#endif /* __CYGWIN__ */
681 -+
682 - /* Record the file names: they're used in case of error, when copying
683 - a directory into itself. I don't like to make these tools do *any*
684 - extra work in the common case when that work is solely to handle
685 -@@ -2947,10 +3006,15 @@
686 - top_level_dst_name = dst_name;
687 -
688 - bool first_dir_created_per_command_line_arg = false;
689 -- return copy_internal (src_name, dst_name, nonexistent_dst, NULL, NULL,
690 -+ bool result = copy_internal (src_name, dst_name, nonexistent_dst, NULL, NULL,
691 - options, true,
692 - &first_dir_created_per_command_line_arg,
693 - copy_into_self, rename_succeeded);
694 -+#if __CYGWIN__
695 -+ if (cygwin == 3)
696 -+ freea ((char *) dst_name);
697 -+#endif /* __CYGWIN__ */
698 -+ return result;
699 - }
700 -
701 - /* Set *X to the default options for a value of type struct cp_options. */
702 ---- coreutils-8.28_prep/src/dd.c 2017-09-01 13:11:03.000000000 +0600
703 -+++ coreutils-8.28_prep/src/dd.c 2017-11-20 10:58:06.670586400 +0600
704 -@@ -37,6 +37,10 @@
705 - #include "xstrtol.h"
706 - #include "xtime.h"
707 -
708 -+#if __CYGWIN__
709 -+# include <io.h>
710 -+#endif
711 -+
712 - /* The official name of this program (e.g., no 'g' prefix). */
713 - #define PROGRAM_NAME "dd"
714 -
715 -@@ -1991,6 +1995,13 @@
716 - static void
717 - set_fd_flags (int fd, int add_flags, char const *name)
718 - {
719 -+#if __CYGWIN__
720 -+ /* Cygwin does not allow fcntl to set the mode. */
721 -+ int mode_flags = add_flags & (O_BINARY | O_TEXT);
722 -+ add_flags &= ~(O_BINARY | O_TEXT);
723 -+ if (mode_flags && setmode (fd, mode_flags) == -1)
724 -+ error (EXIT_FAILURE, errno, _("setting flags for %s"), quote (name));
725 -+#endif /* __CYGWIN__ */
726 - /* Ignore file creation flags that are no-ops on file descriptors. */
727 - add_flags &= ~ (O_NOCTTY | O_NOFOLLOW);
728 -
729 -@@ -2380,6 +2391,8 @@
730 - }
731 - else
732 - {
733 -+ if ((input_flags & (O_BINARY | O_TEXT)) == 0)
734 -+ input_flags |= O_BINARY;
735 - if (ifd_reopen (STDIN_FILENO, input_file, O_RDONLY | input_flags, 0) < 0)
736 - die (EXIT_FAILURE, errno, _("failed to open %s"),
737 - quoteaf (input_file));
738 -@@ -2403,6 +2416,8 @@
739 - | (conversions_mask & C_NOCREAT ? 0 : O_CREAT)
740 - | (conversions_mask & C_EXCL ? O_EXCL : 0)
741 - | (seek_records || (conversions_mask & C_NOTRUNC) ? 0 : O_TRUNC));
742 -+ if ((opts & (O_BINARY | O_TEXT)) == 0)
743 -+ opts |= O_BINARY;
744 -
745 - /* Open the output file with *read* access only if we might
746 - need to read to satisfy a 'seek=' request. If we can't read
747 ---- coreutils-8.28_prep/src/dircolors.c 2017-09-01 13:11:03.000000000 +0600
748 -+++ coreutils-8.28_prep/src/dircolors.c 2017-11-20 10:58:06.670586400 +0600
749 -@@ -496,8 +496,12 @@
750 - }
751 - else
752 - {
753 -+ /* tcsh treats LS_COLORS as a magic shell variable for its
754 -+ builtin ls-F, but does not recognize all the categories
755 -+ that coreutils ls does. Therefore, silence stderr to
756 -+ avoid messages like "Unknown colorls variable `su'.". */
757 - prefix = "setenv LS_COLORS '";
758 -- suffix = "'\n";
759 -+ suffix = "' >&/dev/null\n";
760 - }
761 - fputs (prefix, stdout);
762 - fwrite (s, 1, len, stdout);
763 ---- coreutils-8.28_prep/src/install.c 2017-09-01 13:11:03.000000000 +0600
764 -+++ coreutils-8.28_prep/src/install.c 2017-11-20 10:58:06.670586400 +0600
765 -@@ -45,6 +45,10 @@
766 - #include "utimens.h"
767 - #include "xstrtol.h"
768 -
769 -+#if __CYGWIN__
770 -+# include "cygwin.h"
771 -+#endif
772 -+
773 - /* The official name of this program (e.g., no 'g' prefix). */
774 - #define PROGRAM_NAME "install"
775 -
776 -@@ -556,6 +560,16 @@
777 - error (0, errno, _("fork system call failed"));
778 - break;
779 - case 0: /* Child. */
780 -+#if __CYGWIN__
781 -+ {
782 -+ /* Check for .exe here, since strip doesn't. */
783 -+ char *p;
784 -+ if (((p = strchr (name, '\0') - 4) <= name
785 -+ || strcasecmp (p, ".exe") != 0)
786 -+ && 0 < cygwin_spelling (name))
787 -+ CYGWIN_APPEND_EXE (p, name);
788 -+ }
789 -+#endif /* __CYGWIN__ */
790 - execlp (strip_program, strip_program, name, NULL);
791 - die (EXIT_FAILURE, errno, _("cannot run %s"), quoteaf (strip_program));
792 - default: /* Parent. */
793 ---- coreutils-8.28_prep/src/ls.c 2017-09-01 13:11:03.000000000 +0600
794 -+++ coreutils-8.28_prep/src/ls.c 2017-11-20 10:58:06.670586400 +0600
795 -@@ -121,6 +121,10 @@
796 - # include <sys/capability.h>
797 - #endif
798 -
799 -+#if __CYGWIN__
800 -+# include "cygwin.h"
801 -+#endif
802 -+
803 - #define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \
804 - : (ls_mode == LS_MULTI_COL \
805 - ? "dir" : "vdir"))
806 -@@ -782,6 +786,11 @@
807 - N_("%b %e %H:%M")
808 - };
809 -
810 -+#if __CYGWIN__
811 -+/* Whether .exe should be appended to command-line args as needed. */
812 -+static bool append_exe;
813 -+#endif /* __CYGWIN__ */
814 -+
815 - /* The set of signals that are caught. */
816 -
817 - static sigset_t caught_signals;
818 -@@ -817,6 +826,9 @@
819 - enum
820 - {
821 - AUTHOR_OPTION = CHAR_MAX + 1,
822 -+#if __CYGWIN__
823 -+ APPEND_EXE_OPTION,
824 -+#endif /* __CYGWIN__ */
825 - BLOCK_SIZE_OPTION,
826 - COLOR_OPTION,
827 - DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION,
828 -@@ -880,6 +892,9 @@
829 - {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
830 - {"context", no_argument, 0, 'Z'},
831 - {"author", no_argument, NULL, AUTHOR_OPTION},
832 -+#if __CYGWIN__
833 -+ {"append-exe", no_argument, NULL, APPEND_EXE_OPTION},
834 -+#endif /* __CYGWIN__ */
835 - {GETOPT_HELP_OPTION_DECL},
836 - {GETOPT_VERSION_OPTION_DECL},
837 - {NULL, 0, NULL, 0}
838 -@@ -2096,6 +2111,12 @@
839 - print_scontext = true;
840 - break;
841 -
842 -+#if __CYGWIN__
843 -+ case APPEND_EXE_OPTION:
844 -+ append_exe = true;
845 -+ break;
846 -+#endif /* __CYGWIN__ */
847 -+
848 - case_GETOPT_HELP_CHAR;
849 -
850 - case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
851 -@@ -3107,6 +3128,12 @@
852 - uintmax_t blocks = 0;
853 - struct fileinfo *f;
854 -
855 -+#if __CYGWIN__
856 -+ char *name_alt = NULL;
857 -+ if (command_line_arg && append_exe && 0 < cygwin_spelling (name))
858 -+ CYGWIN_APPEND_EXE (name_alt, name);
859 -+#endif /* __CYGWIN__ */
860 -+
861 - /* An inode value prior to gobble_file necessarily came from readdir,
862 - which is not used for command line arguments. */
863 - assert (! command_line_arg || inode == NOT_AN_INODE_NUMBER);
864 -@@ -3237,11 +3264,19 @@
865 - file_failure (command_line_arg,
866 - _("cannot access %s"), full_name);
867 - if (command_line_arg)
868 -- return 0;
869 -+ {
870 -+#if __CYGWIN__
871 -+ freea (name_alt);
872 -+#endif /* __CYGWIN__ */
873 -+ return 0;
874 -+ }
875 -
876 - f->name = xstrdup (name);
877 - cwd_n_used++;
878 -
879 -+#if __CYGWIN__
880 -+ freea (name_alt);
881 -+#endif /* __CYGWIN__ */
882 - return 0;
883 - }
884 -
885 -@@ -3430,6 +3465,9 @@
886 - f->name = xstrdup (name);
887 - cwd_n_used++;
888 -
889 -+#if __CYGWIN__
890 -+ freea (name_alt);
891 -+#endif /* __CYGWIN__ */
892 - return blocks;
893 - }
894 -
895 -@@ -5277,6 +5315,11 @@
896 - -1 list one file per line. Avoid '\\n' with -q or -b\
897 - \n\
898 - "), stdout);
899 -+#if __CYGWIN__
900 -+ fputs (_("\
901 -+ --append-exe append .exe if cygwin magic was needed\n\
902 -+"), stdout);
903 -+#endif /* __CYGWIN__ */
904 - fputs (HELP_OPTION_DESCRIPTION, stdout);
905 - fputs (VERSION_OPTION_DESCRIPTION, stdout);
906 - emit_size_note ();
907 ---- coreutils-8.28_prep/src/md5sum.c 2017-09-01 13:11:03.000000000 +0600
908 -+++ coreutils-8.28_prep/src/md5sum.c 2017-11-20 17:27:01.925674000 +0600
909 -@@ -1019,6 +1019,8 @@
910 - char **operand_lim = argv + argc;
911 - if (optind == argc)
912 - *operand_lim++ = bad_cast ("-");
913 -+ if (O_BINARY)
914 -+ xset_binary_mode (STDIN_FILENO, O_BINARY);
915 -
916 - for (char **operandp = argv + optind; operandp < operand_lim; operandp++)
917 - {
918 ---- coreutils-8.28_prep/src/mv.c 2017-09-01 13:11:03.000000000 +0600
919 -+++ coreutils-8.28_prep/src/mv.c 2017-11-20 10:58:06.670586400 +0600
920 -@@ -92,7 +92,7 @@
921 - x->require_restore_cwd = true;
922 -
923 - {
924 -- static struct dev_ino dev_ino_buf;
925 -+ static struct root_dev_ino dev_ino_buf;
926 - x->root_dev_ino = get_root_dev_ino (&dev_ino_buf);
927 - if (x->root_dev_ino == NULL)
928 - die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
929 -@@ -452,6 +452,16 @@
930 - else if (!target_directory)
931 - {
932 - assert (2 <= n_files);
933 -+#if __CYGWIN__
934 -+ struct stat s1, s2;
935 -+ if (2 == n_files
936 -+ && lstat (file[0], &s1) == 0 && lstat (file[1], &s2) == 0
937 -+ && s1.st_ino == s2.st_ino)
938 -+ {
939 -+ /* Allow 'mv foo Foo' to change case of the directory foo. */
940 -+ }
941 -+ else
942 -+#endif /* __CYGWIN__ */
943 - if (target_directory_operand (file[n_files - 1]))
944 - target_directory = file[--n_files];
945 - else if (2 < n_files)
946 ---- coreutils-8.28_prep/src/pwd.c 2017-09-01 13:11:03.000000000 +0600
947 -+++ coreutils-8.28_prep/src/pwd.c 2017-11-20 10:58:06.686330400 +0600
948 -@@ -268,8 +268,8 @@
949 - robust_getcwd (struct file_name *file_name)
950 - {
951 - size_t height = 1;
952 -- struct dev_ino dev_ino_buf;
953 -- struct dev_ino *root_dev_ino = get_root_dev_ino (&dev_ino_buf);
954 -+ struct root_dev_ino dev_ino_buf;
955 -+ struct root_dev_ino *root_dev_ino = get_root_dev_ino (&dev_ino_buf);
956 - struct stat dot_sb;
957 -
958 - if (root_dev_ino == NULL)
959 -@@ -282,7 +282,7 @@
960 - while (1)
961 - {
962 - /* If we've reached the root, we're done. */
963 -- if (SAME_INODE (dot_sb, *root_dev_ino))
964 -+ if (ROOT_DEV_INO_CHECK (root_dev_ino, &dot_sb))
965 - break;
966 -
967 - find_dir_entry (&dot_sb, file_name, height++);
968 -@@ -291,6 +291,9 @@
969 - /* See if a leading slash is needed; file_name_prepend adds one. */
970 - if (file_name->start[0] == '\0')
971 - file_name_prepend (file_name, "", 0);
972 -+ /* If we aren't in `/', we must be in `//'. */
973 -+ if (! SAME_INODE (root_dev_ino->single_slash, dot_sb))
974 -+ file_name_prepend (file_name, "", 0);
975 - }
976 -
977 -
978 ---- coreutils-8.28_prep/src/remove.h 2017-09-01 13:11:03.000000000 +0600
979 -+++ coreutils-8.28_prep/src/remove.h 2017-11-20 10:58:06.686330400 +0600
980 -@@ -54,7 +54,7 @@
981 -
982 - /* Pointer to the device and inode numbers of '/', when --recursive
983 - and preserving '/'. Otherwise NULL. */
984 -- struct dev_ino *root_dev_ino;
985 -+ struct root_dev_ino *root_dev_ino;
986 -
987 - /* If nonzero, stdin is a tty. */
988 - bool stdin_tty;
989 ---- coreutils-8.28_prep/src/rm.c 2017-09-01 13:11:03.000000000 +0600
990 -+++ coreutils-8.28_prep/src/rm.c 2017-11-20 10:58:06.686330400 +0600
991 -@@ -326,7 +326,7 @@
992 -
993 - if (x.recursive && preserve_root)
994 - {
995 -- static struct dev_ino dev_ino_buf;
996 -+ static struct root_dev_ino dev_ino_buf;
997 - x.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
998 - if (x.root_dev_ino == NULL)
999 - die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
1000 ---- coreutils-8.28_prep/src/stat.c 2017-09-01 13:11:03.000000000 +0600
1001 -+++ coreutils-8.28_prep/src/stat.c 2017-11-20 10:58:06.686330400 +0600
1002 -@@ -74,6 +74,13 @@
1003 - #include "find-mount-point.h"
1004 - #include "xvasprintf.h"
1005 -
1006 -+#if __CYGWIN__
1007 -+# include "cygwin.h"
1008 -+/* Whether .exe should be appended to command-line args as needed. */
1009 -+static bool append_exe;
1010 -+# define APPEND_EXE_OPTION 10000
1011 -+#endif
1012 -+
1013 - #if USE_STATVFS
1014 - # define STRUCT_STATXFS_F_FSID_IS_INTEGER STRUCT_STATVFS_F_FSID_IS_INTEGER
1015 - # define HAVE_STRUCT_STATXFS_F_TYPE HAVE_STRUCT_STATVFS_F_TYPE
1016 -@@ -194,6 +201,9 @@
1017 - {"format", required_argument, NULL, 'c'},
1018 - {"printf", required_argument, NULL, PRINTF_OPTION},
1019 - {"terse", no_argument, NULL, 't'},
1020 -+#if __CYGWIN__
1021 -+ {"append-exe", no_argument, NULL, APPEND_EXE_OPTION},
1022 -+#endif /* __CYGWIN__ */
1023 - {GETOPT_HELP_OPTION_DECL},
1024 - {GETOPT_VERSION_OPTION_DECL},
1025 - {NULL, 0, NULL, 0}
1026 -@@ -1345,14 +1355,26 @@
1027 - return false;
1028 - }
1029 -
1030 -+#if __CYGWIN__
1031 -+ char *name_alt = NULL;
1032 -+ if (append_exe && 0 < cygwin_spelling (filename))
1033 -+ CYGWIN_APPEND_EXE (name_alt, filename);
1034 -+#endif /* __CYGWIN__ */
1035 -+
1036 - if (STATFS (filename, &statfsbuf) != 0)
1037 - {
1038 - error (0, errno, _("cannot read file system information for %s"),
1039 - quoteaf (filename));
1040 -+#if __CYGWIN__
1041 -+ freea (name_alt);
1042 -+#endif /* __CYGWIN__ */
1043 - return false;
1044 - }
1045 -
1046 - bool fail = print_it (format, -1, filename, print_statfs, &statfsbuf);
1047 -+#if __CYGWIN__
1048 -+ freea (name_alt);
1049 -+#endif /* __CYGWIN__ */
1050 - return ! fail;
1051 - }
1052 -
1053 -@@ -1363,6 +1385,7 @@
1054 - {
1055 - int fd = STREQ (filename, "-") ? 0 : -1;
1056 - struct stat statbuf;
1057 -+ char *name_alt = NULL;
1058 -
1059 - if (0 <= fd)
1060 - {
1061 -@@ -1375,18 +1398,28 @@
1062 - /* We can't use the shorter
1063 - (follow_links?stat:lstat) (filename, &statbug)
1064 - since stat might be a function-like macro. */
1065 -- else if ((follow_links
1066 -- ? stat (filename, &statbuf)
1067 -- : lstat (filename, &statbuf)) != 0)
1068 -+ else
1069 - {
1070 -- error (0, errno, _("cannot stat %s"), quoteaf (filename));
1071 -- return false;
1072 -+ if ((follow_links
1073 -+ ? stat (filename, &statbuf)
1074 -+ : lstat (filename, &statbuf)) != 0)
1075 -+ {
1076 -+ error (0, errno, _("cannot stat %s"), quoteaf (filename));
1077 -+ return false;
1078 -+ }
1079 -+#if __CYGWIN__
1080 -+ if (append_exe && 0 < cygwin_spelling (filename))
1081 -+ CYGWIN_APPEND_EXE (name_alt, filename);
1082 -+#endif /* __CYGWIN__ */
1083 - }
1084 -
1085 - if (S_ISBLK (statbuf.st_mode) || S_ISCHR (statbuf.st_mode))
1086 - format = format2;
1087 -
1088 - bool fail = print_it (format, fd, filename, print_stat, &statbuf);
1089 -+#if __CYGWIN__
1090 -+ freea (name_alt);
1091 -+#endif /* __CYGWIN__ */
1092 - return ! fail;
1093 - }
1094 -
1095 -@@ -1508,6 +1541,11 @@
1096 - if you want a newline, include \\n in FORMAT\n\
1097 - -t, --terse print the information in terse form\n\
1098 - "), stdout);
1099 -+#if __CYGWIN__
1100 -+ fputs (_("\
1101 -+ --append-exe append .exe if cygwin magic was needed\n\
1102 -+"), stdout);
1103 -+#endif /* __CYGWIN__ */
1104 - fputs (HELP_OPTION_DESCRIPTION, stdout);
1105 - fputs (VERSION_OPTION_DESCRIPTION, stdout);
1106 -
1107 -@@ -1627,6 +1665,12 @@
1108 - terse = true;
1109 - break;
1110 -
1111 -+#if __CYGWIN__
1112 -+ case APPEND_EXE_OPTION:
1113 -+ append_exe = true;
1114 -+ break;
1115 -+#endif /* __CYGWIN__ */
1116 -+
1117 - case_GETOPT_HELP_CHAR;
1118 -
1119 - case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
1120
1121 diff --git a/sys-apps/coreutils/files/coreutils-8.32-mint.patch b/sys-apps/coreutils/files/coreutils-8.32-mint.patch
1122 deleted file mode 100644
1123 index f02aeb2c9a..0000000000
1124 --- a/sys-apps/coreutils/files/coreutils-8.32-mint.patch
1125 +++ /dev/null
1126 @@ -1,155 +0,0 @@
1127 -http://bugs.gentoo.org/show_bug.cgi?id=260551
1128 -http://bugs.gentoo.org/show_bug.cgi?id=264763
1129 -http://bugs.gentoo.org/show_bug.cgi?id=497772
1130 -https://savannah.gnu.org/patch/index.php?6758
1131 -
1132 -diff -u lib/mountlist.c lib/mountlist.c
1133 ---- a/lib/mountlist.c 2009-02-07 09:58:37.000000000 +0000
1134 -+++ b/lib/mountlist.c 2009-04-08 04:04:19.000000000 +0000
1135 -@@ -387,6 +387,7 @@
1136 - If NEED_FS_TYPE is true, ensure that the file system type fields in
1137 - the returned list are valid. Otherwise, they might not be. */
1138 -
1139 -+#ifndef __MINT__
1140 - struct mount_entry *
1141 - read_file_system_list (bool need_fs_type)
1142 - {
1143 -@@ -970,6 +971,84 @@
1144 - return NULL;
1145 - }
1146 - }
1147 -+#else /* __MINT__ */
1148 -+
1149 -+#include <mintbind.h>
1150 -+#include <osbind.h>
1151 -+#include <sys/statfs.h>
1152 -+#include <mint/dcntl.h>
1153 -+
1154 -+/* get the list of available drives */
1155 -+static long
1156 -+get_drives(void)
1157 -+{
1158 -+ long drive_bits;
1159 -+
1160 -+ drive_bits = Dsetdrv(Dgetdrv());
1161 -+ drive_bits &= ~(1|2); /* exclude all floppies */
1162 -+
1163 -+ return drive_bits;
1164 -+}
1165 -+
1166 -+struct mount_entry *
1167 -+read_file_system_list (bool need_fs_type)
1168 -+{
1169 -+ struct mount_entry *mount_list;
1170 -+ struct mount_entry *me;
1171 -+ struct mount_entry *mtail;
1172 -+ struct statfs fsp;
1173 -+ struct fs_info info;
1174 -+ long drive_bits;
1175 -+ int i, j;
1176 -+ char lw[] = "a:/", str[25];
1177 -+
1178 -+ /* Start the list off with a dummy entry. */
1179 -+ me = xmalloc (sizeof (*me));
1180 -+ me->me_next = NULL;
1181 -+ mount_list = mtail = me;
1182 -+
1183 -+ drive_bits = get_drives();
1184 -+ for (i = 0; i < 32; i++)
1185 -+ {
1186 -+ if (drive_bits & (1L << i))
1187 -+ {
1188 -+ if (i < 26)
1189 -+ lw[0] = 'a' + i;
1190 -+ else
1191 -+ lw[0] = '1' + i - 26;
1192 -+
1193 -+ if(statfs(lw, &fsp) == 0)
1194 -+ {
1195 -+ char name[32];
1196 -+
1197 -+ me = xmalloc (sizeof (*me));
1198 -+
1199 -+ me->me_devname = xstrdup(lw);
1200 -+ me->me_mountdir = xstrdup("u:/");
1201 -+
1202 -+ if (lw[0] < 'a') /* 1: .. 6: */
1203 -+ me->me_dev = lw[0] - '1' + 27;
1204 -+ else
1205 -+ me->me_dev = lw[0] - 'a';
1206 -+
1207 -+ get_fsname(lw, NULL, name);
1208 -+ me->me_type = xstrdup(name);
1209 -+ /* Add to the linked list. */
1210 -+ me->me_next = NULL;
1211 -+ mtail->me_next = me;
1212 -+ mtail = me;
1213 -+ }
1214 -+ }
1215 -+ }
1216 -+
1217 -+ /* Free the dummy head. */
1218 -+ me = mount_list;
1219 -+ mount_list = mount_list->me_next;
1220 -+ free(me);
1221 -+ return mount_list;
1222 -+}
1223 -+
1224 -+#endif /* __MINT__ */
1225 -
1226 - /* Free a mount entry as returned from read_file_system_list (). */
1227 -
1228 -diff -u src/df.c src/df.c
1229 ---- a/src/df.c 2009-02-14 10:18:27.000000000 +0000
1230 -+++ b/src/df.c 2009-04-08 04:04:19.000000000 +0000
1231 -@@ -337,7 +337,12 @@
1232 - It would be better to report on the unmounted file system,
1233 - but statfs doesn't do that on most systems. */
1234 - if (!stat_file)
1235 -+#ifndef __MINT__
1236 - stat_file = mount_point ? mount_point : disk;
1237 -+#else
1238 -+ /* MiNT: mount_point is always u:/, so use disk */
1239 -+ stat_file = disk;
1240 -+#endif
1241 -
1242 - if (force_fsu)
1243 - fsu = *force_fsu;
1244 -diff -u Makefile.in Makefile.in
1245 ---- a/Makefile.in 2014-01-07 10:01:01.000000000 +0000
1246 -+++ b/Makefile.in 2014-01-07 10:36:50.000000000 +0000
1247 -@@ -3310,7 +3310,7 @@
1248 - # must precede $(LIBINTL) in order to ensure we use GNU getopt.
1249 - # But libcoreutils.a must also follow $(LIBINTL), since libintl uses
1250 - # replacement functions defined in libcoreutils.a.
1251 --LDADD = src/libver.a lib/libcoreutils.a $(LIBINTL) lib/libcoreutils.a
1252 -+LDADD = src/libver.a lib/libcoreutils.a $(LIBINTL) lib/libcoreutils.a $(LIB_PTHREAD)
1253 -
1254 - # First, list all programs, to make listing per-program libraries easier.
1255 - # See [ below.
1256 -diff --git a/src/uptime.c b/src/uptime.c
1257 -index a42e702..638c2d6 100644
1258 ---- a/src/uptime.c
1259 -+++ b/src/uptime.c
1260 -@@ -17,6 +17,9 @@
1261 - /* Created by hacking who.c by Kaveh Ghazi ghazi@××××××××××××.edu. */
1262 -
1263 - #include <config.h>
1264 -+#ifdef __MINT__
1265 -+#define HAVE_PROC_UPTIME 1
1266 -+#endif
1267 - #include <stdio.h>
1268 -
1269 - #include <sys/types.h>
1270 -@@ -62,7 +65,11 @@ print_uptime (size_t n, const STRUCT_UTMP *this)
1271 - #ifdef HAVE_PROC_UPTIME
1272 - FILE *fp;
1273 -
1274 -+#ifdef __MINT__
1275 -+ fp = fopen ("/kern/uptime", "r");
1276 -+#else
1277 - fp = fopen ("/proc/uptime", "r");
1278 -+#endif
1279 - if (fp != NULL)
1280 - {
1281 - char buf[BUFSIZ];