rpms/coreutils/F-7 coreutils-6.9-du-ls-upstream.patch, NONE, 1.1 coreutils-6.9-statsecuritycontext.patch, NONE, 1.1 coreutils-getdateYYYYMMDD.patch, NONE, 1.1 coreutils-selinux.patch, 1.36, 1.37 coreutils.spec, 1.175, 1.176
Ondrej Vasik (ovasik)
fedora-extras-commits at redhat.com
Wed Dec 5 13:53:43 UTC 2007
Author: ovasik
Update of /cvs/extras/rpms/coreutils/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20859
Modified Files:
coreutils-selinux.patch coreutils.spec
Added Files:
coreutils-6.9-du-ls-upstream.patch
coreutils-6.9-statsecuritycontext.patch
coreutils-getdateYYYYMMDD.patch
Log Message:
Backport of some fixes(stat,ls,date,du,preserving sec. context) - see changelog for details
coreutils-6.9-du-ls-upstream.patch:
--- NEW FILE coreutils-6.9-du-ls-upstream.patch ---
Fixes some small bugs (merged upstream patches)
Fixed RedHat Bugzillas: 250089(fix by jplans at 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))
coreutils-6.9-statsecuritycontext.patch:
--- NEW FILE coreutils-6.9-statsecuritycontext.patch ---
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);
}
coreutils-getdateYYYYMMDD.patch:
--- NEW FILE coreutils-getdateYYYYMMDD.patch ---
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'}],
coreutils-selinux.patch:
Index: coreutils-selinux.patch
===================================================================
RCS file: /cvs/extras/rpms/coreutils/F-7/coreutils-selinux.patch,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- coreutils-selinux.patch 30 Oct 2007 17:10:48 -0000 1.36
+++ coreutils-selinux.patch 5 Dec 2007 13:53:39 -0000 1.37
@@ -2223,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\
Index: coreutils.spec
===================================================================
RCS file: /cvs/extras/rpms/coreutils/F-7/coreutils.spec,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -r1.175 -r1.176
--- coreutils.spec 30 Oct 2007 17:10:48 -0000 1.175
+++ coreutils.spec 5 Dec 2007 13:53:39 -0000 1.176
@@ -1,7 +1,7 @@
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
Name: coreutils
Version: 6.9
-Release: 5%{?dist}
+Release: 6%{?dist}
License: GPLv2+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -20,9 +20,11 @@
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
# sh-utils
Patch703: sh-utils-2.0.11-dateman.patch
@@ -48,6 +50,7 @@
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
@@ -90,9 +93,11 @@
%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
# sh-utils
%patch703 -p1 -b .dateman
@@ -115,6 +120,7 @@
#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).
@@ -277,6 +283,16 @@
/sbin/runuser
%changelog
+* Wed Dec 05 2007 Ondrej Vasik <ovasik at 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 at redhat.com> 6.9-5
- allow cp -a to rewrite file on different filesystem(#219900)
(based on upstream patch)
More information about the fedora-extras-commits
mailing list