Compare commits

...
Sign in to create a new pull request.

10 commits

Author SHA1 Message Date
Fedora Release Engineering
542aafff5f dist-git conversion 2010-07-28 12:12:05 +00:00
Ondrej Vasik
fe00b21308 Cumulative update from rawhide 2010-04-28 16:32:37 +00:00
Ondrej Vasik
475144d01b fix typo in DIR_COLORS* files, remove .orig file from patch 2010-01-14 08:31:12 +00:00
Ondrej Vasik
2b212bd2dc require gmp-devel/gmp for large numbers support(#552846), various fixes
from F-12/rawhide
2010-01-12 14:58:44 +00:00
Ondrej Vasik
4e6805255c CVE-2009-4135 : Unsafe temporary directory use in distcheck rule 2009-12-11 18:50:15 +00:00
Bill Nottingham
32b6f1c33a Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:33:09 +00:00
Ondrej Vasik
f58d89bcea ls -i print consistent inode numbers also for mount points(#453709),
process install-info only with info files present(#515970), fix
    misalignment in ls -l for fr_FR.UTF_8 locales(#517626)
2009-09-08 08:46:55 +00:00
Kamil Dudka
03331ced26 - ls -1U with two or more arguments (or with -R or -s) works properly again
- install runs faster again with SELinux enabled (#479502)
2009-08-05 08:56:45 +00:00
Ondrej Vasik
4f510d965d cumulative F-11 coreutils update - fixes for multibyte patch and
selinux/xattr support
2009-07-08 14:44:11 +00:00
Jesse Keating
f16db63b05 Initialize branch F-11 for coreutils 2009-04-15 05:43:18 +00:00
20 changed files with 1429 additions and 164 deletions

View file

View file

@ -1,21 +0,0 @@
# Makefile for source rpm: coreutils
# $Id$
NAME := coreutils
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attempt a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View file

@ -0,0 +1,65 @@
diff -urNp coreutils-7.2-orig/src/ls.c coreutils-7.2/src/ls.c
--- coreutils-7.2-orig/src/ls.c 2010-01-12 15:54:16.000000000 +0100
+++ coreutils-7.2/src/ls.c 2010-01-12 15:54:57.000000000 +0100
@@ -3593,6 +3593,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)
@@ -3714,9 +3726,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);
@@ -4106,7 +4116,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.2-orig/tests/ls/dangle coreutils-7.2/tests/ls/dangle
--- coreutils-7.2-orig/tests/ls/dangle 2009-02-27 17:36:00.000000000 +0100
+++ coreutils-7.2/tests/ls/dangle 2010-01-12 15:54:57.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

View file

@ -0,0 +1,454 @@
diff -urNp coreutils-7.2-orig/lib/gnulib.mk coreutils-7.2/lib/gnulib.mk
--- coreutils-7.2-orig/lib/gnulib.mk 2009-03-26 09:12:33.000000000 +0100
+++ coreutils-7.2/lib/gnulib.mk 2009-09-08 10:08:09.000000000 +0200
@@ -1600,6 +1600,12 @@ EXTRA_DIST += str-kmp.h
## end gnulib module mbsstr
+## begin gnulib module mbsalign
+
+libcoreutils_a_SOURCES += mbsalign.c mbsalign.h
+
+## end gnulib module mbsalign
+
## begin gnulib module mbswidth
libcoreutils_a_SOURCES += mbswidth.h mbswidth.c
diff -urNp coreutils-7.2-orig/lib/mbsalign.c coreutils-7.2/lib/mbsalign.c
--- coreutils-7.2-orig/lib/mbsalign.c 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-7.2/lib/mbsalign.c 2009-08-15 17:25:32.000000000 +0200
@@ -0,0 +1,236 @@
+/* Align/Truncate a string in a given screen width
+ 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/>. */
+
+/* Written by Pádraig Brady. */
+
+#include <config.h>
+#include "mbsalign.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <limits.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+/* Replace non printable chars.
+ Return 1 if replacement made, 0 otherwise. */
+
+static bool
+wc_ensure_printable (wchar_t *wchars)
+{
+ bool replaced = false;
+ wchar_t *wc = wchars;
+ while (*wc)
+ {
+ if (!iswprint ((wint_t) *wc))
+ {
+ *wc = 0xFFFD; /* L'\uFFFD' (replacement char) */
+ replaced = true;
+ }
+ wc++;
+ }
+ return replaced;
+}
+
+/* Truncate wchar string to width cells.
+ * Returns number of cells used. */
+
+static size_t
+wc_truncate (wchar_t *wc, size_t width)
+{
+ size_t cells = 0;
+ int next_cells = 0;
+
+ while (*wc)
+ {
+ next_cells = wcwidth (*wc);
+ if (next_cells == -1) /* non printable */
+ {
+ *wc = 0xFFFD; /* L'\uFFFD' (replacement char) */
+ next_cells = 1;
+ }
+ if (cells + next_cells > width)
+ break;
+ cells += next_cells;
+ wc++;
+ }
+ *wc = L'\0';
+ return cells;
+}
+
+/* FIXME: move this function to gnulib as it's missing on:
+ OpenBSD 3.8, IRIX 5.3, Solaris 2.5.1, mingw, BeOS */
+
+static int
+rpl_wcswidth (const wchar_t *s, size_t n)
+{
+ int ret = 0;
+
+ while (n-- > 0 && *s != L'\0')
+ {
+ int nwidth = wcwidth (*s++);
+ if (nwidth == -1) /* non printable */
+ return -1;
+ if (ret > (INT_MAX - nwidth)) /* overflow */
+ return -1;
+ ret += nwidth;
+ }
+
+ return ret;
+}
+
+/* Write N_SPACES space characters to DEST while ensuring
+ nothing is written beyond DEST_END. A terminating NUL
+ is always added to DEST.
+ A pointer to the terminating NUL is returned. */
+
+static char*
+mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
+{
+ /* FIXME: Should we pad with "figure space" (\u2007)
+ if non ascii data present? */
+ while (n_spaces-- && (dest < dest_end))
+ *dest++ = ' ';
+ *dest = '\0';
+ return dest;
+}
+
+/* Align a string, SRC, in a field of *WIDTH columns, handling multi-byte
+ characters; write the result into the DEST_SIZE-byte buffer, DEST.
+ ALIGNMENT specifies whether to left- or right-justify or to center.
+ If SRC requires more than *WIDTH columns, truncate it to fit.
+ When centering, the number of trailing spaces may be one less than the
+ number of leading spaces. The FLAGS parameter is unused at present.
+ Return the length in bytes required for the final result, not counting
+ the trailing NUL. A return value of DEST_SIZE or larger means there
+ wasn't enough space. DEST will be NUL terminated in any case.
+ Return (size_t) -1 upon error (invalid multi-byte sequence in SRC,
+ or malloc failure).
+ Update *WIDTH to indicate how many columns were used before padding. */
+
+size_t
+mbsalign (const char *src, char *dest, size_t dest_size,
+ size_t *width, mbs_align_t align, int flags)
+{
+ size_t ret = -1;
+ size_t src_size = strlen (src) + 1;
+ char *newstr = NULL;
+ wchar_t *str_wc = NULL;
+ const char *str_to_print = src;
+ size_t n_cols = src_size - 1;
+ size_t n_used_bytes = n_cols; /* Not including NUL */
+ size_t n_spaces = 0;
+ bool conversion = false;
+ bool wc_enabled = false;
+
+ /* In multi-byte locales convert to wide characters
+ to allow easy truncation. Also determine number
+ of screen columns used. */
+ if (MB_CUR_MAX > 1)
+ {
+ size_t src_chars = mbstowcs (NULL, src, 0);
+ if (src_chars == (size_t) -1)
+ goto mbsalign_cleanup;
+ src_chars += 1; /* make space for NUL */
+ str_wc = malloc (src_chars * sizeof (wchar_t));
+ if (str_wc == NULL)
+ goto mbsalign_cleanup;
+ if (mbstowcs (str_wc, src, src_chars) > 0)
+ {
+ str_wc[src_chars - 1] = L'\0';
+ wc_enabled = true;
+ conversion = wc_ensure_printable (str_wc);
+ n_cols = rpl_wcswidth (str_wc, src_chars);
+ }
+ }
+
+ /* If we transformed or need to truncate the source string
+ then create a modified copy of it. */
+ if (conversion || (n_cols > *width))
+ {
+ newstr = malloc (src_size);
+ if (newstr == NULL)
+ goto mbsalign_cleanup;
+ str_to_print = newstr;
+ if (wc_enabled)
+ {
+ n_cols = wc_truncate (str_wc, *width);
+ n_used_bytes = wcstombs (newstr, str_wc, src_size);
+ }
+ else
+ {
+ n_cols = *width;
+ n_used_bytes = n_cols;
+ memcpy (newstr, src, n_cols);
+ newstr[n_cols] = '\0';
+ }
+ }
+
+ if (*width > n_cols)
+ n_spaces = *width - n_cols;
+
+ /* indicate to caller how many cells needed (not including padding). */
+ *width = n_cols;
+
+ /* indicate to caller how many bytes needed (not including NUL). */
+ ret = n_used_bytes + (n_spaces * 1);
+
+ /* Write as much NUL terminated output to DEST as possible. */
+ if (dest_size != 0)
+ {
+ char *dest_end = dest + dest_size - 1;
+ size_t start_spaces = n_spaces / 2 + n_spaces % 2;
+ size_t end_spaces = n_spaces / 2;
+
+ switch (align)
+ {
+ case MBS_ALIGN_CENTER:
+ start_spaces = n_spaces / 2 + n_spaces % 2;
+ end_spaces = n_spaces / 2;
+ break;
+ case MBS_ALIGN_LEFT:
+ start_spaces = 0;
+ end_spaces = n_spaces;
+ break;
+ case MBS_ALIGN_RIGHT:
+ start_spaces = n_spaces;
+ end_spaces = 0;
+ break;
+ }
+
+ dest = mbs_align_pad (dest, dest_end, start_spaces);
+ dest = mempcpy(dest, str_to_print, MIN (n_used_bytes, dest_end - dest));
+ dest = mbs_align_pad (dest, dest_end, end_spaces);
+ }
+
+mbsalign_cleanup:
+
+ free (str_wc);
+ free (newstr);
+
+ return ret;
+}
+/*
+ * Local variables:
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -urNp coreutils-7.2-orig/lib/mbsalign.h coreutils-7.2/lib/mbsalign.h
--- coreutils-7.2-orig/lib/mbsalign.h 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-7.2/lib/mbsalign.h 2009-08-15 17:25:32.000000000 +0200
@@ -0,0 +1,23 @@
+/* Align/Truncate a string in a given screen width
+ 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/>. */
+
+#include <stddef.h>
+
+typedef enum { MBS_ALIGN_LEFT, MBS_ALIGN_RIGHT, MBS_ALIGN_CENTER } mbs_align_t;
+
+size_t
+mbsalign (const char *src, char *dest, size_t dest_size,
+ size_t *width, mbs_align_t align, int flags);
diff -urNp coreutils-7.2-orig/src/ls.c coreutils-7.2/src/ls.c
--- coreutils-7.2-orig/src/ls.c 2009-09-08 10:00:39.000000000 +0200
+++ coreutils-7.2/src/ls.c 2009-09-08 10:13:41.000000000 +0200
@@ -63,6 +63,10 @@
#include <selinux/selinux.h>
#include <wchar.h>
+#if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+
/* Use SA_NOCLDSTOP as a proxy for whether the sigaction machinery is
present. */
#ifndef SA_NOCLDSTOP
@@ -105,6 +109,7 @@
#include "strftime.h"
#include "xstrtol.h"
#include "areadlink.h"
+#include "mbsalign.h"
#define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \
: (ls_mode == LS_MULTI_COL \
@@ -719,6 +724,11 @@ static char const *long_time_format[2] =
screen columns small, because many people work in windows with
only 80 columns. But make this as wide as the other string
below, for recent files. */
+ /* TRANSLATORS: ls output needs to be aligned for ease of reading,
+ so be wary of using variable width fields from the locale.
+ Note %b is handled specially by ls and aligned correctly.
+ Note also that specifying a width as in %5b is erroneous as strftime
+ will count bytes rather than characters in multibyte locales. */
N_("%b %e %Y"),
/* strftime format for recent files (younger than 6 months), in -l
output. This should contain the month, day and time (at
@@ -727,6 +737,11 @@ static char const *long_time_format[2] =
screen columns small, because many people work in windows with
only 80 columns. But make this as wide as the other string
above, for non-recent files. */
+ /* TRANSLATORS: ls output needs to be aligned for ease of reading,
+ so be wary of using variable width fields from the locale.
+ Note %b is handled specially by ls and aligned correctly.
+ Note also that specifying a width as in %5b is erroneous as strftime
+ will count bytes rather than characters in multibyte locales. */
N_("%b %e %H:%M")
};
@@ -1007,6 +1022,57 @@ dired_dump_obstack (const char *prefix,
}
}
+/* Read the abbreviated month names from the locale, to align them
+ and to determine the max width of the field and to truncate names
+ greater than our max allowed.
+ Note even though this handles multibyte locales correctly
+ it's not restricted to them as single byte locales can have
+ variable width abbreviated months and also precomputing/caching
+ the names was seen to increase the performance of ls significantly. */
+
+/* max number of display cells to use */
+enum { MAX_MON_WIDTH = 5 };
+/* In the unlikely event that the abmon[] storage is not big enough
+ an error message will be displayed, and we revert to using
+ unmodified abbreviated month names from the locale database. */
+static char abmon[12][MAX_MON_WIDTH * 2 * MB_LEN_MAX + 1];
+/* minimum width needed to align %b, 0 => don't use precomputed values. */
+static size_t required_mon_width;
+
+static size_t
+abmon_init (void)
+{
+#ifdef HAVE_NL_LANGINFO
+ required_mon_width = MAX_MON_WIDTH;
+ size_t curr_max_width;
+ do
+ {
+ curr_max_width = required_mon_width;
+ required_mon_width = 0;
+ for (int i = 0; i < 12; i++)
+ {
+ size_t width = curr_max_width;
+
+ int req = mbsalign (nl_langinfo (ABMON_1 + i),
+ abmon[i], sizeof (abmon[i]),
+ &width, MBS_ALIGN_LEFT, 0);
+
+ if (req == -1 || req >= sizeof(abmon[i]))
+ {
+ required_mon_width = 0; /* ignore precomputed strings. */
+ return required_mon_width;
+ }
+
+ required_mon_width = MAX (required_mon_width, width);
+ }
+ }
+ while (curr_max_width > required_mon_width);
+#endif
+
+ return required_mon_width;
+}
+
+
static size_t
dev_ino_hash (void const *x, size_t table_size)
{
@@ -1997,6 +2063,10 @@ decode_switches (int argc, char **argv)
}
}
}
+ /* Note we leave %5b etc. alone so user widths/flags are honoured. */
+ if (strstr(long_time_format[0],"%b") || strstr(long_time_format[1],"%b"))
+ if (!abmon_init())
+ error (0, 0, _("error initializing month strings"));
}
return optind;
@@ -3375,6 +3445,35 @@ print_current_files (void)
}
}
+/* Replace the first %b with precomputed aligned month names.
+ Note on glibc-2.7 on linux at least this speeds up the whole `ls -lU`
+ process by around 17%, compared to letting strftime() handle the %b. */
+
+static size_t
+align_nstrftime (char *src, size_t size, char const *fmt, struct tm const *tm,
+ int __utc, int __ns)
+{
+ const char *nfmt = fmt;
+ /* In the unlikely event that rpl_fmt below is not large enough,
+ the replacement is not done. A malloc here slows ls down by 2% */
+ char rpl_fmt[sizeof (abmon[0]) + 100];
+ char *pb = NULL;
+ if (required_mon_width && (pb = strstr (fmt, "%b")))
+ {
+ if (strlen(fmt) < (sizeof (rpl_fmt) - sizeof (abmon[0]) + 2))
+ {
+ char *pfmt = rpl_fmt;
+ nfmt = rpl_fmt;
+
+ pfmt = mempcpy (pfmt, fmt, pb - fmt);
+ pfmt = stpcpy (pfmt, abmon[tm->tm_mon]);
+ strcpy (pfmt, pb + 2);
+ }
+ }
+ size_t ret = nstrftime (src, size, nfmt, tm, __utc, __ns);
+ return ret;
+}
+
/* Return the expected number of columns in a long-format time stamp,
or zero if it cannot be calculated. */
@@ -3399,7 +3498,7 @@ long_time_expected_width (void)
if (tm)
{
size_t len =
- nstrftime (buf, sizeof buf, long_time_format[0], tm, 0, 0);
+ align_nstrftime (buf, sizeof buf, long_time_format[0], tm, 0, 0);
if (len != 0)
width = mbsnwidth (buf, len, 0);
}
@@ -3740,8 +3839,8 @@ print_long_format (const struct fileinfo
/* We assume here that all time zones are offset from UTC by a
whole number of seconds. */
- s = nstrftime (p, TIME_STAMP_LEN_MAXIMUM + 1, fmt,
- when_local, 0, when_timespec.tv_nsec);
+ s = align_nstrftime (p, TIME_STAMP_LEN_MAXIMUM + 1, fmt,
+ when_local, 0, when_timespec.tv_nsec);
}
if (s || !*p)

