New upstream release 6.10, for more details see changelog

This commit is contained in:
Ondrej Vasik 2008-01-25 17:48:11 +00:00
parent 7bec829ba1
commit 0363d66490
20 changed files with 1319 additions and 3334 deletions

View File

@ -1,15 +1,15 @@
--- coreutils-5.97/src/uname.c.sysinfo 2005-09-15 20:57:04.000000000 +0100
+++ coreutils-5.97/src/uname.c 2006-08-24 17:15:56.000000000 +0100
@@ -155,7 +155,7 @@
@@ -263,7 +263,7 @@
int
main (int argc, char **argv)
{
int c;
- static char const unknown[] = "unknown";
+ static char unknown[] = "unknown";
/* Mask indicating which elements to print. */
unsigned int toprint = 0;
@@ -249,13 +249,35 @@
@@ -306,13 +306,35 @@
if (toprint & PRINT_PROCESSOR)
{
@ -46,7 +46,7 @@
#endif
#ifdef UNAME_PROCESSOR
if (element == unknown)
@@ -293,7 +315,7 @@
@@ -348,7 +370,7 @@
if (toprint & PRINT_HARDWARE_PLATFORM)
{
@ -55,7 +55,7 @@
#if HAVE_SYSINFO && defined SI_PLATFORM
{
static char hardware_platform[257];
@@ -301,6 +323,14 @@
@@ -356,6 +378,14 @@
hardware_platform, sizeof hardware_platform))
element = hardware_platform;
}

View File

@ -1,5 +1,5 @@
--- coreutils-6.7/tests/help-version.runuser 2006-12-07 09:06:04.000000000 +0000
+++ coreutils-6.7/tests/help-version 2007-01-09 17:31:44.000000000 +0000
--- coreutils-6.10/tests/misc/help-version.runuser
+++ coreutils-6.10/tests/misc/help-version
@@ -168,6 +168,7 @@
seq_args=10
sleep_args=0
@ -8,17 +8,19 @@
# I'd rather not run sync, since it spins up disks that I've
# deliberately caused to spin down (but not unmounted).
--- coreutils-6.7/README.runuser 2006-11-24 21:28:27.000000000 +0000
+++ coreutils-6.7/README 2007-01-09 17:32:16.000000000 +0000
@@ -11,7 +11,7 @@
dd df dir dircolors dirname du echo env expand expr factor false fmt fold
ginstall groups head hostid hostname id join kill link ln logname ls
md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr
- printenv printf ptx pwd readlink rm rmdir seq sha1sum sha224sum sha256sum
+ printenv printf ptx pwd readlink rm rmdir runuser seq sha1sum sha224sum sha256sum
sha384sum sha512sum shred shuf sleep sort split stat stty su sum sync tac
tail tee test touch tr true tsort tty uname unexpand uniq unlink uptime
users vdir wc who whoami yes
--- coreutils-6.10/README.runuser
+++ coreutils-6.10/README
@@ -11,8 +11,8 @@
factor false fmt fold groups head hostid hostname id install join kill
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
- runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf
- sleep sort split stat stty su sum sync tac tail tee test touch tr true
+ runcon runuser seq sha1sum sha224sum sha256sum sha384sum sha512sum shred
+ shuf sleep sort split stat stty su sum sync tac tail tee test touch tr true
tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes
See the file NEWS for a list of major changes in the current release.
--- coreutils-6.7/src/su.c.runuser 2007-01-09 17:27:56.000000000 +0000
+++ coreutils-6.7/src/su.c 2007-01-09 17:30:12.000000000 +0000
@@ -110,9 +110,15 @@
@ -92,7 +94,7 @@
+#ifdef RUNUSER
+ if (getuid() != geteuid())
+ /* safety net: deny operation if we are suid by accident */
+ error(EXIT_FAIL, 1, "runuser may not be setuid");
+ error(EXIT_FAILURE, 1, "runuser may not be setuid");
+#else
retval = pam_authenticate(pamh, 0);
PAM_BAIL_P;
@ -190,7 +192,7 @@
+ case 'g':
+ gr = getgrnam(optarg);
+ if (!gr)
+ error (EXIT_FAIL, 0, _("group %s does not exist"), optarg);
+ error (EXIT_FAILURE, 0, _("group %s does not exist"), optarg);
+ use_gid = 1;
+ groups[0] = gr->gr_gid;
+ break;
@ -198,12 +200,12 @@
+ case 'G':
+ num_supp_groups++;
+ if (num_supp_groups >= NGROUPS_MAX)
+ error (EXIT_FAIL, 0,
+ error (EXIT_FAILURE, 0,
+ _("Can't specify more than %d supplemental groups"),
+ NGROUPS_MAX - 1);
+ gr = getgrnam(optarg);
+ if (!gr)
+ error (EXIT_FAIL, 0, _("group %s does not exist"), optarg);
+ error (EXIT_FAILURE, 0, _("group %s does not exist"), optarg);
+ groups[num_supp_groups] = gr->gr_gid;
+ break;
+#endif
@ -252,17 +254,17 @@
+#endif
+ );
}
--- coreutils-6.7/src/Makefile.am.runuser 2007-01-09 17:27:56.000000000 +0000
+++ coreutils-6.7/src/Makefile.am 2007-01-09 17:27:56.000000000 +0000
@@ -17,7 +17,7 @@
## along with this program; if not, write to the Free Software Foundation,
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-EXTRA_PROGRAMS = chroot df hostid nice pinky stty su uname uptime users who
+EXTRA_PROGRAMS = chroot df hostid nice pinky stty su runuser uname uptime users who
bin_SCRIPTS = groups
bin_PROGRAMS = [ chgrp chown chmod cp dd dircolors du \
--- coreutils-6.10/src/Makefile.am.runuser
+++ coreutils-6.10/src/Makefile.am
@@ -38,7 +38,7 @@
shuf sort split sum tac tail tr tsort unexpand uniq wc \
basename date dirname echo env expr factor false \
id kill logname pathchk printenv printf pwd \
- runcon seq sleep tee \
+ runcon runuser seq sleep tee \
test true tty whoami yes \
base64
@@ -112,6 +112,10 @@
mv_LDADD += $(LIB_ACL)
ginstall_LDADD += $(LIB_ACL)
@ -283,27 +285,26 @@
installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'`
--- coreutils-6.7/AUTHORS.runuser 2006-10-22 17:54:15.000000000 +0100
+++ coreutils-6.7/AUTHORS 2007-01-09 17:27:56.000000000 +0000
--- coreutils-6.10/AUTHORS.runuser
+++ coreutils-6.10/AUTHORS
@@ -60,6 +60,7 @@
readlink: Dmitry V. Levin
rm: Paul Rubin, David MacKenzie, Richard Stallman, Jim Meyering
rmdir: David MacKenzie
+runuser: David MacKenzie, Dan Walsh
runcon: Russell Coker
seq: Ulrich Drepper
sha1sum: Ulrich Drepper, Scott Miller, David Madore
sha224sum: Ulrich Drepper, Scott Miller, David Madore
--- coreutils-6.7/man/Makefile.am.runuser 2006-11-16 08:49:56.000000000 +0000
+++ coreutils-6.7/man/Makefile.am 2007-01-09 17:32:38.000000000 +0000
@@ -26,7 +26,7 @@
link.1 ln.1 logname.1 \
ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mv.1 nl.1 nohup.1 od.1 \
paste.1 pathchk.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \
- rm.1 rmdir.1 seq.1 sha1sum.1 sha224sum.1 sha256sum.1 sha384sum.1 sha512sum.1 \
+ rm.1 rmdir.1 runuser.1 seq.1 sha1sum.1 sha224sum.1 sha256sum.1 sha384sum.1 sha512sum.1 \
shred.1 shuf.1 sleep.1 sort.1 split.1 stat.1 \
su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
tty.1 unexpand.1 uniq.1 unlink.1 vdir.1 wc.1 \
--- coreutils-6.10/man/Makefile.am.runuser
+++ coreutils-6.10/man/Makefile.am
@@ -92,6 +92,7 @@
rm.1: $(common_dep) $(srcdir)/rm.x ../src/rm.c
rmdir.1: $(common_dep) $(srcdir)/rmdir.x ../src/rmdir.c
runcon.1: $(common_dep) $(srcdir)/runcon.x ../src/runcon.c
+runuser.1: $(common_dep) $(srcdir)/runuser.x ../src/su.c
seq.1: $(common_dep) $(srcdir)/seq.x ../src/seq.c
sha1sum.1: $(common_dep) $(srcdir)/sha1sum.x ../src/md5sum.c
sha224sum.1: $(common_dep) $(srcdir)/sha224sum.x ../src/md5sum.c
--- /dev/null 2007-01-09 09:38:07.860075128 +0000
+++ coreutils-6.7/man/runuser.x 2007-01-09 17:27:56.000000000 +0000
@@ -0,0 +1,4 @@
@ -312,7 +313,7 @@
+[DESCRIPTION]
+.\" Add any additional description here
--- /dev/null 2007-01-09 09:38:07.860075128 +0000
+++ coreutils-6.7/man/runuser.1 2007-01-09 17:27:56.000000000 +0000
+++ coreutils-6.10/man/runuser.1 2007-01-09 17:27:56.000000000 +0000
@@ -0,0 +1,68 @@
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33.
+.TH RUNUSER "1" "September 2004" "runuser (coreutils) 5.2.1" "User Commands"
@ -330,7 +331,7 @@
+to set user ID, the command will fail.
+.TP
+-, \fB\-l\fR, \fB\-\-login\fR
+make the shell a login shell
+make the shell a login shell, uses runuser-l PAM file instead of default one.
+.TP
+\fB\-c\fR, \fB\-\-commmand\fR=\fICOMMAND\fR
+pass a single COMMAND to the shell with \fB\-c\fR

View File

@ -1,110 +0,0 @@
When "cp -i --update old new" would do nothing because "new" is
newer than "old", cp would nonetheless prompt for whether it is
ok to overwrite "new". Then, regardless of the response (because
of the --update option), cp would do nothing.
The following patch eliminates the unnecessary prompt in that case.
diff --git a/src/copy.c b/src/copy.c
index b7bf73b..0e549d2 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -1210,6 +1210,30 @@ copy_internal (char const *src_name, char const *dst_name,
return false;
}
+ if (!S_ISDIR (src_mode) && x->update)
+ {
+ /* When preserving time stamps (but not moving within a file
+ system), don't worry if the destination time stamp is
+ less than the source merely because of time stamp
+ truncation. */
+ int options = ((x->preserve_timestamps
+ && ! (x->move_mode
+ && dst_sb.st_dev == src_sb.st_dev))
+ ? UTIMECMP_TRUNCATE_SOURCE
+ : 0);
+
+ if (0 <= utimecmp (dst_name, &dst_sb, &src_sb, options))
+ {
+ /* We're using --update and the destination is not older
+ than the source, so do not copy or move. Pretend the
+ rename succeeded, so the caller (if it's mv) doesn't
+ end up removing the source file. */
+ if (rename_succeeded)
+ *rename_succeeded = true;
+ return true;
+ }
+ }
+
/* When there is an existing destination file, we may end up
returning early, and hence not copying/moving the file.
This may be due to an interactive `negative' reply to the
@@ -1302,30 +1326,6 @@ copy_internal (char const *src_name, char const *dst_name,
return false;
}
}
-
- if (x->update)
- {
- /* When preserving time stamps (but not moving within a file
- system), don't worry if the destination time stamp is
- less than the source merely because of time stamp
- truncation. */
- int options = ((x->preserve_timestamps
- && ! (x->move_mode
- && dst_sb.st_dev == src_sb.st_dev))
- ? UTIMECMP_TRUNCATE_SOURCE
- : 0);
-
- if (0 <= utimecmp (dst_name, &dst_sb, &src_sb, options))
- {
- /* We're using --update and the destination is not older
- than the source, so do not copy or move. Pretend the
- rename succeeded, so the caller (if it's mv) doesn't
- end up removing the source file. */
- if (rename_succeeded)
- *rename_succeeded = true;
- return true;
- }
- }
}
if (x->move_mode)
diff --git a/tests/mv/update b/tests/mv/update
index 0c06024..6c3d149 100755
--- a/tests/mv/update
+++ b/tests/mv/update
@@ -1,7 +1,7 @@
#!/bin/sh
# make sure --update works as advertised
-# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2004, 2006-2007 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
@@ -46,11 +46,16 @@ fi
fail=0
-for cp_or_mv in cp mv; do
- # This is a no-op.
- $cp_or_mv --update old new || fail=1
- case "`cat new`" in new) ;; *) fail=1 ;; esac
- case "`cat old`" in old) ;; *) fail=1 ;; esac
+for interactive in '' -i; do
+ for cp_or_mv in cp mv; do
+ # This is a no-op, with no prompt.
+ # With coreutils-6.9 and earlier, using --update with -i would
+ # mistakenly elicit a prompt.
+ $cp_or_mv $interactive --update old new < /dev/null > out 2>&1 || fail=1
+ test -s out && fail=1
+ case "`cat new`" in new) ;; *) fail=1 ;; esac
+ case "`cat old`" in old) ;; *) fail=1 ;; esac
+ done
done
# This will actually perform the rename.
--
1.5.3.rc1.16.g9d6f

