bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] cp, mv: remove 3-year-deprecated+warned-about --reply option


From: Jim Meyering
Subject: Re: [PATCH] cp, mv: remove 3-year-deprecated+warned-about --reply option
Date: Sat, 29 Nov 2008 12:46:44 +0100

Jim Meyering <address@hidden> wrote:
> I'm finally removing the --reply option to mv and cp.
> This is in my queue to push very soon:
...
>  NEWS     |    3 +++
>  src/cp.c |   22 ----------------------
>  src/mv.c |   23 +----------------------
>  3 files changed, 4 insertions(+), 44 deletions(-)

That was incomplete.
With the following addition of test changes, "make distcheck" passes, too:

>From b3f545cc7b1ecd3c2eb1158779c0a4aa76719aa7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 8 Oct 2008 08:51:38 +0200
Subject: [PATCH] cp, mv: remove 3-year-deprecated+warned-about --reply option

* src/cp.c (reply_args, reply_vals): Remove globals.
[REPLY_OPTION]: Remove enum.
(long_opts) ["reply"]: Remove initializer.
(main): Remove case stmt.
* src/mv.c: Likewise.
Don't include "argmatch.h".  No longer used.
* NEWS (Changes in behavior): Mention this.
* tests/Makefile.am (TESTS): Remove mv/reply-no.
* tests/mv/reply-no: Remove file.
* tests/mv/i-link-no: Update, now that --reply= is gone.
---
 NEWS               |    3 +++
 src/cp.c           |   22 ----------------------
 src/mv.c           |   24 +-----------------------
 tests/Makefile.am  |    1 -
 tests/mv/i-link-no |   13 +++++--------
 tests/mv/reply-no  |   42 ------------------------------------------
 6 files changed, 9 insertions(+), 96 deletions(-)
 delete mode 100755 tests/mv/reply-no

diff --git a/NEWS b/NEWS
index ae980b7..ca87b23 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,9 @@ GNU coreutils NEWS                                    -*- 
outline -*-

 ** Changes in behavior

+  cp and mv: the --reply={yes,no,query} option has been removed.
+  Using it has elicited a warning for the last three years.
+
   ls -l now marks SELinux-only files with the less obtrusive '.',
   rather than '+'.  A file with any other combination of MAC and ACL
   is still marked with a '+'.
diff --git a/src/cp.c b/src/cp.c
index 95eba0c..8e34965 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -76,7 +76,6 @@ enum
   NO_PRESERVE_ATTRIBUTES_OPTION,
   PARENTS_OPTION,
   PRESERVE_ATTRIBUTES_OPTION,
-  REPLY_OPTION,
   SPARSE_OPTION,
   STRIP_TRAILING_SLASHES_OPTION,
   UNLINK_DEST_BEFORE_OPENING
@@ -108,18 +107,6 @@ static enum Sparse_type const sparse_type[] =
 };
 ARGMATCH_VERIFY (sparse_type_string, sparse_type);

