Compare commits

...

13 Commits
rawhide ... f7

Author SHA1 Message Date
Fedora Release Engineering 97620161ab dist-git conversion 2010-07-28 12:10:44 +00:00
Ondrej Vasik 4602948652 fixed harmless warning in atomic2 test 2008-03-25 18:18:51 +00:00
Ondrej Vasik 03f70d51e7 mv: never unlink a destination file before calling rename 2008-03-25 18:03:37 +00:00
Ondrej Vasik 98439f6466 dd doubleclose + other way to keep user defined LS_COLORS 2008-03-11 16:48:56 +00:00
Ondrej Vasik b842ca2899 Various changes - backport from F8/Devel, see changelog for details 2008-03-04 13:41:39 +00:00
Ondrej Vasik ef39316a81 Backport of some fixes(stat,ls,date,du,preserving sec. context) - see
changelog for details
2007-12-05 13:53:39 +00:00
Ondrej Vasik 1cfc05a031 fix for runuser (#232652), for sort -R(#249315), for cp -a rewrite on
NFS(#219900), License tag to GPLv2+
2007-10-30 17:10:48 +00:00
Ondrej Vasik caa9ac6d01 upstream patch - fixing cp -iu options(#248591) + runuser patch backport
from F8(#241662)
2007-10-25 11:21:09 +00:00
Tim Waugh 38d2277a5a Fix x-option test. 2007-06-13 14:01:02 +00:00
Tim Waugh e644251644 6.9-3 2007-06-13 13:51:49 +00:00
Tim Waugh d13c865cca - Fixed 'ls -x' output (bug #240298). 2007-06-13 13:30:00 +00:00
Tim Waugh 576e6d1900 - Disambiguate futimens() from the glibc implementation (bug #242321). 2007-06-13 12:00:18 +00:00
Bill Nottingham 857f4f069a Initialize branch F-7 for coreutils 2007-05-18 03:24:39 +00:00
21 changed files with 1338 additions and 73 deletions

View File

View File

@ -1,6 +0,0 @@
# Makefile for source rpm: coreutils
# $Id$
NAME := coreutils
SPECFILE = $(firstword $(wildcard *.spec))
include ../common/Makefile.common

View File

@ -304,14 +304,6 @@
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 \
@@ -105,6 +105,7 @@
readlink.1: $(common_dep) $(srcdir)/readlink.x ../src/readlink.c
rm.1: $(common_dep) $(srcdir)/rm.x ../src/rm.c
rmdir.1: $(common_dep) $(srcdir)/rmdir.x ../src/rmdir.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 @@
@ -338,7 +330,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

110
coreutils-6.9-cp-i-u.patch Normal file
View File

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

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

@ -0,0 +1,13 @@
diff -urp coreutils-6.9-orig/lib/long-options.c coreutils-6.9/lib/long-options.c
--- coreutils-6.9-orig/lib/long-options.c
+++ coreutils-6.9/lib/long-options.c
@@ -57,8 +57,7 @@ parse_long_options (int argc,
/* Don't print an error message for unrecognized options. */
opterr = 0;
- if (argc == 2
- && (c = getopt_long (argc, argv, "+", long_options, NULL)) != -1)
+ while ((c = getopt_long (argc, argv, "+", long_options, NULL)) != -1)
{
switch (c)
{

View File

@ -0,0 +1,160 @@
diff -ur coreutils-6.9-orig/src/install.c coreutils-6.9/src/install.c
--- a/src/install.c 2007-10-30 12:34:07.000000000 +0100
+++ b/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
--- a/src/mv.c 2007-10-30 12:34:07.000000000 +0100
+++ b/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

@ -0,0 +1,205 @@
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,20 +29,34 @@ TERM con80x43
TERM con80x50
TERM con80x60
TERM cons25
TERM xterm
TERM rxvt
TERM xterm-color
TERM color-xterm
TERM vt100
TERM console
TERM cygwin
TERM dtterm
TERM color_xterm
TERM ansi
TERM screen
TERM screen.linux
TERM kon
TERM kterm
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 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 xterm-color
TERM xterm-debian
# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
EIGHTBIT 1
@ -78,24 +93,71 @@ EXEC 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

View File

@ -29,7 +29,11 @@ TERM con80x50
TERM con80x60
TERM cons25
TERM xterm
TERM xterm-16color
TERM xterm-88color
TERM xterm-256color
TERM rxvt
TERM rxvt-unicode
TERM xterm-color
TERM color-xterm
TERM vt100
@ -71,24 +75,70 @@ 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
.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

View File

@ -1,4 +1,11 @@
# color-ls initialization
if ( $?USER_LS_COLORS ) then
if ( "$USER_LS_COLORS" != "" ) then
#When USER_LS_COLORS set, do not override user specified LS_COLORS but use them
goto finish
endif
endif
alias ll 'ls -l'
alias l. 'ls -d .*'
@ -7,11 +14,9 @@ if ($?TERM) then
if ( -e "/etc/DIR_COLORS.$TERM" ) set COLORS="/etc/DIR_COLORS.$TERM"
endif
if ( -f ~/.dircolors ) set COLORS=~/.dircolors
if ($?TERM) then
if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM"
endif
if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
if ($?TERM) then
if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM"
if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM"
endif
@ -19,14 +24,16 @@ if ( ! -e "$COLORS" ) exit
eval `dircolors -c $COLORS`
if ( "$LS_COLORS" == '' ) then
exit
endif
if ( "$LS_COLORS" == '' ) exit
set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS`
if ( "$color_none" == '' ) then
alias ll 'ls -l --color=tty'
alias l. 'ls -d .* --color=tty'
alias ls 'ls --color=tty'
if ( "$color_none" != '' ) then
unset color_none
exit
endif
unset color_none
finish:
alias ll 'ls -l --color=auto'
alias l. 'ls -d .* --color=auto'
alias ls 'ls --color=auto'

View File

@ -1,21 +1,36 @@
# color-ls initialization
alias ll='ls -l' 2>/dev/null
alias l.='ls -d .*' 2>/dev/null
#do not override user LS_COLORS, but use them when USER_LS_COLORS is set.
if [ -z "$USER_LS_COLORS" ]; then
alias ll='ls -l' 2>/dev/null
alias l.='ls -d .*' 2>/dev/null
COLORS=/etc/DIR_COLORS
[ -e "/etc/DIR_COLORS.$TERM" ] && COLORS="/etc/DIR_COLORS.$TERM"
[ -e "$HOME/.dircolors" ] && COLORS="$HOME/.dircolors"
[ -e "$HOME/.dircolors.$TERM" ] && COLORS="$HOME/.dircolors.$TERM"
[ -e "$HOME/.dir_colors" ] && COLORS="$HOME/.dir_colors"
[ -e "$HOME/.dir_colors.$TERM" ] && COLORS="$HOME/.dir_colors.$TERM"
[ -e "$COLORS" ] || return
eval `dircolors --sh "$COLORS"`
[ -z "$LS_COLORS" ] && return
# Skip the rest for noninteractive shells.
[ -z "$PS1" ] && return
if ! egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null ; then
alias ll='ls -l --color=tty' 2>/dev/null
alias l.='ls -d .* --color=tty' 2>/dev/null
alias ls='ls --color=tty' 2>/dev/null
COLORS=
for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \
"$HOME/.dir_colors" "$HOME/.dircolors"; do
[ -e "$colors" ] && COLORS="$colors" && break
done
if [ -z "$COLORS" ]; then
for colors in "/etc/DIR_COLORS.$TERM" "/etc/DIR_COLORS" ; do
[ -e "$colors" ] && COLORS="$colors" && break
done
fi
# Existence of $COLORS already checked above.
[ -n "$COLORS" ] || return
eval `dircolors --sh "$COLORS" 2>/dev/null`
[ -z "$LS_COLORS" ] && return
egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
fi
alias ll='ls -l --color=auto' 2>/dev/null
alias l.='ls -d .* --color=auto' 2>/dev/null
alias ls='ls --color=auto' 2>/dev/null

View File

@ -0,0 +1,45 @@
diff -urNp coreutils-6.9-orig/src/dd.c coreutils-6.9/src/dd.c
--- coreutils-6.9-orig/src/dd.c
+++ coreutils-6.9/src/dd.c
@@ -391,6 +391,25 @@ static char const ebcdic_to_ascii[] =
'\070', '\071', '\372', '\373', '\374', '\375', '\376', '\377'
};
+/* True if we need to close the standard output *stream*. */
+static bool close_stdout_required = true;
+
+/* The only reason to close the standard output *stream* is if
+ parse_long_options fails (as it does for --help or --version).
+ In any other case, dd uses only the STDOUT_FILENO file descriptor,
+ and the "cleanup" function calls "close (STDOUT_FILENO)".
+ Closing the file descriptor and then letting the usual atexit-run
+ close_stdout function call "fclose (stdout)" would result in a
+ harmless failure of the close syscall (with errno EBADF).
+ This function serves solely to avoid the unnecessary close_stdout
+ call, once parse_long_options has succeeded. */
+static void
+maybe_close_stdout (void)
+{
+ if (close_stdout_required)
+ close_stdout ();
+}
+
void
usage (int status)
{
@@ -1639,12 +1658,14 @@ main (int argc, char **argv)
textdomain (PACKAGE);
/* Arrange to close stdout if parse_long_options exits. */
- atexit (close_stdout);
+ atexit (maybe_close_stdout);
page_size = getpagesize ();
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
+ close_stdout_required = false;
+
if (getopt_long (argc, argv, "", NULL, NULL) != -1)
usage (EXIT_FAILURE);

47
coreutils-futimens.patch Normal file
View File

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

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

@ -2196,7 +2196,7 @@
{
struct keyfield const *key = keylist;
@@ -1875,6 +2265,177 @@
@@ -1875,6 +2265,179 @@
return key->reverse ? -diff : diff;
}
@ -2232,7 +2232,9 @@
+ size_t lenb = limb <= textb ? 0 : limb - textb;
+
+ /* Actually compare the fields. */
+ if (key->numeric | key->general_numeric)
+ if (key->random)
+ diff = compare_random (texta, lena, textb, lenb);
+ else if (key->numeric | key->general_numeric)
+ {
+ char savea = *lima, saveb = *limb;
+
@ -2373,7 +2375,7 @@
+
/* Compare two lines A and B, returning negative, zero, or positive
depending on whether A compares less than, equal to, or greater than B. */
@@ -2744,7 +3305,7 @@
initialize_exit_failure (SORT_FAILURE);

109
coreutils-ls-x.patch Normal file
View File

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

117
coreutils-mvatomic.patch Normal file
View File

@ -0,0 +1,117 @@
src/copy.c | 5 +++--
tests/mv/Makefile.am | 4 ++--
tests/mv/atomic2 | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 69 insertions(+), 4 deletions(-)
create mode 100755 tests/mv/atomic2
diff --git a/src/copy.c b/src/copy.c
index fd31b5c..208a674 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -1339,10 +1339,11 @@ copy_internal (char const *src_name, char const *dst_name,
new_dst = true;
}
else if (! S_ISDIR (dst_sb.st_mode)
+ /* Never unlink dst_name when in move mode. */
+ && ! x->move_mode
&& (x->unlink_dest_before_opening
|| (x->preserve_links && 1 < dst_sb.st_nlink)
- || (!x->move_mode
- && x->dereference == DEREF_NEVER
+ || (x->dereference == DEREF_NEVER
&& S_ISLNK (src_sb.st_mode))
))
{
diff --git a/tests/mv/Makefile.am b/tests/mv/Makefile.am
index c121911..92ec68e 100644
--- a/tests/mv/Makefile.am
+++ b/tests/mv/Makefile.am
@@ -1,7 +1,6 @@
# Make coreutils tests for "mv". -*-Makefile-*-
-# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
-# Free Software Foundation, Inc.
+# Copyright (C) 1998-2008 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
@@ -17,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
TESTS = \
+ atomic2 \
hard-verbose \
backup-dir \
dir2dir \
diff --git a/tests/mv/atomic2 b/tests/mv/atomic2
new file mode 100755
index 0000000..d1029aa
--- /dev/null
+++ b/tests/mv/atomic2
@@ -0,0 +1,64 @@
+#!/bin/sh
+# ensure that mv doesn't first unlink a multi-hard-linked destination
+
+# Copyright (C) 2008 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
+ mv --version
+fi
+
+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
+
+# Before the fix, mv would unnecessarily unlink the destination symlink:
+# $ rm -f a b b2; touch a b; ln b b2; strace -e unlink /p/bin/mv a b
+# unlink("b") = 0
+#
+# With the fix, it doesn't call unlink:
+# $ rm -f a b b2; touch a b; ln b b2; strace -e unlink ./mv a b
+# $
+
+framework_failure=0
+touch a b || framework_failure=1
+ln b b2 || framework_failure=1
+if test $framework_failure = 1; then
+ echo "$0: failure in testing framework" 1>&2
+ (exit 1); exit 1
+fi
+
+# Skip this test on systems without strace.
+strace -V < /dev/null > ver 2>&1 || skip=1
+if test "$skip" = 1; then
+ echo "$0: no strace program, so skipping this test" 1>&2
+ (exit 77); exit 77
+fi
+
+fail=0
+
+strace -qe unlink mv a b > out 2>&1 || fail=1
+$EGREP 'unlink.*"b"' out && fail=1
+
+# Ensure that the source, "a", is gone.
+ls -dl a > /dev/null 2>&1 && fail=1
+
+# Ensure that the destination, "b", has link count 1.
+n_links=`stat --printf=%h b` || fail=1
+test "$n_links" = 1 || fail=1
+
+(exit $fail); exit $fail
--
1.5.5.rc0.7.g57e83

View File

@ -1717,7 +1717,7 @@
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
--- /dev/null 2007-03-23 08:54:03.819414923 +0000
+++ coreutils-6.9/src/runcon.c 2007-03-23 11:59:21.000000000 +0000
@@ -0,0 +1,253 @@
@@ -0,0 +1,252 @@
+/*
+ * runcon [ context |
+ * ( [ -c ] [ -r role ] [-t type] [ -u user ] [ -l levelrange ] )
@ -1803,7 +1803,6 @@
+ textdomain (PACKAGE);
+
+ while (1) {
+ int c;
+ int this_option_optind = optind ? optind : 1;
+ int option_index = 0;
+ static struct option long_options[] = {
@ -1816,7 +1815,7 @@
+ { "version", 0, &show_version, 1 },
+ { 0, 0, 0, 0 }
+ };
+ c = getopt_long(argc, argv, "r:t:u:l:c", long_options, &option_index);
+ int c = getopt_long(argc, argv, "+r:t:u:l:c", long_options, &option_index);
+ if ( c == -1 ) {
+ break;
+ }
@ -2224,18 +2223,32 @@
+#endif
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
@@ -523,6 +613,10 @@
default:
@@ -503,6 +591,7 @@
static bool
change_attributes (char const *name)
{
+ bool ok = false;
/* chown must precede chmod because on some systems,
chown clears the set[ug]id bits for non-superusers,
resulting in incorrect permissions.
@@ -521,9 +610,14 @@
else if (chmod (name, mode) != 0)
error (0, errno, _("cannot change permissions of %s"), quote (name));
else
return true;
- return true;
+ ok = true;
+
+#ifdef WITH_SELINUX
+ if (use_default_selinux_context)
+ setdefaultfilecon(name);
+ setdefaultfilecon (name);
+#endif
return false;
- return false;
+ return ok;
}
/* Set the timestamps of file TO to match those of file FROM.
@@ -687,6 +781,11 @@
-T, --no-target-directory treat DEST as a normal file\n\
-v, --verbose print the name of each directory as it is created\n\

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.9-orig/doc/coreutils.info coreutils-6.10/doc/coreutils.info
--- coreutils-6.9-orig/doc/coreutils.info
+++ coreutils-6.9/doc/coreutils.info
@@ -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.9-orig/doc/coreutils.texi
+++ coreutils-6.9/doc/coreutils.texi
@@ -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,8 +1,8 @@
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
Name: coreutils
Version: 6.9
Release: 2%{?dist}
License: GPL
Release: 9%{?dist}
License: GPLv2+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -17,9 +17,17 @@ 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
Patch5: coreutils-dddoubleclose.patch
Patch6: coreutils-mvatomic.patch
# Our patches
Patch100: coreutils-chgrp.patch
Patch101: coreutils-getdateYYYYMMDD.patch
#Patch102: coreutils-6.9-longoptions.patch
# sh-utils
Patch703: sh-utils-2.0.11-dateman.patch
@ -43,6 +51,10 @@ Patch916: coreutils-getfacl-exit-code.patch
#SELINUX 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
@ -81,9 +93,17 @@ the old GNU fileutils, sh-utils, and textutils packages.
%setup -q
# From upstream
%patch1 -p1 -b .futimens
%patch2 -p1 -b .ls-x
%patch3 -p1 -b .cp-i-u
%patch4 -p1 -b .du-ls
%patch5 -p1 -b .doubleclose
%patch6 -p1 -b .mvatomic
# Our patches
%patch100 -p1 -b .chgrp
%patch101 -p1 -b .getdate
#%patch102 -p1 -b .longopts
# sh-utils
%patch703 -p1 -b .dateman
@ -105,12 +125,16 @@ 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
chmod a+x tests/mv/atomic2
%build
%ifarch s390 s390x
@ -266,6 +290,57 @@ fi
/sbin/runuser
%changelog
* Tue Mar 25 2008 Ondrej Vasik <ovasik@redhat.com> 6.9-9
- mv: never unlink a destination file before calling rename
(upstream, #438076)
- defer usage of longoptions patch until final upstream
version (#43105)
* Tue Mar 11 2008 Ondrej Vasik <ovasik@redhat.com> 6.9-8
- other way to keep user defined LS_COLORS(#430827)
- fixed harmless double close stdout in dd(#436368)
* Tue Mar 04 2008 Ondrej Vasik <ovasik@redhat.com> 6.9-7
- su-l/runuser-l pam file usage a bit documented(#368721)
- added several missing colored TERMS(#239266)
- added several missing image/compressed file extensions
- some optimalizations of colorls.sh
(#430813, #430827, #430823, #430189, #433190)
- fix unability of echo to display certain strings(
added -- separator, #431005) , do not require only one
long_opt for certain commands like sleep, yes - but
use first usable (#431005)
- keep old csh/sh usermodified colorls shell scripts
(#432154)
* Wed Dec 05 2007 Ondrej Vasik <ovasik@redhat.com> 6.9-6
- fixed bug in handling YYYYMMDD date format with relative
signed offset(#377821)
- fixed bug in selinux patch which caused bad preserving
of security context in install(#319231)
- added some upstream supported dircolors TERMs(#239266)
- fixed du output for unaccesible dirs(#250089)
- fix for wrong colored (broken) symlinks(#404511,#246567)
- fix for displaying of security context in stat(#41181)
* Tue Oct 30 2007 Ondrej Vasik <ovasik@redhat.com> 6.9-5
- allow cp -a to rewrite file on different filesystem(#219900)
(based on upstream patch)
- modified coreutils-i18n.patch because of sort -R in
a non C locales(fix by Andreas Schwab) (#249315)
- applied upstream patch for runuser to coreutils-selinux.patch(#232652)
- License tag to GPLv2+
* Thu Oct 25 2007 Ondrej Vasik <ovasik@redhat.com> 6.9-4
- applied upstream patch for cp and mv(bug #248591)
- Don't generate runuser.1 since we ship a complete manpage for it
(bug #241662).
* Wed Jun 13 2007 Tim Waugh <twaugh@redhat.com> 6.9-3
- Fixed 'ls -x' output (bug #240298).
- Disambiguate futimens() from the glibc implementation (bug #242321).
* Mon Apr 02 2007 Karsten Hopp <karsten@redhat.com> 6.9-2
- /bin/mv in %%post requires libselinux