On 10/15/18 7:44 AM, Assaf Gordon wrote:
Discussion can continue by replying to this thread.

This particular bug report seemed valid, and the fix was simple so I installed it into coreutils master via the attached patches (the first one merely updates to the current Gnulib).

>From 9c3730e601b72b4478e81d3c75e06ede4cfd93bc Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Fri, 19 Oct 2018 12:19:43 -0700
Subject: [PATCH 1/2] build: update gnulib submodule to latest

* gl/modules/tempname.diff: Update to match Gnulib.
---
 gl/modules/tempname.diff | 4 ++--
 gnulib                   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gl/modules/tempname.diff b/gl/modules/tempname.diff
index d572734b6..345f9da02 100644
--- a/gl/modules/tempname.diff
+++ b/gl/modules/tempname.diff
@@ -2,10 +2,10 @@ diff --git a/modules/tempname b/modules/tempname
 index 570ea54..f1be8ff 100644
 --- a/modules/tempname
 +++ b/modules/tempname
-@@ -12,6 +12,8 @@
- fcntl-h
+@@ -13,6 +13,8 @@
  gettimeofday
  lstat
+ mkdir
 +randint
 +stdbool
  stdint
diff --git a/gnulib b/gnulib
index 2522322e5..1ff0e9684 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 2522322e5304e7d86c63e607e2bc83c8d8b0a889
+Subproject commit 1ff0e9684bb83a8277ffe22ac125ce7e90f6702b
-- 
2.17.2

>From cbc427485e8c202b8aeae567f99c4a080a55adac Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Fri, 19 Oct 2018 12:19:43 -0700
Subject: [PATCH 2/2] cp: 'cp -il A B' no longer fails if user OKs it

* NEWS: Mention the change.
* src/copy.c (copy_internal): Replace the link if the
user has okayed it.
---
 NEWS       | 4 ++++
 src/copy.c | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 77c26df4d..0fea1a118 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,10 @@ GNU coreutils NEWS                                    -*- outline -*-
 
 ** Bug fixes
 
+  When B already exists, 'cp -il A B' no longer immediately fails
+  after asking the user whether to proceed.
+  [This bug was present in "the beginning".]
+
   df no longer corrupts displayed multibyte characters on macOS.
 
 ** New features
diff --git a/src/copy.c b/src/copy.c
index 1a9cdd1a8..417147bc2 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -2657,9 +2657,9 @@ copy_internal (char const *src_name, char const *dst_name,
            && !(! CAN_HARDLINK_SYMLINKS && S_ISLNK (src_mode)
                 && x->dereference == DEREF_NEVER))
     {
-      if (! create_hard_link (src_name, dst_name,
-                              x->unlink_dest_after_failed_open,
-                              false, dereference))
+      bool replace = (x->unlink_dest_after_failed_open
+                      || x->interactive == I_ASK_USER);
+      if (! create_hard_link (src_name, dst_name, replace, false, dereference))
         goto un_backup;
     }
   else if (S_ISREG (src_mode)
-- 
2.17.2

Reply via email to