new upstream bugfix release 7.6, removed applied patches,defuzzed the rest

This commit is contained in:
Ondrej Vasik 2009-09-12 09:28:49 +00:00
parent 266a669f62
commit 2505178971
16 changed files with 1487 additions and 1751 deletions

View File

@ -1 +1 @@
coreutils-7.5.tar.xz
coreutils-7.6.tar.xz

View File

@ -27,17 +27,6 @@ diff -urNp coreutils-7.2-orig/gnulib-tests/gnulib.mk coreutils-7.2/gnulib-tests/
## end gnulib module strverscmp-tests
diff -urN coreutils-6.11-orig/tests/mkdir/selinux coreutils-6.11/tests/mkdir/selinux
--- coreutils-6.11-orig/tests/mkdir/selinux 2008-04-19 23:34:23.000000000 +0200
+++ coreutils-6.11/tests/mkdir/selinux 2008-04-22 13:23:50.000000000 +0200
@@ -38,6 +28,7 @@
# successfully, in spite of the invalid context string.
. $srcdir/test-lib.sh
+require_selinux_
c=invalid-selinux-context
msg="failed to set default file creation context to \`$c':"
diff -urNp coreutils-6.11-orig/tests/test-lib.sh coreutils-6.11/tests/test-lib.sh
--- coreutils-6.11-orig/tests/test-lib.sh 2008-04-19 23:34:23.000000000 +0200
+++ coreutils-6.11/tests/test-lib.sh 2008-04-24 14:18:59.000000000 +0200

View File