View file

@ -0,0 +1,71 @@
diff -urNp coreutils-7.2-orig/doc/coreutils.texi coreutils-7.2/doc/coreutils.texi
--- coreutils-7.2-orig/doc/coreutils.texi 2009-03-29 19:44:10.000000000 +0200
+++ coreutils-7.2/doc/coreutils.texi 2010-01-12 15:49:19.000000000 +0100
@@ -6100,8 +6100,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.2-orig/src/ls.c coreutils-7.2/src/ls.c
--- coreutils-7.2-orig/src/ls.c 2010-01-12 15:48:41.000000000 +0100
+++ coreutils-7.2/src/ls.c 2010-01-12 15:49:19.000000000 +0100
@@ -2471,6 +2471,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.2-orig/tests/ls/infloop coreutils-7.2/tests/ls/infloop
--- coreutils-7.2-orig/tests/ls/infloop 2009-02-27 17:36:00.000000000 +0100
+++ coreutils-7.2/tests/ls/infloop 2010-01-12 15:49:19.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-2008 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 <<EOF > 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

View file

@ -0,0 +1,30 @@
diff -urNp coreutils-7.2-orig/src/true.c coreutils-7.2/src/true.c
--- coreutils-7.2-orig/src/true.c 2009-03-29 19:43:41.000000000 +0200
+++ coreutils-7.2/src/true.c 2010-01-12 15:52:44.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);