-/* Valid arguments to the `--reply' option. */
-static char const* const reply_args[] =
-{
-  "yes", "no", "query", NULL
-};
-/* The values that correspond to the above strings. */
-static int const reply_vals[] =
-{
-  I_ALWAYS_YES, I_ALWAYS_NO, I_ASK_USER
-};
-ARGMATCH_VERIFY (reply_args, reply_vals);
-
 static struct option const long_opts[] =
 {
   {"archive", no_argument, NULL, 'a'},
@@ -138,8 +125,6 @@ static struct option const long_opts[] =
   {"preserve", optional_argument, NULL, PRESERVE_ATTRIBUTES_OPTION},
   {"recursive", no_argument, NULL, 'R'},
   {"remove-destination", no_argument, NULL, UNLINK_DEST_BEFORE_OPENING},
-  {"reply", required_argument, NULL, REPLY_OPTION}, /* Deprecated 2005-07-03,
-                                                      remove in 2008. */
   {"sparse", required_argument, NULL, SPARSE_OPTION},
   {"strip-trailing-slashes", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION},
   {"suffix", required_argument, NULL, 'S'},
@@ -1001,13 +986,6 @@ main (int argc, char **argv)
          x.recursive = true;
          break;

-       case REPLY_OPTION: /* Deprecated */
-         x.interactive = XARGMATCH ("--reply", optarg,
-                                    reply_args, reply_vals);
-         error (0, 0,
-                _("the --reply option is deprecated; use -i or -f instead"));
-         break;
-
        case UNLINK_DEST_BEFORE_OPENING:
          x.unlink_dest_before_opening = true;
          break;
diff --git a/src/mv.c b/src/mv.c
index fc255f3..98309a4 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -24,7 +24,6 @@
 #include <selinux/selinux.h>

 #include "system.h"
-#include "argmatch.h"
 #include "backupfile.h"
 #include "copy.h"
 #include "cp-hash.h"
@@ -52,33 +51,18 @@
    non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
 enum
 {
-  REPLY_OPTION = CHAR_MAX + 1,
-  STRIP_TRAILING_SLASHES_OPTION
+  STRIP_TRAILING_SLASHES_OPTION = CHAR_MAX + 1
 };

 /* Remove any trailing slashes from each SOURCE argument.  */
 static bool remove_trailing_slashes;

-/* Valid arguments to the `--reply' option. */
-static char const* const reply_args[] =
-{
-  "yes", "no", "query", NULL
-};
-
-/* The values that correspond to the above strings. */
-static int const reply_vals[] =
-{
-  I_ALWAYS_YES, I_ALWAYS_NO, I_ASK_USER
-};
-
 static struct option const long_options[] =
 {
   {"backup", optional_argument, NULL, 'b'},
   {"force", no_argument, NULL, 'f'},
   {"interactive", no_argument, NULL, 'i'},
   {"no-target-directory", no_argument, NULL, 'T'},
-  {"reply", required_argument, NULL, REPLY_OPTION}, /* Deprecated 2005-07-03,
-                                                      remove in 2008. */
   {"strip-trailing-slashes", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION},
   {"suffix", required_argument, NULL, 'S'},
   {"target-directory", required_argument, NULL, 't'},
@@ -390,12 +374,6 @@ main (int argc, char **argv)
        case 'i':
          x.interactive = I_ASK_USER;
          break;
-       case REPLY_OPTION: /* Deprecated */
-         x.interactive = XARGMATCH ("--reply", optarg,
-                                    reply_args, reply_vals);
-         error (0, 0,
-                _("the --reply option is deprecated; use -i or -f instead"));
-         break;
        case STRIP_TRAILING_SLASHES_OPTION:
          remove_trailing_slashes = true;
          break;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8413fe9..8dbbe9f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -387,7 +387,6 @@ TESTS =                                             \
   mv/part-symlink                              \
   mv/partition-perm                            \
   mv/perm-1                                    \
-  mv/reply-no                                  \
   mv/to-symlink                                        \
   mv/trailing-slash                            \
   mv/update                                    \
diff --git a/tests/mv/i-link-no b/tests/mv/i-link-no
index 226d5dd..2a762d6 100755
--- a/tests/mv/i-link-no
+++ b/tests/mv/i-link-no
@@ -29,19 +29,16 @@ ln a/foo a/bar || framework_failure
 echo FUBAR > b/FUBAR || framework_failure
 ln b/FUBAR b/bar || framework_failure
 chmod a-w b/bar || framework_failure
+echo n > no || framework_failure

 fail=0

-mv --reply=no a/bar a/foo b > out 2> err || fail=1
-cat <<EOF > exp
-EOF
+mv a/bar a/foo b < no > out 2> err || fail=1
+touch exp
+touch exp_err

-cat <<EOF > exp_err
-mv: the --reply option is deprecated; use -i or -f instead
-EOF
-
-compare err exp_err || fail=1
 compare out exp || fail=1
+compare err exp_err || fail=1

 case "`cat b/foo`" in
   foo) ;;
diff --git a/tests/mv/reply-no b/tests/mv/reply-no
deleted file mode 100755
index fb7cc2f..0000000
--- a/tests/mv/reply-no
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-# Ensure that `mv --reply=no f1 f2' works.
-
-# Copyright (C) 2005-2008 Free Software Foundation, Inc.
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-if test "$VERBOSE" = yes; then
-  set -x
-  mv --version
-fi
-
-. $srcdir/test-lib.sh
-
-touch a b || framework_failure
-
-fail=0
-
-mv --interactive --reply=no a b > out 2>&1 || fail=1
-
-# Both files must remain.
-test -f a || fail=1
-test -f b || fail=1
-
-cat <<EOF > exp_err
-mv: the --reply option is deprecated; use -i or -f instead
-EOF
-
-compare out exp_err || fail=1
-
-Exit $fail
--
1.6.0.4.1101.g642f8




reply via email to

[Prev in Thread] Current Thread [Next in Thread]