@ -1,17 +0,0 @@
diff -urNp coreutils-7.5-orig/src/df.c coreutils-7.5/src/df.c
--- coreutils-7.5-orig/src/df.c 2009-08-15 17:25:32.000000000 +0200
+++ coreutils-7.5/src/df.c 2009-09-03 16:37:25.000000000 +0200
@@ -995,7 +995,12 @@ main (int argc, char **argv)
for (i = optind; i < argc; ++i)
{
int fd = open (argv[i], O_RDONLY | O_NOCTTY);
- if (fd < 0 || fstat (fd, &stats[i - optind]))
+ if (0 <= fd && !fstat (fd, &stats[i - optind])
+ && !stat (argv[i], &stats[i - optind]))
+ {
+ /* open() may have failed for normal user but stat() works */
+ }
+ else
{
error (0, errno, "%s", quote (argv[i]));
exit_status = EXIT_FAILURE;

View File

@ -1,18 +0,0 @@
diff -urNp coreutils-7.5-orig/src/copy.c coreutils-7.5/src/copy.c
--- coreutils-7.5-orig/src/copy.c
+++ coreutils-7.5/src/copy.c
@@ -124,7 +124,13 @@ static inline int
utimens_symlink (char const *file, struct timespec const *timespec)
{
#if HAVE_UTIMENSAT
- return utimensat (AT_FDCWD, file, timespec, AT_SYMLINK_NOFOLLOW);
+ int err = utimensat (AT_FDCWD, file, timespec, AT_SYMLINK_NOFOLLOW);
+ /* When configuring on a system with new headers and libraries, and
+ running on one with a kernel that is old enough to lack the syscall,
+ utimensat fails with ENOSYS. Ignore that. */
+ if (err && errno == ENOSYS)
+ err = 0;
+ return err;
#else
/* Don't set errno=ENOTSUP here as we don't want
to output an error message for this case. */

View File

@ -1,193 +0,0 @@
From 3af748aa25193e8a5a8fe520cd967cfbc4d71cb8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 2 Jul 2008 18:01:43 +0200
Subject: [PATCH] ls -i: print consistent inode numbers also for mount points
On most unix- and linux-based kernels, ls -i DIR_CONTAINING_MOUNT_POINT
would print the wrong inode number for any entry that is a mount point.
It would do that by relying on readdir's dirent.d_ino values, while
most readdir implementations return the inode number of the underlying,
inaccessible directory. Thus, it is not consistent with what you'd
get when applying stat to the same entry. This bug led to surprising
results like "ls -i" and "ls -i --color" printing different numbers (ls
must usually "stat" a file to colorize its name). This change makes it
so that on offending systems, ls must stat non-command-line-arguments
for which otherwise it would be able to use "for free" dirent.d_ino
values. Regardless of this change, ls is already required to stat every
command-line argument. Note: versions of GNU ls prior to coreutils-6.0
did not perform the invalid optimization, and hence always printed
correct inode numbers. Thus, for the sake of correctness, ls -i is
forgoing the readdir optimization, for any kernel (including linux!)
with POSIX-nonconforming readdir. Note that currently, only Cygwin has
been agile enough to conform.
* src/ls.c (RELIABLE_D_INO): Define.
(print_dir): Use it.
For plenty of discussion, see this long thread:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14020
This bug was introduced by the 2006-02-26 commit, 33eb3efe:
"In ls, avoid calling stat for --inode (-i), when possible."
* tests/ls/readdir-mountpoint-inode: New test.
* tests/Makefile.am (TESTS): Add it.
* tests/ls/stat-vs-dirent: Don't suppress failure of this test,
now that ls -i is fixed. Though note that it doesn't test well,
since it compares only the always-stat'd command-line arguments.
---
src/ls.c | 23 +++++++++++-
tests/Makefile.am | 1 +
tests/ls/readdir-mountpoint-inode | 72 +++++++++++++++++++++++++++++++++++++
tests/ls/stat-vs-dirent | 7 +---
4 files changed, 96 insertions(+), 7 deletions(-)
create mode 100755 tests/ls/readdir-mountpoint-inode
diff --git a/src/ls.c b/src/ls.c
index 6316dfa..553090d 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -126,6 +126,26 @@
Subtracting doesn't always work, due to overflow. */
#define longdiff(a, b) ((a) < (b) ? -1 : (a) > (b))
+/* Unix-based readdir implementations have historically returned a dirent.d_ino
+ value that is sometimes not equal to the stat-obtained st_ino value for
+ that same entry. This error occurs for a readdir entry that refers
+ to a mount point. readdir's error is to return the inode number of
+ the underlying directory -- one that typically cannot be stat'ed, as
+ long as a file system is mounted on that directory. RELIABLE_D_INO
+ encapsulates whether we can use the more efficient approach of relying
+ on readdir-supplied d_ino values, or whether we must incur the cost of
+ calling stat or lstat to obtain each guaranteed-valid inode number. */
+
+#ifndef READDIR_LIES_ABOUT_MOUNTPOINT_D_INO
+# define READDIR_LIES_ABOUT_MOUNTPOINT_D_INO 1
+#endif
+
+#if READDIR_LIES_ABOUT_MOUNTPOINT_D_INO
+# define RELIABLE_D_INO(dp) NOT_AN_INODE_NUMBER
+#else
+# define RELIABLE_D_INO(dp) D_INO (dp)
+#endif
+
#if ! HAVE_STRUCT_STAT_ST_AUTHOR
# define st_author st_uid
#endif
@@ -2501,7 +2521,8 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
# endif
}
#endif
- total_blocks += gobble_file (next->d_name, type, D_INO (next),
+ total_blocks += gobble_file (next->d_name, type,
+ RELIABLE_D_INO (next),
false, name);
/* In this narrow case, print out each name right away, so
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3177056..0151cb0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -358,6 +358,7 @@ TESTS = \
ls/no-arg \
ls/no-cap \
ls/proc-selinux-segfault \
+ ls/readdir-mountpoint-inode \
ls/recursive \
ls/rt-1 \
ls/stat-dtype \
diff --git a/tests/ls/readdir-mountpoint-inode b/tests/ls/readdir-mountpoint-inode
new file mode 100755
index 0000000..763cab1
--- /dev/null
+++ b/tests/ls/readdir-mountpoint-inode
@@ -0,0 +1,72 @@
+#!/bin/sh
+# ensure that ls -i works also for mount points
+
+# Copyright (C) 2009 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
+ ls --version
+fi
+
+. $srcdir/test-lib.sh
+
+fail=0
+
+mount_points=$(df --local -P 2>&1 | sed -n 's,.*[0-9]% \(/.\),\1,p')
+test -z "$mount_points" && skip_test_ "this test requires a non-root mount point"
+
+# Given e.g., /dev/shm, produce the list of GNU ls options that
+# let us list just that entry using readdir data from its parent:
+# ls -i -I '[^s]*' -I 's[^h]*' -I 'sh[^m]*' -I 'shm?*' -I '.?*' \
+# -I '?' -I '??' /dev
+
+ls_ignore_options()
+{
+ name=$1
+ opts="-I '.?*' -I '$name?*'"
+ while :; do
+ glob=$(echo "$name"|sed 's/\(.*\)\(.\)$/\1[^\2]*/')
+ opts="$opts -I '$glob'"
+ name=$(echo "$name"|sed 's/.$//')
+ test -z "$name" && break
+ glob=$(echo "$name"|sed 's/./?/g')
+ opts="$opts -I '$glob'"
+ done
+ echo "$opts"
+}
+
+inode_via_readdir()
+{
+ mount_point=$1
+ base=$(basename $mount_point)
+ case $base in
+ .*) skip_test_ 'mount point component starts with "."' ;;
+ *[*?]*) skip_test_ 'mount point component contains "?" or "*"' ;;
+ esac
+ opts=$(ls_ignore_options "$base")
+ parent_dir=$(dirname $mount_point)
+ eval "ls -i $opts $parent_dir" | sed 's/ .*//'
+}
+
+# FIXME: use a timeout, in case stat'ing mount points takes too long.
+
+for dir in $mount_points; do
+ readdir_inode=$(inode_via_readdir $dir)
+ stat_inode=$(env stat --format=%i $dir)
+ test "$readdir_inode" = "$stat_inode" || fail=1
+done
+
+Exit $fail
diff --git a/tests/ls/stat-vs-dirent b/tests/ls/stat-vs-dirent
index c1d7ff5..064ec12 100755
--- a/tests/ls/stat-vs-dirent
+++ b/tests/ls/stat-vs-dirent
@@ -49,12 +49,7 @@ while :; do
The flaw isn't serious for coreutils, but it might break other tools,
so you should report it to your operating system vendor." 1>&2
- # This test fails too often, and we don't want to be distracted
- # with reports, since the code that could be affected by the losing
- # behavior (pwd and getcwd) works around any mismatch.
- # So do continue to issue the warning, but don't count it as a
- # real failure.
- # fail=1
+ fail=1
break
fi
fi
--
1.6.4.2.363.g2d6e