View File

@ -1,98 +0,0 @@
Fixes some small bugs (merged upstream patches)
Fixed RedHat Bugzillas: 250089(fix by jplans@redhat.com), 239266
diff -Naurp coreutils-5.2.1/lib/fts.c coreutils-5.2.1.new/lib/fts.c
--- coreutils-5.2.1/lib/fts.c 2003-12-20 10:05:23.000000000 -0800
+++ coreutils-5.2.1.new/lib/fts.c 2007-06-14 11:38:00.696001000 -0700
@@ -685,7 +685,7 @@ fts_read(sp)
/* If fts_build's call to fts_safe_changedir failed
because it was not able to fchdir into a
subdirectory, tell the caller. */
- if (p->fts_errno)
+ if (p->fts_errno && p->fts_info != FTS_DNR)
p->fts_info = FTS_ERR;
LEAVE_DIR (sp, p, "2");
return (p);
}
diff -ur coreutils-6.9-orig/src/du.c coreutils-6.9/src/du.c
--- coreutils-6.9-orig/src/du.c
+++ coreutils-6.9/src/du.c
duinfo_add (&dulvl[level].ent, &dui);
/* Even if this directory is unreadable or we can't chdir into it,
- do let its size contribute to the total, ... */
+ do let its size contribute to the total. */
duinfo_add (&tot_dui, &dui);
- /* ... but don't print out a total for it, since without the size(s)
- of any potential entries, it could be very misleading. */
- if (ent->fts_info == FTS_DNR)
- return ok;
-
/* If we're not counting an entry, e.g., because it's a hard link
to a file we've already counted (and --count-links), then don't
print a line for it. */
diff -urNp coreutils-6.9-orig/src/dircolors.hin coreutils-6.9/src/dircolors.hin
--- coreutils-6.9-orig/src/dircolors.hin 2007-03-18 22:36:43.000000000 +0100
+++ coreutils-6.9/src/dircolors.hin 2007-11-02 12:27:03.000000000 +0100
@@ -27,6 +27,7 @@ TERM cons25
TERM console
TERM cygwin
TERM dtterm
+TERM eterm-color
TERM gnome
TERM konsole
TERM kterm
@@ -40,6 +40,7 @@ TERM rxvt-cygwin
TERM rxvt-cygwin-native
TERM rxvt-unicode
TERM screen
+TERM screen-256color
TERM screen-bce
TERM screen-w
TERM screen.linux
@@ -46,7 +47,9 @@ TERM screen-w
TERM screen.linux
TERM vt100
TERM xterm
+TERM xterm-16color
TERM xterm-256color
+TERM xterm-88color
TERM xterm-color
TERM xterm-debian
diff -ur a/src/ls.c b/src/ls.c
--- a/src/ls.c
+++ b/src/ls.c
@@ -1168,7 +1168,7 @@ main (int argc, char **argv)
{
/* Avoid following symbolic links when possible. */
if (is_colored (C_ORPHAN)
- || is_colored (C_EXEC)
+ || (is_colored (C_EXEC) && color_symlink_as_referent)
|| (is_colored (C_MISSING) && format == long_format))
check_symlink_color = true;
@@ -2570,7 +2574,8 @@ gobble_file (char const *name, enum file
|| ((print_inode || format_needs_type)
&& (type == symbolic_link || type == unknown)
&& (dereference == DEREF_ALWAYS
- || (command_line_arg && dereference != DEREF_NEVER)))
+ || (command_line_arg && dereference != DEREF_NEVER)
+ || color_symlink_as_referent || check_symlink_color))
/* Command line dereferences are already taken care of by the above
assertion that the inode number is not yet known. */
|| (print_inode && inode == NOT_AN_INODE_NUMBER)
@@ -2713,6 +2713,12 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
free (linkname);
}
+ /* When not distinguishing types of symlinks, pretend we know that
+ it is stat'able, so that it will be colored as a regular symlink,
+ and not as an orphan. */
+ if (S_ISLNK (f->stat.st_mode) && !check_symlink_color)
+ f->linkok = true;
+
if (S_ISLNK (f->stat.st_mode))
f->filetype = symbolic_link;
else if (S_ISDIR (f->stat.st_mode))

