From: "Pádraig Brady" <P@draigBrady.com>
To: Attila Fidan <dev@print0.net>, 70727-done@debbugs.gnu.org
Subject: bug#70727: cp doesn't recognize the new --update=none-fail option
Date: Fri, 3 May 2024 10:26:40 +0100 [thread overview]
Message-ID: <f967c0ed-7a98-450b-b8a2-c3278a0fcdf5@draigBrady.com> (raw)
In-Reply-To: <fguanooj6kb7msml233rcmyiawjp2rckdtlqkrdx6tprfiest7@sbxos2czyo4f>
[-- Attachment #1: Type: text/plain, Size: 1094 bytes --]
On 03/05/2024 05:12, Attila Fidan via GNU coreutils Bug Reports wrote:
> Hi,
>
> I wanted to use the new cp --update=none-fail option introduced in 9.5,
> but it said "invalid argument ‘none-fail’ for ‘--update’". It turns out
> that the commit (49912bac286eb3c0ef7d1567ae790193ad5eb2e8) adding it
> forgot to add the new operation to update_type[] and
> update_type_string[] in cp.c like it did for mv.c. After patching
> coreutils locally the functionality works as expected.
>
> It seems like the test suite didn't catch this because there's no
> cp/update.sh test like there is for mv. There's a test for if using
> --backup and --update=none-fail are mutually exclusive by checking if cp
> returns 1, but an invalid argument also makes cp return 1 :)
>
> I didn't include a patch in case a change to the test suite is wanted,
> but the proposed change is tiny and rather obvious.
Well that's embarrassing.
I implemented in cp first, tested that manually,
then must have messed up that hunk when rebasing.
The attached should fix this.
Marking this as done.
thanks,
Pádraig.
[-- Attachment #2: cp--update=none-fail.patch --]
[-- Type: text/x-patch, Size: 2261 bytes --]
From de49e993ea8b6dcdf6cada3c0f44a6371514f952 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Fri, 3 May 2024 10:18:50 +0100
Subject: [PATCH] cp: actually support --update=none-fail
* src/cp.c: Add the entries for the --update=none-fail option.
* tests/mv/update.sh: Add a test case.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/70727
---
NEWS | 4 ++++
src/cp.c | 4 ++--
tests/mv/update.sh | 11 +++++++++++
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 389f72516..7e8ccb34f 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,10 @@ GNU coreutils NEWS -*- outline -*-
** Bug fixes
+ cp fixes support for --update=none-fail, which would have been
+ rejected as an invalid option.
+ [bug introduced in coreutils-9.5]
+
ls and printf fix shell quoted output in the edge case of escaped
first and last characters, and single quotes in the string.
[bug introduced in coreutils-8.26]
diff --git a/src/cp.c b/src/cp.c
index 28b0217db..06dbad155 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -104,11 +104,11 @@ ARGMATCH_VERIFY (reflink_type_string, reflink_type);
static char const *const update_type_string[] =
{
- "all", "none", "older", nullptr
+ "all", "none", "none-fail", "older", nullptr
};
static enum Update_type const update_type[] =
{
- UPDATE_ALL, UPDATE_NONE, UPDATE_OLDER,
+ UPDATE_ALL, UPDATE_NONE, UPDATE_NONE_FAIL, UPDATE_OLDER,
};
ARGMATCH_VERIFY (update_type_string, update_type);
diff --git a/tests/mv/update.sh b/tests/mv/update.sh
index 164357803..39ff677b9 100755
--- a/tests/mv/update.sh
+++ b/tests/mv/update.sh
@@ -38,6 +38,17 @@ for interactive in '' -i; do
done
done
+# These should accept all options
+for update_option in '--update' '--update=older' '--update=all' \
+ '--update=none' '--update=none-fail'; do
+
+ touch file1 || framework_failure_
+ mv $update_option file1 file2 || fail=1
+ test -f file1 && fail=1
+ cp $update_option file2 file1 || fail=1
+ rm file1 file2 || framework_failure_
+done
+
# These should perform the rename / copy
for update_option in '--update' '--update=older' '--update=all' \
'--update=none --update=all'; do
--
2.44.0
prev parent reply other threads:[~2024-05-03 9:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 4:12 bug#70727: cp doesn't recognize the new --update=none-fail option Attila Fidan via GNU coreutils Bug Reports
2024-05-03 9:26 ` Pádraig Brady [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-coreutils
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f967c0ed-7a98-450b-b8a2-c3278a0fcdf5@draigBrady.com \
--to=p@draigbrady.com \
--cc=70727-done@debbugs.gnu.org \
--cc=dev@print0.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).