View file

@ -0,0 +1,26 @@
diff -ruNp coreutils-7.2.orig/m4/jm-macros.m4 coreutils-7.2/m4/jm-macros.m4
--- coreutils-7.2.orig/m4/jm-macros.m4 2009-08-05 10:50:48.389482889 +0200
+++ coreutils-7.2/m4/jm-macros.m4 2009-08-05 10:53:37.894733210 +0200
@@ -47,7 +47,21 @@ AC_DEFUN([coreutils_MACROS],
AC_CHECK_FUNCS_ONCE([directio])
# Used by install.c.
- AC_CHECK_FUNCS_ONCE([matchpathcon_init_prefix])
+ coreutils_saved_libs=$LIBS
+ LIBS="$LIBS $LIB_SELINUX"
+ AC_CHECK_FUNCS([matchpathcon_init_prefix], [],
+ [
+ case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in
+ no:*) # SELinux disabled
+ ;;
+ *:no) # SELinux disabled
+ ;;
+ *)
+ AC_MSG_WARN([SELinux enabled, but matchpathcon_init_prefix not found])
+ AC_MSG_WARN([The install utility may run slowly])
+ esac
+ ])
+ LIBS=$coreutils_saved_libs
# Used by sort.c.
AC_CHECK_FUNCS_ONCE([nl_langinfo])

92
coreutils-7.4-ls-1U.patch Normal file
View file

@ -0,0 +1,92 @@
diff -ruNp coreutils-7.2.orig/src/ls.c coreutils-7.2/src/ls.c
--- coreutils-7.2.orig/src/ls.c 2009-08-05 10:50:48.432858145 +0200
+++ coreutils-7.2/src/ls.c 2009-08-05 10:52:21.066692900 +0200
@@ -2411,6 +2411,19 @@ print_dir (char const *name, char const
DEV_INO_PUSH (dir_stat.st_dev, dir_stat.st_ino);
}
+ if (recursive | print_dir_name)
+ {
+ if (!first)
+ DIRED_PUTCHAR ('\n');
+ first = false;
+ DIRED_INDENT ();
+ PUSH_CURRENT_DIRED_POS (&subdired_obstack);
+ dired_pos += quote_name (stdout, realname ? realname : name,
+ dirname_quoting_options, NULL);
+ PUSH_CURRENT_DIRED_POS (&subdired_obstack);
+ DIRED_FPUTS_LITERAL (":\n", stdout);
+ }
+
/* Read the directory entries, and insert the subfiles into the `cwd_file'
table. */
@@ -2450,7 +2463,8 @@ print_dir (char const *name, char const
ls uses constant memory while processing the entries of
this directory. Useful when there are many (millions)
of entries in a directory. */
- if (format == one_per_line && sort_type == sort_none)
+ if (format == one_per_line && sort_type == sort_none
+ && !print_block_size && !recursive)
{
/* We must call sort_files in spite of
"sort_type == sort_none" for its initialization
@@ -2486,19 +2500,6 @@ print_dir (char const *name, char const
if (recursive)
extract_dirs_from_files (name, command_line_arg);
- if (recursive | print_dir_name)
- {
- if (!first)
- DIRED_PUTCHAR ('\n');
- first = false;
- DIRED_INDENT ();
- PUSH_CURRENT_DIRED_POS (&subdired_obstack);
- dired_pos += quote_name (stdout, realname ? realname : name,
- dirname_quoting_options, NULL);
- PUSH_CURRENT_DIRED_POS (&subdired_obstack);
- DIRED_FPUTS_LITERAL (":\n", stdout);
- }
-
if (format == long_format || print_block_size)
{
const char *p;
diff -ruNp coreutils-7.2.orig/tests/misc/ls-misc coreutils-7.2/tests/misc/ls-misc
--- coreutils-7.2.orig/tests/misc/ls-misc 2009-03-29 19:44:10.000000000 +0200
+++ coreutils-7.2/tests/misc/ls-misc 2009-08-05 10:52:21.067920550 +0200
@@ -18,6 +18,7 @@
use strict;
(my $program_name = $0) =~ s|.*/||;
+my $prog = 'ls';
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
@@ -224,6 +225,18 @@ my @Tests =
{PRE => sub { mk_file @v_files }},
{POST => sub { unlink @v_files }},
],
+
+ # Test for the ls -1U bug fixed in coreutils-7.5.
+ # It is triggered only with -1U and with two or more arguments,
+ # at least one of which is a nonempty directory.
+ ['multi-arg-U1', '-U1 d no-such',
+ {OUT => "d:\nf\n"},
+ {ERR_SUBST=>'s/ch:.*/ch:/'},
+ {ERR => "$prog: cannot access no-such:\n"},
+ $mkdir_reg,
+ $rmdir_reg,
+ {EXIT => 2},
+ ],
);
# Start with an unset LS_COLORS environment variable.
@@ -232,8 +245,6 @@ delete $ENV{LS_COLORS};
my $save_temps = $ENV{SAVE_TEMPS};
my $verbose = $ENV{VERBOSE};
-my $prog = 'ls';
-
setuid_setup;
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
$fail

View file

@ -0,0 +1,193 @@
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

