diff --git a/coreutils-8.15-cp-attribute-truncate.patch b/coreutils-8.15-cp-attribute-truncate.patch new file mode 100644 index 0000000..b7d27ef --- /dev/null +++ b/coreutils-8.15-cp-attribute-truncate.patch @@ -0,0 +1,103 @@ +From 3d53e7fe1c31aa440cc9708c7c51db6b78c07653 Mon Sep 17 00:00:00 2001 +From: =?utf8?q?P=C3=A1draig=20Brady?= +Date: Thu, 12 Apr 2012 12:47:30 +0100 +Subject: [PATCH 1/1] cp: change --attributes-only to not truncate existing files + +* src/copy.c (copy_reg): Don't truncate an existing file, +to support copying attributes between existing files. +The original use case only considered creating new files, +and it would be a very unusual use case to be relying +on the truncating behavior. +* doc/coreutils.texi (cp invocation): Mention the non +truncating behavior. +* tests/cp/attr-existing: A new test to ensure O_TRUNC skipped. +* tests/Makefile.am: Reference the new test. +--- + doc/coreutils.texi | 6 +++--- + src/copy.c | 4 +++- + tests/Makefile.am | 1 + + tests/cp/attr-existing | 29 +++++++++++++++++++++++++++++ + 4 files changed, 36 insertions(+), 4 deletions(-) + create mode 100755 tests/cp/attr-existing + +diff --git a/doc/coreutils.texi b/doc/coreutils.texi +index 510abb9..1fbf051 100644 +--- a/doc/coreutils.texi ++++ b/doc/coreutils.texi +@@ -7649,9 +7649,9 @@ Equivalent to @option{-dR --preserve=all} with the reduced diagnostics. + + @itemx --attributes-only + @opindex --attributes-only +-Preserve the specified attributes of the original files in the copy, +-but do not copy any data. See the @option{--preserve} option for +-controlling which attributes to copy. ++Copy only the specified attributes of the source file to the destination. ++If the destination already exists, do not alter its contents. ++See the @option{--preserve} option for controlling which attributes to copy. + + @item -b + @itemx @w{@kbd{--backup}[=@var{method}]} +diff --git a/src/copy.c b/src/copy.c +index f63a726..414fbe0 100644 +--- a/src/copy.c ++++ b/src/copy.c +@@ -826,7 +826,9 @@ copy_reg (char const *src_name, char const *dst_name, + by the specs for both cp and mv. */ + if (! *new_dst) + { +- dest_desc = open (dst_name, O_WRONLY | O_TRUNC | O_BINARY); ++ int open_flags = ++ O_WRONLY | O_BINARY | (x->data_copy_required ? O_TRUNC : 0); ++ dest_desc = open (dst_name, open_flags); + dest_errno = errno; + + /* When using cp --preserve=context to copy to an existing destination, +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 011051a..4d73a92 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -320,6 +320,7 @@ TESTS = \ + chown/separator \ + cp/abuse \ + cp/acl \ ++ cp/attr-existing \ + cp/backup-1 \ + cp/backup-dir \ + cp/backup-is-src \ +diff --git a/tests/cp/attr-existing b/tests/cp/attr-existing +new file mode 100755 +index 0000000..9cf0ffc +--- /dev/null ++++ b/tests/cp/attr-existing +@@ -0,0 +1,29 @@ ++#!/bin/sh ++# Make sure cp --attributes-only doesn't truncate existing data ++ ++# Copyright 2012 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 . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../src ++print_ver_ cp ++ ++printf '1' > file1 ++printf '2' > file2 ++printf '2' > file2.exp ++ ++cp --attributes-only file1 file2 || fail=1 ++cmp file2 file2.exp || fail=1 ++ ++Exit $fail +-- +1.7.2.5 diff --git a/coreutils-8.15-du-x-nondir.patch b/coreutils-8.15-du-x-nondir.patch new file mode 100644 index 0000000..02d120e --- /dev/null +++ b/coreutils-8.15-du-x-nondir.patch @@ -0,0 +1,43 @@ +diff --git a/src/du.c b/src/du.c +index e4e36df..41c9535 100644 +--- a/src/du.c ++++ b/src/du.c +@@ -443,7 +443,14 @@ process_file (FTS *fts, FTSENT *ent) + return false; + } + +- if (fts->fts_options & FTS_XDEV && fts->fts_dev != sb->st_dev) ++ /* The --one-file-system (-x) option cannot exclude anything ++ specified on the command-line. By definition, it can exclude ++ a file or directory only when its device number is different ++ from that of its just-processed parent directory, and du does ++ not process the parent of a command-line argument. */ ++ if (fts->fts_options & FTS_XDEV ++ && FTS_ROOTLEVEL < ent->fts_level ++ && fts->fts_dev != sb->st_dev) + excluded = true; + } + +diff --git a/tests/du/one-file-system b/tests/du/one-file-system +index f0d264a..110080f 100755 +--- a/tests/du/one-file-system ++++ b/tests/du/one-file-system +@@ -43,7 +43,15 @@ compare exp out || fail=1 + du -xL d > u || fail=1 + sed 's/^[0-9][0-9]* //' u > out1 + echo d > exp1 || fail=1 +- + compare exp1 out1 || fail=1 + ++# With coreutils-8.15, "du -xs FILE" would print no output. ++touch f ++for opt in -x -xs; do ++ du $opt f > u || fail=1 ++ sed 's/^[0-9][0-9]* //' u > out2 ++ echo f > exp2 || fail=1 ++ compare exp2 out2 || fail=1 ++done ++ + Exit $fail +-- +cgit v0.9.0.2 diff --git a/coreutils-DIR_COLORS b/coreutils-DIR_COLORS index 5a41e99..9c182c8 100644 --- a/coreutils-DIR_COLORS +++ b/coreutils-DIR_COLORS @@ -240,5 +240,7 @@ EXEC 01;32 .xml 00;33 .epub 00;33 .abw 00;33 +.htm 00;33 .html 00;33 +.shtml 00;33 .wpd 00;33 diff --git a/coreutils-DIR_COLORS.256color b/coreutils-DIR_COLORS.256color index ddff4ac..1037dd5 100644 --- a/coreutils-DIR_COLORS.256color +++ b/coreutils-DIR_COLORS.256color @@ -213,5 +213,7 @@ EXEC 38;5;34 .xml 00;33 .epub 00;33 .abw 00;33 +.htm 00;33 .html 00;33 +.shtml 00;33 .wpd 00;33 diff --git a/coreutils-DIR_COLORS.lightbgcolor b/coreutils-DIR_COLORS.lightbgcolor index e2c05da..4456a8c 100644 --- a/coreutils-DIR_COLORS.lightbgcolor +++ b/coreutils-DIR_COLORS.lightbgcolor @@ -216,5 +216,7 @@ EXEC 00;32 .xml 00;33 .epub 00;33 .abw 00;33 +.htm 00;33 .html 00;33 +.shtml 00;33 .wpd 00;33 diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh index 48daa78..e244afb 100755 --- a/coreutils-colorls.csh +++ b/coreutils-colorls.csh @@ -14,10 +14,10 @@ if ($?TERM) then if ( -e "/etc/DIR_COLORS.$TERM" ) then set COLORS="/etc/DIR_COLORS.$TERM" endif -endif -if ( -e "/etc/DIR_COLORS.256color" ) then - if ( "`tty -s && tput colors`" == "256" ) then - set COLORS=/etc/DIR_COLORS.256color + if ( -e "/etc/DIR_COLORS.256color" ) then + if ( "`tput colors`" == "256" ) then + set COLORS=/etc/DIR_COLORS.256color + endif endif endif if ( -f ~/.dircolors ) set COLORS=~/.dircolors diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index ec79964..a0bd8b0 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -3096,12 +3096,12 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c + } + while (hi - lo > 1); + -+ if (ea) -+ *ea = (char *) month; -+ + result = (!strncmp (month, monthtab[lo].name, strlen (monthtab[lo].name)) + ? monthtab[lo].val : 0); + ++ if (ea && result) ++ *ea = s + strlen (monthtab[lo].name); ++ + return result; +} +#endif diff --git a/coreutils.spec b/coreutils.spec index 7ef0e35..2e68606 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -18,6 +18,8 @@ Source202: coreutils-su-l.pamd Source203: coreutils-runuser-l.pamd # From upstream +Patch1: coreutils-8.15-cp-attribute-truncate.patch +Patch2: coreutils-8.15-du-x-nondir.patch # Our patches #general patch to workaround koji build system issues @@ -121,6 +123,7 @@ Requires(post): grep Requires: ncurses Requires: gmp +Provides: bundled(gnulib) Provides: fileutils = %{version}-%{release} Provides: sh-utils = %{version}-%{release} Provides: stat = %{version}-%{release} @@ -143,6 +146,8 @@ the old GNU fileutils, sh-utils, and textutils packages. %setup -q # From upstream +%patch1 -p1 -b .trunc +%patch2 -p1 -b .xnondir # Our patches %patch100 -p1 -b .configure @@ -173,7 +178,7 @@ the old GNU fileutils, sh-utils, and textutils packages. %patch951 -p1 -b .selinuxman %patch952 -p1 -b .cpZ -chmod a+x tests/misc/sort-mb-tests tests/df/direct || : +chmod a+x tests/misc/sort-mb-tests tests/df/direct tests/cp/attr-existing || : #fix typos/mistakes in localized documentation(#439410, #440056) find ./po/ -name "*.p*" | xargs \ @@ -416,6 +421,17 @@ fi %{?!norunuser:%{_sbindir}/runuser} %changelog +* Fri Jul 13 2012 Ondrej Vasik 8.15-7 +- fix the tcsh colorls.csh behaviour in non-interactive + mode (#804604) +- add .htm and .shtml to colorized DIR_COLORS document + type (#817218) +- fix regression in du -x with nondir argument (by J.Meyering) +- fix sort segfault with multibyte locales (by P.Brady) +- add virtual provides for bundled(gnulib) copylib (#821748) +- cp: change --attribute-only to not truncate existing files + (#811746) + * Fri Feb 10 2012 Harald Hoyer 8.15-6 - turn on testsuite again