From 8724b4e49e773efa67255b49513ff4be296c3fbe Mon Sep 17 00:00:00 2001 From: Ondrej Vasik Date: Mon, 23 Nov 2009 09:53:12 +0000 Subject: [PATCH] Various fixes from rawhide --- coreutils-7.6-ftssubmount.patch | 24 ++++++++ coreutils-7.6-ls-derefdanglinginode.patch | 65 +++++++++++++++++++++ coreutils-7.6-ls-infloop.patch | 71 +++++++++++++++++++++++ coreutils-7.6-tail-F-renaming.patch | 18 ++++++ coreutils-7.6-trueexecve.patch | 30 ++++++++++ coreutils-DIR_COLORS | 4 +- coreutils-DIR_COLORS.256color | 4 +- coreutils-DIR_COLORS.lightbgcolor | 4 +- coreutils.spec | 39 ++++++++++--- 9 files changed, 249 insertions(+), 10 deletions(-) create mode 100644 coreutils-7.6-ftssubmount.patch create mode 100644 coreutils-7.6-ls-derefdanglinginode.patch create mode 100644 coreutils-7.6-ls-infloop.patch create mode 100644 coreutils-7.6-tail-F-renaming.patch create mode 100644 coreutils-7.6-trueexecve.patch diff --git a/coreutils-7.6-ftssubmount.patch b/coreutils-7.6-ftssubmount.patch new file mode 100644 index 0000000..c42a337 --- /dev/null +++ b/coreutils-7.6-ftssubmount.patch @@ -0,0 +1,24 @@ +diff -urNp coreutils-7.6-orig/lib/fts.c coreutils-7.6/lib/fts.c +--- coreutils-7.6-orig/lib/fts.c 2009-09-10 19:33:40.000000000 +0200 ++++ coreutils-7.6/lib/fts.c 2009-11-18 14:34:17.000000000 +0100 +@@ -1276,6 +1276,20 @@ fts_build (register FTS *sp, int type) + opening it. */ + if (cur->fts_info == FTS_NSOK) + cur->fts_info = fts_stat(sp, cur, false); ++ else if (sp->fts_options & FTS_TIGHT_CYCLE_CHECK) { ++ /* Now read the stat info again after opening a directory to ++ * reveal eventual changes caused by a submount triggered by ++ * the traversal. But do it only for utilities which use ++ * FTS_TIGHT_CYCLE_CHECK. Therefore, only find and du ++ * benefit/suffer from this feature for now. ++ */ ++ LEAVE_DIR (sp, cur, "4"); ++ fts_stat (sp, cur, false); ++ if (! enter_dir (sp, cur)) { ++ __set_errno (ENOMEM); ++ return NULL; ++ } ++ } + + /* + * Nlinks is the number of possible entries of type directory in the diff --git a/coreutils-7.6-ls-derefdanglinginode.patch b/coreutils-7.6-ls-derefdanglinginode.patch new file mode 100644 index 0000000..a0afc83 --- /dev/null +++ b/coreutils-7.6-ls-derefdanglinginode.patch @@ -0,0 +1,65 @@ +diff -urNp coreutils-7.6-orig/src/ls.c coreutils-7.6/src/ls.c +--- coreutils-7.6-orig/src/ls.c 2009-11-23 10:31:08.000000000 +0100 ++++ coreutils-7.6/src/ls.c 2009-11-23 10:35:47.000000000 +0100 +@@ -3592,6 +3592,18 @@ format_group_width (gid_t g) + } + + ++/* Return a pointer to a formatted version of F->stat.st_ino, ++ possibly using buffer, BUF, of length BUFLEN, which must be at least ++ INT_BUFSIZE_BOUND (uintmax_t) bytes. */ ++static char * ++format_inode (char *buf, size_t buflen, const struct fileinfo *f) ++{ ++ assert (INT_BUFSIZE_BOUND (uintmax_t) <= buflen); ++ return (f->stat.st_ino == NOT_AN_INODE_NUMBER ++ ? (char *) "?" ++ : umaxtostr (f->stat.st_ino, buf)); ++} ++ + /* Print info about f in scontext format */ + static void + print_scontext_format (const struct fileinfo *f) +@@ -3713,9 +3725,7 @@ print_long_format (const struct fileinfo + { + char hbuf[INT_BUFSIZE_BOUND (uintmax_t)]; + sprintf (p, "%*s ", inode_number_width, +- (f->stat.st_ino == NOT_AN_INODE_NUMBER +- ? "?" +- : umaxtostr (f->stat.st_ino, hbuf))); ++ format_inode (hbuf, sizeof hbuf, f)); + /* Increment by strlen (p) here, rather than by inode_number_width + 1. + The latter is wrong when inode_number_width is zero. */ + p += strlen (p); +@@ -4105,7 +4115,7 @@ print_file_name_and_frills (const struct + + if (print_inode) + printf ("%*s ", format == with_commas ? 0 : inode_number_width, +- umaxtostr (f->stat.st_ino, buf)); ++ format_inode (buf, sizeof buf, f)); + + if (print_block_size) + printf ("%*s ", format == with_commas ? 0 : block_size_width, +diff -urNp coreutils-7.6-orig/tests/ls/dangle coreutils-7.6/tests/ls/dangle +--- coreutils-7.6-orig/tests/ls/dangle 2009-09-01 13:01:16.000000000 +0200 ++++ coreutils-7.6/tests/ls/dangle 2009-11-23 10:37:44.000000000 +0100 +@@ -26,6 +26,9 @@ fi + ln -s no-such-file dangle || framework_failure + mkdir -p dir/sub || framework_failure + ln -s dir slink-to-dir || framework_failure ++mkdir d || framework_failure ++ln -s no-such d/dangle || framework_failure ++echo '? dangle' > subdir_exp || framework_failure + + fail=0 + +@@ -50,4 +53,9 @@ EOF + + compare out exp || fail=1 + ++# Ensure that ls -Li prints "?" as the inode of a dangling symlink. ++rm -f out ++ls -Li d > out 2>/dev/null && fail=1 ++compare out subdir_exp || fail=1 ++ + Exit $fail diff --git a/coreutils-7.6-ls-infloop.patch b/coreutils-7.6-ls-infloop.patch new file mode 100644 index 0000000..54d0876 --- /dev/null +++ b/coreutils-7.6-ls-infloop.patch @@ -0,0 +1,71 @@ +diff -urNp coreutils-7.6-orig/doc/coreutils.texi coreutils-7.6/doc/coreutils.texi +--- coreutils-7.6-orig/doc/coreutils.texi 2009-11-23 10:21:55.000000000 +0100 ++++ coreutils-7.6/doc/coreutils.texi 2009-11-23 10:24:03.000000000 +0100 +@@ -6113,8 +6113,9 @@ Exit status: + 1 minor problems (e.g., failure to access a file or directory not + specified as a command line argument. This happens when listing a + directory in which entries are actively being removed or renamed.) +-2 serious trouble (e.g., memory exhausted, invalid option or failure +- to access file or directory specified as a command line argument) ++2 serious trouble (e.g., memory exhausted, invalid option, failure ++ to access a file or directory specified as a command line argument ++ or a directory loop) + @end display + + Also see @ref{Common options}. +diff -urNp coreutils-7.6-orig/src/ls.c coreutils-7.6/src/ls.c +--- coreutils-7.6-orig/src/ls.c 2009-11-23 10:21:55.000000000 +0100 ++++ coreutils-7.6/src/ls.c 2009-11-23 10:24:40.000000000 +0100 +@@ -2494,6 +2494,7 @@ print_dir (char const *name, char const + error (0, 0, _("%s: not listing already-listed directory"), + quotearg_colon (name)); + closedir (dirp); ++ set_exit_status (true); + return; + } + +diff -urNp coreutils-7.6-orig/tests/ls/infloop coreutils-7.6/tests/ls/infloop +--- coreutils-7.6-orig/tests/ls/infloop 2009-09-01 13:01:16.000000000 +0200 ++++ coreutils-7.6/tests/ls/infloop 2009-11-23 10:28:45.000000000 +0100 +@@ -2,6 +2,7 @@ + # show that the following no longer makes ls infloop + # mkdir loop; cd loop; ln -s ../loop sub; ls -RL + ++# Also ensure ls exits with status = 2 in that case. + # Copyright (C) 2001-2002, 2004, 2006-2009 Free Software Foundation, Inc. + + # This program is free software: you can redistribute it and/or modify +@@ -27,21 +28,22 @@ fi + mkdir loop || framework_failure + ln -s ../loop loop/sub || framework_failure + +-fail=0 +- +-ls -RL loop 2>err | head -n 7 > out +-# With an inf-looping ls, out will contain these 7 lines: +-cat < bad ++cat <<\EOF > exp-out || framework_failure + loop: + sub ++EOF + +-loop/sub: +-sub +- +-loop/sub/sub: ++cat <<\EOF > exp-err || framework_failure ++ls: loop/sub: not listing already-listed directory + EOF + +-# Make sure we don't get the "bad" output. +-compare out bad > /dev/null 2>&1 && fail=1 ++fail=0 ++ ++timeout 1 ls -RL loop 2>err > out ++# Ensure that ls exits with status 2 upon detecting a cycle ++test $? = 2 || fail=1 ++ ++compare err exp-err || fail=1 ++compare out exp-out || fail=1 + + Exit $fail diff --git a/coreutils-7.6-tail-F-renaming.patch b/coreutils-7.6-tail-F-renaming.patch new file mode 100644 index 0000000..01cb5a9 --- /dev/null +++ b/coreutils-7.6-tail-F-renaming.patch @@ -0,0 +1,18 @@ +diff -urNp coreutils-7.6-orig/src/tail.c coreutils-7.6/src/tail.c +--- coreutils-7.6-orig/src/tail.c 2009-09-10 19:33:26.000000000 +0200 ++++ coreutils-7.6/src/tail.c 2009-11-18 14:43:19.000000000 +0100 +@@ -1357,7 +1357,13 @@ tail_forever_inotify (int wd, struct Fil + + if (ev->mask & (IN_ATTRIB | IN_DELETE_SELF | IN_MOVE_SELF)) + { +- if (ev->mask & (IN_DELETE_SELF | IN_MOVE_SELF)) ++ /* For IN_DELETE_SELF, we always want to remove the watch. ++ However, for IN_MOVE_SELF (the file we're watching has ++ been clobbered via a rename), when tailing by NAME, we ++ must continue to watch the file. It's only when following ++ by file descriptor that we must remove the watch. */ ++ if ((ev->mask & IN_DELETE_SELF) ++ || ((ev->mask & IN_MOVE_SELF) && follow_mode == Follow_descriptor)) + { + inotify_rm_watch (wd, f[i].wd); + hash_delete (wd_table, &(f[i])); diff --git a/coreutils-7.6-trueexecve.patch b/coreutils-7.6-trueexecve.patch new file mode 100644 index 0000000..9d9ac08 --- /dev/null +++ b/coreutils-7.6-trueexecve.patch @@ -0,0 +1,30 @@ +diff -urNp coreutils-7.6-orig/src/true.c coreutils-7.6/src/true.c +--- coreutils-7.6-orig/src/true.c 2009-09-01 13:01:16.000000000 +0200 ++++ coreutils-7.6/src/true.c 2009-11-18 15:00:22.000000000 +0100 +@@ -54,18 +54,19 @@ Usage: %s [ignored command line argument + int + main (int argc, char **argv) + { +- initialize_main (&argc, &argv); +- set_program_name (argv[0]); +- setlocale (LC_ALL, ""); +- bindtextdomain (PACKAGE, LOCALEDIR); +- textdomain (PACKAGE); +- +- atexit (close_stdout); + + /* Recognize --help or --version only if it's the only command-line + argument. */ + if (argc == 2) + { ++ initialize_main (&argc, &argv); ++ set_program_name (argv[0]); ++ setlocale (LC_ALL, ""); ++ bindtextdomain (PACKAGE, LOCALEDIR); ++ textdomain (PACKAGE); ++ ++ atexit (close_stdout); ++ + if (STREQ (argv[1], "--help")) + usage (EXIT_STATUS); + diff --git a/coreutils-DIR_COLORS b/coreutils-DIR_COLORS index 0e07569..ce0faa8 100644 --- a/coreutils-DIR_COLORS +++ b/coreutils-DIR_COLORS @@ -1,5 +1,5 @@ # Configuration file for the color ls utility -# Synchronized with coreutils 7.1 dircolors +# Synchronized with coreutils 8.0 dircolors # This file goes in the /etc directory, and must be world readable. # You can copy this file to .dir_colors in your $HOME directory to override # the system defaults. @@ -183,6 +183,8 @@ EXEC 01;32 .xcf 01;35 .xwd 01;35 .yuv 01;35 +.cgm 01;35 +.emf 01;35 # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions .axv 01;35 diff --git a/coreutils-DIR_COLORS.256color b/coreutils-DIR_COLORS.256color index 4628941..f72884e 100644 --- a/coreutils-DIR_COLORS.256color +++ b/coreutils-DIR_COLORS.256color @@ -1,6 +1,6 @@ # Configuration file for the 256color ls utility # This file goes in the /etc directory, and must be world readable. -# Synchronized with coreutils 7.1 dircolors +# Synchronized with coreutils 8.0 dircolors # You can copy this file to .dir_colors in your $HOME directory to override # the system defaults. # In the case that you are not satisfied with supplied colors, please @@ -158,6 +158,8 @@ EXEC 01;38;5;34 .xcf 01;38;5;13 .xwd 01;38;5;13 .yuv 01;38;5;13 +.cgm 01;38;5;13 +.emf 01;38;5;13 # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions .axv 01;38;5;13 diff --git a/coreutils-DIR_COLORS.lightbgcolor b/coreutils-DIR_COLORS.lightbgcolor index d254559..a1df64e 100644 --- a/coreutils-DIR_COLORS.lightbgcolor +++ b/coreutils-DIR_COLORS.lightbgcolor @@ -1,5 +1,5 @@ # Configuration file for the color ls utility - modified for gray backgrounds -# Synchronized with coreutils 7.1 dircolors +# Synchronized with coreutils 8.0 dircolors # This file goes in the /etc directory, and must be world readable. # You can copy this file to .dir_colors in your $HOME directory to override # the system defaults. @@ -160,6 +160,8 @@ EXEC 00;32 .xcf 00;35 .xwd 00;35 .yuv 00;35 +.cgm 00;35 +.emf 00;35 # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions .axv 00;35 diff --git a/coreutils.spec b/coreutils.spec index 06648b5..cd60a39 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 7.6 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -20,6 +20,11 @@ Source203: coreutils-runuser-l.pamd # From upstream Patch1: coreutils-cpxattrreadonly.patch Patch2: coreutils-7.6-lzipcolor.patch +Patch3: coreutils-7.6-ftssubmount.patch +Patch4: coreutils-7.6-tail-F-renaming.patch +Patch5: coreutils-7.6-trueexecve.patch +Patch6: coreutils-7.6-ls-infloop.patch +Patch7: coreutils-7.6-ls-derefdanglinginode.patch # Our patches Patch100: coreutils-6.10-configuration.patch @@ -111,6 +116,10 @@ Libraries for coreutils package. # From upstream %patch1 -p1 -b .roxattr %patch2 -p1 -b .lzip +%patch3 -p1 -b .ftssubmount +%patch4 -p1 -b .renaming +%patch5 -p1 -b .execve +%patch6 -p1 -b .infloop # Our patches %patch100 -p1 -b .configure @@ -138,6 +147,9 @@ Libraries for coreutils package. %patch950 -p1 -b .selinux %patch951 -p1 -b .selinuxman +#upstream apply later +%patch7 -p1 -b .inode + chmod a+x tests/misc/sort-mb-tests #fix typos/mistakes in localized documentation(#439410, #440056) @@ -254,15 +266,15 @@ rm -rf $RPM_BUILD_ROOT # coreutils.info. else their postun'll be run too late # and install-info will fail badly because of duplicates for file in sh-utils textutils fileutils; do - if [ -f %{_infodir}/$file.info ]; then - /sbin/install-info --delete %{_infodir}/$file.info --dir=%{_infodir}/dir &> /dev/null || : + if [ -f %{_infodir}/$file.info.gz ]; then + /sbin/install-info --delete %{_infodir}/$file.info.gz --dir=%{_infodir}/dir &> /dev/null || : fi done %preun if [ $1 = 0 ]; then - if [ -f %{_infodir}/%{name}.info ]; then - /sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || : + if [ -f %{_infodir}/%{name}.info.gz ]; then + /sbin/install-info --delete %{_infodir}/%{name}.info.gz %{_infodir}/dir || : fi fi @@ -270,8 +282,8 @@ fi /bin/grep -v '(sh-utils)\|(fileutils)\|(textutils)' %{_infodir}/dir > \ %{_infodir}/dir.rpmmodify || exit 0 /bin/mv -f %{_infodir}/dir.rpmmodify %{_infodir}/dir -if [ -f %{_infodir}/%{name}.info ]; then - /sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || : +if [ -f %{_infodir}/%{name}.info.gz ]; then + /sbin/install-info %{_infodir}/%{name}.info.gz %{_infodir}/dir || : fi %files -f %{name}.lang @@ -329,6 +341,19 @@ fi %{_libdir}/coreutils %changelog +* Mon Nov 23 2009 Ondrej Vasik - 7.6-6 +- update /etc/DIR_COLORS* files +- ls -LR exits with status 2, not 0, when it encounters + a cycle(#525402) +- ls: print "?", not "0" as inode of dereferenced dangling + symlink(#525400) +- /bin/{true,false} - do not segfault with abusive + execve() usage (#537684) +- tail -F no longer can fail to track a file after + it's been rotated (#537664) +- du - do not fail on a submount during traversal (#501848) +- call the install-info on .gz info files + * Tue Sep 22 2009 Ondrej Vasik - 7.6-5 - improve and correct runuser documentation (#524805)