@ -0,0 +1,75 @@
diff -urNp coreutils-7.6-orig/m4/jm-macros.m4 coreutils-7.6/m4/jm-macros.m4
--- coreutils-7.6-orig/m4/jm-macros.m4 2010-04-28 17:44:36.000000000 +0200
+++ coreutils-7.6/m4/jm-macros.m4 2010-04-28 17:45:01.000000000 +0200
@@ -146,6 +146,25 @@ AC_DEFUN([coreutils_MACROS],
])
AC_REQUIRE([AM_LANGINFO_CODESET])
+
+ # Accept configure options: --with-tty-group[=GROUP], --without-tty-group
+ # You can determine the group of a TTY via 'stat --format %G /dev/tty'
+ # Omitting this option is equivalent to using --without-tty-group.
+ AC_ARG_WITH([tty-group],
+ AS_HELP_STRING([--with-tty-group[[[=NAME]]]],
+ [group used by system for TTYs, "tty" when not specified]
+ [ (default: do not rely on any group used for TTYs)]),
+ [tty_group_name=$withval],
+ [tty_group_name=no])
+
+ if test "x$tty_group_name" != xno; then
+ if test "x$tty_group_name" = xyes; then
+ tty_group_name=tty
+ fi
+ AC_MSG_NOTICE([TTY group used by system set to "$tty_group_name"])
+ AC_DEFINE_UNQUOTED([TTY_GROUP_NAME], ["$tty_group_name"],
+ [group used by system for TTYs])
+ fi
])
AC_DEFUN([gl_CHECK_ALL_HEADERS],
diff -urNp coreutils-7.6-orig/src/who.c coreutils-7.6/src/who.c
--- coreutils-7.6-orig/src/who.c 2010-04-28 17:44:36.000000000 +0200
+++ coreutils-7.6/src/who.c 2010-04-28 17:45:01.000000000 +0200
@@ -36,6 +36,10 @@
#include "error.h"
#include "quote.h"
+#ifdef TTY_GROUP_NAME
+# include <grp.h>
+#endif
+
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "who"
@@ -307,6 +311,22 @@ print_line (int userlen, const char *use
free (x_exitstr);
}
+/* Return true if a terminal device given as PSTAT allows other users
+ to send messages to; false otherwise */
+static bool
+is_tty_writable (struct stat const *pstat)
+{
+#ifdef TTY_GROUP_NAME
+ /* Ensure the group of the TTY device matches TTY_GROUP_NAME, more info at
+ https://bugzilla.redhat.com/454261 */
+ struct group *ttygr = getgrnam (TTY_GROUP_NAME);
+ if (!ttygr || (pstat->st_gid != ttygr->gr_gid))
+ return false;
+#endif
+
+ return pstat->st_mode & S_IWGRP;
+}
+
/* Send properly parsed USER_PROCESS info to print_line. The most
recent boot time is BOOTTIME. */
static void
@@ -345,7 +365,7 @@ print_user (const STRUCT_UTMP *utmp_ent,
if (stat (line, &stats) == 0)
{
- mesg = (stats.st_mode & S_IWGRP) ? '+' : '-';
+ mesg = is_tty_writable (&stats) ? '+' : '-';
last_change = stats.st_atime;
}
else

View file

@ -0,0 +1,67 @@
diff -urNp coreutils-7.2-orig/maint.mk coreutils-7.2/maint.mk
--- coreutils-7.2-orig/maint.mk 2009-03-29 19:44:10.000000000 +0200
+++ coreutils-7.2/maint.mk 2009-12-11 19:44:19.699563781 +0100
@@ -666,14 +666,14 @@ bin=bin-$$$$
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
-TMPDIR ?= /tmp
-t=$(TMPDIR)/$(PACKAGE)/test
+tmpdir = $(abs_top_builddir)/tests/torture
+t=$(tmpdir)/$(PACKAGE)/test
pfx=$(t)/i
# More than once, tainted build and source directory names would
# have caused at least one "make check" test to apply "chmod 700"
# to all directories under $HOME. Make sure it doesn't happen again.
-tp := $(shell echo "$(TMPDIR)/$(PACKAGE)-$$$$")
+tp = $(tmpdir)/taint
t_prefix = $(tp)/a
t_taint = '$(t_prefix) b'
fake_home = $(tp)/home
@@ -691,10 +691,11 @@ taint-distcheck: $(DIST_ARCHIVES)
touch $(fake_home)/f
mkdir -p $(fake_home)/d/e
ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
+ HOME=$(fake_home); export HOME; \
cd $(t_taint)/$(distdir) \
&& ./configure \
&& $(MAKE) \
- && HOME=$(fake_home) $(MAKE) check \
+ && $(MAKE) check \
&& ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
&& diff $(tp)/.ls-before $(tp)/.ls-after \
&& test -d $(t_prefix)
@@ -713,6 +714,7 @@ endef
# Install, then verify that all binaries and man pages are in place.
# Note that neither the binary, ginstall, nor the ].1 man page is installed.
define my-instcheck
+ echo running my-instcheck; \
$(MAKE) prefix=$(pfx) install \
&& test ! -f $(pfx)/bin/ginstall \
&& { fail=0; \
@@ -731,6 +733,7 @@ endef
define coreutils-path-check
{ \
+ echo running coreutils-path-check; \
if test -f $(srcdir)/src/true.c; then \
fail=1; \
mkdir $(bin) \
@@ -777,7 +780,7 @@ my-distcheck: $(DIST_ARCHIVES) $(local-c
mkdir -p $(t)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
cd $(t)/$(distdir) \
- && ./configure --disable-nls \
+ && ./configure --quiet --disable-nls \
&& $(MAKE) CFLAGS='$(warn_cflags)' \
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
&& $(MAKE) dvi \
@@ -789,6 +792,7 @@ my-distcheck: $(DIST_ARCHIVES) $(local-c
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
-rm -rf $(t)
+ rmdir $(tmpdir)/$(PACKAGE) $(tmpdir)
@echo "========================"; \
echo "$(distdir).tar.gz is ready for distribution"; \
echo "========================"

View file

@ -1,5 +1,5 @@
# Configuration file for the color ls utility # Configuration file for the color ls utility
# Synchronized with coreutils 7.1 dircolors # Synchronized with coreutils 8.1 dircolors
# This file goes in the /etc directory, and must be world readable. # 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 # You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults. # the system defaults.
@ -50,6 +50,7 @@ TERM rxvt-cygwin-native
TERM rxvt-unicode TERM rxvt-unicode
TERM screen TERM screen
TERM screen-256color TERM screen-256color
TERM screen-256color-bce
TERM screen-bce TERM screen-bce
TERM screen-w TERM screen-w
TERM screen.linux TERM screen.linux
@ -78,7 +79,7 @@ RESET 0 # reset to "normal" color
DIR 01;34 # directory DIR 01;34 # directory
LINK 01;36 # symbolic link (If you set this to 'target' instead of a LINK 01;36 # symbolic link (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.) # numerical value, the color is as for the file pointed to.)
HARDLINK 44;37 # regular file with more than one link HARDLINK 44;37 # regular file with more than one link
FIFO 40;33 # pipe FIFO 40;33 # pipe
SOCK 01;35 # socket SOCK 01;35 # socket
DOOR 01;35 # door DOOR 01;35 # door
@ -115,12 +116,17 @@ EXEC 01;32
.taz 01;31 .taz 01;31
.lzh 01;31 .lzh 01;31
.lzma 01;31 .lzma 01;31
.tlz 01;31
.txz 01;31
.zip 01;31 .zip 01;31
.z 01;31 .z 01;31
.Z 01;31 .Z 01;31
.dz 01;31 .dz 01;31
.gz 01;31 .gz 01;31
.lz 01;31
.xz 01;31
.bz2 01;31 .bz2 01;31
.tbz 01;31
.tbz2 01;31 .tbz2 01;31
.bz 01;31 .bz 01;31
.tz 01;31 .tz 01;31
@ -133,7 +139,7 @@ EXEC 01;32
.cpio 01;31 .cpio 01;31
.7z 01;31 .7z 01;31
.rz 01;31 .rz 01;31
.xz 01;31
# image formats (magenta) # image formats (magenta)
.jpg 01;35 .jpg 01;35
.jpeg 01;35 .jpeg 01;35
@ -148,6 +154,8 @@ EXEC 01;32
.tif 01;35 .tif 01;35
.tiff 01;35 .tiff 01;35
.png 01;35 .png 01;35
.svg 01;35
.svgz 01;35
.mng 01;35 .mng 01;35
.pcx 01;35 .pcx 01;35
.mov 01;35 .mov 01;35
@ -175,13 +183,15 @@ EXEC 01;32
.xcf 01;35 .xcf 01;35
.xwd 01;35 .xwd 01;35
.yuv 01;35 .yuv 01;35
.svg 01;35 .cgm 01;35
.svgz 01;35 .emf 01;35
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axv 01;35 .axv 01;35
.anx 01;35 .anx 01;35
.ogv 01;35 .ogv 01;35
.ogx 01;35 .ogx 01;35
# audio formats (cyan) # audio formats (cyan)
.aac 01;36 .aac 01;36
.au 01;36 .au 01;36
@ -194,6 +204,7 @@ EXEC 01;32
.ogg 01;36 .ogg 01;36
.ra 01;36 .ra 01;36
.wav 01;36 .wav 01;36
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axa 01;36 .axa 01;36
.oga 01;36 .oga 01;36

View file

@ -1,6 +1,6 @@
# Configuration file for the 256color ls utility # Configuration file for the 256color ls utility
# This file goes in the /etc directory, and must be world readable. # This file goes in the /etc directory, and must be world readable.
# Synchronized with coreutils 7.1 dircolors # Synchronized with coreutils 8.1 dircolors
# You can copy this file to .dir_colors in your $HOME directory to override # You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults. # the system defaults.
# In the case that you are not satisfied with supplied colors, please # In the case that you are not satisfied with supplied colors, please
@ -52,17 +52,17 @@ EIGHTBIT 1
#NORMAL 00 # global default, no color code at all #NORMAL 00 # global default, no color code at all
#FILE 00 # normal file, use no color at all #FILE 00 # normal file, use no color at all
RESET 0 # reset to "normal" color RESET 0 # reset to "normal" color
DIR 01;38;5;27 # directory DIR 38;5;27 # directory
LINK 01;38;5;51 # symbolic link (If you set this to 'target' instead of a LINK 38;5;51 # symbolic link (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.) # numerical value, the color is as for the file pointed to.)
HARDLINK 44;38;5;15; # regular file with more than one link HARDLINK 44;38;5;15 # regular file with more than one link
FIFO 40;38;5;11 # pipe FIFO 40;38;5;11 # pipe
SOCK 01;38;5;13 # socket SOCK 38;5;13 # socket
DOOR 01;38;5;5 # door DOOR 38;5;5 # door
BLK 01;48;5;232;38;5;11 # block device driver BLK 48;5;232;38;5;11 # block device driver
CHR 01;48;5;232;38;5;3 # character device driver CHR 48;5;232;38;5;3 # character device driver
ORPHAN 01;48;5;232;38;5;9 # symlink to nonexistent file, or non-stat'able file ORPHAN 48;5;232;38;5;9 # symlink to nonexistent file, or non-stat'able file
MISSING 01;05;48;5;232;38;5;15 # ... and the files they point to MISSING 05;48;5;232;38;5;15 # ... and the files they point to
SETUID 48;5;196;38;5;15 # file that is setuid (u+s) SETUID 48;5;196;38;5;15 # file that is setuid (u+s)
SETGID 48;5;11;38;5;16 # file that is setgid (g+s) SETGID 48;5;11;38;5;16 # file that is setgid (g+s)
CAPABILITY 48;5;196;38;5;226 # file with capability CAPABILITY 48;5;196;38;5;226 # file with capability
@ -71,107 +71,117 @@ OTHER_WRITABLE 48;5;10;38;5;21 # dir that is other-writable (o+w) and not sticky
STICKY 48;5;21;38;5;15 # dir with the sticky bit set (+t) and not other-writable STICKY 48;5;21;38;5;15 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission: # This is for files with execute permission:
EXEC 01;38;5;34 EXEC 38;5;34
# List any file extensions like '.gz' or '.tar' that you would like ls # List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string. # to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#') # (and any comments you want to add after a '#')
# executables (bright green) # executables (bright green)
#.cmd 01;38;5;34 #.cmd 38;5;34
#.exe 01;38;5;34 #.exe 38;5;34
#.com 01;38;5;34 #.com 38;5;34
#.btm 01;38;5;34 #.btm 38;5;34
#.bat 01;38;5;34 #.bat 38;5;34
#.sh 01;38;5;34 #.sh 38;5;34
#.csh 01;38;5;34 #.csh 38;5;34
# archives or compressed (bright red) # archives or compressed (bright red)
.tar 01;38;5;9 .tar 38;5;9
.tgz 01;38;5;9 .tgz 38;5;9
.arj 01;38;5;9 .arj 38;5;9
.taz 01;38;5;9 .taz 38;5;9
.lzh 01;38;5;9 .lzh 38;5;9
.lzma 01;38;5;9 .lzma 38;5;9
.zip 01;38;5;9 .tlz 38;5;9
.z 01;38;5;9 .txz 38;5;9
.Z 01;38;5;9 .zip 38;5;9
.dz 01;38;5;9 .z 38;5;9
.gz 01;38;5;9 .Z 38;5;9
.bz2 01;38;5;9 .dz 38;5;9
.tbz2 01;38;5;9 .gz 38;5;9
.bz 01;38;5;9 .lz 38;5;9
.tz 01;38;5;9 .xz 38;5;9
.deb 01;38;5;9 .bz2 38;5;9
.rpm 01;38;5;9 .tbz 38;5;9
.jar 01;38;5;9 .tbz2 38;5;9
.rar 01;38;5;9 .bz 38;5;9
.ace 01;38;5;9 .tz 38;5;9
.zoo 01;38;5;9 .deb 38;5;9
.cpio 01;38;5;9 .rpm 38;5;9
.7z 01;38;5;9 .jar 38;5;9
.rz 01;38;5;9 .rar 38;5;9
.xz 01;38;5;9 .ace 38;5;9
.zoo 38;5;9
.cpio 38;5;9
.7z 38;5;9
.rz 38;5;9
# image formats (magenta) # image formats (magenta)
.jpg 01;38;5;13 .jpg 38;5;13
.jpeg 01;38;5;13 .jpeg 38;5;13
.gif 01;38;5;13 .gif 38;5;13
.bmp 01;38;5;13 .bmp 38;5;13
.pbm 01;38;5;13 .pbm 38;5;13
.pgm 01;38;5;13 .pgm 38;5;13
.ppm 01;38;5;13 .ppm 38;5;13
.tga 01;38;5;13 .tga 38;5;13
.xbm 01;38;5;13 .xbm 38;5;13
.xpm 01;38;5;13 .xpm 38;5;13
.tif 01;38;5;13 .tif 38;5;13
.tiff 01;38;5;13 .tiff 38;5;13
.png 01;38;5;13 .png 38;5;13
.mng 01;38;5;13 .svg 38;5;13
.pcx 01;38;5;13 .svgz 38;5;13
.mov 01;38;5;13 .mng 38;5;13
.mpg 01;38;5;13 .pcx 38;5;13
.mpeg 01;38;5;13 .mov 38;5;13
.m2v 01;38;5;13 .mpg 38;5;13
.mkv 01;38;5;13 .mpeg 38;5;13
.ogm 01;38;5;13 .m2v 38;5;13
.mp4 01;38;5;13 .mkv 38;5;13
.m4v 01;38;5;13 .ogm 38;5;13
.mp4v 01;38;5;13 .mp4 38;5;13
.vob 01;38;5;13 .m4v 38;5;13
.qt 01;38;5;13 .mp4v 38;5;13
.nuv 01;38;5;13 .vob 38;5;13
.wmv 01;38;5;13 .qt 38;5;13
.asf 01;38;5;13 .nuv 38;5;13
.rm 01;38;5;13 .wmv 38;5;13
.rmvb 01;38;5;13 .asf 38;5;13
.flc 01;38;5;13 .rm 38;5;13
.avi 01;38;5;13 .rmvb 38;5;13
.fli 01;38;5;13 .flc 38;5;13
.flv 01;38;5;13 .avi 38;5;13
.gl 01;38;5;13 .fli 38;5;13
.dl 01;38;5;13 .flv 38;5;13
.xcf 01;38;5;13 .gl 38;5;13
.xwd 01;38;5;13 .dl 38;5;13
.yuv 01;38;5;13 .xcf 38;5;13
.svg 01;38;5;13 .xwd 38;5;13
.svgz 01;38;5;13 .yuv 38;5;13
.cgm 38;5;13
.emf 38;5;13
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axv 01;38;5;13 .axv 38;5;13
.anx 01;38;5;13 .anx 38;5;13
.ogv 01;38;5;13 .ogv 38;5;13
.ogx 01;38;5;13 .ogx 38;5;13
# audio formats (cyan) # audio formats (cyan)
.aac 01;38;5;45 .aac 38;5;45
.au 01;38;5;45 .au 38;5;45
.flac 01;38;5;45 .flac 38;5;45
.mid 01;38;5;45 .mid 38;5;45
.midi 01;38;5;45 .midi 38;5;45
.mka 01;38;5;45 .mka 38;5;45
.mp3 01;38;5;45 .mp3 38;5;45
.mpc 01;38;5;45 .mpc 38;5;45
.ogg 01;38;5;45 .ogg 38;5;45
.ra 01;38;5;45 .ra 38;5;45
.wav 01;38;5;45 .wav 38;5;45
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axa 01;38;5;45 .axa 38;5;45
.oga 01;38;5;45 .oga 38;5;45
.spx 01;38;5;45 .spx 38;5;45
.xspf 01;38;5;45 .xspf 38;5;45

View file

@ -1,5 +1,5 @@
# Configuration file for the color ls utility - modified for gray backgrounds # Configuration file for the color ls utility - modified for gray backgrounds
# Synchronized with coreutils 7.1 dircolors # Synchronized with coreutils 8.1 dircolors
# This file goes in the /etc directory, and must be world readable. # 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 # You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults. # the system defaults.
@ -94,12 +94,17 @@ EXEC 00;32
.taz 00;31 .taz 00;31
.lzh 00;31 .lzh 00;31
.lzma 00;31 .lzma 00;31
.tlz 00;31
.txz 00;31
.zip 00;31 .zip 00;31
.z 00;31 .z 00;31
.Z 00;31 .Z 00;31
.dz 00;31 .dz 00;31
.gz 00;31 .gz 00;31
.lz 00;31
.xz 00;31
.bz2 00;31 .bz2 00;31
.tbz 00;31
.tbz2 00;31 .tbz2 00;31
.bz 00;31 .bz 00;31
.tz 00;31 .tz 00;31
@ -112,7 +117,6 @@ EXEC 00;32
.cpio 00;31 .cpio 00;31
.7z 00;31 .7z 00;31
.rz 00;31 .rz 00;31
.xz 00;31
# image formats (magenta) # image formats (magenta)
.jpg 00;35 .jpg 00;35
.jpeg 00;35 .jpeg 00;35
@ -127,6 +131,8 @@ EXEC 00;32
.tif 00;35 .tif 00;35
.tiff 00;35 .tiff 00;35
.png 00;35 .png 00;35
.svg 00;35
.svgz 00;35
.mng 00;35 .mng 00;35
.pcx 00;35 .pcx 00;35
.mov 00;35 .mov 00;35
@ -154,13 +160,15 @@ EXEC 00;32
.xcf 00;35 .xcf 00;35
.xwd 00;35 .xwd 00;35
.yuv 00;35 .yuv 00;35
.svg 00;35 .cgm 00;35
.svgz 00;35 .emf 00;35
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axv 00;35 .axv 00;35
.anx 00;35 .anx 00;35
.ogv 00;35 .ogv 00;35
.ogx 00;35 .ogx 00;35
# audio formats (cyan) # audio formats (cyan)
.aac 00;36 .aac 00;36
.au 00;36 .au 00;36
@ -173,6 +181,7 @@ EXEC 00;32
.ogg 00;36 .ogg 00;36
.ra 00;36 .ra 00;36
.wav 00;36 .wav 00;36
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axa 00;36 .axa 00;36
.oga 00;36 .oga 00;36

View file

@ -2,7 +2,7 @@
# color-ls initialization # color-ls initialization
if ( $?USER_LS_COLORS ) then if ( $?USER_LS_COLORS ) then
if ( "$USER_LS_COLORS" != "" ) then if ( "$USER_LS_COLORS" != "" ) then
#when USER_LS_COLORS defined do not override user #when USER_LS_COLORS defined do not override user
#specified LS_COLORS and use them #specified LS_COLORS and use them
goto finish goto finish
endif endif
@ -12,14 +12,14 @@ alias ll 'ls -l'
alias l. 'ls -d .*' alias l. 'ls -d .*'
set COLORS=/etc/DIR_COLORS set COLORS=/etc/DIR_COLORS
if ($?TERM) then if ($?TERM) then
if ( -e "/etc/DIR_COLORS.$TERM" ) then if ( -e "/etc/DIR_COLORS.$TERM" ) then
set COLORS="/etc/DIR_COLORS.$TERM" set COLORS="/etc/DIR_COLORS.$TERM"
endif endif
endif endif
if ( -e "/etc/DIR_COLORS.256color" ) then if ( -e "/etc/DIR_COLORS.256color" ) then
if ( "`tput colors`" == "256" ) then if ( "`tty -s && tput colors`" == "256" ) then
set COLORS=/etc/DIR_COLORS.256color set COLORS=/etc/DIR_COLORS.256color
endif endif
endif endif
if ( -f ~/.dircolors ) set COLORS=~/.dircolors if ( -f ~/.dircolors ) set COLORS=~/.dircolors
if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
@ -30,11 +30,11 @@ endif
if ( ! -e "$COLORS" ) exit if ( ! -e "$COLORS" ) exit
eval `dircolors -c $COLORS` eval "`dircolors -c $COLORS`"
if ( "$LS_COLORS" == '' ) exit if ( "$LS_COLORS" == '' ) exit
set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS` set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS`
if ( "$color_none" != '' ) then if ( "$color_none" != '' ) then
unset color_none unset color_none
exit exit
endif endif

View file

@ -18,7 +18,7 @@ if [ -z "$USER_LS_COLORS" ]; then
done done
[ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.256color" ] && \ [ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.256color" ] && \
[ "x`tput colors 2>/dev/null`" = "x256" ] && \ [ "x`tty -s && tput colors 2>/dev/null`" = "x256" ] && \
COLORS="/etc/DIR_COLORS.256color" COLORS="/etc/DIR_COLORS.256color"
if [ -z "$COLORS" ]; then if [ -z "$COLORS" ]; then
@ -30,9 +30,9 @@ if [ -z "$USER_LS_COLORS" ]; then
# Existence of $COLORS already checked above. # Existence of $COLORS already checked above.
[ -n "$COLORS" ] || return [ -n "$COLORS" ] || return
eval `dircolors --sh "$COLORS" 2>/dev/null` eval "`dircolors --sh "$COLORS" 2>/dev/null`"
[ -z "$LS_COLORS" ] && return [ -z "$LS_COLORS" ] && return
egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
fi fi
alias ll='ls -l --color=auto' 2>/dev/null alias ll='ls -l --color=auto' 2>/dev/null

View file

@ -433,7 +433,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ +
+ memset (&state, 0, sizeof (mbstate_t)); + memset (&state, 0, sizeof (mbstate_t));
+ +
+ if (ptr == lim) + if (ptr >= lim)
+ return; + return;
+ +
+ if (tab != NULL) + if (tab != NULL)
@ -464,7 +464,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ } + }
+ } + }
+ +
+ if (sep == lim) + if (sep >= lim)
+ break; + break;
+ +
+ extract_field (line, ptr, sep - ptr); + extract_field (line, ptr, sep - ptr);
@ -505,7 +505,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ mblength = (mblength < 1) ? 1 : mblength; + mblength = (mblength < 1) ? 1 : mblength;
+ +
+ sep = ptr + mblength; + sep = ptr + mblength;
+ while (sep != lim) + while (sep < lim)
+ { + {
+ state_bak = state; + state_bak = state;
+ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state); + mblength = mbrtowc (&wc, sep, lim - sep + 1, &state);
@ -524,7 +524,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ } + }
+ +
+ extract_field (line, ptr, sep - ptr); + extract_field (line, ptr, sep - ptr);
+ if (sep == lim) + if (sep >= lim)
+ return; + return;
+ +
+ state_bak = state; + state_bak = state;
@ -538,7 +538,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ mblength = (mblength < 1) ? 1 : mblength; + mblength = (mblength < 1) ? 1 : mblength;
+ +
+ ptr = sep + mblength; + ptr = sep + mblength;
+ while (ptr != lim) + while (ptr < lim)
+ { + {
+ state_bak = state; + state_bak = state;
+ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state); + mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state);
@ -556,7 +556,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ ptr += mblength; + ptr += mblength;
+ } + }
+ } + }
+ while (ptr != lim); + while (ptr < lim);
+ } + }
+ +
+ extract_field (line, ptr, lim - ptr); + extract_field (line, ptr, lim - ptr);
@ -2204,7 +2204,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
{ {
struct keyfield const *key = keylist; struct keyfield const *key = keylist;
@@ -1875,6 +2265,179 @@ @@ -1875,6 +2265,181 @@
return key->reverse ? -diff : diff; return key->reverse ? -diff : diff;
} }
@ -2254,6 +2254,8 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
+ (texta, textb)); + (texta, textb));
+ *lima = savea, *limb = saveb; + *lima = savea, *limb = saveb;
+ } + }
+ else if (key->version)
+ diff = compare_version (texta, lena, textb, lenb);
+ else if (key->month) + else if (key->month)
+ diff = getmonth (texta, lena) - getmonth (textb, lenb); + diff = getmonth (texta, lena) - getmonth (textb, lenb);
+ else + else
@ -2384,7 +2386,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
/* Compare two lines A and B, returning negative, zero, or positive /* Compare two lines A and B, returning negative, zero, or positive
depending on whether A compares less than, equal to, or greater than B. */ depending on whether A compares less than, equal to, or greater than B. */
@@ -2744,7 +3305,7 @@ @@ -2744,7 +3307,7 @@
initialize_exit_failure (SORT_FAILURE); initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE); hard_LC_COLLATE = hard_locale (LC_COLLATE);
@ -2393,7 +2395,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
hard_LC_TIME = hard_locale (LC_TIME); hard_LC_TIME = hard_locale (LC_TIME);
#endif #endif
@@ -2765,6 +3326,27 @@ @@ -2765,6 +3328,27 @@
thousands_sep = -1; thousands_sep = -1;
} }
@ -2421,7 +2423,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
have_read_stdin = false; have_read_stdin = false;
inittables (); inittables ();
@@ -3015,13 +3597,35 @@ @@ -3015,13 +3599,35 @@
case 't': case 't':
{ {
@ -2461,7 +2463,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
else else
{ {
/* Provoke with `sort -txx'. Complain about /* Provoke with `sort -txx'. Complain about
@@ -3032,9 +3636,12 @@ @@ -3032,9 +3638,12 @@
quote (optarg)); quote (optarg));
} }
} }

View file

@ -265,7 +265,7 @@
shell_basename = last_component (shell); shell_basename = last_component (shell);
arg0 = xmalloc (strlen (shell_basename) + 2); arg0 = xmalloc (strlen (shell_basename) + 2);
arg0[0] = '-'; arg0[0] = '-';
@@ -360,6 +512,66 @@ @@ -360,6 +512,67 @@
error (0, errno, "%s", shell); error (0, errno, "%s", shell);
exit (exit_status); exit (exit_status);
} }
@ -303,12 +303,12 @@
+ +
+ pid = waitpid(-1, &status, WUNTRACED); + pid = waitpid(-1, &status, WUNTRACED);
+ +
+ if (WIFSTOPPED(status)) { + if (((pid_t)-1 != pid) && (0 != WIFSTOPPED (status))) {
+ kill(getpid(), SIGSTOP); + kill(getpid(), WSTOPSIG(status));
+ /* once we get here, we must have resumed */ + /* once we get here, we must have resumed */
+ kill(pid, SIGCONT); + kill(pid, SIGCONT);
+ } + }
+ } while (WIFSTOPPED(status)); + } while (0 != WIFSTOPPED(status));
+ } + }
+ +
+ if (caught) { + if (caught) {
@ -327,7 +327,8 @@
+ fprintf(stderr, " ...killed.\n"); + fprintf(stderr, " ...killed.\n");
+ exit(-1); + exit(-1);
+ } + }
+ exit (WEXITSTATUS(status)); + exit ((0 != WIFEXITED (status)) ? WEXITSTATUS (status)
+ : WTERMSIG (status) + 128);
+#endif /* USE_PAM */ +#endif /* USE_PAM */
} }

