diff --git a/coreutils-6.9-longoptions.patch b/coreutils-6.9-longoptions.patch index f66b96d..c3500a5 100644 --- a/coreutils-6.9-longoptions.patch +++ b/coreutils-6.9-longoptions.patch @@ -1,17 +1,3 @@ -diff -urp coreutils-6.9-orig/src/echo.c coreutils-6.9/src/echo.c ---- coreutils-6.9-orig/src/echo.c -+++ coreutils-6.9/src/echo.c -@@ -163,6 +163,10 @@ main (int argc, char **argv) - { - case 'e': case 'E': case 'n': - break; -+ case '-': -+ /* end of short options(allows to print -n,-e or -E) */ -+ argc--; -+ argv++; - default: - goto just_echo; - } diff -urp coreutils-6.9-orig/lib/long-options.c coreutils-6.9/lib/long-options.c --- coreutils-6.9-orig/lib/long-options.c +++ coreutils-6.9/lib/long-options.c diff --git a/coreutils-mvatomic.patch b/coreutils-mvatomic.patch new file mode 100644 index 0000000..a82b9b7 --- /dev/null +++ b/coreutils-mvatomic.patch @@ -0,0 +1,116 @@ + src/copy.c | 5 +++-- + tests/mv/Makefile.am | 4 ++-- + tests/mv/atomic2 | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 68 insertions(+), 4 deletions(-) + create mode 100755 tests/mv/atomic2 + +diff --git a/src/copy.c b/src/copy.c +index fd31b5c..208a674 100644 +--- a/src/copy.c ++++ b/src/copy.c +@@ -1339,10 +1339,11 @@ copy_internal (char const *src_name, char const *dst_name, + new_dst = true; + } + else if (! S_ISDIR (dst_sb.st_mode) ++ /* Never unlink dst_name when in move mode. */ ++ && ! x->move_mode + && (x->unlink_dest_before_opening + || (x->preserve_links && 1 < dst_sb.st_nlink) +- || (!x->move_mode +- && x->dereference == DEREF_NEVER ++ || (x->dereference == DEREF_NEVER + && S_ISLNK (src_sb.st_mode)) + )) + { +diff --git a/tests/mv/Makefile.am b/tests/mv/Makefile.am +index c121911..92ec68e 100644 +--- a/tests/mv/Makefile.am ++++ b/tests/mv/Makefile.am +@@ -1,7 +1,6 @@ + # Make coreutils tests for "mv". -*-Makefile-*- + +-# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 +-# Free Software Foundation, Inc. ++# Copyright (C) 1998-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 +@@ -17,6 +16,7 @@ + # along with this program. If not, see . + + TESTS = \ ++ atomic2 \ + hard-verbose \ + backup-dir \ + dir2dir \ +diff --git a/tests/mv/atomic2 b/tests/mv/atomic2 +new file mode 100755 +index 0000000..d1029aa +--- /dev/null ++++ b/tests/mv/atomic2 +@@ -0,0 +1,63 @@ ++#!/bin/sh ++# ensure that mv doesn't first unlink a multi-hard-linked destination ++ ++# Copyright (C) 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 . ++ ++if test "$VERBOSE" = yes; then ++ set -x ++ mv --version ++fi ++ ++pwd=`pwd` ++t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$ ++trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0 ++trap '(exit $?); exit $?' 1 2 13 15 ++ ++# Before the fix, mv would unnecessarily unlink the destination symlink: ++# $ rm -f a b b2; touch a b; ln b b2; strace -e unlink /p/bin/mv a b ++# unlink("b") = 0 ++# ++# With the fix, it doesn't call unlink: ++# $ rm -f a b b2; touch a b; ln b b2; strace -e unlink ./mv a b ++# $ ++ ++touch a b || framework_failure=1 ++ln b b2 || framework_failure=1 ++if test $framework_failure = 1; then ++ echo "$0: failure in testing framework" 1>&2 ++ (exit 1); exit 1 ++fi ++ ++# Skip this test on systems without strace. ++strace -V < /dev/null > ver 2>&1 || skip=1 ++if test "$skip" = 1; then ++ echo "$0: no strace program, so skipping this test" 1>&2 ++ (exit 77); exit 77 ++fi ++ ++fail=0 ++ ++strace -qe unlink mv a b > out 2>&1 || fail=1 ++$EGREP 'unlink.*"b"' out && fail=1 ++ ++# Ensure that the source, "a", is gone. ++ls -dl a > /dev/null 2>&1 && fail=1 ++ ++# Ensure that the destination, "b", has link count 1. ++n_links=`stat --printf=%h b` || fail=1 ++test "$n_links" = 1 || fail=1 ++ ++(exit $fail); exit $fail +-- +1.5.5.rc0.7.g57e83 diff --git a/coreutils.spec b/coreutils.spec index da2d9a5..ddcb85c 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: The GNU core utilities: a set of tools commonly used in shell scripts Name: coreutils Version: 6.9 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv2+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -22,11 +22,12 @@ Patch2: coreutils-ls-x.patch Patch3: coreutils-6.9-cp-i-u.patch Patch4: coreutils-6.9-du-ls-upstream.patch Patch5: coreutils-dddoubleclose.patch +Patch6: coreutils-mvatomic.patch # Our patches Patch100: coreutils-chgrp.patch Patch101: coreutils-getdateYYYYMMDD.patch -Patch102: coreutils-6.9-longoptions.patch +#Patch102: coreutils-6.9-longoptions.patch # sh-utils Patch703: sh-utils-2.0.11-dateman.patch @@ -97,11 +98,12 @@ the old GNU fileutils, sh-utils, and textutils packages. %patch3 -p1 -b .cp-i-u %patch4 -p1 -b .du-ls %patch5 -p1 -b .doubleclose +%patch6 -p1 -b .mvatomic # Our patches %patch100 -p1 -b .chgrp %patch101 -p1 -b .getdate -%patch102 -p1 -b .longopts +#%patch102 -p1 -b .longopts # sh-utils %patch703 -p1 -b .dateman @@ -132,6 +134,7 @@ sed -i -e 's/basic-1//g' tests/stty/Makefile* chmod a+x tests/sort/sort-mb-tests chmod a+x tests/ls/x-option +chmod a+x tests/mv/atomic2 %build %ifarch s390 s390x @@ -287,6 +290,12 @@ fi /sbin/runuser %changelog +* Tue Mar 25 2008 Ondrej Vasik 6.9-9 +- mv: never unlink a destination file before calling rename + (upstream, #438076) +- defer usage of longoptions patch until final upstream + version (#43105) + * Tue Mar 11 2008 Ondrej Vasik 6.9-8 - other way to keep user defined LS_COLORS(#430827) - fixed harmless double close stdout in dd(#436368)