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

rpms/coreutils/devel coreutils-rename.patch, NONE, 1.1 coreutils.spec, 1.144, 1.145



Author: twaugh

Update of /cvs/dist/rpms/coreutils/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv19435

Modified Files:
	coreutils.spec 
Added Files:
	coreutils-rename.patch 
Log Message:
* Thu Sep 28 2006 Tim Waugh <twaugh redhat com> 5.97-11
- Back-ported rename patch (bug #205744).


coreutils-rename.patch:
 NEWS                    |    5 +++++
 src/cp.c                |    5 -----
 src/mv.c                |    6 ------
 tests/cp/Makefile.am    |    2 +-
 tests/cp/trailing-slash |    2 ++
 tests/mv/trailing-slash |   31 ++++++++++++++++++++++++++++++-
 6 files changed, 38 insertions(+), 13 deletions(-)

--- NEW FILE coreutils-rename.patch ---
--- coreutils-5.97/src/mv.c.rename	2006-09-28 13:02:20.000000000 +0100
+++ coreutils-5.97/src/mv.c	2006-09-28 13:03:30.000000000 +0100
@@ -157,16 +157,11 @@
 static bool
 target_directory_operand (char const *file)
 {
-  char const *b = base_name (file);
-  size_t blen = strlen (b);
-  bool looks_like_a_dir = (blen == 0 || ISSLASH (b[blen - 1]));
   struct stat st;
   int err = (stat (file, &st) == 0 ? 0 : errno);
   bool is_a_dir = !err && S_ISDIR (st.st_mode);
   if (err && err != ENOENT)
     error (EXIT_FAILURE, err, _("accessing %s"), quote (file));
-  if (is_a_dir < looks_like_a_dir)
-    error (EXIT_FAILURE, err, _("target %s is not a directory"), quote (file));
   return is_a_dir;
 }
 
@@ -268,7 +263,6 @@
      function that ignores a trailing slash.  I believe the Linux
      rename semantics are POSIX and susv2 compliant.  */
 
-  strip_trailing_slashes (dest);
   if (remove_trailing_slashes)
     strip_trailing_slashes (source);
 
--- coreutils-5.97/src/cp.c.rename	2006-09-28 13:02:20.000000000 +0100
+++ coreutils-5.97/src/cp.c	2006-09-28 13:04:08.000000000 +0100
@@ -542,9 +542,6 @@
 static bool
 target_directory_operand (char const *file, struct stat *st, bool *new_dst)
 {
-  char const *b = base_name (file);
-  size_t blen = strlen (b);
-  bool looks_like_a_dir = (blen == 0 || ISSLASH (b[blen - 1]));
   int err = (stat (file, st) == 0 ? 0 : errno);
   bool is_a_dir = !err && S_ISDIR (st->st_mode);
   if (err)
@@ -553,8 +550,6 @@
 	error (EXIT_FAILURE, err, _("accessing %s"), quote (file));
       *new_dst = true;
     }
-  if (is_a_dir < looks_like_a_dir)
-    error (EXIT_FAILURE, err, _("target %s is not a directory"), quote (file));
   return is_a_dir;
 }
 
--- coreutils-5.97/NEWS.rename	2006-09-28 13:02:19.000000000 +0100
+++ coreutils-5.97/NEWS	2006-09-28 13:02:41.000000000 +0100
@@ -25,6 +25,11 @@
   chgrp now supports --preserve-root, --no-preserve-root (default),
   as it was documented to do, and just as chmod, chown, and rm do.
 
+  mv and "cp -r" no longer fail when invoked with two arguments
+  where the first one names a directory and the second name ends in
+  a slash and doesn't exist.  E.g., "mv dir B/", for nonexistent B,
+  now succeeds, once more.  This bug was introduced in coreutils-5.3.0.
+
 
 * Major changes in release 5.96 (2006-05-22) [stable]
 
--- coreutils-5.97/tests/mv/trailing-slash.rename	2004-06-23 16:07:04.000000000 +0100
+++ coreutils-5.97/tests/mv/trailing-slash	2006-09-28 13:04:55.000000000 +0100
@@ -1,6 +1,8 @@
 #!/bin/sh
 # On some operating systems, e.g. SunOS-4.1.1_U1 on sun3x,
 # rename() doesn't accept trailing slashes.