97
coreutils-silentmv.patch Normal file
View file

@ -0,0 +1,97 @@
diff -urNp coreutils-7.2-orig/src/copy.c coreutils-7.2/src/copy.c
--- coreutils-7.2-orig/src/copy.c 2009-07-08 16:21:46.000000000 +0200
+++ coreutils-7.2/src/copy.c 2009-07-08 16:31:43.000000000 +0200
@@ -139,6 +139,22 @@ copy_attr_error (struct error_context *c
int err = errno;
va_list ap;
+ if (errno != ENOTSUP && errno != ENODATA)
+ {
+ /* use verror module to print error message */
+ va_start (ap, fmt);
+ verror (0, err, fmt, ap);
+ va_end (ap);
+ }
+}
+
+static void
+copy_attr_allerror (struct error_context *ctx ATTRIBUTE_UNUSED,
+ char const *fmt, ...)
+{
+ int err = errno;
+ va_list ap;
+
/* use verror module to print error message */
va_start (ap, fmt);
verror (0, err, fmt, ap);
@@ -163,12 +179,13 @@ copy_attr_by_fd (char const *src_path, i
{
struct error_context ctx =
{
- .error = copy_attr_error,
+ .error = x->require_preserve_xattr ? copy_attr_allerror : copy_attr_error,
.quote = copy_attr_quote,
.quote_free = copy_attr_free
};
return 0 == attr_copy_fd (src_path, src_fd, dst_path, dst_fd, 0,
- x->reduce_diagnostics ? NULL : &ctx);
+ (x->reduce_diagnostics
+ && !x->require_preserve_xattr) ? NULL : &ctx);
}
static bool
@@ -177,12 +194,13 @@ copy_attr_by_name (char const *src_path,
{
struct error_context ctx =
{
- .error = copy_attr_error,
+ .error = x->require_preserve_xattr ? copy_attr_allerror : copy_attr_error,
.quote = copy_attr_quote,
.quote_free = copy_attr_free
};
return 0 == attr_copy_file (src_path, dst_path, 0,
- x-> reduce_diagnostics ? NULL :&ctx);
+ (x-> reduce_diagnostics
+ && !x->require_preserve_xattr) ? NULL :&ctx);
}
#else /* USE_XATTR */
@@ -465,7 +483,7 @@ copy_reg (char const *src_name, char con
security_context_t con = NULL;
if (getfscreatecon (&con) < 0)
{
- if (!x->reduce_diagnostics)
+ if (!x->reduce_diagnostics || x->require_preserve_context)
error (0, errno, _("failed to get file system create context"));
if (x->require_preserve_context)
{
@@ -478,7 +496,7 @@ copy_reg (char const *src_name, char con
{
if (fsetfilecon (dest_desc, con) < 0)
{
- if (!x->reduce_diagnostics)
+ if (!x->reduce_diagnostics || x->require_preserve_context)
error (0, errno,
_("failed to set the security context of %s to %s"),
quote_n (0, dst_name), quote_n (1, con));
@@ -1731,7 +1749,7 @@ copy_internal (char const *src_name, cha
{
if (setfscreatecon (con) < 0)
{
- if (!x->reduce_diagnostics)
+ if (!x->reduce_diagnostics || x->require_preserve_context)
error (0, errno,
_("failed to set default file creation context to %s"),
quote (con));
@@ -1745,9 +1763,9 @@ copy_internal (char const *src_name, cha
}
else
{
- if (errno != ENOTSUP && errno != ENODATA)
+ if ((errno != ENOTSUP && errno != ENODATA) || x->require_preserve_context)
{
- if (!x->reduce_diagnostics)
+ if (!x->reduce_diagnostics || x->require_preserve_context)
error (0, errno,
_("failed to get security context of %s"),
quote (src_name));

View file

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils Name: coreutils
Version: 7.2 Version: 7.2
Release: 1%{?dist} Release: 8%{?dist}
License: GPLv3+ License: GPLv3+
Group: System Environment/Base Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/ Url: http://www.gnu.org/software/coreutils/
@ -19,10 +19,20 @@ Source202: coreutils-su-l.pamd
Source203: coreutils-runuser-l.pamd Source203: coreutils-runuser-l.pamd
# From upstream # From upstream
Patch1: coreutils-7.4-ls-1U.patch
Patch2: coreutils-7.4-install-SELinux.patch
Patch3: coreutils-7.5-ls-inode.patch
Patch4: coreutils-7.2-ls-fr_FR-misalignment.patch
Patch5: coreutils-CVE-2009-4135.patch
Patch6: coreutils-7.2-ls-infloop.patch
Patch7: coreutils-7.2-ls-derefdanglinginode.patch
Patch8: coreutils-7.2-trueexecve.patch
Patch9: coreutils-7.6-who-msgstatus.patch
# Our patches # Our patches
Patch100: coreutils-6.10-configuration.patch Patch100: coreutils-6.10-configuration.patch
Patch101: coreutils-6.10-manpages.patch Patch101: coreutils-6.10-manpages.patch
Patch102: coreutils-silentmv.patch
# sh-utils # sh-utils
Patch703: sh-utils-2.0.11-dateman.patch Patch703: sh-utils-2.0.11-dateman.patch
@ -59,6 +69,7 @@ BuildRequires: automake >= 1.10.1
BuildRequires: libcap-devel >= 2.0.6 BuildRequires: libcap-devel >= 2.0.6
BuildRequires: libattr-devel BuildRequires: libattr-devel
BuildRequires: attr BuildRequires: attr
BuildRequires: gmp-devel
Requires(post): libselinux >= 1.25.6-1 Requires(post): libselinux >= 1.25.6-1
Requires: libattr Requires: libattr
@ -72,6 +83,7 @@ Requires(post): grep
%{?!nopam:Requires: pam >= 0.66-12} %{?!nopam:Requires: pam >= 0.66-12}
Requires(post): libcap >= 2.0.6 Requires(post): libcap >= 2.0.6
Requires: ncurses Requires: ncurses
Requires: gmp
# Require a C library that doesn't put LC_TIME files in our way. # Require a C library that doesn't put LC_TIME files in our way.
Conflicts: glibc < 2.2 Conflicts: glibc < 2.2
@ -98,10 +110,19 @@ the old GNU fileutils, sh-utils, and textutils packages.
%setup -q %setup -q
# From upstream # From upstream
%patch1 -p1 -b .ls-1U
%patch2 -p1 -b .install-SELinux
%patch3 -p1 -b .lsinode
%patch4 -p1 -b .frenchmonths
%patch5 -p1 -b .unsafetmp
%patch6 -p1 -b .infloop
%patch8 -p1 -b .execve
%patch9 -p1 -b .whomsg
# Our patches # Our patches
%patch100 -p1 -b .configure %patch100 -p1 -b .configure
%patch101 -p1 -b .manpages %patch101 -p1 -b .manpages
%patch102 -p1 -b .silentmv
# sh-utils # sh-utils
%patch703 -p1 -b .dateman %patch703 -p1 -b .dateman
@ -124,6 +145,10 @@ the old GNU fileutils, sh-utils, and textutils packages.
%patch950 -p1 -b .selinux %patch950 -p1 -b .selinux
%patch951 -p1 -b .selinuxman %patch951 -p1 -b .selinuxman
#upstream apply later
%patch7 -p1 -b .inode
chmod a+x tests/misc/sort-mb-tests chmod a+x tests/misc/sort-mb-tests
sed -i 's/1.10a/1.10.1/' configure.ac sed -i 's/1.10a/1.10.1/' configure.ac
@ -151,6 +176,7 @@ automake --copy --add-missing
%configure --enable-largefile --with-afs %{?!nopam:--enable-pam} \ %configure --enable-largefile --with-afs %{?!nopam:--enable-pam} \
--enable-selinux \ --enable-selinux \
--enable-install-program=su,hostname,arch \ --enable-install-program=su,hostname,arch \
--with-tty-group \
DEFAULT_POSIX2_VERSION=200112 alternative=199209 || : DEFAULT_POSIX2_VERSION=200112 alternative=199209 || :
# Regenerate manpages # Regenerate manpages
@ -186,15 +212,15 @@ bzip2 -9f ChangeLog
# let be compatible with old fileutils, sh-utils and textutils packages : # let be compatible with old fileutils, sh-utils and textutils packages :
mkdir -p $RPM_BUILD_ROOT{/bin,%_bindir,%_sbindir,/sbin} mkdir -p $RPM_BUILD_ROOT{/bin,%_bindir,%_sbindir,/sbin}
%{?!nopam:mkdir -p $RPM_BUILD_ROOT%_sysconfdir/pam.d} %{?!nopam:mkdir -p $RPM_BUILD_ROOT%_sysconfdir/pam.d}
for f in arch basename cat chgrp chmod chown cp cut date dd df echo env false link ln ls mkdir mknod mktemp mv nice pwd rm rmdir sleep sort stty sync touch true uname unlink for f in arch basename cat chgrp chmod chown cp cut date dd df echo env false link ln ls mkdir mknod mktemp mv nice pwd readlink rm rmdir sleep sort stty sync touch true uname unlink
do do
mv $RPM_BUILD_ROOT{%_bindir,/bin}/$f mv $RPM_BUILD_ROOT{%_bindir,/bin}/$f
done done
# chroot was in /usr/sbin : # chroot was in /usr/sbin :
mv $RPM_BUILD_ROOT{%_bindir,%_sbindir}/chroot mv $RPM_BUILD_ROOT{%_bindir,%_sbindir}/chroot
# {cat,sort,cut} were previously moved from bin to /usr/bin and linked into # {env,cut,readlink} were previously moved from /usr/bin to /bin and linked into
for i in env cut; do ln -sf ../../bin/$i $RPM_BUILD_ROOT/usr/bin; done for i in env cut readlink; do ln -sf ../../bin/$i $RPM_BUILD_ROOT/usr/bin; done
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
install -p -c -m644 %SOURCE101 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS install -p -c -m644 %SOURCE101 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS
@ -244,19 +270,25 @@ rm -rf $RPM_BUILD_ROOT
# coreutils.info. else their postun'll be run too late # coreutils.info. else their postun'll be run too late
# and install-info will fail badly because of duplicates # and install-info will fail badly because of duplicates
for file in sh-utils textutils fileutils; do 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 || : /sbin/install-info --delete %{_infodir}/$file.info --dir=%{_infodir}/dir &> /dev/null || :
fi
done done
%preun %preun
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
if [ -f %{_infodir}/%{name}.info ]; then
/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || : /sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
fi
fi fi
%post %post
/bin/grep -v '(sh-utils)\|(fileutils)\|(textutils)' %{_infodir}/dir > \ /bin/grep -v '(sh-utils)\|(fileutils)\|(textutils)' %{_infodir}/dir > \
%{_infodir}/dir.rpmmodify || exit 0 %{_infodir}/dir.rpmmodify || exit 0
/bin/mv -f %{_infodir}/dir.rpmmodify %{_infodir}/dir /bin/mv -f %{_infodir}/dir.rpmmodify %{_infodir}/dir
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || : if [ -f %{_infodir}/%{name}.info ]; then
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
fi
%files -f %{name}.lang %files -f %{name}.lang
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -290,6 +322,7 @@ fi
/bin/mv /bin/mv
/bin/nice /bin/nice
/bin/pwd /bin/pwd
/bin/readlink
/bin/rm /bin/rm
/bin/rmdir /bin/rmdir
/bin/sleep /bin/sleep
@ -309,6 +342,56 @@ fi
/sbin/runuser /sbin/runuser
%changelog %changelog
* Wed Apr 28 2010 Ondrej Vasik <ovasik@redhat.com> - 7.2-8
- doublequote LS_COLORS in colorls.*sh scripts to speedup
shell start(#586029)
- move readlink from /usr/bin to bin, keep symlink in
/usr/bin(#580682)
- run tput colors in colorls profile.d scripts only
in the interactive mode(#450424)
- fix exit status of terminated child processes in su with
pam(#559098)
- who doesn't determine user's message status correctly
(#454261)
* Thu Jan 14 2010 Ondrej Vasik <ovasik@redhat.com> - 7.2-7
- fix typo in DIR_COLORS* files
* Tue Jan 12 2010 Ondrej Vasik <ovasik@redhat.com> - 7.2-6
- require gmp-devel/gmp for large numbers support(#552846)
- use grep instead of deprecated egrep in colorls.sh script
(#548174)
- fix DIR_COLORS.256color file, update /etc/DIR_COLORS* files
- /bin/{true,false} - do not segfault with abusive
execve() usage (#537684)
- ls: print "?", not "0" as inode of dereferenced dangling
symlink(#525400)
- ls -LR exits with status 2, not 0, when it encounters
a cycle(#525402)
* Fri Dec 11 2009 Ondrej Vasik <ovasik@redhat.com> - 7.2-5
- CVE-2009-4135 : Unsafe temporary directory use in "distcheck" rule
* Tue Sep 08 2009 Ondrej Vasik <ovasik@redhat.com> - 7.2-4
- ls -i: print consistent inode numbers also for mount points
(#453709)
- do process install-info only with info files present(#515970)
- fix misalignment in ls -l in fr_FR locales(#517626)
* Wed Aug 05 2009 Kamil Dudka <kdudka@redhat.com> - 7.2-3
- ls -1U with two or more arguments (or with -R or -s) works properly again
- install runs faster again with SELinux enabled (#479502)
* Wed Jul 09 2009 Ondrej Vasik <ovasik@redhat.com> 7.2-2
- do not ignore sort's version sort for multibyte locales
(#509688)
- fix segfaults in join (i18n patch) when using multibyte
locales(#497368)
- make mv xattr support failures silent (as is done for
cp -a) - #496142
- do not silence xattr/selinux failures when preserving
those attributes is required
* Tue Mar 31 2009 Ondrej Vasik <ovasik@redhat.com> 7.2-1 * Tue Mar 31 2009 Ondrej Vasik <ovasik@redhat.com> 7.2-1
- New upstream bugfix release 7.2 - New upstream bugfix release 7.2
- removed applied patches - removed applied patches