diff options
author | Brian Inglis <Brian.Inglis@Shaw.ca> | 2023-03-21 08:36:45 -0600 |
---|---|---|
committer | Brian Inglis <Brian.Inglis@Shaw.ca> | 2023-03-21 08:36:45 -0600 |
commit | c2e3207e005da40bec862b19f6dd44a7a63f6fae (patch) | |
tree | 769eff765beced2fc9f248adb0e453cf0884398c | |
parent | 9.1 and patch fix (diff) |
9.2playground
-rw-r--r-- | coreutils-9.2-src-copy.c.patch | 158 | ||||
-rw-r--r-- | coreutils.cygport | 25 |
2 files changed, 181 insertions, 2 deletions
diff --git a/coreutils-9.2-src-copy.c.patch b/coreutils-9.2-src-copy.c.patch new file mode 100644 index 0000000..918a9e8 --- /dev/null +++ b/coreutils-9.2-src-copy.c.patch @@ -0,0 +1,158 @@ +--- origsrc/src/copy.c 2023-03-13 12:08:10.000000000 -0600 ++++ src/src/copy.c 2022-05-09 00:11:47.335547900 -0600 +@@ -84,6 +84,10 @@ + #ifdef HAVE_LINUX_FS_H + # include <linux/fs.h> + #endif ++ ++#ifdef __CYGWIN__ ++# include "cygwin.h" ++#endif + + #if !defined FICLONE && defined __linux__ + # define FICLONE _IOW (0x94, 9, int) +@@ -1725,7 +1729,11 @@ close_src_desc: + static bool + same_file_ok (char const *src_name, struct stat const *src_sb, + int dst_dirfd, char const *dst_relname, 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; +@@ -1870,6 +1878,18 @@ same_file_ok (char const *src_name, stru + if (S_ISLNK (dst_sb_link->st_mode)) + return true; + ++#if __CYGWIN__ ++ /* If the files have the same name, but differ in case, then let ++ rename() change the case. */ ++ if (same_link && x->move_mode && same_name (src_name, dst_relname) ++ && memcmp (last_component (src_name), last_component (dst_relname), ++ base_len (src_name))) ++ { ++ *case_change = true; ++ return true; ++ } ++#endif ++ + /* 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 +@@ -2299,13 +2319,23 @@ copy_internal (char const *src_name, cha + if (!use_lstat && nonexistent_dst < 0) + new_dst = true; + else if (follow_fstatat (dst_dirfd, drelname, &dst_sb, fstatat_flags) +- == 0) ++ == 0 ++#if __CYGWIN__ ++ /* stat("a") succeeds if "a.exe" - only identical accepted. */ ++ && cygwin_spelling (drelname) == 0 ++#endif ++ ) + { + have_dst_lstat = use_lstat; + rename_errno = EEXIST; + } + else + { ++#if __CYGWIN__ ++ /* only DST_RELNAME.exe exists - want non-existant DST_RELNAME. */ ++ if (cygwin_spelling (drelname) != 0) ++ errno = ENOENT; ++#endif + if (errno == ELOOP && x->unlink_dest_after_failed_open) + /* leave new_dst=false so we unlink later. */; + else if (errno != ENOENT) +@@ -2321,10 +2351,17 @@ copy_internal (char const *src_name, cha + if (rename_errno == EEXIST) + { + bool return_now = false; ++#if __CYGWIN__ ++ bool case_change = false; ++#endif + + if (x->interactive != I_ALWAYS_NO + && ! same_file_ok (src_name, &src_sb, dst_dirfd, drelname, +- &dst_sb, x, &return_now)) ++ &dst_sb, x, &return_now ++#if __CYGWIN__ ++ , &case_change ++#endif ++ )) + { + error (0, 0, _("%s and %s are the same file"), + quoteaf_n (0, src_name), quoteaf_n (1, dst_name)); +@@ -2386,6 +2423,9 @@ copy_internal (char const *src_name, cha + cp and mv treat -i and -f differently. */ + if (x->move_mode) + { ++#if __CYGWIN__ ++ if (!case_change) ++#endif + if (abandon_move (x, dst_name, dst_dirfd, drelname, &dst_sb)) + { + /* Pretend the rename succeeded, so the caller (mv) +@@ -2535,7 +2575,11 @@ copy_internal (char const *src_name, cha + && ! x->move_mode + && (x->unlink_dest_before_opening + || (x->data_copy_required +- && ((x->preserve_links && 1 < dst_sb.st_nlink) ++ && ((x->preserve_links && 1 < dst_sb.st_nlink ++#if __CYGWIN__ ++ && ! case_change ++#endif ++ ) + || (x->dereference == DEREF_NEVER + && ! S_ISREG (src_sb.st_mode)))) + )) +@@ -3355,6 +3399,24 @@ copy (char const *src_name, char const * + { + assert (valid_options (options)); + ++#if __CYGWIN__ ++ /* .exe magic - if src exists with an implicit .exe suffix and is ++ not a symlink, but dst does not exist and was also specified ++ without a suffix, then append .exe to dst. */ ++ int cygwin = cygwin_spelling (src_name); ++ char *p; ++ if (cygwin == 2 ++ && ((p = strchr (dst_name, '\0') - 4) <= dst_name ++ || strcasecmp (p, ".exe") != 0)) ++ { ++ cygwin = 3; ++ CYGWIN_APPEND_EXE (p, dst_name); ++ if ((p = strchr (dst_relname, '\0') - 4) <= dst_relname ++ || strcasecmp (p, ".exe") != 0) ++ CYGWIN_APPEND_EXE (p, dst_relname); ++ } ++#endif ++ + /* 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 +@@ -3366,11 +3428,19 @@ copy (char const *src_name, char const * + top_level_dst_name = dst_name; + + bool first_dir_created_per_command_line_arg = false; +- return copy_internal (src_name, dst_name, dst_dirfd, dst_relname, ++ bool done = copy_internal (src_name, dst_name, dst_dirfd, dst_relname, + 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); ++ freea ((char *) dst_relname); ++ } ++#endif ++ return done; + } + + /* Set *X to the default options for a value of type struct cp_options. */ diff --git a/coreutils.cygport b/coreutils.cygport index a5f8aab..61dea64 100644 --- a/coreutils.cygport +++ b/coreutils.cygport @@ -7,7 +7,7 @@ # preserved. NAME=coreutils -VERSION=9.1 +VERSION=9.2 RELEASE=1 CATEGORY=Base @@ -43,7 +43,7 @@ PATCH_URI=" coreutils-8.32-src-chown.c.patch coreutils-8.32-src-chown-core.h.patch coreutils-8.32-src-chroot.c.patch - coreutils-9.1-src-copy.c.patch + coreutils-9.2-src-copy.c.patch coreutils-8.32-src-dd.c.patch coreutils-8.32-src-dircolors.c.patch coreutils-8.32-src-install.c.patch @@ -182,6 +182,27 @@ src_test() make -k check || true } + +# SPDX-License-Identifier: GPL-3.0-or-later AND GFDL-1.3-or-later +LICENSE_SPDX="SPDX-License-Identifier: GPL-3.0-or-later AND GFDL-1.3-or-later" +LICENSE="GPL-3.0-or-later AND GFDL-1.3-or-later" + +CYGWIN_MAINTAINER=Eric%20Blake +CYGWIN_MAINTAINER_EMAIL=eblake@redhat.com + +CYGWIN_CO_MAINTAINER=Brian%20Inglis +CYGWIN_CO_MAINTAINER_EMAIL=Brian.Inglis@SystematicSW.ab.ca + +UPSTREAM_MAINTAINER=%22GNU%20coreutils%20bugs%22 +UPSTREAM_MAINTAINER_EMAIL=bug-coreutils@gnu.org + +SUBJECT=${OSTYPE^}%20Package%20$NAME%20$VERSION +MAILTO=mailto:$UPSTREAM_MAINTAINER%20%3C$UPSTREAM_MAINTAINER_EMAIL%3E\ +?from=$CYGWIN_MAINTAINER%20%3C$CYGWIN_MAINTAINER_EMAIL%3E\ +\&cc=$CYGWIN_CO_MAINTAINER%20%3C$CYGWIN_CO_MAINTAINER_EMAIL%3E\ +\&subject=$SUBJECT\&body=Hi%20$UPSTREAM_MAINTAINER,%20$SUBJECT + + # Local Variables: # fill-column: 72 # mode: sh |