futimens() fallback mode, tests, no longer double runuser to

/usr/bin/runuser
This commit is contained in:
Ondrej Vasik 2008-06-06 14:12:16 +00:00
parent 98cf8da1e8
commit c8e66e12c9
3 changed files with 101 additions and 30 deletions

View File

@ -1,18 +1,3 @@
diff --git a/lib/utimens.c b/lib/utimens.c
index 134310b..18a8e7c 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -103,6 +103,10 @@ gl_futimens (int fd ATTRIBUTE_UNUSED,
if (fd < 0)
{
int result = utimensat (AT_FDCWD, file, timespec, 0);
+ /* Work around what might be a koji xen kernel bug):
+ http://bugzilla.redhat.com/442352 */
+ if (result == 280)
+ result = 0;
if (result == 0 || errno != ENOSYS)
return result;
}
diff -urN coreutils-6.12-orig/tests/misc/cut coreutils-6.12/tests/misc/cut
--- coreutils-6.12-orig/tests/misc/cut 2008-05-17 08:41:11.000000000 +0200
+++ coreutils-6.12/tests/misc/cut 2008-06-02 11:13:08.000000000 +0200
@ -31,23 +16,11 @@ diff -urN coreutils-6.12-orig/tests/misc/cut coreutils-6.12/tests/misc/cut
# None of the following invalid ranges provoked an error up to coreutils-6.9.
- ['inval1', qw(-f 2-0), {IN=>''}, {OUT=>''}, {EXIT=>1},
- {ERR=>"$prog: invalid decreasing range\n$try"}],
+# ['inval1', qw(-f 2-0), {IN=>''}, {OUT=>''}, {EXIT=>1},
+# {ERR=>"$prog: invalid decreasing range\n$try"}],
+ ['inval1', qw(-f 2-0), {IN=>''}, {OUT=>''}, {EXIT=>1},
+ {ERR=>"$prog: invalid byte, character or field list\n$try"}],
['inval2', qw(-f -), {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
['inval3', '-f', '4,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
['inval4', '-f', '1-2,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
diff -urNp coreutils-6.11-orig/tests/touch/no-create-missing coreutils-6.11/tests/touch/no-create-missing
--- coreutils-6.11-orig/tests/touch/no-create-missing 2008-04-19 23:34:23.000000000 +0200
+++ coreutils-6.11/tests/touch/no-create-missing 2008-04-24 12:34:52.000000000 +0200
@@ -36,7 +36,7 @@ test="$abs_top_builddir/src/test"
# This test is ineffective unless /dev/stdout also works.
if "$test" -w /dev/stdout >/dev/null &&
"$test" ! -w /dev/stdout >&-; then
- touch -c - >&- 2> /dev/null || fail=1
+ #touch -c - >&- || fail=1
touch -cm - >&- 2> /dev/null || fail=1
touch -ca - >&- 2> /dev/null || fail=1
fi
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

View File

@ -0,0 +1,87 @@
diff -urNp coreutils-6.12-orig/lib/utimens.c coreutils-6.12/lib/utimens.c
--- coreutils-6.12-orig/lib/utimens.c 2008-06-06 12:49:08.000000000 +0200
+++ coreutils-6.12/lib/utimens.c 2008-06-06 12:52:24.000000000 +0200
@@ -103,6 +103,17 @@ gl_futimens (int fd ATTRIBUTE_UNUSED,
if (fd < 0)
{
int result = utimensat (AT_FDCWD, file, timespec, 0);
+# ifdef __linux__
+ /* Work around what might be a kernel bug:
+ http://bugzilla.redhat.com/442352
+ http://bugzilla.redhat.com/449910
+ It appears that utimensat can mistakenly return 280 rather
+ than 0 to indicate success.
+ FIXME: remove in 2010 or whenever the offending kernels
+ are no longer in common use. */
+ if (0 < result)
+ errno = ENOSYS;
+# endif
if (result == 0 || errno != ENOSYS)
return result;
}
@@ -110,6 +121,17 @@ gl_futimens (int fd ATTRIBUTE_UNUSED,
#if HAVE_FUTIMENS
{
int result = futimens (fd, timespec);
+# ifdef __linux__
+ /* Work around what might be a kernel bug:
+ http://bugzilla.redhat.com/442352
+ http://bugzilla.redhat.com/449910
+ It appears that utimens can mistakenly return 280 rather
+ than 0 to indicate success.
+ FIXME: remove in 2010 or whenever the offending kernels
+ are no longer in common use. */
+ if (0 < result)
+ errno = ENOSYS;
+# endif
if (result == 0 || errno != ENOSYS)
return result;
}
diff -urNp coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
--- coreutils-6.12-orig/tests/Makefile.am 2008-06-05 10:52:49.000000000 +0200
+++ coreutils-6.12/tests/Makefile.am 2008-06-05 13:23:02.000000000 +0200
@@ -215,6 +215,7 @@ TESTS = \
misc/tty-eof \
misc/unexpand \
misc/uniq \
+ misc/utimensat-touchcp \
chmod/c-option \
chmod/equal-x \
chmod/equals \
diff -urNp coreutils-6.12-orig/tests/misc/utimensat-touchcp coreutils-6.12/tests/misc/utimensat-touchcp
--- coreutils-6.12-orig/tests/misc/utimensat-touchcp 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-6.12/tests/misc/utimensat-touchcp 2008-06-05 13:22:01.000000000 +0200
@@ -0,0 +1,33 @@
+#!/bin/sh
+# Make sure touch -r and cp -pr works without hanging.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ touch --version
+ cp --version
+fi
+
+. $srcdir/test-lib.sh
+
+touch a.old || framework_failure
+sleep 1
+
+fail=0
+
+#check for touch
+touch -r a.old a || fail=1
+ls -l --full-time a >time1
+ls -l --full-time a.old >time2
+sed -i 's/a.old/a/' time2
+cmp time1 time2 > /dev/null 2>&1 || fail=1
+test $fail = 1 && diff time1 time2 2> /dev/null
+
+#check for cp
+cp -pr a.old b || fail=1
+ls -l --full-time a >time1
+ls -l --full-time a.old >time2
+sed -i 's/a.old/a/' time2
+cmp time1 time2 > /dev/null 2>&1 || fail=1
+test $fail = 1 && diff time1 time2 2> /dev/null
+
+(exit $fail); exit $fail

View File

@ -1,7 +1,7 @@
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
Name: coreutils
Version: 6.12
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -25,6 +25,7 @@ Patch100: coreutils-6.10-configuration.patch
Patch101: coreutils-6.10-manpages.patch
#Patch102: coreutils-6.10-longoptions.patch
Patch103: coreutils-6.11-sparc-shafix.patch
Patch104: coreutils-6.12-utimenstouchcp.patch
# sh-utils
Patch703: sh-utils-2.0.11-dateman.patch
@ -105,6 +106,7 @@ cd %name-%version
%patch101 -p1 -b .manpages
#%patch102 -p1 -b .longopt
%patch103 -p1 -b .sparc
%patch104 -p1 -b .utimensat
# sh-utils
%patch703 -p1 -b .dateman
@ -131,6 +133,7 @@ cd %name-%version
chmod a+x tests/misc/sort-mb-tests
chmod a+x tests/misc/id-context
chmod a+x tests/misc/utimensat-touchcp
#fix typos/mistakes in localized documentation(#439410, #440056)
for pofile in $(find ./po/*.p*)
@ -206,6 +209,8 @@ install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.c
# su
install -m 4755 src/su $RPM_BUILD_ROOT/bin
install -m 755 src/runuser $RPM_BUILD_ROOT/sbin
# do not ship runuser in /usr/bin/runuser
rm -rf $RPM_BUILD_ROOT/usr/bin/runuser
# These come from util-linux and/or procps.
for i in hostname uptime kill ; do
@ -307,6 +312,12 @@ fi
/sbin/runuser
%changelog
* Fri Jun 06 2008 Ondrej Vasik <ovasik@redhat.com> - 6.12-3
- workaround for koji failures(#449910, #442352) now
preserves timestamps correctly - fallback to supported
functions, added test case
- runuser binary is no longer doubled in /usr/bin/runuser
* Wed Jun 04 2008 Ondrej Vasik <ovasik@redhat.com> - 6.12-2
- workaround for strange koji failures(#449910,#442352)
- fixed ls -ZC segfault(#449866, introduced by 6.10-1