>From cbc427485e8c202b8aeae567f99c4a080a55adac Mon Sep 17 00:00:00 2001 From: Paul Eggert 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