View File

@ -187,14 +187,6 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "expand"
@@ -183,6 +200,7 @@
stops = num_start + len - 1;
}
}
+
else
{
error (0, 0, _("tab size contains invalid character(s): %s"),
@@ -365,6 +383,142 @@
}
}
@ -586,21 +578,6 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
outlist = outlist_head.next;
if (outlist)
@@ -397,12 +628,12 @@
if (o->file == 0)
{
if (line1 == &uni_blank)
- {
+ {
line = line2;
field = join_field_2;
}
else
- {
+ {
line = line1;
field = join_field_1;
}
@@ -416,7 +647,7 @@
o = o->next;
if (o == NULL)

View File

@ -598,7 +598,7 @@ diff -urNp coreutils-7.1-orig/src/ls.c coreutils-7.1/src/ls.c
+"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\n\
emit_size_note ();
diff -urNp coreutils-7.1-orig/src/mkdir.c coreutils-7.1/src/mkdir.c
--- coreutils-7.1-orig/src/mkdir.c 2008-10-19 21:47:57.000000000 +0200
+++ coreutils-7.1/src/mkdir.c 2009-02-24 13:47:15.000000000 +0100

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 7.5
Release: 6%{?dist}
Version: 7.6
Release: 1%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -18,14 +18,11 @@ Source202: coreutils-su-l.pamd
Source203: coreutils-runuser-l.pamd
# From upstream
Patch1: coreutils-7.5-kojiutimensatskip.patch
Patch2: coreutils-7.5-ls-inode.patch
# Our patches
Patch100: coreutils-6.10-configuration.patch
Patch101: coreutils-6.10-manpages.patch
Patch102: coreutils-7.4-sttytcsadrain.patch
Patch103: coreutils-7.5-df-localdevice.patch
# sh-utils
Patch703: sh-utils-2.0.11-dateman.patch
@ -110,14 +107,11 @@ Libraries for coreutils package.
%setup -q
# From upstream
%patch1 -p1 -b .kojiutimensat
%patch2 -p1 -b .inode
# Our patches
%patch100 -p1 -b .configure
%patch101 -p1 -b .manpages
%patch102 -p1 -b .tcsadrain
%patch103 -p1 -b .localdevice
# sh-utils
%patch703 -p1 -b .dateman
@ -333,6 +327,10 @@ fi
%{_libdir}/coreutils
%changelog
* Sat Sep 12 2009 Ondrej Vasik <ovasik@redhat.com> - 7.6-1
- new upstream bugfix release 7.6, removed applied patches,
defuzzed the rest
* Thu Sep 10 2009 Ondrej Vasik <ovasik@redhat.com> - 7.5-6
- fix double free error in fold for singlebyte locales
(caused by multibyte patch)

View File

@ -1 +1 @@
ca9219c5b7efa533d552f61a3880f458 coreutils-7.5.tar.xz
a9fb9368e40205d70fc37b9fe441e8ec coreutils-7.6.tar.xz