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

@ -3,16 +3,16 @@
@@ -451,14 +451,7 @@ @@ -451,14 +451,7 @@
format = DATE_FMT_LANGINFO (); format = DATE_FMT_LANGINFO ();
if (! *format) if (! *format)
{ {
- /* Do not wrap the following literal format string with _(...). - /* Do not wrap the following literal format string with _(...).
- For example, suppose LC_ALL is unset, LC_TIME="POSIX", - For example, suppose LC_ALL is unset, LC_TIME="POSIX",
- and LANG="ko_KR". In that case, POSIX says that LC_TIME - and LANG="ko_KR". In that case, POSIX says that LC_TIME
- determines the format and contents of date and time strings - determines the format and contents of date and time strings
- written by date, which means "date" must generate output - written by date, which means "date" must generate output
- using the POSIX locale; but adding _() would cause "date" - using the POSIX locale; but adding _() would cause "date"
- to use a Korean translation of the format. */ - to use a Korean translation of the format. */
- format = "%a %b %e %H:%M:%S %Z %Y"; - format = "%a %b %e %H:%M:%S %Z %Y";
+ format = dcgettext(NULL, N_("%a %b %e %H:%M:%S %Z %Y"), LC_TIME); + format = dcgettext(NULL, N_("%a %b %e %H:%M:%S %Z %Y"), LC_TIME);
} }
} }

View File