+# Also, ensure that "mv dir non-exist-dir/" works.
+# Also, ensure that "cp dir non-exist-dir/" works.
 
 if test "$VERBOSE" = yes; then
   set -x
@@ -20,7 +22,7 @@
 mkdir foo || framework_failure=1
 
 if test $framework_failure = 1; then
-  echo 'failure in testing framework'
+  echo 'failure in testing framework' 1>&2
   exit 1
 fi
 
@@ -28,4 +30,31 @@
 
 mv foo/ bar || fail=1
 
+# mv and cp would misbehave for coreutils versions [5.3.0..5.97], 6.0 and 6.1
+for cmd in mv 'cp -r'; do
+  for opt in '' -T -u; do
+    rm -rf d e || framework_failure=1
+    mkdir d    || framework_failure=1
+    if test $framework_failure = 1; then
+      echo 'failure in testing framework'
+      (exit 1); exit 1
+    fi
+
+    $cmd $opt d e/ || fail=1
+    if test "$cmd" = mv; then
+      test -d d && fail=1
+    else
+      test -d d || fail=1
+    fi
+    test -d e || fail=1
+  done
+done
+
+# We would like the erroneous-looking "mv any non-dir/" to fail,
+# but with the current implementation, it depends on how the
+# underlying rename syscall handles the trailing slash.
+# It does fail, as desired, on recent Linux and Solaris systems.
+#touch a a2
+#mv a a2/ && fail=1
+
 (exit $fail); exit $fail
--- coreutils-5.97/tests/cp/Makefile.am.rename	2006-02-06 12:45:26.000000000 +0000
+++ coreutils-5.97/tests/cp/Makefile.am	2006-09-28 13:02:41.000000000 +0100
@@ -8,7 +8,7 @@
   same-file cp-mv-backup symlink-slash slink-2-slink fail-perm dir-slash \
   perm cp-HL special-bits link dir-rm-dest cp-parents deref-slink \
   dir-vs-file into-self
-EXTRA_DIST = $(TESTS)
+EXTRA_DIST = $(TESTS) trailing-slash
 TESTS_ENVIRONMENT = \
   MAKE=$(MAKE) \
   PATH="`pwd`/../../src$(PATH_SEPARATOR)$$PATH"
--- /dev/null	2006-09-28 09:30:57.614257500 +0100
+++ coreutils-5.97/tests/cp/trailing-slash	2006-09-28 13:02:41.000000000 +0100
@@ -0,0 +1,2 @@
+# this is just a place-holder.
+# For trailing-slash-related tests, see ../mv/trailing-slash.


Index: coreutils.spec
===================================================================
RCS file: /cvs/dist/rpms/coreutils/devel/coreutils.spec,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -r1.144 -r1.145
--- coreutils.spec	27 Sep 2006 12:08:31 -0000	1.144
+++ coreutils.spec	28 Sep 2006 12:27:32 -0000	1.145
@@ -1,7 +1,7 @@
 Summary: The GNU core utilities: a set of tools commonly used in shell scripts
 Name:    coreutils
 Version: 5.97
-Release: 10
+Release: 11
 License: GPL
 Group:   System Environment/Base
 Url:     http://www.gnu.org/software/coreutils/
@@ -21,6 +21,7 @@
 
 # From upstream
 Patch1: coreutils-sort-compatibility.patch
+Patch2: coreutils-rename.patch
 Patch10: coreutils-newhashes.patch
 
 # Our patches
@@ -80,6 +81,7 @@
 
 # From upstream
 %patch1 -p1 -b .sort-compatibility
+%patch2 -p1 -b .rename
 %patch10 -p1 -b .newhashes
 
 # Our patches
@@ -282,6 +284,9 @@
 /sbin/runuser
 
 %changelog
+* Thu Sep 28 2006 Tim Waugh <twaugh redhat com> 5.97-11
+- Back-ported rename patch (bug #205744).
+
 * Tue Sep 12 2006 Tim Waugh <twaugh redhat com> 5.97-10
 - Ignore 'cifs' filesystems for 'df -l' (bug #183703).
 - Include -g/-G in runuser man page (part of bug #199344).


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