View File

@ -1,160 +0,0 @@
diff -ur coreutils-6.9-orig/src/install.c coreutils-6.9/src/install.c
--- coreutils-6.9-orig/src/install.c 2007-10-30 12:34:07.000000000 +0100
+++ coreutils-6.9/src/install.c 2007-10-30 15:41:15.000000000 +0100
@@ -174,6 +174,7 @@
x->preserve_mode = false;
x->preserve_timestamps = false;
x->require_preserve = false;
+ x->require_preserve_context = false;
x->recursive = false;
x->sparse_mode = SPARSE_AUTO;
x->symbolic_link = false;
diff -ur coreutils-6.9-orig/src/mv.c coreutils-6.9/src/mv.c
--- coreutils-6.9-orig/src/mv.c 2007-10-30 12:34:07.000000000 +0100
+++ coreutils-6.9/src/mv.c 2007-10-30 15:34:37.000000000 +0100
@@ -131,6 +131,7 @@
x->preserve_timestamps = true;
x->preserve_security_context = selinux_enabled;
x->require_preserve = false; /* FIXME: maybe make this an option */
+ x->require_preserve_context = false;
x->recursive = true;
x->sparse_mode = SPARSE_AUTO; /* FIXME: maybe make this an option */
x->symbolic_link = false;
diff -ur coreutils-6.9-orig/src/copy.c coreutils-6.9/src/copy.c
--- coreutils-6.9-orig/src/copy.c 2007-10-30 12:34:07.000000000 +0100
+++ coreutils-6.9/src/copy.c 2007-10-30 16:01:22.000000000 +0100
@@ -306,25 +307,33 @@
if (! *new_dst)
{
dest_desc = open (dst_name, O_WRONLY | O_TRUNC | O_BINARY);
#ifdef WITH_SELINUX
- if (dest_desc >= 0 && selinux_enabled &&
- (x->preserve_security_context || x->set_security_context))
+ if (x->preserve_security_context && 0 <= dest_desc)
{
- security_context_t con;
- if(getfscreatecon(&con) == -1)
+ security_context_t con = NULL;
+ if(getfscreatecon(&con) < 0)
{
- return_val = false;
- goto close_src_desc;
+ if (x->require_preserve_context)
+ {
+ error(0, errno, _("failed to get file system create context"));
+ return_val = false;
+ goto close_src_desc;
+ }
}
if (con)
{
- if(fsetfilecon(dest_desc, con) == -1)
+ if(fsetfilecon(dest_desc, con) < 0)
{
- return_val = false;
- freecon(con);
- goto close_src_desc;
+ if (x->require_preserve_context)
+ {
+ error(0, errno, _("failed to set security context of %s to %s"),
+ quote_n (0, dst_name), quote_n(1, con));
+ return_val = false;
+ freecon(con);
+ goto close_src_desc;
+ }
}
freecon(con);
}
@@ -1577,10 +1587,10 @@
{
if (setfscreatecon(con) < 0)
{
- error (0, errno, _("cannot set setfscreatecon %s"), quote (con));
- if (x->require_preserve) {
- freecon(con);
- return 1;
+ error (0, errno, _("cannot set default file creation context to %s"), quote (con));
+ if (x->require_preserve_context) {
+ freecon(con);
+ return false;
}
}
freecon(con);
@@ -1588,7 +1598,8 @@
else {
if (( errno != ENOTSUP ) && ( errno != ENODATA )) {
error (0, errno, _("cannot lgetfilecon %s"), quote (src_name));
- return 1;
+ if (x->require_preserve_context)
+ return false;
}
}
}
diff -ur coreutils-6.9-orig/src/copy.h coreutils-6.9/src/copy.h
--- coreutils-6.9-orig/src/copy.h 2007-10-30 12:34:07.000000000 +0100
+++ coreutils-6.9/src/copy.h 2007-10-30 15:52:59.000000000 +0100
@@ -150,6 +150,18 @@
it be zero. */
bool require_preserve;
+ /* Useful only when preserve_security_context is true.
+ If true, a failed attempt to preserve a file's security context
+ propagates failure "out" to the caller. If false, a failure to
+ preserve a file's security context does not change the invoking
+ application's exit status. Give diagnostics for failed syscalls
+ regardless of this setting. For example, with "cp --preserve=context"
+ this flag is "true", while with "cp -a", it is false. That means
+ "cp -a" attempts to preserve any security context, but does not
+ fail if it is unable to do so. */
+ bool require_preserve_context;
+
+
/* If true, copy directories recursively and copy special files
as themselves rather than copying their contents. */
bool recursive;
diff -ur coreutils-6.9-orig/src/cp.c coreutils-6.9/src/cp.c
--- coreutils-6.9-orig/src/cp.c 2007-10-30 12:42:13.000000000 +0100
+++ coreutils-6.9/src/cp.c 2007-10-30 16:00:33.000000000 +0100
@@ -766,7 +766,7 @@
x->preserve_security_context = false;
x->set_security_context = false;
#endif
-
+ x->require_preserve_context = false;
x->require_preserve = false;
x->recursive = false;
x->sparse_mode = SPARSE_AUTO;
@@ -844,6 +844,7 @@
case PRESERVE_CONTEXT:
x->preserve_security_context = on_off;
+ x->require_preserve_context = on_off;
break;
case PRESERVE_ALL:
@@ -851,7 +834,10 @@
x->preserve_timestamps = on_off;
x->preserve_ownership = on_off;
x->preserve_links = on_off;
- x->preserve_security_context = on_off;
+ if (selinux_enabled) {
+ x->preserve_security_context = on_off;
+ x->require_preserve_context = on_off;
+ }
break;
default:
@@ -915,8 +916,9 @@
x.preserve_ownership = true;
x.preserve_mode = true;
x.preserve_timestamps = true;
- x.preserve_security_context = true;
- x.require_preserve = true;
+ if (selinux_enabled)
+ x.preserve_security_context = true;
+ x.require_preserve = true;
x.recursive = true;
break;

View File

@ -1,205 +0,0 @@
diff -urp coreutils-6.9-orig/src/stat.c coreutils-6.9/src/stat.c
--- coreutils-6.9-orig/src/stat.c 2007-12-04 16:26:39.000000000 +0100
+++ coreutils-6.9/src/stat.c 2007-12-05 00:05:11.000000000 +0100
@@ -55,12 +55,7 @@
# include <fs_info.h>
#endif
-#ifdef WITH_SELINUX
#include <selinux/selinux.h>
-#define SECURITY_ID_T security_context_t
-#else
-#define SECURITY_ID_T char *
-#endif
#include "system.h"
@@ -179,6 +174,9 @@ static struct option const long_options[
char *program_name;
+/* Whether to follow symbolic links; True for --dereference (-L). */
+static bool follow_links = false;
+
/* Whether to interpret backslash-escape sequences.
True for --printf=FMT, not for --format=FMT (-c). */
static bool interpret_backslash_escapes;
@@ -402,10 +400,30 @@ out_uint_x (char *pformat, size_t prefix
printf (pformat, arg);
}
+/* Very specialized function (modifies FORMAT), just so as to avoid
+ duplicating this code between both print_statfs and print_stat. */
+static void
+out_file_context (char const *filename, char *pformat, size_t prefix_len)
+{
+ char *scontext;
+ if ((follow_links
+ ? getfilecon (filename, &scontext)
+ : lgetfilecon (filename, &scontext)) < 0)
+ {
+ error (0, errno, _("failed to get security context of %s"),
+ quote (filename));
+ scontext = NULL;
+ }
+ strcpy (pformat + prefix_len, "s");
+ printf (pformat, (scontext ? scontext : "?"));
+ if (scontext)
+ freecon (scontext);
+}
+
/* print statfs info */
static void
print_statfs (char *pformat, size_t prefix_len, char m, char const *filename,
- void const *data, SECURITY_ID_T scontext)
+ void const *data)
{
STRUCT_STATVFS const *statfsbuf = data;
@@ -481,8 +499,7 @@ print_statfs (char *pformat, size_t pref
out_int (pformat, prefix_len, statfsbuf->f_ffree);
break;
case 'C':
- strcat (pformat, "s");
- printf(scontext);
+ out_file_context (filename, pformat, prefix_len);
break;
default:
fputc ('?', stdout);
@@ -493,7 +510,7 @@ print_statfs (char *pformat, size_t pref
/* print stat info */
static void
print_stat (char *pformat, size_t prefix_len, char m,
- char const *filename, void const *data, SECURITY_ID_T scontext)
+ char const *filename, void const *data)
{
struct stat *statbuf = (struct stat *) data;
struct passwd *pw_ent;
@@ -607,8 +624,7 @@ print_stat (char *pformat, size_t prefix
out_uint (pformat, prefix_len, statbuf->st_ctime);
break;
case 'C':
- strcat (pformat, "s");
- printf(pformat,scontext);
+ out_file_context(filename, pformat, prefix_len);
break;
default:
fputc ('?', stdout);
@@ -656,9 +672,8 @@ print_esc_char (char c)
static void
print_it (char const *format, char const *filename,
- void (*print_func) (char *, size_t, char, char const *, void const *,
- SECURITY_ID_T ),
- void const *data, SECURITY_ID_T scontext)
+ void (*print_func) (char *, size_t, char, char const *, void const *),
+ void const *data)
{
/* Add 2 to accommodate our conversion of the stat `%s' format string
to the longer printf `%llu' one. */
@@ -699,7 +714,7 @@ print_it (char const *format, char const
putchar ('%');
break;
default:
- print_func (dest, len + 1, *fmt_char, filename, data, scontext);
+ print_func (dest, len + 1, *fmt_char, filename, data);
break;
}
break;
@@ -765,18 +780,6 @@ static bool
do_statfs (char const *filename, bool terse, bool secure, char const *format)
{
STRUCT_STATVFS statfsbuf;
- SECURITY_ID_T scontext = NULL;
-#ifdef WITH_SELINUX
- if(is_selinux_enabled()) {
- if (getfilecon(filename,&scontext)<0) {
- if (secure) {
- perror (filename);
- return false;
- }
- scontext = NULL;
- }
- }
-#endif
if (STATFS (filename, &statfsbuf) != 0)
{
@@ -812,43 +815,23 @@ do_statfs (char const *filename, bool te
}
}
- print_it (format, filename, print_statfs, &statfsbuf, scontext);
-#ifdef WITH_SELINUX
- if (scontext != NULL)
- freecon(scontext);
-#endif
+ print_it (format, filename, print_statfs, &statfsbuf);
return true;
}
/* stat the file and print what we find */
static bool
-do_stat (char const *filename, bool follow_links, bool terse, bool secure,
+do_stat (char const *filename, bool terse, bool secure,
char const *format)
{
struct stat statbuf;
- SECURITY_ID_T scontext = NULL;
-
+
if ((follow_links ? stat : lstat) (filename, &statbuf) != 0)
{
error (0, errno, _("cannot stat %s"), quote (filename));
return false;
}
-#ifdef WITH_SELINUX
- if(is_selinux_enabled()) {
- int i;
- if (!follow_links)
- i=lgetfilecon(filename, &scontext);
- else
- i=getfilecon(filename, &scontext);
- if (i == -1 && secure)
- {
- perror (filename);
- return false;
- }
- }
-#endif
-
if (format == NULL)
{
if (terse)
@@ -893,11 +876,7 @@ do_stat (char const *filename, bool foll
}
}
}
- print_it (format, filename, print_stat, &statbuf, scontext);
-#ifdef WITH_SELINUX
- if (scontext)
- freecon(scontext);
-#endif
+ print_it (format, filename, print_stat, &statbuf);
return true;
}
@@ -996,7 +975,6 @@ main (int argc, char *argv[])
{
int c;
int i;
- bool follow_links = false;
bool fs = false;
bool terse = false;
bool secure = false;
@@ -1065,7 +1043,7 @@ main (int argc, char *argv[])
for (i = optind; i < argc; i++)
ok &= (fs
? do_statfs (argv[i], terse, secure, format)
- : do_stat (argv[i], follow_links, terse, secure, format));
+ : do_stat (argv[i], terse, secure, format));
exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
}

View File

@ -15,8 +15,9 @@ COLOR tty
OPTIONS -F -T 0
# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM console
TERM Eterm
TERM ansi
TERM color-xterm
TERM con132x25
TERM con132x30
TERM con132x43
@ -28,26 +29,34 @@ TERM con80x43
TERM con80x50
TERM con80x60
TERM cons25
TERM xterm
TERM console
TERM cygwin
TERM dtterm
TERM eterm-color
TERM gnome
TERM konsole
TERM kterm
TERM linux
TERM linux-c
TERM mach-color
TERM mlterm
TERM putty
TERM rxvt
TERM rxvt-cygwin
TERM rxvt-cygwin-native
TERM rxvt-unicode
TERM xterm-color
TERM screen
TERM screen-256color
TERM screen-bce
TERM screen-w
TERM screen.linux
TERM vt100
TERM xterm
TERM xterm-16color
TERM xterm-256color
TERM xterm-88color
TERM color-xterm
TERM vt100
TERM dtterm
TERM eterm-color
TERM color_xterm
TERM ansi
TERM screen
TERM screen-256color
TERM screen.linux
TERM kon
TERM kterm
TERM gnome
TERM konsole
TERM xterm-color
TERM xterm-debian
# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
EIGHTBIT 1
@ -63,13 +72,21 @@ EIGHTBIT 1
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 01;34 # directory
LINK 01;36 # symbolic link
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.)
FIFO 40;33 # pipe
SOCK 01;35 # socket
DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 01;05;37;41 # orphaned syminks
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
MISSING 01;05;37;41 # ... and the files they point to
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
EXEC 01;32
@ -77,31 +94,90 @@ EXEC 01;32
# 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.
# (and any comments you want to add after a '#')
.cmd 01;32 # executables (bright green)
# executables (bright green)
.cmd 01;32
.exe 01;32
.com 01;32
.btm 01;32
.bat 01;32
.sh 01;32
.csh 01;32
.tar 01;31 # archives or compressed (bright red)
# archives or compressed (bright red)
.tar 01;31
.tgz 01;31
.svgz 01;31
.arj 01;31
.taz 01;31
.lzh 01;31
.lzma 01;31
.zip 01;31
.z 01;31
.Z 01;31
.dz 01;31
.gz 01;31
.bz2 01;31
.tbz2 01;31
.bz 01;31
.tz 01;31
.deb 01;31
.rpm 01;31
.jar 01;31
.rar 01;31
.ace 01;31
.zoo 01;31
.cpio 01;31
.jpg 01;35 # image formats
.7z 01;31
.rz 01;31
# image formats (magenta)
.jpg 01;35
.jpeg 01;35
.gif 01;35
.bmp 01;35
.pbm 01;35
.pgm 01;35
.ppm 01;35
.tga 01;35
.xbm 01;35
.xpm 01;35
.png 01;35
.tif 01;35
.tiff 01;35
.png 01;35
.mng 01;35
.pcx 01;35
.mov 01;35
.mpg 01;35
.mpeg 01;35
.m2v 01;35
.mkv 01;35
.ogm 01;35
.mp4 01;35
.m4v 01;35
.mp4v 01;35
.vob 01;35
.qt 01;35
.nuv 01;35
.wmv 01;35
.asf 01;35
.rm 01;35
.rmvb 01;35
.flc 01;35
.avi 01;35
.fli 01;35
.gl 01;35
.dl 01;35
.xcf 01;35
.xwd 01;35
.yuv 01;35
.svg 01;35
# audio formats (cyan)
.aac 00;36
.au 00;36
.flac 00;36
.mid 00;36
.midi 00;36
.mka 00;36
.mp3 00;36
.mpc 00;36
.ogg 00;36
.ra 00;36
.wav 00;36

View File

@ -0,0 +1,161 @@
# Configuration file for the 256color ls utility
# This file goes in the /etc directory, and must be world readable.
# You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults.
# In the case that you are not satisfied with supplied colors, please
# submit your color configuration or attach your file with colors readable
# on ALL color background schemas (white,gray,black) to RedHat Bugzilla
# ticket on https://bugzilla.redhat.com/show_bug.cgi?id=429121 . TIA.
# Please just keep ls color conventions from 8 color scheme.
# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
# pipes. 'all' adds color characters to all output. 'none' shuts colorization
# off.
COLOR tty
# Extra command line options for ls go here.
# Basically these ones are:
# -F = show '/' for dirs, '*' for executables, etc.
# -T 0 = don't trust tab spacing when formatting ls output.
OPTIONS -F -T 0
# Below, there should be one TERM entry for each termtype that is colorizable
TERM putty-256color
TERM rxvt-256color
TERM screen-256color
TERM xterm-256color
TERM gnome-256color
# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
EIGHTBIT 1
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color(8 colors mode) codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color(8 colors mode) codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
# Text color(256 colors mode) codes:
# Valid syntax for text 256color is 38;5;<color number> , where color number
# is number between 0 and 255.
# You may find following command useful to search the best one for you:
# for ((x=0; x<=255; x++));do echo -e "${x}:\033[38;5;${x}mcolor\033[000m";done
# Background color(256 colors mode) codes:
# Valid syntax for background 256color is 48;5;<color number> , where
# color number is number between 0 and 255.
# You may find following command useful to search the best one for you:
# for ((x=0; x<=255; x++));do echo -e "${x}:\033[48;5;${x}mcolor\033[000m";done
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 01;38;5;27 # directory
LINK 01;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.)
FIFO 40;38;5;11 # pipe
SOCK 01;38;5;13 # socket
DOOR 01;38;5;5 # door
BLK 01;48;5;232;38;5;11 # block device driver
CHR 01;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
MISSING 01;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)
SETGID 48;5;11;38;5;16 # file that is setgid (g+s)
STICKY_OTHER_WRITABLE 48;5;10;38;5;16 # dir that is sticky and other-writable (+t,o+w)
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
# This is for files with execute permission:
EXEC 01;38;5;10
# 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.
# (and any comments you want to add after a '#')
# executables (bright green)
.cmd 01;38;5;10
.exe 01;38;5;10
.com 01;38;5;10
.btm 01;38;5;10
.bat 01;38;5;10
.sh 01;38;5;10
.csh 01;38;5;10
# archives or compressed (bright red)
.tar 01;38;5;9
.tgz 01;38;5;9
.svgz 01;38;5;9
.arj 01;38;5;9
.taz 01;38;5;9
.lzh 01;38;5;9
.lzma 01;38;5;9
.zip 01;38;5;9
.z 01;38;5;9
.Z 01;38;5;9
.dz 01;38;5;9
.gz 01;38;5;9
.bz2 01;38;5;9
.tbz2 01;38;5;9
.bz 01;38;5;9
.tz 01;38;5;9
.deb 01;38;5;9
.rpm 01;38;5;9
.jar 01;38;5;9
.rar 01;38;5;9
.ace 01;38;5;9
.zoo 01;38;5;9
.cpio 01;38;5;9
.7z 01;38;5;9
.rz 01;38;5;9
# image formats (magenta)
.jpg 01;38;5;13
.jpeg 01;38;5;13
.gif 01;38;5;13
.bmp 01;38;5;13
.pbm 01;38;5;13
.pgm 01;38;5;13
.ppm 01;38;5;13
.tga 01;38;5;13
.xbm 01;38;5;13
.xpm 01;38;5;13
.tif 01;38;5;13
.tiff 01;38;5;13
.png 01;38;5;13
.mng 01;38;5;13
.pcx 01;38;5;13
.mov 01;38;5;13
.mpg 01;38;5;13
.mpeg 01;38;5;13
.m2v 01;38;5;13
.mkv 01;38;5;13
.ogm 01;38;5;13
.mp4 01;38;5;13
.m4v 01;38;5;13
.mp4v 01;38;5;13
.vob 01;38;5;13
.qt 01;38;5;13
.nuv 01;38;5;13
.wmv 01;38;5;13
.asf 01;38;5;13
.rm 01;38;5;13
.rmvb 01;38;5;13
.flc 01;38;5;13
.avi 01;38;5;13
.fli 01;38;5;13
.gl 01;38;5;13
.dl 01;38;5;13
.xcf 01;38;5;13
.xwd 01;38;5;13
.yuv 01;38;5;13
.svg 01;38;5;13
# audio formats (cyan)
.aac 00;38;5;14
.au 00;38;5;14
.flac 00;38;5;14
.mid 00;38;5;14
.midi 00;38;5;14
.mka 00;38;5;14
.mp3 00;38;5;14
.mpc 00;38;5;14
.ogg 00;38;5;14
.ra 00;38;5;14
.wav 00;38;5;14

View File

@ -54,13 +54,21 @@ EIGHTBIT 1
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 00;34 # directory
LINK 00;36 # symbolic link
LINK 00;36 # symbolic link (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
FIFO 40;33 # pipe
SOCK 00;35 # socket
DOOR 00;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 01;05;37;41 # orphaned syminks
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
MISSING 01;05;37;41 # ... and the files they point to
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
EXEC 00;32
@ -75,24 +83,82 @@ EXEC 00;32
.bat 00;32
.sh 00;32
.csh 00;32
.tar 00;31 # archives or compressed (red)
# archives or compressed (red)
.tar 00;31
.tgz 00;31
.svgz 00;31
.arj 00;31
.taz 00;31
.lzh 00;31
.lzma 00;31
.zip 00;31
.z 00;31
.Z 00;31
.dz 00;31
.gz 00;31
.bz2 00;31
.tbz2 00;31
.bz 00;31
.tz 00;31
.deb 00;31
.rpm 00;31
.jar 00;31
.rar 00;31
.ace 00;31
.zoo 00;31
.cpio 00;31
.jpg 00;35 # image formats
.7z 00;31
.rz 00;31
# image formats (magenta)
.jpg 00;35
.jpeg 00;35
.gif 00;35
.bmp 00;35
.pbm 00;35
.pgm 00;35
.ppm 00;35
.tga 00;35
.xbm 00;35
.xpm 00;35
.png 00;35
.tif 00;35
.tiff 00;35
.png 00;35
.mng 00;35
.pcx 00;35
.mov 00;35
.mpg 00;35
.mpeg 00;35
.m2v 00;35
.mkv 00;35
.ogm 00;35
.mp4 00;35
.m4v 00;35
.mp4v 00;35
.vob 00;35
.qt 00;35
.nuv 00;35
.wmv 00;35
.asf 00;35
.rm 00;35
.rmvb 00;35
.flc 00;35
.avi 00;35
.fli 00;35
.gl 00;35
.dl 00;35
.xcf 00;35
.xwd 00;35
.yuv 00;35
.svg 00;35
# audio formats (cyan)
.aac 00;36
.au 00;36
.flac 00;36
.mid 00;36
.midi 00;36
.mka 00;36
.mp3 00;36
.mpc 00;36
.ogg 00;36
.ra 00;36
.wav 00;36

View File

@ -1,47 +0,0 @@
--- coreutils-6.9/lib/utimens.h.futimens 2007-02-23 18:25:21.000000000 +0000
+++ coreutils-6.9/lib/utimens.h 2007-06-13 11:40:37.000000000 +0100
@@ -1,3 +1,3 @@
#include <time.h>
-int futimens (int, char const *, struct timespec const [2]);
+int gl_futimens (int, char const *, struct timespec const [2]);
int utimens (char const *, struct timespec const [2]);
--- coreutils-6.9/lib/utimens.c.futimens 2007-01-18 08:33:34.000000000 +0000
+++ coreutils-6.9/lib/utimens.c 2007-06-13 11:40:37.000000000 +0100
@@ -75,7 +75,7 @@ struct utimbuf
Return 0 on success, -1 (setting errno) on failure. */
int
-futimens (int fd ATTRIBUTE_UNUSED,
+gl_futimens (int fd ATTRIBUTE_UNUSED,
char const *file, struct timespec const timespec[2])
{
/* Some Linux-based NFS clients are buggy, and mishandle time stamps
@@ -185,5 +185,5 @@ futimens (int fd ATTRIBUTE_UNUSED,
int
utimens (char const *file, struct timespec const timespec[2])
{
- return futimens (-1, file, timespec);
+ return gl_futimens (-1, file, timespec);
}
--- coreutils-6.9/src/copy.c.futimens 2007-06-13 11:56:44.000000000 +0100
+++ coreutils-6.9/src/copy.c 2007-06-13 11:57:00.000000000 +0100
@@ -547,7 +547,7 @@ copy_reg (char const *src_name, char con
timespec[0] = get_stat_atime (src_sb);
timespec[1] = get_stat_mtime (src_sb);
- if (futimens (dest_desc, dst_name, timespec) != 0)
+ if (gl_futimens (dest_desc, dst_name, timespec) != 0)
{
error (0, errno, _("preserving times for %s"), quote (dst_name));
if (x->require_preserve)
--- coreutils-6.9/src/touch.c.futimens 2007-06-13 11:58:00.000000000 +0100
+++ coreutils-6.9/src/touch.c 2007-06-13 11:58:06.000000000 +0100
@@ -182,7 +182,7 @@ touch (const char *file)
t = timespec;
}
- ok = (futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
+ ok = (gl_futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
if (fd == STDIN_FILENO)
{

View File

@ -1,124 +0,0 @@
diff -urNp coreutils-6.9.orig/lib/getdate.y coreutils-6.9/lib/getdate.y
--- coreutils-6.9.orig/lib/getdate.y 2007-02-23 19:25:21.000000000 +0100
+++ coreutils-6.9/lib/getdate.y 2007-11-23 10:27:13.000000000 +0100
@@ -199,6 +199,42 @@ static int yylex (union YYSTYPE *, parse
static int yyerror (parser_control const *, char const *);
static long int time_zone_hhmm (textint, long int);
+static void
+digits_to_date_time (parser_control *pc, textint text_int)
+{
+ if (pc->dates_seen && ! pc->year.digits
+ && ! pc->rels_seen && (pc->times_seen || 2 < text_int.digits))
+ pc->year = text_int;
+ else
+ {
+ if (4 < text_int.digits)
+ {
+ pc->dates_seen++;
+ pc->day = text_int.value % 100;
+ pc->month = (text_int.value / 100) % 100;
+ pc->year.value = text_int.value / 10000;
+ pc->year.digits = text_int.digits - 4;
+ }
+ else
+ {
+ pc->times_seen++;
+ if (text_int.digits <= 2)
+ {
+ pc->hour = text_int.value;
+ pc->minutes = 0;
+ }
+ else
+ {
+ pc->hour = text_int.value / 100;
+ pc->minutes = text_int.value % 100;
+ }
+ pc->seconds.tv_sec = 0;
+ pc->seconds.tv_nsec = 0;
+ pc->meridian = MER24;
+ }
+ }
+}
+
%}
/* We want a reentrant parser, even if the TZ manipulation and the calls to
@@ -268,6 +304,7 @@ item:
| rel
{ pc->rels_seen = true; }
| number
+ | hybrid
;
time:
@@ -543,38 +580,23 @@ unsigned_seconds:
number:
tUNUMBER
+ { digits_to_date_time (pc, $1); }
+ ;
+
+hybrid:
+ tUNUMBER relunit_snumber
{
- if (pc->dates_seen && ! pc->year.digits
- && ! pc->rels_seen && (pc->times_seen || 2 < $1.digits))
- pc->year = $1;
- else
- {
- if (4 < $1.digits)
- {
- pc->dates_seen++;
- pc->day = $1.value % 100;
- pc->month = ($1.value / 100) % 100;
- pc->year.value = $1.value / 10000;
- pc->year.digits = $1.digits - 4;
- }
- else
- {
- pc->times_seen++;
- if ($1.digits <= 2)
- {
- pc->hour = $1.value;
- pc->minutes = 0;
- }
- else
- {
- pc->hour = $1.value / 100;
- pc->minutes = $1.value % 100;
- }
- pc->seconds.tv_sec = 0;
- pc->seconds.tv_nsec = 0;
- pc->meridian = MER24;
- }
- }
+ /* Hybrid all-digit and relative offset, so that we accept e.g.,
+ "YYYYMMDD +N days" as well as "YYYYMMDD N days". */
+ digits_to_date_time (pc, $1);
+ pc->rel.ns += $2.ns;
+ pc->rel.seconds += $2.seconds;
+ pc->rel.minutes += $2.minutes;
+ pc->rel.hour += $2.hour;
+ pc->rel.day += $2.day;
+ pc->rel.month += $2.month;
+ pc->rel.year += $2.year;
+ pc->rels_seen = true;
}
;
diff -urNp coreutils-6.9.orig/tests/misc/date coreutils-6.9/tests/misc/date
--- coreutils-6.9.orig/tests/misc/date 2007-03-18 22:36:43.000000000 +0100
+++ coreutils-6.9/tests/misc/date 2007-11-23 10:14:19.000000000 +0100
@@ -135,6 +135,11 @@ my @Tests =
['next-mo', "-d '$d1 next month' '+%Y-%m-%d %T'", {OUT=>"$dm $t0"}],
['next-y', "-d '$d1 next year' '+%Y-%m-%d %T'", {OUT=>"$dy $t0"}],
+ # This has always worked, ...
+ ['rel-1', "-d '20050101 1 day' +%F", {OUT=>"2005-01-02"}],
+ # ...but up to coreutils-6.9, this was rejected due to the "+".
+ ['rel-1p', "-d '20050101 +1 day' +%F", {OUT=>"2005-01-02"}],
+
['utc-0', "-u -d '08/01/97 6:00' '+%D,%H:%M'", {OUT=>"08/01/97,06:00"},
{ENV => 'TZ=UTC+4'}],

View File

@ -1,23 +0,0 @@
--- coreutils-6.8+/tests/cp/acl.getfacl-exit-code 2007-03-01 16:48:29.000000000 +0000
+++ coreutils-6.8+/tests/cp/acl 2007-03-01 16:49:35.000000000 +0000
@@ -70,16 +70,16 @@
# copy a file without preserving permissions
cp a/file b/ || fail=1
-acl2=`cd b && getfacl file` || framework_failure=1
+acl2=`cd b && getfacl file`
test "$acl1" = "$acl2" || fail=1
rm a/file || framework_failure=1
# copy a file, preserving permissions
touch a/file || framework_failure=1
-setfacl -m user:bin:rw a/file || framework_failure=1
-acl1=`cd a && getfacl file` || framework_failure=1
+setfacl -m user:bin:rw a/file
+acl1=`cd a && getfacl file`
cp -p a/file b/ || fail=1
-acl2=`cd b && getfacl file` || framework_failure=1
+acl2=`cd b && getfacl file`
test "$acl1" = "$acl2" || fail=1
if test $framework_failure = 1; then

View File

@ -1,44 +1,56 @@
--- coreutils-6.7/lib/getugroups.c.getgrouplist 2006-09-14 10:53:58.000000000 +0100
+++ coreutils-6.7/lib/getugroups.c 2007-01-09 17:33:09.000000000 +0000
@@ -21,6 +21,9 @@
diff -urp coreutils-6.10-orig/lib/getugroups.c coreutils-6.10/lib/getugroups.c
--- coreutils-6.10-orig/lib/getugroups.c 2007-10-17 15:47:25.000000000 +0200
+++ coreutils-6.10/lib/getugroups.c 2008-01-24 16:37:04.000000000 +0100
@@ -19,6 +19,9 @@
#include <config.h>
+/* We do not need this code if getgrouplist(3) is available. */
+#ifndef HAVE_GETGROUPLIST
+
#include <sys/types.h>
#include "getugroups.h"
#include <stdio.h> /* grp.h on alpha OSF1 V2.0 uses "FILE *". */
#include <grp.h>
@@ -102,3 +105,4 @@
@@ -114,3 +117,4 @@ getugroups (int maxcount, GETGROUPS_T *g
return count;
}
+#endif /* have getgrouplist */
--- coreutils-6.7/src/id.c.getgrouplist 2006-10-22 17:54:15.000000000 +0100
+++ coreutils-6.7/src/id.c 2007-01-09 17:33:09.000000000 +0000
@@ -253,7 +253,14 @@
if (!username)
max_n_groups = getgroups (0, NULL);
else
- max_n_groups = getugroups (0, NULL, username, gid);
+ {
diff -urp coreutils-6.10-orig/lib/mgetgroups.c coreutils-6.10/lib/mgetgroups.c
--- coreutils-6.10-orig/lib/mgetgroups.c 2007-11-25 14:23:31.000000000 +0100
+++ coreutils-6.10/lib/mgetgroups.c 2008-01-24 16:41:15.000000000 +0100
@@ -43,9 +43,17 @@ mgetgroups (const char *username, gid_t
int ng;
GETGROUPS_T *g;
- max_n_groups = (username
- ? getugroups (0, NULL, username, gid)
- : getgroups (0, NULL));
+ if (!username)
+ max_n_groups = getgroups(0, NULL);
+ else
+ {
+#ifdef HAVE_GETGROUPLIST
+ max_n_groups = 0;
+ getgrouplist (username, gid, NULL, &max_n_groups);
+#else
+ max_n_groups = getugroups (0, NULL, username, gid);
+#endif
+ }
+ }
if (max_n_groups < 0)
ng = -1;
@@ -263,7 +270,22 @@
if (!username)
ng = getgroups (max_n_groups, g);
else
- ng = getugroups (max_n_groups, g, username, gid);
+ {
/* If we failed to count groups with NULL for a buffer,
try again with a non-NULL one, just in case. */
@@ -62,9 +70,25 @@ mgetgroups (const char *username, gid_t
if (g == NULL)
return -1;
- ng = (username
- ? getugroups (max_n_groups, g, username, gid)
- : getgroups (max_n_groups, g));
+ if (!username)
+ ng = getgroups (max_n_groups, g);
+ else
+ {
+#ifdef HAVE_GETGROUPLIST
+ int e;
+ ng = max_n_groups;
@ -53,13 +65,14 @@
+#else
+ ng = getugroups (max_n_groups, g, username, gid);
+#endif
+ }
}
+ }
if (ng < 0)
--- coreutils-6.7/m4/jm-macros.m4.getgrouplist 2006-12-06 11:04:22.000000000 +0000
+++ coreutils-6.7/m4/jm-macros.m4 2007-01-09 17:33:47.000000000 +0000
@@ -64,6 +64,7 @@
{
diff -urp coreutils-6.10-orig/m4/jm-macros.m4 coreutils-6.10/m4/jm-macros.m4
--- coreutils-6.10-orig/m4/jm-macros.m4 2007-11-25 14:23:31.000000000 +0100
+++ coreutils-6.10/m4/jm-macros.m4 2008-01-24 16:42:00.000000000 +0100
@@ -52,6 +52,7 @@ AC_DEFUN([coreutils_MACROS],
fchown \
fchmod \
ftruncate \

View File

@ -89,8 +89,8 @@
+Cherry30
--- coreutils-6.8+/tests/sort/Makefile.am.i18n 2007-01-24 07:47:37.000000000 +0000
+++ coreutils-6.8+/tests/sort/Makefile.am 2007-03-01 15:09:59.000000000 +0000
@@ -66,15 +66,17 @@
bigfield.O bigfield.E
@@ -66,12 +66,14 @@
bigfield.O bigfield.E obs-inval.O obs-inval.E realloc-buf.O realloc-buf.E
##test-files-end
-EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
@ -99,9 +99,6 @@
+
+EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) mb1.I mb1.X mb2.I mb2.X
+noinst_SCRIPTS = $x-tests # $x-mb-tests
TESTS_ENVIRONMENT = \
CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH"
editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,$(srcdir),g'
@ -1096,7 +1093,7 @@
+ mbstate_t thisstate;
+#endif
+
if (readlinebuffer (thisline, stdin) == 0)
if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
break;
thisfield = find_field (thisline);
thislen = thisline->length - 1 - (thisfield - thisline->buffer);
@ -1130,7 +1127,7 @@
+ mbstate_t prevstate;
+#endif
if (readlinebuffer (prevline, stdin) == 0)
if (readlinebuffer_delim (prevline, stdin, delimiter) == 0)
goto closefiles;
prevfield = find_field (prevline);
prevlen = prevline->length - 1 - (prevfield - prevline->buffer);
@ -1146,7 +1143,7 @@
+#if HAVE_MBRTOWC
+ mbstate_t thisstate;
+#endif
if (readlinebuffer (thisline, stdin) == 0)
if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
{
if (ferror (stdin))
@@ -341,6 +561,15 @@
@ -3612,7 +3609,7 @@
fieldstr++;
@@ -387,14 +464,16 @@
if (value == 0)
if (!rhs_specified)
{
/* `n-'. From `initial' to end of line. */
- eol_range_start = initial;
@ -3625,7 +3622,7 @@
{
/* `m-n' or `-n' (1-n). */
if (value < initial)
- FATAL_ERROR (_("invalid byte or field list"));
- FATAL_ERROR (_("invalid decreasing range"));
+ FATAL_ERROR (_("invalid byte, character or field list"));
/* Is there already a range going to end of line? */

View File

@ -1,109 +0,0 @@
--- coreutils-6.9/src/ls.c.ls-x 2007-06-13 14:27:36.000000000 +0100
+++ coreutils-6.9/src/ls.c 2007-06-13 14:28:42.000000000 +0100
@@ -4151,16 +4151,16 @@
size_t pos = 0;
size_t cols = calculate_columns (false);
struct column_info const *line_fmt = &column_info[cols - 1];
- size_t name_length = length_of_file_name_and_frills (cwd_file);
+ struct fileinfo const *f = sorted_file[0];
+ size_t name_length = length_of_file_name_and_frills (f);
size_t max_name_length = line_fmt->col_arr[0];
/* Print first entry. */
- print_file_name_and_frills (cwd_file);
+ print_file_name_and_frills (f);
/* Now the rest. */
for (filesno = 1; filesno < cwd_n_used; ++filesno)
{
- struct fileinfo const *f;
size_t col = filesno % cols;
if (col == 0)
--- coreutils-6.9/tests/ls/Makefile.am.ls-x 2007-03-18 21:36:43.000000000 +0000
+++ coreutils-6.9/tests/ls/Makefile.am 2007-06-13 14:28:42.000000000 +0100
@@ -24,7 +24,7 @@
stat-dtype \
inode dangle file-type recursive dired infloop \
rt-1 time-1 symlink-slash follow-slink no-arg m-option \
- stat-vs-dirent
+ stat-vs-dirent x-option
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
--- /dev/null 2007-06-13 08:43:51.993263382 +0100
+++ coreutils-6.9/tests/ls/x-option 2007-06-13 14:28:42.000000000 +0100
@@ -0,0 +1,59 @@
+#!/bin/sh
+# Exercise the -x option.
+
+# Copyright (C) 2007 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ ls --version
+fi
+
+. $srcdir/../envvar-check
+. $srcdir/../lang-default
+
+pwd=`pwd`
+t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
+trap '(exit $?); exit $?' 1 2 13 15
+
+framework_failure=0
+mkdir -p $tmp || framework_failure=1
+cd $tmp || framework_failure=1
+mkdir subdir || framework_failure=1
+touch subdir/b || framework_failure=1
+touch subdir/a || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo "$0: failure in testing framework" 1>&2
+ (exit 1); exit 1
+fi
+
+fail=0
+
+# Coreutils 6.8 and 6.9 would output this in the wrong order.
+ls -x subdir > out || fail=1
+ls -rx subdir >> out || fail=1
+cat <<\EOF > exp || fail=1
+a b
+b a
+EOF
+
+cmp out exp || fail=1
+test $fail = 1 && diff out exp 2> /dev/null
+
+(exit $fail); exit $fail
--- coreutils-6.9/NEWS.ls-x 2007-03-22 21:19:45.000000000 +0000
+++ coreutils-6.9/NEWS 2007-06-13 14:28:42.000000000 +0100
@@ -13,6 +13,11 @@
Using pr -m -s (i.e. merging files, with TAB as the output separator)
no longer inserts extraneous spaces between output columns.
+** Bug fixes
+
+ ls -x DIR would sometimes output the wrong string in place of the
+ first entry. [introduced in coreutils-6.8]
+
* Noteworthy changes in release 6.8 (2007-02-24) [not-unstable]

View File

@ -1,7 +1,7 @@
--- coreutils-5.2.1/src/who.c.overflow 2005-05-25 09:59:06.000000000 +0100
+++ coreutils-5.2.1/src/who.c 2005-05-25 10:00:31.000000000 +0100
@@ -75,7 +75,7 @@
# define NEW_TIME 0
# define UT_TYPE_NEW_TIME(U) false
#endif
-#define IDLESTR_LEN 6

View File

@ -177,13 +177,13 @@
+ pam_close_session(pamh, 0);
+ pam_end(pamh, PAM_ABORT);
+#endif
error (EXIT_FAIL, errno, _("cannot set groups"));
error (EXIT_FAILURE, errno, _("cannot set groups"));
+ }
endgrent ();
#endif
if (setgid (pw->pw_gid))
@@ -318,6 +413,31 @@
error (EXIT_FAIL, errno, _("cannot set user id"));
error (EXIT_FAILURE, errno, _("cannot set user id"));
}
+#ifdef USE_PAM
@ -397,7 +397,7 @@
--- coreutils-6.7/configure.ac.pam 2006-12-07 21:30:24.000000000 +0000
+++ coreutils-6.7/configure.ac 2007-01-09 17:18:04.000000000 +0000
@@ -39,6 +39,13 @@
@@ -44,6 +44,13 @@
gl_INIT
coreutils_MACROS
@ -408,6 +408,6 @@
+LIB_PAM="-ldl -lpam -lpam_misc"
+AC_SUBST(LIB_PAM)])
+
AC_CHECK_FUNCS(uname,
OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uname\$(EXEEXT)"
MAN="$MAN uname.1")
AC_FUNC_FORK
optional_bin_progs=

File diff suppressed because it is too large Load Diff

View File

@ -28,3 +28,30 @@ diff -uNrp -x '*~' coreutils-5.97-orig/src/su.c coreutils-5.97/src/su.c
PAM_BAIL_P;
#ifndef RUNUSER
diff -urp coreutils-6.10-orig/doc/coreutils.info coreutils-6.10/doc/coreutils.info
--- coreutils-6.10-orig/doc/coreutils.info 2008-01-22 00:32:44.000000000 +0100
+++ coreutils-6.10/doc/coreutils.info 2008-01-24 17:17:04.000000000 +0100
@@ -11006,7 +11006,8 @@ options::.
set, even for the super-user, as described above), and set `PATH'
to a compiled-in default value. Change to USER's home directory.
Prepend `-' to the shell's name, intended to make it read its
- login startup file(s).
+ login startup file(s). When this option is given, /etc/pam.d/su-l
+ PAM file is used instead of the default one.
`-m'
`-p'
diff -urp coreutils-6.10-orig/doc/coreutils.texi coreutils-6.10/doc/coreutils.texi
--- coreutils-6.10-orig/doc/coreutils.texi 2008-01-24 16:50:57.000000000 +0100
+++ coreutils-6.10/doc/coreutils.texi 2008-01-24 17:12:58.000000000 +0100
@@ -13670,7 +13670,9 @@ the exit status of @var{command} otherwi
@command{su} allows one user to temporarily become another user. It runs a
command (often an interactive shell) with the real and effective user
-ID, group ID, and supplemental groups of a given @var{user}. Synopsis:
+ID, group ID, and supplemental groups of a given @var{user}. When the -l
+option is given, the su-l PAM file is used instead of the default su PAM file.
+Synopsis:
@example
su [@var{option}]@dots{} [@var{user} [@var{arg}]@dots{}]

View File

@ -1,14 +1,15 @@
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
Name: coreutils
Version: 6.9
Release: 17%{?dist}
License: GPLv2+
Version: 6.10
Release: 1%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.bz2
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.lzma
Source101: coreutils-DIR_COLORS
Source102: coreutils-DIR_COLORS.xterm
Source103: coreutils-DIR_COLORS.256color
Source105: coreutils-colorls.sh
Source106: coreutils-colorls.csh
Source200: coreutils-su.pamd
@ -17,14 +18,10 @@ Source202: coreutils-su-l.pamd
Source203: coreutils-runuser-l.pamd
# From upstream
Patch1: coreutils-futimens.patch
Patch2: coreutils-ls-x.patch
Patch3: coreutils-6.9-cp-i-u.patch
Patch4: coreutils-6.9-du-ls-upstream.patch
# Our patches
Patch100: coreutils-chgrp.patch
Patch101: coreutils-getdateYYYYMMDD.patch
Patch101: coreutils-6.10-configuration.patch
# sh-utils
Patch703: sh-utils-2.0.11-dateman.patch
@ -46,17 +43,18 @@ Patch912: coreutils-overflow.patch
Patch915: coreutils-split-pam.patch
Patch916: coreutils-getfacl-exit-code.patch
#SELINUX Patch
#SELINUX Patch - implements Redhat changes
#(upstream did some SELinux implementation unlike with RedHat patch)
Patch950: coreutils-selinux.patch
#SELINUX Patch fix to allow cp -a rewrite file on different filesystem
Patch951: coreutils-6.9-requiresecuritycontext.patch
Patch952: coreutils-6.9-statsecuritycontext.patch
BuildRequires: libselinux-devel >= 1.25.6-1
BuildRequires: libacl-devel
BuildRequires: gettext bison
BuildRequires: texinfo >= 4.3
BuildRequires: autoconf >= 2.58, automake >= 1.8
BuildRequires: lzma
BuildRequires: autoconf >= 2.58
#dist-lzma required
BuildRequires: automake >= 1.10.1
%{?!nopam:BuildRequires: pam-devel}
Requires(post): libselinux >= 1.25.6-1
@ -73,11 +71,12 @@ Provides: fileutils = %{version}-%{release}
Provides: sh-utils = %{version}-%{release}
Provides: stat = %{version}-%{release}
Provides: textutils = %{version}-%{release}
Obsoletes: mktemp
Provides: mktemp = %{version}-%{release}
Obsoletes: fileutils <= 4.1.9
Obsoletes: sh-utils <= 2.0.12
Obsoletes: stat <= 3.3
Obsoletes: textutils <= 2.0.21
# readlink(1) moved here from tetex.
Conflicts: tetex < 1.0.7-66
@ -86,17 +85,17 @@ These are the GNU core utilities. This package is the combination of
the old GNU fileutils, sh-utils, and textutils packages.
%prep
%setup -q
#do not unpack in setup because of lzma is not yet supported in setup macro
%setup -q -c -T
cd ..
lzma -dc %SOURCE0 | tar xf -
cd %name-%version
# From upstream
%patch1 -p1 -b .futimens
%patch2 -p1 -b .ls-x
%patch3 -p1 -b .cp-i-u
%patch4 -p1 -b .du-ls
# Our patches
%patch100 -p1 -b .chgrp
%patch101 -p1 -b .getdate
%patch101 -p1 -b .configure
# sh-utils
%patch703 -p1 -b .dateman
@ -118,15 +117,8 @@ the old GNU fileutils, sh-utils, and textutils packages.
#SELinux
%patch950 -p1 -b .selinux
%patch951 -p1 -b .require-preserve
%patch952 -p1 -b .statsecuritycontext
# Don't run basic-1 test, since it breaks when run in the background
# (bug #102033).
sed -i -e 's/basic-1//g' tests/stty/Makefile*
chmod a+x tests/sort/sort-mb-tests
chmod a+x tests/ls/x-option
%build
%ifarch s390 s390x
@ -142,6 +134,7 @@ autoconf --force
automake --copy --add-missing
%configure --enable-largefile --with-afs %{?!nopam:--enable-pam} \
--enable-selinux \
--enable-install-program=su,hostname \
DEFAULT_POSIX2_VERSION=200112 alternative=199209 || :
make all %{?_smp_mflags} \
%{?!nopam:CPPFLAGS="-DUSE_PAM"} \
@ -173,7 +166,7 @@ bzip2 -9f ChangeLog
# let be compatible with old fileutils, sh-utils and textutils packages :
mkdir -p $RPM_BUILD_ROOT{/bin,%_bindir,%_sbindir,/sbin}
%{?!nopam:mkdir -p $RPM_BUILD_ROOT%_sysconfdir/pam.d}
for f in basename cat chgrp chmod chown cp cut date dd df echo env false link ln ls mkdir mknod mv nice pwd rm rmdir sleep sort stty sync touch true uname unlink
for f in 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
do
mv $RPM_BUILD_ROOT{%_bindir,/bin}/$f
done
@ -186,6 +179,7 @@ for i in env cut; do ln -sf ../../bin/$i $RPM_BUILD_ROOT/usr/bin; done
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
install -p -c -m644 %SOURCE101 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS
install -p -c -m644 %SOURCE102 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS.xterm
install -p -c -m644 %SOURCE103 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS.256color
install -p -c -m644 %SOURCE105 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.sh
install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.csh
@ -280,6 +274,7 @@ fi
/bin/stty
%attr(4755,root,root) /bin/su
/bin/sync
/bin/mktemp
/bin/touch
/bin/true
/bin/uname
@ -291,6 +286,23 @@ fi
/sbin/runuser
%changelog
* Fri Jan 25 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-1
- New upstream release(changed %%prep because of lack of lzma
support in %%setup macro)
- License GPLv3+
- removed patches cp-i-u,du-ls-upstream,statsecuritycontext,
futimens,getdateYYYYMMDD,ls-x
- modified patches to be compilable after upstream changes
- selinux patch reworked to have backward compatibility with
F8(cp,ls and stat behaviour differ from upstream in SELinux
options)
- su-l/runuser-l pam file usage a bit documented(#368721)
- more TERMs for DIR_COLORS, added colors for audio files,
more image/compress file types(taken from upstream
dircolors.hin)
- new file DIR_COLORS.256color which takes advantage from
256color term types-not really used yet(#429121)
* Wed Jan 16 2008 Ondrej Vasik <ovasik@redhat.com> - 6.9-17
- added several missing colored TERMs(including rxvt-unicode,
screen-256color and xterm-256color) to DIR_COLORS and