@ -17,9 +17,9 @@
+ char *element = unknown; + char *element = unknown;
#if HAVE_SYSINFO && defined SI_ARCHITECTURE #if HAVE_SYSINFO && defined SI_ARCHITECTURE
{ {
static char processor[257]; static char processor[257];
if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor)) if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
element = processor; element = processor;
} }
+#else +#else
+ { + {
@ -54,10 +54,10 @@
+ char *element = unknown; + char *element = unknown;
#if HAVE_SYSINFO && defined SI_PLATFORM #if HAVE_SYSINFO && defined SI_PLATFORM
{ {
static char hardware_platform[257]; static char hardware_platform[257];
@@ -356,6 +378,14 @@ @@ -356,6 +378,14 @@
hardware_platform, sizeof hardware_platform)) hardware_platform, sizeof hardware_platform))
element = hardware_platform; element = hardware_platform;
} }
+#else +#else
+ { + {

View File

@ -121,11 +121,11 @@ diff -urNp coreutils-7.0.orig/src/su.c coreutils-7.0/src/su.c
static void run_shell (char const *, char const *, char **, size_t, static void run_shell (char const *, char const *, char **, size_t,
- const struct passwd *) - const struct passwd *)
+ const struct passwd * + const struct passwd *
+#ifdef RUNUSER +#ifdef RUNUSER
+ , gid_t *groups, int num_groups + , gid_t *groups, int num_groups
+#endif +#endif
+ ) + )
#ifdef USE_PAM #ifdef USE_PAM
; ;
#else #else
@ -180,9 +180,9 @@ diff -urNp coreutils-7.0.orig/src/su.c coreutils-7.0/src/su.c
-change_identity (const struct passwd *pw) -change_identity (const struct passwd *pw)
+change_identity (const struct passwd *pw +change_identity (const struct passwd *pw
+#ifdef RUNUSER +#ifdef RUNUSER
+ , gid_t *groups, int num_groups + , gid_t *groups, int num_groups
+#endif +#endif
+ ) + )
{ {
#ifdef HAVE_INITGROUPS #ifdef HAVE_INITGROUPS
+ int rc = 0; + int rc = 0;
@ -202,12 +202,12 @@ diff -urNp coreutils-7.0.orig/src/su.c coreutils-7.0/src/su.c
static void static void
run_shell (char const *shell, char const *command, char **additional_args, run_shell (char const *shell, char const *command, char **additional_args,
- size_t n_additional_args, const struct passwd *pw) - size_t n_additional_args, const struct passwd *pw)
+ size_t n_additional_args, const struct passwd *pw + size_t n_additional_args, const struct passwd *pw
+#ifdef RUNUSER +#ifdef RUNUSER
+ , gid_t *groups, int num_groups + , gid_t *groups, int num_groups
+#endif +#endif
+ ) + )
{ {
size_t n_args = 1 + fast_startup + 2 * !!command + n_additional_args + 1; size_t n_args = 1 + fast_startup + 2 * !!command + n_additional_args + 1;
char const **args = xnmalloc (n_args, sizeof *args); char const **args = xnmalloc (n_args, sizeof *args);
@ -218,9 +218,9 @@ diff -urNp coreutils-7.0.orig/src/su.c coreutils-7.0/src/su.c
- change_identity (pw); - change_identity (pw);
+ change_identity (pw + change_identity (pw
+#ifdef RUNUSER +#ifdef RUNUSER
+ , groups, num_groups + , groups, num_groups
+#endif +#endif
+ ); + );
pam_end(pamh, 0); pam_end(pamh, 0);
if (!same_session) if (!same_session)
setsid (); setsid ();
@ -279,43 +279,43 @@ diff -urNp coreutils-7.0.orig/src/su.c coreutils-7.0/src/su.c
- while ((optc = getopt_long (argc, argv, "c:flmps:", longopts, NULL)) != -1) - while ((optc = getopt_long (argc, argv, "c:flmps:", longopts, NULL)) != -1)
+ while ((optc = getopt_long (argc, argv, "c:flmps:" + while ((optc = getopt_long (argc, argv, "c:flmps:"
+#ifdef RUNUSER +#ifdef RUNUSER
+ "g:G:" + "g:G:"
+#endif +#endif
+ , longopts, NULL)) != -1) + , longopts, NULL)) != -1)
{ {
switch (optc) switch (optc)
{ {
@@ -697,6 +773,28 @@ main (int argc, char **argv) @@ -697,6 +773,28 @@ main (int argc, char **argv)
shell = optarg; shell = optarg;
break; break;
+#ifdef RUNUSER +#ifdef RUNUSER
+ case 'g': + case 'g':
+ gr = getgrnam(optarg); + gr = getgrnam(optarg);
+ if (!gr) + if (!gr)
+ error (EXIT_FAILURE, 0, _("group %s does not exist"), optarg); + error (EXIT_FAILURE, 0, _("group %s does not exist"), optarg);
+ use_gid = 1; + use_gid = 1;
+ groups[0] = gr->gr_gid; + groups[0] = gr->gr_gid;
+ break; + break;
+ +
+ case 'G': + case 'G':
+ num_supp_groups++; + num_supp_groups++;
+ if (num_supp_groups >= NGROUPS_MAX) + if (num_supp_groups >= NGROUPS_MAX)
+ error (EXIT_FAILURE, 0, + error (EXIT_FAILURE, 0,
+ _("Can't specify more than %d supplemental groups"), + _("Can't specify more than %d supplemental groups"),
+ NGROUPS_MAX - 1); + NGROUPS_MAX - 1);
+ gr = getgrnam(optarg); + gr = getgrnam(optarg);
+ if (!gr) + if (!gr)
+ error (EXIT_FAILURE, 0, _("group %s does not exist"), optarg); + error (EXIT_FAILURE, 0, _("group %s does not exist"), optarg);
+ groups[num_supp_groups] = gr->gr_gid; + groups[num_supp_groups] = gr->gr_gid;
+ break; + break;
+#endif +#endif
+ +
case_GETOPT_HELP_CHAR; case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
@@ -735,7 +833,20 @@ main (int argc, char **argv) @@ -735,7 +833,20 @@ main (int argc, char **argv)
: DEFAULT_SHELL); : DEFAULT_SHELL);
endpwent (); endpwent ();
- if (!correct_password (pw)) - if (!correct_password (pw))
@ -343,17 +343,17 @@ diff -urNp coreutils-7.0.orig/src/su.c coreutils-7.0/src/su.c
- change_identity (pw); - change_identity (pw);
+ change_identity (pw + change_identity (pw
+#ifdef RUNUSER +#ifdef RUNUSER
+ , groups, num_supp_groups + , groups, num_supp_groups
+#endif +#endif
+ ); + );
#endif #endif
- run_shell (shell, command, argv + optind, MAX (0, argc - optind), pw); - run_shell (shell, command, argv + optind, MAX (0, argc - optind), pw);
+ run_shell (shell, command, argv + optind, MAX (0, argc - optind), pw + run_shell (shell, command, argv + optind, MAX (0, argc - optind), pw
+#ifdef RUNUSER +#ifdef RUNUSER
+ , groups, num_supp_groups + , groups, num_supp_groups
+#endif +#endif
+ ); + );
} }
diff -urNp coreutils-7.5.orig/tests/misc/help-version coreutils-7.5/tests/misc/help-version diff -urNp coreutils-7.5.orig/tests/misc/help-version coreutils-7.5/tests/misc/help-version
--- coreutils-7.5.orig/tests/misc/help-version --- coreutils-7.5.orig/tests/misc/help-version

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 ## 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 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-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 +++ coreutils-6.11/tests/test-lib.sh 2008-04-24 14:18:59.000000000 +0200

View File

@ -2,7 +2,7 @@ diff -urNp coreutils-6.12-orig/src/md5sum.c coreutils-6.12/src/md5sum.c
--- coreutils-6.12-orig/src/md5sum.c 2008-05-26 08:40:33.000000000 +0200 --- coreutils-6.12-orig/src/md5sum.c 2008-05-26 08:40:33.000000000 +0200
+++ coreutils-6.12/src/md5sum.c 2008-10-21 16:07:28.000000000 +0200 +++ coreutils-6.12/src/md5sum.c 2008-10-21 16:07:28.000000000 +0200
@@ -175,6 +175,9 @@ With no FILE, or when FILE is -, read st @@ -175,6 +175,9 @@ With no FILE, or when FILE is -, read st
fputs (_("\ fputs (_("\
-t, --text read in text mode (default)\n\ -t, --text read in text mode (default)\n\
"), stdout); "), stdout);
+ fputs (_("\ + fputs (_("\

View File

@ -2,11 +2,11 @@ diff -urNp coreutils-7.4-orig/src/stty.c coreutils-7.4/src/stty.c
--- coreutils-7.4-orig/src/stty.c 2009-04-24 14:41:19.000000000 +0200 --- coreutils-7.4-orig/src/stty.c 2009-04-24 14:41:19.000000000 +0200
+++ coreutils-7.4/src/stty.c 2009-06-11 10:15:41.000000000 +0200 +++ coreutils-7.4/src/stty.c 2009-06-11 10:15:41.000000000 +0200
@@ -1001,7 +1001,7 @@ main (int argc, char **argv) @@ -1001,7 +1001,7 @@ main (int argc, char **argv)
spurious difference in an uninitialized portion of the structure. */ spurious difference in an uninitialized portion of the structure. */
DECLARE_ZEROED_AGGREGATE (struct termios, new_mode); DECLARE_ZEROED_AGGREGATE (struct termios, new_mode);
- if (tcsetattr (STDIN_FILENO, TCSADRAIN, &mode)) - if (tcsetattr (STDIN_FILENO, TCSADRAIN, &mode))
+ if (tcsetattr (STDIN_FILENO, TCSANOW, &mode)) + if (tcsetattr (STDIN_FILENO, TCSANOW, &mode))
error (EXIT_FAILURE, errno, "%s", device_name); error (EXIT_FAILURE, errno, "%s", device_name);
/* POSIX (according to Zlotnick's book) tcsetattr returns zero if /* POSIX (according to Zlotnick's book) tcsetattr returns zero if

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

File diff suppressed because it is too large Load Diff

View File

@ -155,15 +155,15 @@
+ char const *display = getenv ("DISPLAY"); + char const *display = getenv ("DISPLAY");
+ char const *xauthority = getenv ("XAUTHORITY"); + char const *xauthority = getenv ("XAUTHORITY");
if (term) if (term)
term = xstrdup (term); term = xstrdup (term);
environ = xmalloc ((6 + !!term) * sizeof (char *)); environ = xmalloc ((6 + !!term) * sizeof (char *));
environ[0] = NULL; environ[0] = NULL;
if (term) if (term)
xsetenv ("TERM", term); xsetenv ("TERM", term);
+ if (display) + if (display)
+ xsetenv ("DISPLAY", display); + xsetenv ("DISPLAY", display);
+ if (xauthority) + if (xauthority)
+ xsetenv ("XAUTHORITY", xauthority); + xsetenv ("XAUTHORITY", xauthority);
xsetenv ("HOME", pw->pw_dir); xsetenv ("HOME", pw->pw_dir);
xsetenv ("SHELL", shell); xsetenv ("SHELL", shell);
xsetenv ("USER", pw->pw_name); xsetenv ("USER", pw->pw_name);
@ -218,8 +218,8 @@
static void static void
run_shell (char const *shell, char const *command, char **additional_args, run_shell (char const *shell, char const *command, char **additional_args,
- size_t n_additional_args) - size_t n_additional_args)
+ size_t n_additional_args, const struct passwd *pw) + size_t n_additional_args, const struct passwd *pw)
{ {
size_t n_args = 1 + fast_startup + 2 * !!command + n_additional_args + 1; size_t n_args = 1 + fast_startup + 2 * !!command + n_additional_args + 1;
char const **args = xnmalloc (n_args, sizeof *args); char const **args = xnmalloc (n_args, sizeof *args);

View File

@ -38,14 +38,14 @@ diff -urNp coreutils-7.1-orig/src/copy.c coreutils-7.1/src/copy.c
--- coreutils-7.1-orig/src/copy.c 2009-02-18 15:32:52.000000000 +0100 --- coreutils-7.1-orig/src/copy.c 2009-02-18 15:32:52.000000000 +0100
+++ coreutils-7.1/src/copy.c 2009-02-24 13:47:15.000000000 +0100 +++ coreutils-7.1/src/copy.c 2009-02-24 13:47:15.000000000 +0100
@@ -1830,6 +1830,8 @@ copy_internal (char const *src_name, cha @@ -1830,6 +1830,8 @@ copy_internal (char const *src_name, cha
{ {
/* Here, we are crossing a file system boundary and cp's -x option /* Here, we are crossing a file system boundary and cp's -x option
is in effect: so don't copy the contents of this directory. */ is in effect: so don't copy the contents of this directory. */
+ if (x->preserve_security_context) + if (x->preserve_security_context)
+ restore_default_fscreatecon_or_die (); + restore_default_fscreatecon_or_die ();
} }
else else
{ {
diff -urNp coreutils-7.1-orig/src/copy.h coreutils-7.1/src/copy.h diff -urNp coreutils-7.1-orig/src/copy.h coreutils-7.1/src/copy.h
--- coreutils-7.1-orig/src/copy.h 2009-02-18 15:32:52.000000000 +0100 --- coreutils-7.1-orig/src/copy.h 2009-02-18 15:32:52.000000000 +0100
+++ coreutils-7.1/src/copy.h 2009-02-24 13:47:15.000000000 +0100 +++ coreutils-7.1/src/copy.h 2009-02-24 13:47:15.000000000 +0100
@ -102,60 +102,60 @@ diff -urNp coreutils-7.1-orig/src/cp.c coreutils-7.1/src/cp.c
- while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:T", - while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:T",
+ while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ:", + while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ:",
long_opts, NULL)) long_opts, NULL))
!= -1) != -1)
{ {
@@ -945,6 +951,16 @@ main (int argc, char **argv) @@ -945,6 +951,16 @@ main (int argc, char **argv)
copy_contents = true; copy_contents = true;
break; break;
+ case 'c': + case 'c':
+ if ( x.set_security_context ) { + if ( x.set_security_context ) {
+ (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]); + (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]);
+ exit( 1 ); + exit( 1 );
+ } + }
+ else if (selinux_enabled) { + else if (selinux_enabled) {
+ x.preserve_security_context = true; + x.preserve_security_context = true;
+ x.require_preserve_context = true; + x.require_preserve_context = true;
+ } + }
+ break; + break;
case 'd': case 'd':
x.preserve_links = true; x.preserve_links = true;
x.dereference = DEREF_NEVER; x.dereference = DEREF_NEVER;
@@ -1054,6 +1070,27 @@ main (int argc, char **argv) @@ -1054,6 +1070,27 @@ main (int argc, char **argv)
x.one_file_system = true; x.one_file_system = true;
break; break;
+ +
+ case 'Z': + case 'Z':
+ /* politely decline if we're not on a selinux-enabled kernel. */ + /* politely decline if we're not on a selinux-enabled kernel. */
+ if( !selinux_enabled ) { + if( !selinux_enabled ) {
+ fprintf( stderr, "Warning: ignoring --context (-Z). " + fprintf( stderr, "Warning: ignoring --context (-Z). "
+ "It requires a SELinux enabled kernel.\n" ); + "It requires a SELinux enabled kernel.\n" );
+ break; + break;
+ } + }
+ if ( x.preserve_security_context ) { + if ( x.preserve_security_context ) {
+ (void) fprintf(stderr, "%s: cannot force target context to '%s' and preserve it\n", argv[0], optarg); + (void) fprintf(stderr, "%s: cannot force target context to '%s' and preserve it\n", argv[0], optarg);
+ exit( 1 ); + exit( 1 );
+ } + }
+ x.set_security_context = true; + x.set_security_context = true;
+ /* if there's a security_context given set new path + /* if there's a security_context given set new path
+ components to that context, too */ + components to that context, too */
+ if ( setfscreatecon(optarg) < 0 ) { + if ( setfscreatecon(optarg) < 0 ) {
+ (void) fprintf(stderr, _("cannot set default security context %s\n"), optarg); + (void) fprintf(stderr, _("cannot set default security context %s\n"), optarg);
+ exit( 1 ); + exit( 1 );
+ } + }
+ break; + break;
+ +
case 'S': case 'S':
make_backups = true; make_backups = true;
backup_suffix_string = optarg; backup_suffix_string = optarg;
diff -urNp coreutils-7.1-orig/src/chcon.c coreutils-7.1/src/chcon.c diff -urNp coreutils-7.1-orig/src/chcon.c coreutils-7.1/src/chcon.c
--- coreutils-7.1-orig/src/chcon.c 2008-10-12 16:12:56.000000000 +0200 --- coreutils-7.1-orig/src/chcon.c 2008-10-12 16:12:56.000000000 +0200
+++ coreutils-7.1/src/chcon.c 2009-02-24 13:47:15.000000000 +0100 +++ coreutils-7.1/src/chcon.c 2009-02-24 13:47:15.000000000 +0100
@@ -346,7 +346,7 @@ Usage: %s [OPTION]... CONTEXT FILE...\n\ @@ -346,7 +346,7 @@ Usage: %s [OPTION]... CONTEXT FILE...\n\
"), "),
program_name, program_name, program_name); program_name, program_name, program_name);
fputs (_("\ fputs (_("\
-Change the security context of each FILE to CONTEXT.\n\ -Change the security context of each FILE to CONTEXT.\n\
+Change the SELinux security context of each FILE to CONTEXT.\n\ +Change the SELinux security context of each FILE to CONTEXT.\n\
@ -191,36 +191,36 @@ diff -urNp coreutils-7.1-orig/src/install.c coreutils-7.1/src/install.c
- while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z:", long_options, - while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z:", long_options,
+ while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pPt:TvS:Z:", long_options, + while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pPt:TvS:Z:", long_options,
NULL)) != -1) NULL)) != -1)
{ {
switch (optc) switch (optc)
@@ -539,6 +540,7 @@ main (int argc, char **argv) @@ -539,6 +540,7 @@ main (int argc, char **argv)
error (0, 0, _("WARNING: --preserve_context is deprecated; " error (0, 0, _("WARNING: --preserve_context is deprecated; "
"use --preserve-context instead")); "use --preserve-context instead"));
/* fall through */ /* fall through */
+ case 'P': + case 'P':
case PRESERVE_CONTEXT_OPTION: case PRESERVE_CONTEXT_OPTION:
if ( ! selinux_enabled) if ( ! selinux_enabled)
{ {
@@ -546,6 +548,10 @@ main (int argc, char **argv) @@ -546,6 +548,10 @@ main (int argc, char **argv)
"this kernel is not SELinux-enabled")); "this kernel is not SELinux-enabled"));
break; break;
} }
+ if ( x.set_security_context ) { + if ( x.set_security_context ) {
+ (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]); + (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]);
+ exit( 1 ); + exit( 1 );
+ } + }
x.preserve_security_context = true; x.preserve_security_context = true;
use_default_selinux_context = false; use_default_selinux_context = false;
break; break;
@@ -557,6 +563,7 @@ main (int argc, char **argv) @@ -557,6 +563,7 @@ main (int argc, char **argv)
break; break;
} }
scontext = optarg; scontext = optarg;
+ x.set_security_context = true; + x.set_security_context = true;
use_default_selinux_context = false; use_default_selinux_context = false;
break; break;
case_GETOPT_HELP_CHAR; case_GETOPT_HELP_CHAR;
@@ -990,8 +997,8 @@ Mandatory arguments to long options are @@ -990,8 +997,8 @@ Mandatory arguments to long options are
-v, --verbose print the name of each directory as it is created\n\ -v, --verbose print the name of each directory as it is created\n\
"), stdout); "), stdout);
@ -312,21 +312,21 @@ diff -urNp coreutils-7.1-orig/src/ls.c coreutils-7.1/src/ls.c
@@ -1194,7 +1203,8 @@ main (int argc, char **argv) @@ -1194,7 +1203,8 @@ main (int argc, char **argv)
/* Avoid following symbolic links when possible. */ /* Avoid following symbolic links when possible. */
if (is_colored (C_ORPHAN) if (is_colored (C_ORPHAN)
|| (is_colored (C_EXEC) && color_symlink_as_referent) || (is_colored (C_EXEC) && color_symlink_as_referent)
- || (is_colored (C_MISSING) && format == long_format)) - || (is_colored (C_MISSING) && format == long_format))
+ || (is_colored (C_MISSING) && (format == long_format + || (is_colored (C_MISSING) && (format == long_format
+ || format == security_format))) + || format == security_format)))
check_symlink_color = true; check_symlink_color = true;
/* If the standard output is a controlling terminal, watch out /* If the standard output is a controlling terminal, watch out
@@ -1241,7 +1251,7 @@ main (int argc, char **argv) @@ -1241,7 +1251,7 @@ main (int argc, char **argv)
if (dereference == DEREF_UNDEFINED) if (dereference == DEREF_UNDEFINED)
dereference = ((immediate_dirs dereference = ((immediate_dirs
|| indicator_style == classify || indicator_style == classify
- || format == long_format) - || format == long_format)
+ || format == long_format || format == security_format) + || format == long_format || format == security_format)
? DEREF_NEVER ? DEREF_NEVER
: DEREF_COMMAND_LINE_SYMLINK_TO_DIR); : DEREF_COMMAND_LINE_SYMLINK_TO_DIR);
@@ -1261,7 +1271,7 @@ main (int argc, char **argv) @@ -1261,7 +1271,7 @@ main (int argc, char **argv)
@ -336,7 +336,7 @@ diff -urNp coreutils-7.1-orig/src/ls.c coreutils-7.1/src/ls.c
+ || format == security_format || print_scontext + || format == security_format || print_scontext
|| print_block_size; || print_block_size;
format_needs_type = (! format_needs_stat format_needs_type = (! format_needs_stat
&& (recursive && (recursive
@@ -1292,7 +1302,7 @@ main (int argc, char **argv) @@ -1292,7 +1302,7 @@ main (int argc, char **argv)
} }
else else
@ -356,42 +356,42 @@ diff -urNp coreutils-7.1-orig/src/ls.c coreutils-7.1/src/ls.c
/* FIXME: put this in a function. */ /* FIXME: put this in a function. */
{ {
@@ -1837,13 +1847,27 @@ decode_switches (int argc, char **argv) @@ -1837,13 +1847,27 @@ decode_switches (int argc, char **argv)
break; break;
case 'Z': case 'Z':
- print_scontext = true; - print_scontext = true;
+ print_scontext = 1; + print_scontext = 1;
+ format = security_format; + format = security_format;
break; break;
case_GETOPT_HELP_CHAR; case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+ case CONTEXT_OPTION: /* default security context format */ + case CONTEXT_OPTION: /* default security context format */
+ print_scontext = 1; + print_scontext = 1;
+ format = security_format; + format = security_format;
+ break; + break;
+ case LCONTEXT_OPTION: /* long format plus security context */ + case LCONTEXT_OPTION: /* long format plus security context */
+ print_scontext = 1; + print_scontext = 1;
+ format = long_format; + format = long_format;
+ break; + break;
+ case SCONTEXT_OPTION: /* short form of new security format */ + case SCONTEXT_OPTION: /* short form of new security format */
+ print_scontext = 0; + print_scontext = 0;
+ format = security_format; + format = security_format;
+ break; + break;
+ +
default: default:
usage (LS_FAILURE); usage (LS_FAILURE);
} }
@@ -2557,8 +2581,10 @@ clear_files (void) @@ -2557,8 +2581,10 @@ clear_files (void)
struct fileinfo *f = sorted_file[i]; struct fileinfo *f = sorted_file[i];
free (f->name); free (f->name);
free (f->linkname); free (f->linkname);
- if (f->scontext != UNKNOWN_SECURITY_CONTEXT) - if (f->scontext != UNKNOWN_SECURITY_CONTEXT)
- freecon (f->scontext); - freecon (f->scontext);
+ if (f->scontext != UNKNOWN_SECURITY_CONTEXT) { + if (f->scontext != UNKNOWN_SECURITY_CONTEXT) {
+ freecon (f->scontext); + freecon (f->scontext);
+ f->scontext = NULL; + f->scontext = NULL;
+ } + }
} }
@ -411,49 +411,49 @@ diff -urNp coreutils-7.1-orig/src/ls.c coreutils-7.1/src/ls.c
- if (format == long_format || print_scontext) - if (format == long_format || print_scontext)
+ if (format == long_format || format == security_format || print_scontext) + if (format == long_format || format == security_format || print_scontext)
{ {
bool have_selinux = false; bool have_selinux = false;
bool have_acl = false; bool have_acl = false;
@@ -2732,7 +2760,7 @@ gobble_file (char const *name, enum file @@ -2732,7 +2760,7 @@ gobble_file (char const *name, enum file
err = 0; err = 0;
} }
- if (err == 0 && format == long_format) - if (err == 0 && format == long_format)
+ if (err == 0 && (format == long_format || format == security_format)) + if (err == 0 && (format == long_format || format == security_format))
{ {
int n = file_has_acl (absolute_name, &f->stat); int n = file_has_acl (absolute_name, &f->stat);
err = (n < 0); err = (n < 0);
@@ -2751,7 +2779,8 @@ gobble_file (char const *name, enum file @@ -2751,7 +2779,8 @@ gobble_file (char const *name, enum file
} }
if (S_ISLNK (f->stat.st_mode) if (S_ISLNK (f->stat.st_mode)
- && (format == long_format || check_symlink_color)) - && (format == long_format || check_symlink_color))
+ && (format == long_format || format == security_format + && (format == long_format || format == security_format
+ || check_symlink_color)) + || check_symlink_color))
{ {
char *linkname; char *linkname;
struct stat linkstats; struct stat linkstats;
@@ -2771,6 +2800,7 @@ gobble_file (char const *name, enum file @@ -2771,6 +2800,7 @@ gobble_file (char const *name, enum file
command line are automatically traced if not being command line are automatically traced if not being
listed as files. */ listed as files. */
if (!command_line_arg || format == long_format if (!command_line_arg || format == long_format
+ || format == security_format + || format == security_format
|| !S_ISDIR (linkstats.st_mode)) || !S_ISDIR (linkstats.st_mode))
{ {
/* Get the linked-to file's mode for the filetype indicator /* Get the linked-to file's mode for the filetype indicator
@@ -2810,7 +2840,7 @@ gobble_file (char const *name, enum file @@ -2810,7 +2840,7 @@ gobble_file (char const *name, enum file
block_size_width = len; block_size_width = len;
} }
- if (format == long_format) - if (format == long_format)
+ if (format == long_format || format == security_format) + if (format == long_format || format == security_format)
{ {
if (print_owner) if (print_owner)
{ {
@@ -3312,6 +3341,13 @@ print_current_files (void) @@ -3312,6 +3341,13 @@ print_current_files (void)
print_long_format (sorted_file[i]); print_long_format (sorted_file[i]);
DIRED_PUTCHAR ('\n'); DIRED_PUTCHAR ('\n');
} }
+ break; + break;
+ case security_format: + case security_format:
+ for (i = 0; i < cwd_n_used; i++) + for (i = 0; i < cwd_n_used; i++)
@ -514,15 +514,15 @@ diff -urNp coreutils-7.1-orig/src/ls.c coreutils-7.1/src/ls.c
+ DIRED_INDENT (); + DIRED_INDENT ();
+ DIRED_FPUTS (buf, stdout, p - buf); + DIRED_FPUTS (buf, stdout, p - buf);
+ size_t w = print_name_with_quoting (f->name, FILE_OR_LINK_MODE(f), f->linkok, + size_t w = print_name_with_quoting (f->name, FILE_OR_LINK_MODE(f), f->linkok,
+ f->stat_ok, f->filetype, &dired_obstack, f->stat.st_nlink, p - buf); + f->stat_ok, f->filetype, &dired_obstack, f->stat.st_nlink, p - buf);
+ +
+ if (f->filetype == symbolic_link) { + if (f->filetype == symbolic_link) {
+ if (f->linkname) { + if (f->linkname) {
+ DIRED_FPUTS_LITERAL (" -> ", stdout); + DIRED_FPUTS_LITERAL (" -> ", stdout);
+ print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1, + print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1,
+ f->stat_ok, f->filetype, NULL, f->stat.st_nlink, (p-buf) + w + 4 ); + f->stat_ok, f->filetype, NULL, f->stat.st_nlink, (p-buf) + w + 4 );
+ if (indicator_style != none) + if (indicator_style != none)
+ print_type_indicator (f->stat_ok, f->linkmode, f->filetype); + print_type_indicator (f->stat_ok, f->linkmode, f->filetype);
+ } + }
+ } + }
+ else { + else {
@ -553,27 +553,27 @@ diff -urNp coreutils-7.1-orig/src/ls.c coreutils-7.1/src/ls.c
@@ -3543,9 +3648,6 @@ print_long_format (const struct fileinfo @@ -3543,9 +3648,6 @@ print_long_format (const struct fileinfo
if (print_author) if (print_author)
format_user (f->stat.st_author, author_width, f->stat_ok); format_user (f->stat.st_author, author_width, f->stat_ok);
- if (print_scontext) - if (print_scontext)
- format_user_or_group (f->scontext, 0, scontext_width); - format_user_or_group (f->scontext, 0, scontext_width);
- -
p = buf; p = buf;
} }
@@ -3888,9 +3990,6 @@ print_file_name_and_frills (const struct @@ -3888,9 +3990,6 @@ print_file_name_and_frills (const struct
human_readable (ST_NBLOCKS (f->stat), buf, human_output_opts, human_readable (ST_NBLOCKS (f->stat), buf, human_output_opts,
ST_NBLOCKSIZE, output_block_size)); ST_NBLOCKSIZE, output_block_size));
- if (print_scontext) - if (print_scontext)
- printf ("%*s ", format == with_commas ? 0 : scontext_width, f->scontext); - printf ("%*s ", format == with_commas ? 0 : scontext_width, f->scontext);
- -
size_t width = print_name_with_quoting (f->name, FILE_OR_LINK_MODE (f), size_t width = print_name_with_quoting (f->name, FILE_OR_LINK_MODE (f),
f->linkok, f->stat_ok, f->filetype, f->linkok, f->stat_ok, f->filetype,
NULL, f->stat.st_nlink, start_col); NULL, f->stat.st_nlink, start_col);
@@ -4105,9 +4204,6 @@ length_of_file_name_and_frills (const st @@ -4105,9 +4204,6 @@ length_of_file_name_and_frills (const st
output_block_size)) output_block_size))
: block_size_width); : block_size_width);
- if (print_scontext) - if (print_scontext)
- len += 1 + (format == with_commas ? strlen (f->scontext) : scontext_width); - len += 1 + (format == with_commas ? strlen (f->scontext) : scontext_width);
@ -598,7 +598,7 @@ diff -urNp coreutils-7.1-orig/src/ls.c coreutils-7.1/src/ls.c
+"), stdout); +"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_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 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-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 +++ coreutils-7.1/src/mkdir.c 2009-02-24 13:47:15.000000000 +0100
@ -665,32 +665,32 @@ diff -urNp coreutils-7.1-orig/src/stat.c coreutils-7.1/src/stat.c
+ if (terse) + if (terse)
{ {
- format = (terse - format = (terse
- ? "%n %i %l %t %s %S %b %f %a %c %d\n" - ? "%n %i %l %t %s %S %b %f %a %c %d\n"
- : " File: \"%n\"\n" - : " File: \"%n\"\n"
- " ID: %-8i Namelen: %-7l Type: %T\n" - " ID: %-8i Namelen: %-7l Type: %T\n"
- "Block size: %-10s Fundamental block size: %S\n" - "Block size: %-10s Fundamental block size: %S\n"
- "Blocks: Total: %-10b Free: %-10f Available: %a\n" - "Blocks: Total: %-10b Free: %-10f Available: %a\n"
- "Inodes: Total: %-10c Free: %d\n"); - "Inodes: Total: %-10c Free: %d\n");
+ if (secure) + if (secure)
+ format = "%n %i %l %t %s %S %b %f %a %c %d %C\n"; + format = "%n %i %l %t %s %S %b %f %a %c %d %C\n";
+ else + else
+ format = "%n %i %l %t %s %S %b %f %a %c %d\n"; + format = "%n %i %l %t %s %S %b %f %a %c %d\n";
} }
+ else + else
+ { + {
+ if (secure) + if (secure)
+ format = " File: \"%n\"\n" + format = " File: \"%n\"\n"
+ " ID: %-8i Namelen: %-7l Type: %T\n" + " ID: %-8i Namelen: %-7l Type: %T\n"
+ "Block size: %-10s Fundamental block size: %S\n" + "Block size: %-10s Fundamental block size: %S\n"
+ "Blocks: Total: %-10b Free: %-10f Available: %a\n" + "Blocks: Total: %-10b Free: %-10f Available: %a\n"
+ "Inodes: Total: %-10c Free: %d\n" + "Inodes: Total: %-10c Free: %d\n"
+ " S_Context: %C\n"; + " S_Context: %C\n";
+ else + else
+ format = " File: \"%n\"\n" + format = " File: \"%n\"\n"
+ " ID: %-8i Namelen: %-7l Type: %T\n" + " ID: %-8i Namelen: %-7l Type: %T\n"
+ "Block size: %-10s Fundamental block size: %S\n" + "Block size: %-10s Fundamental block size: %S\n"
+ "Blocks: Total: %-10b Free: %-10f Available: %a\n" + "Blocks: Total: %-10b Free: %-10f Available: %a\n"
+ "Inodes: Total: %-10c Free: %d\n"; + "Inodes: Total: %-10c Free: %d\n";
+ } + }
+ } + }
@ -709,46 +709,46 @@ diff -urNp coreutils-7.1-orig/src/stat.c coreutils-7.1/src/stat.c
if (format == NULL) if (format == NULL)
{ {
if (terse) if (terse)
- { - {
- format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n"; - format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n";
- } - }
+ { + {
+ if (secure) + if (secure)
+ format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o %C\n"; + format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o %C\n";
+ else + else
+ format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n"; + format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n";
+ } + }
else else
{ {
/* Temporary hack to match original output until conditional /* Temporary hack to match original output until conditional
@@ -885,12 +904,22 @@ do_stat (char const *filename, bool ters @@ -885,12 +904,22 @@ do_stat (char const *filename, bool ters
} }
else else
{ {
- format = - format =
- " File: %N\n" - " File: %N\n"
- " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" - " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
- "Device: %Dh/%dd\tInode: %-10i Links: %h\n" - "Device: %Dh/%dd\tInode: %-10i Links: %h\n"
- "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" - "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
- "Access: %x\n" "Modify: %y\n" "Change: %z\n"; - "Access: %x\n" "Modify: %y\n" "Change: %z\n";
+ if (secure) + if (secure)
+ format = + format =
+ " File: %N\n" + " File: %N\n"
+ " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" + " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
+ "Device: %Dh/%dd\tInode: %-10i Links: %-5h" + "Device: %Dh/%dd\tInode: %-10i Links: %-5h"
+ " Device type: %t,%T\n" + " Device type: %t,%T\n"
+ "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" + "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
+ " S_Context: %C\n" + " S_Context: %C\n"
+ "Access: %x\n" "Modify: %y\n" "Change: %z\n"; + "Access: %x\n" "Modify: %y\n" "Change: %z\n";
+ else + else
+ format = + format =
+ " File: %N\n" + " File: %N\n"
+ " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" + " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
+ "Device: %Dh/%dd\tInode: %-10i Links: %h\n" + "Device: %Dh/%dd\tInode: %-10i Links: %h\n"
+ "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" + "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
+ "Access: %x\n" "Modify: %y\n" "Change: %z\n"; + "Access: %x\n" "Modify: %y\n" "Change: %z\n";
} }
} }
} }
@@ -911,6 +940,7 @@ usage (int status) @@ -911,6 +940,7 @@ usage (int status)
Display file or file system status.\n\ Display file or file system status.\n\
@ -767,34 +767,34 @@ diff -urNp coreutils-7.1-orig/src/stat.c coreutils-7.1/src/stat.c
bool ok = true; bool ok = true;
@@ -1034,13 +1065,13 @@ main (int argc, char *argv[]) @@ -1034,13 +1065,13 @@ main (int argc, char *argv[])
terse = true; terse = true;
break; break;
- case 'Z': /* FIXME: remove in 2010 */ - case 'Z': /* FIXME: remove in 2010 */
- /* Ignore, for compatibility with distributions - /* Ignore, for compatibility with distributions
- that implemented this before upstream. - that implemented this before upstream.
- But warn of impending removal. */ - But warn of impending removal. */
- error (0, 0, - error (0, 0,
- _("the --context (-Z) option is obsolete and will be removed\n" - _("the --context (-Z) option is obsolete and will be removed\n"
- "in a future release")); - "in a future release"));
+ case 'Z': + case 'Z':
+ if((is_selinux_enabled()>0)) + if((is_selinux_enabled()>0))
+ secure = 1; + secure = 1;
+ else { + else {
+ error (0, 0, _("Kernel is not SELinux enabled")); + error (0, 0, _("Kernel is not SELinux enabled"));
+ usage (EXIT_FAILURE); + usage (EXIT_FAILURE);
+ } + }
break; break;
case_GETOPT_HELP_CHAR; case_GETOPT_HELP_CHAR;
@@ -1060,8 +1091,8 @@ main (int argc, char *argv[]) @@ -1060,8 +1091,8 @@ main (int argc, char *argv[])
for (i = optind; i < argc; i++) for (i = optind; i < argc; i++)
ok &= (fs ok &= (fs
- ? do_statfs (argv[i], terse, format) - ? do_statfs (argv[i], terse, format)
- : do_stat (argv[i], terse, format)); - : do_stat (argv[i], terse, format));
+ ? do_statfs (argv[i], terse, secure, format) + ? do_statfs (argv[i], terse, secure, format)
+ : do_stat (argv[i], terse, secure, format)); + : do_stat (argv[i], terse, secure, format));
exit (ok ? EXIT_SUCCESS : EXIT_FAILURE); exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
} }

View File

@ -33,24 +33,24 @@
- || sigprocmask(SIG_UNBLOCK, &ourset, NULL)) { - || sigprocmask(SIG_UNBLOCK, &ourset, NULL)) {
+ if (!same_session) + if (!same_session)
+ { + {
+ if (sigaddset(&ourset, SIGINT) || sigaddset(&ourset, SIGQUIT)) + if (sigaddset(&ourset, SIGINT) || sigaddset(&ourset, SIGQUIT))
+ { + {
+ fprintf(stderr, "%s: signal masking malfunction\n", PROGRAM_NAME); + fprintf(stderr, "%s: signal masking malfunction\n", PROGRAM_NAME);
+ caught = 1; + caught = 1;
+ } + }
+ } + }
+ if (!caught && (sigaddset(&ourset, SIGTERM) + if (!caught && (sigaddset(&ourset, SIGTERM)
+ || sigaddset(&ourset, SIGALRM) + || sigaddset(&ourset, SIGALRM)
+ || sigaction(SIGTERM, &action, NULL) + || sigaction(SIGTERM, &action, NULL)
+ || sigprocmask(SIG_UNBLOCK, &ourset, NULL))) { + || sigprocmask(SIG_UNBLOCK, &ourset, NULL))) {
fprintf(stderr, "%s: signal masking malfunction\n", PROGRAM_NAME); fprintf(stderr, "%s: signal masking malfunction\n", PROGRAM_NAME);
caught = 1; caught = 1;
} }
+ if (!caught && !same_session && (sigaction(SIGINT, &action, NULL) + if (!caught && !same_session && (sigaction(SIGINT, &action, NULL)
+ || sigaction(SIGQUIT, &action, NULL))) + || sigaction(SIGQUIT, &action, NULL)))
+ { + {
+ fprintf(stderr, "%s: signal masking malfunction\n", PROGRAM_NAME); + fprintf(stderr, "%s: signal masking malfunction\n", PROGRAM_NAME);
+ caught = 1; + caught = 1;
+ } + }
} }
if (!caught) { if (!caught) {
@ -73,17 +73,17 @@
struct passwd *pw; struct passwd *pw;
struct passwd pw_copy; struct passwd pw_copy;
@@ -656,6 +679,11 @@ @@ -656,6 +679,11 @@
command = optarg; command = optarg;
break; break;
+ case 'C': + case 'C':
+ command = optarg; + command = optarg;
+ request_same_session = 1; + request_same_session = 1;
+ break; + break;
+ +
case 'f': case 'f':
fast_startup = true; fast_startup = true;
break; break;
@@ -725,6 +753,9 @@ @@ -725,6 +753,9 @@
} }
#endif #endif

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.5 Version: 7.6
Release: 6%{?dist} Release: 1%{?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/
@ -18,14 +18,11 @@ Source202: coreutils-su-l.pamd
Source203: coreutils-runuser-l.pamd Source203: coreutils-runuser-l.pamd
# From upstream # From upstream
Patch1: coreutils-7.5-kojiutimensatskip.patch
Patch2: coreutils-7.5-ls-inode.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-7.4-sttytcsadrain.patch Patch102: coreutils-7.4-sttytcsadrain.patch
Patch103: coreutils-7.5-df-localdevice.patch
# sh-utils # sh-utils
Patch703: sh-utils-2.0.11-dateman.patch Patch703: sh-utils-2.0.11-dateman.patch
@ -110,14 +107,11 @@ Libraries for coreutils package.
%setup -q %setup -q
# From upstream # From upstream
%patch1 -p1 -b .kojiutimensat
%patch2 -p1 -b .inode
# Our patches # Our patches
%patch100 -p1 -b .configure %patch100 -p1 -b .configure
%patch101 -p1 -b .manpages %patch101 -p1 -b .manpages
%patch102 -p1 -b .tcsadrain %patch102 -p1 -b .tcsadrain
%patch103 -p1 -b .localdevice
# sh-utils # sh-utils
%patch703 -p1 -b .dateman %patch703 -p1 -b .dateman
@ -333,6 +327,10 @@ fi
%{_libdir}/coreutils %{_libdir}/coreutils
%changelog %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 * Thu Sep 10 2009 Ondrej Vasik <ovasik@redhat.com> - 7.5-6
- fix double free error in fold for singlebyte locales - fix double free error in fold for singlebyte locales
(caused by multibyte patch) (caused by multibyte patch)

View File

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