Compare commits

...

16 Commits
rawhide ... f16

Author SHA1 Message Date
Ondřej Vašík 4e0606fb7a fix showing duplicates in df (#709351, O.Oprala, B.Voelker), df: work around long-named /dev/disk/by-uuid/... symlinks 2012-12-12 14:56:05 +01:00
Ondřej Vašík ff94bfaf4c Fix coreutils build failure caused by automake rebase in released F16 2012-11-06 10:23:37 +01:00
Ondřej Vašík f856ee515a multibyte fixes in cut and expand (by M.Briza, #821260) 2012-11-05 16:01:01 +01:00
Ondřej Vašík 7bf4c1a1c5 fix the tcsh colorls.csh behaviour in non-interactive mode (#804604) 2012-11-05 15:38:45 +01:00
Ondřej Vašík 198748380f add virtual provides for bundled(gnulib) copylib (#821748) 2012-11-05 15:34:07 +01:00
Ondřej Vašík 4919491ae4 cp: avoid data-corrupting free-memory-read (upstream fix) 2012-11-05 15:31:41 +01:00
Ondřej Vašík f05262859a fix support for ecryptfs mount of Private in su (#722323) 2012-11-05 15:29:05 +01:00
Ondřej Vašík ce5ce154cf Relase++ 2012-03-26 12:25:31 +02:00
Ondřej Vašík baa00278c0 fix sort segfault with multibyte locales (by P.Brady), fix showing ACLs in ls (#805398, caused by #692823 fix) 2012-03-26 10:48:53 +02:00
Kamil Dudka d399388c03 various multibyte patch fixes
- fix cut output-delimiter option
- prevent infinite loop in sort when ignoring chars
- prevent using unitialized variable in cut
- fix pr -c and pr -v segfault with multibyte locales
- fix stack smashing, buffer overflow and invalid output of pr (#772172)
2012-01-30 12:56:44 +01:00
Ondřej Vašík d76ed6576a variable u should be static in uname processor type patch 2012-01-30 12:38:14 +01:00
Ondřej Vašík 686d7b3635 su: fix shell suspend in tcsh (#597928) 2012-01-30 12:36:56 +01:00
Ondřej Vašík 440a5d2399 do not use shebang in sourced colorls.csh profile.d script 2012-01-30 12:36:54 +01:00
Kamil Dudka a18bb6f59f output the correct ownership in chown -v (upstream bug #10636) 2012-01-29 14:40:26 +01:00
Ondřej Vašík 3d2e965e42 require at least pam >= 1.1.3-7 (#748215) 2011-10-24 16:21:41 +02:00
Ondřej Vašík adeca1c5dd use acl_extended_file_nofollow() if available (#692823) 2011-07-29 15:13:03 +02:00
13 changed files with 1004 additions and 155 deletions

View File

@ -107,3 +107,38 @@ diff -urNp coreutils-8.4-orig/tests/touch/no-dereference coreutils-8.4/tests/tou
# Changing time of dangling symlink is okay.
# Skip the test if this fails, but the error text corresponds to
diff -urNp coreutils-8.12-orig/src/Makefile.am coreutils-8.12/src/Makefile.am
--- coreutils-8.12-orig/src/Makefile.am 2012-11-06 09:26:07.137152887 +0100
+++ coreutils-8.12/src/Makefile.am 2012-11-06 09:27:02.778884576 +0100
@@ -139,7 +139,7 @@ bin_PROGRAMS = $(OPTIONAL_BIN_PROGS)
noinst_PROGRAMS = setuidgid getlimits
-pkglib_PROGRAMS = $(OPTIONAL_PKGLIB_PROGS)
+pkglibexec_PROGRAMS = $(OPTIONAL_PKGLIB_PROGS)
noinst_HEADERS = \
chown-core.h \
diff -urNp coreutils-8.12-orig/src/stdbuf.c coreutils-8.12/src/stdbuf.c
--- coreutils-8.12-orig/src/stdbuf.c 2011-02-19 22:28:53.000000000 +0100
+++ coreutils-8.12/src/stdbuf.c 2012-11-06 09:28:24.504275850 +0100
@@ -194,15 +194,14 @@ set_LD_PRELOAD (void)
char *LD_PRELOAD;
/* Note this would auto add the appropriate search path for "libstdbuf.so":
- gcc stdbuf.c -Wl,-rpath,'$ORIGIN' -Wl,-rpath,$PKGLIBDIR
+ gcc stdbuf.c -Wl,-rpath,'$ORIGIN' -Wl,-rpath,$PKGLIBEXECDIR
However we want the lookup done for the exec'd command not stdbuf.
- Since we don't link against libstdbuf.so add it to LIBDIR rather than
- LIBEXECDIR, as we'll search for it in the "sys default" case below. */
+ Since we don't link against libstdbuf.so add it to PKGLIBEXECDIR
+ rather than to LIBDIR. */
char const *const search_path[] = {
program_path,
- PKGLIBDIR,
- "", /* sys default */
+ PKGLIBEXECDIR,
NULL
};

164
coreutils-8.12-chown.patch Normal file
View File

@ -0,0 +1,164 @@
From 92625246f6c9614be5780a04eb227d6519becef5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Thu, 26 May 2011 11:15:11 +0100
Subject: [PATCH] chown,chgrp: output the correct ownership in -v messages
* src/chown_core.c (describe_change): Accept the ownership of
the original file and output that when not changing.
This is significant when --from is specified as then
the original and specified ownership may be different.
(user_group_str): A new helper function refactored from
describe_change().
(change_file_owner): Pass the original user and group
strings to describe_change().
* test/chown/basic: Add a test case.
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/chown-core.c | 59 ++++++++++++++++++++++++++++++++++------------------
tests/chown/basic | 11 +++++++++
2 files changed, 49 insertions(+), 21 deletions(-)
diff --git a/src/chown-core.c b/src/chown-core.c
index 82f7341..e72aa33 100644
--- a/src/chown-core.c
+++ b/src/chown-core.c
@@ -102,17 +102,44 @@ uid_to_name (uid_t uid)
: umaxtostr (uid, buf));
}
+/* Allocate a string representing USER and GROUP. */
+
+static char *
+user_group_str (char const *user, char const *group)
+{
+ char *spec;
+
+ if (user)
+ {
+ if (group)
+ {
+ spec = xmalloc (strlen (user) + 1 + strlen (group) + 1);
+ stpcpy (stpcpy (stpcpy (spec, user), ":"), group);
+ }
+ else
+ {
+ spec = xstrdup (user);
+ }
+ }
+ else
+ {
+ spec = xstrdup (group);
+ }
+
+ return spec;
+}
+
/* Tell the user how/if the user and group of FILE have been changed.
If USER is NULL, give the group-oriented messages.
CHANGED describes what (if anything) has happened. */
static void
describe_change (const char *file, enum Change_status changed,
+ char const *old_user, char const *old_group,
char const *user, char const *group)
{
const char *fmt;
- char const *spec;
- char *spec_allocated = NULL;
+ char *spec;
if (changed == CH_NOT_APPLIED)
{
@@ -121,40 +148,25 @@ describe_change (const char *file, enum Change_status changed,
return;
}
- if (user)
- {
- if (group)
- {
- spec_allocated = xmalloc (strlen (user) + 1 + strlen (group) + 1);
- stpcpy (stpcpy (stpcpy (spec_allocated, user), ":"), group);
- spec = spec_allocated;
- }
- else
- {
- spec = user;
- }
- }
- else
- {
- spec = group;
- }
-
switch (changed)
{
case CH_SUCCEEDED:
fmt = (user ? _("changed ownership of %s to %s\n")
: group ? _("changed group of %s to %s\n")
: _("no change to ownership of %s\n"));
+ spec = user_group_str (user, group);
break;
case CH_FAILED:
fmt = (user ? _("failed to change ownership of %s to %s\n")
: group ? _("failed to change group of %s to %s\n")
: _("failed to change ownership of %s\n"));
+ spec = user_group_str (user, group);
break;
case CH_NO_CHANGE_REQUESTED:
fmt = (user ? _("ownership of %s retained as %s\n")
: group ? _("group of %s retained as %s\n")
: _("ownership of %s retained\n"));
+ spec = user_group_str (user ? old_user : NULL, group ? old_group : NULL);
break;
default:
abort ();
@@ -162,7 +174,7 @@ describe_change (const char *file, enum Change_status changed,
printf (fmt, quote (file), spec);
- free (spec_allocated);
+ free (spec);
}
/* Change the owner and/or group of the FILE to UID and/or GID (safely)
@@ -459,8 +471,13 @@ change_file_owner (FTS *fts, FTSENT *ent,
: !symlink_changed ? CH_NOT_APPLIED
: !changed ? CH_NO_CHANGE_REQUESTED
: CH_SUCCEEDED);
+ char *old_usr = file_stats ? uid_to_name (file_stats->st_uid) : NULL;
+ char *old_grp = file_stats ? gid_to_name (file_stats->st_gid) : NULL;
describe_change (file_full_name, ch_status,
+ old_usr, old_grp,
chopt->user_name, chopt->group_name);
+ free (old_usr);
+ free (old_grp);
}
}
diff --git a/tests/chown/basic b/tests/chown/basic
index 0614f70..5626029 100755
--- a/tests/chown/basic
+++ b/tests/chown/basic
@@ -27,6 +27,17 @@ chown -R --preserve-root 0:1 f
# Make sure the owner and group are 0 and 1 respectively.
set _ `ls -n f`; shift; test "$3:$4" = 0:1 || fail=1
+# Make sure the correct diagnostic is output
+# Note we output a name even though an id was specified.
+chown -v --from=42 43 f > out || fail=1
+printf "ownership of \`f' retained as `id -nu`\n" > exp
+compare out exp || fail=1
+
+# Ensure diagnostics work for non existent files.
+chown -v 0 nf > out && fail=1
+printf "failed to change ownership of \`nf' to 0\n" > exp
+compare out exp || fail=1
+
chown --from=0:1 2:010 f || fail=1
# And now they should be 2 and 10 respectively.
--
1.7.1

View File

@ -0,0 +1,59 @@
diff -urNp coreutils-8.12-orig/lib/file-has-acl.c coreutils-8.12/lib/file-has-acl.c
--- coreutils-8.12-orig/lib/file-has-acl.c 2012-03-26 10:18:40.496707657 +0200
+++ coreutils-8.12/lib/file-has-acl.c 2012-03-26 10:22:36.802430522 +0200
@@ -322,6 +322,32 @@ acl_nontrivial (int count, struct acl *e
#endif
+/* acl_extended_file() tests whether a file has an ACL. But it can trigger
+ unnecessary autofs mounts. In newer versions of libacl, a function
+ acl_extended_file_nofollow() is available that uses lgetxattr() and
+ therefore does not have this problem. It is equivalent to
+ acl_extended_file(), except on symbolic links. */
+
+static int
+acl_extended_file_wrap (char const *name)
+{
+ if ( ! HAVE_ACL_EXTENDED_FILE)
+ return -1;
+
+ if (HAVE_ACL_EXTENDED_FILE_NOFOLLOW)
+ {
+ struct stat sb;
+ if (! lstat (name, &sb) && ! S_ISLNK (sb.st_mode))
+ /* acl_extended_file_nofollow() uses lgetxattr() in order to
+ prevent unnecessary mounts. It returns the same result as
+ acl_extended_file() since we already know that NAME is not a
+ symbolic link at this point (modulo the TOCTTOU race condition). */
+ return acl_extended_file_nofollow (name);
+ }
+
+ /* fallback for symlinks and old versions of libacl */
+ return acl_extended_file (name);
+}
/* Return 1 if NAME has a nontrivial access control list, 0 if NAME
only has no or a base access control list, and -1 (setting errno)
@@ -339,20 +365,12 @@ file_has_acl (char const *name, struct s
/* Linux, FreeBSD, MacOS X, IRIX, Tru64 */
int ret;
- if (HAVE_ACL_EXTENDED_FILE || HAVE_ACL_EXTENDED_FILE_NOFOLLOW) /* Linux */
+ if (HAVE_ACL_EXTENDED_FILE) /* Linux */
{
-# if HAVE_ACL_EXTENDED_FILE_NOFOLLOW
- /* acl_extended_file_nofollow() uses lgetxattr() in order to prevent
- unnecessary mounts, but it returns the same result as we already
- know that NAME is not a symbolic link at this point (modulo the
- TOCTTOU race condition). */
- ret = acl_extended_file_nofollow (name);
-# else
/* On Linux, acl_extended_file is an optimized function: It only
makes two calls to getxattr(), one for ACL_TYPE_ACCESS, one for
ACL_TYPE_DEFAULT. */
- ret = acl_extended_file (name);
-# endif
+ ret = acl_extended_file_wrap (name);
}
else /* FreeBSD, MacOS X, IRIX, Tru64 */
{

View File

@ -0,0 +1,29 @@
diff -urNp coreutils-8.17-orig/src/extent-scan.c coreutils-8.17/src/extent-scan.c
--- coreutils-8.17-orig/src/extent-scan.c 2012-05-02 10:31:47.000000000 +0200
+++ coreutils-8.17/src/extent-scan.c 2012-11-05 12:05:36.732370966 +0100
@@ -89,7 +89,7 @@ extern bool
extent_scan_read (struct extent_scan *scan)
{
unsigned int si = 0;
- struct extent_info *last_ei IF_LINT ( = scan->ext_info);
+ struct extent_info *last_ei = scan->ext_info;
while (true)
{
@@ -127,8 +127,14 @@ extent_scan_read (struct extent_scan *sc
assert (scan->ei_count <= SIZE_MAX - fiemap->fm_mapped_extents);
scan->ei_count += fiemap->fm_mapped_extents;
- scan->ext_info = xnrealloc (scan->ext_info, scan->ei_count,
- sizeof (struct extent_info));
+ {
+ /* last_ei points into a buffer that may be freed via xnrealloc.
+ Record its offset and adjust after allocation. */
+ size_t prev_idx = last_ei - scan->ext_info;
+ scan->ext_info = xnrealloc (scan->ext_info, scan->ei_count,
+ sizeof (struct extent_info));
+ last_ei = scan->ext_info + prev_idx;
+ }
unsigned int i = 0;
for (i = 0; i < fiemap->fm_mapped_extents; i++)

View File

@ -0,0 +1,387 @@
diff -urNp coreutils-8.12-orig/doc/coreutils.texi coreutils-8.12/doc/coreutils.texi
--- coreutils-8.12-orig/doc/coreutils.texi 2011-04-25 10:55:27.000000000 +0200
+++ coreutils-8.12/doc/coreutils.texi 2012-12-12 13:28:29.588025346 +0100
@@ -10379,6 +10379,14 @@ Normally the disk space is printed in un
1024 bytes, but this can be overridden (@pxref{Block size}).
Non-integer quantities are rounded up to the next higher unit.
+For bind mounts and without arguments, @command{df} only outputs the statistics
+for the first occurence of that device in the list of file systems (@var{mtab}),
+i.e., it hides duplicate entries, unless the @option{-a} option is specified.
+
+By default, @command{df} omits the early-boot pseudo file system type
+@samp{rootfs}, unless the @option{-a} option is specified or that file system
+type is explicitly to be included by using the @option{-t} option.
+
@cindex disk device file
@cindex device file, disk
If an argument @var{file} is a disk device file containing a mounted
diff -urNp coreutils-8.12-orig/src/df.c coreutils-8.12/src/df.c
--- coreutils-8.12-orig/src/df.c 2011-04-25 11:45:49.000000000 +0200
+++ coreutils-8.12/src/df.c 2012-12-12 13:28:29.593156345 +0100
@@ -25,6 +25,7 @@
#include <assert.h>
#include "system.h"
+#include "canonicalize.h"
#include "error.h"
#include "fsusage.h"
#include "human.h"
@@ -45,6 +46,17 @@
/* If true, show inode information. */
static bool inode_format;
+/* Filled with device numbers of examined file systems to avoid
+ duplicities in output. */
+struct devlist
+{
+ dev_t dev_num;
+ struct devlist *next;
+};
+
+/* Store of already-processed device numbers. */
+static struct devlist *devlist_head;
+
/* If true, show even file systems with zero size or
uninteresting types. */
static bool show_all_fs;
@@ -56,6 +68,12 @@ static bool show_local_fs;
command line argument -- even if it's a dummy (automounter) entry. */
static bool show_listed_fs;
+/* If true, include rootfs in the output. */
+static bool show_rootfs;
+
+/* The literal name of the initial root file system. */
+static char const *ROOTFS = "rootfs";
+
/* Human-readable options for output. */
static int human_output_opts;
@@ -349,6 +367,29 @@ excluded_fstype (const char *fstype)
return false;
}
+/* Check if the device was already examined. */
+
+static bool
+dev_examined (char const *mount_dir, char const *devname)
+{
+ struct stat buf;
+ if (-1 == stat (mount_dir, &buf))
+ return false;
+
+ struct devlist *devlist = devlist_head;
+ for ( ; devlist; devlist = devlist->next)
+ if (devlist->dev_num == buf.st_dev)
+ return true;
+
+ /* Add the device number to the global list devlist. */
+ devlist = xmalloc (sizeof *devlist);
+ devlist->dev_num = buf.st_dev;
+ devlist->next = devlist_head;
+ devlist_head = devlist;
+
+ return false;
+}
+
/* Return true if N is a known integer value. On many file systems,
UINTMAX_MAX represents an unknown value; on AIX, UINTMAX_MAX - 1
represents unknown. Use a rule that works on AIX file systems, and
@@ -417,6 +458,17 @@ add_uint_with_neg_flag (uintmax_t *dest,
*dest = -*dest;
}
+/* Return true if S ends in a string that may be a 36-byte UUID,
+ i.e., of the form HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH, where
+ each H is an upper or lower case hexadecimal digit. */
+static bool _GL_ATTRIBUTE_PURE
+has_uuid_suffix (char const *s)
+{
+ size_t len = strlen (s);
+ return (36 < len
+ && strspn (s + len - 36, "-0123456789abcdefABCDEF") == 36);
+}
+
/* Optain a space listing for the disk device with absolute file name DISK.
If MOUNT_POINT is non-NULL, it is the name of the root of the
file system on DISK.
@@ -428,13 +480,16 @@ add_uint_with_neg_flag (uintmax_t *dest,
If FSTYPE is non-NULL, it is the type of the file system on DISK.
If MOUNT_POINT is non-NULL, then DISK may be NULL -- certain systems may
not be able to produce statistics in this case.
- ME_DUMMY and ME_REMOTE are the mount entry flags. */
+ ME_DUMMY and ME_REMOTE are the mount entry flags.
+ Caller must set PROCESS_ALL to true when iterating over all entries, as
+ when df is invoked with no non-option argument. See below for details. */
static void
get_dev (char const *disk, char const *mount_point,
char const *stat_file, char const *fstype,
bool me_dummy, bool me_remote,
- const struct fs_usage *force_fsu)
+ const struct fs_usage *force_fsu,
+ bool process_all)
{
struct fs_usage fsu;
char buf[LONGEST_HUMAN_READABLE + 2];
@@ -459,6 +514,15 @@ get_dev (char const *disk, char const *m
if (!selected_fstype (fstype) || excluded_fstype (fstype))
return;
+ if (process_all && !show_all_fs && !show_listed_fs)
+ {
+ /* No arguments nor "df -a", then check if df has to ... */
+ if (!show_rootfs && STREQ (disk, ROOTFS))
+ return; /* ... skip rootfs: (unless -trootfs is given. */
+ if (dev_examined (mount_point, disk))
+ return; /* ... skip duplicate entries (bind mounts). */
+ }
+
/* If MOUNT_POINT is NULL, then the file system is not mounted, and this
program reports on the file system that the special file is on.
It would be better to report on the unmounted file system,
@@ -488,6 +552,24 @@ get_dev (char const *disk, char const *m
if (! disk)
disk = "-"; /* unknown */
+
+ char *dev_name = xstrdup (disk);
+ char *resolved_dev;
+
+ /* On some systems, dev_name is a long-named symlink like
+ /dev/disk/by-uuid/828fc648-9f30-43d8-a0b1-f7196a2edb66 pointing to a
+ much shorter and more useful name like /dev/sda1. It may also look
+ like /dev/mapper/luks-828fc648-9f30-43d8-a0b1-f7196a2edb66 and point to
+ /dev/dm-0. When process_all is true and dev_name is a symlink whose
+ name ends with a UUID use the resolved name instead. */
+ if (process_all
+ && has_uuid_suffix (dev_name)
+ && (resolved_dev = canonicalize_filename_mode (dev_name, CAN_EXISTING)))
+ {
+ free (dev_name);
+ dev_name = resolved_dev;
+ }
+
if (! fstype)
fstype = "-"; /* unknown */
@@ -537,7 +619,7 @@ get_dev (char const *disk, char const *m
switch (field)
{
case DEV_FIELD:
- cell = xstrdup (disk);
+ cell = dev_name;
break;
case TYPE_FIELD:
@@ -648,7 +730,7 @@ get_disk (char const *disk)
{
get_dev (best_match->me_devname, best_match->me_mountdir, NULL,
best_match->me_type, best_match->me_dummy,
- best_match->me_remote, NULL);
+ best_match->me_remote, NULL, false);
return true;
}
@@ -734,7 +816,7 @@ get_point (const char *point, const stru
if (best_match)
get_dev (best_match->me_devname, best_match->me_mountdir, point,
best_match->me_type, best_match->me_dummy, best_match->me_remote,
- NULL);
+ NULL, false);
else
{
/* We couldn't find the mount entry corresponding to POINT. Go ahead and
@@ -745,7 +827,7 @@ get_point (const char *point, const stru
char *mp = find_mount_point (point, statp);
if (mp)
{
- get_dev (NULL, mp, NULL, NULL, false, false, NULL);
+ get_dev (NULL, mp, NULL, NULL, false, false, NULL, false);
free (mp);
}
}
@@ -774,7 +856,7 @@ get_all_entries (void)
for (me = mount_list; me; me = me->me_next)
get_dev (me->me_devname, me->me_mountdir, NULL, me->me_type,
- me->me_dummy, me->me_remote, NULL);
+ me->me_dummy, me->me_remote, NULL, true);
}
/* Add FSTYPE to the list of file system types to display. */
@@ -940,6 +1022,7 @@ main (int argc, char **argv)
/* Accept -F as a synonym for -t for compatibility with Solaris. */
case 't':
add_fs_type (optarg);
+ show_rootfs = selected_fstype (ROOTFS);
break;
case 'v': /* For SysV compatibility. */
@@ -1066,13 +1149,21 @@ main (int argc, char **argv)
{
if (inode_format)
grand_fsu.fsu_blocks = 1;
- get_dev ("total", NULL, NULL, NULL, false, false, &grand_fsu);
+ get_dev ("total", NULL, NULL, NULL, false, false, &grand_fsu, false);
}
print_table ();
if (! file_systems_processed)
error (EXIT_FAILURE, 0, _("no file systems processed"));
+ IF_LINT (
+ while (devlist_head)
+ {
+ struct devlist *devlist = devlist_head->next;
+ free (devlist_head);
+ devlist_head = devlist;
+ }
+ );
exit (exit_status);
}
diff -urNp coreutils-8.12-orig/tests/df/skip-duplicates coreutils-8.12/tests/df/skip-duplicates
--- coreutils-8.12-orig/tests/df/skip-duplicates 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.12/tests/df/skip-duplicates 2012-12-12 13:28:29.590144032 +0100
@@ -0,0 +1,77 @@
+#!/bin/sh
+# Test df's behavior when the mount list contains duplicate entries.
+# This test is skipped on systems that lack LD_PRELOAD support; that's fine.
+
+# Copyright (C) 2012 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/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+print_ver_ df
+
+df || skip_ "df fails"
+
+# Simulate an mtab file with two entries of the same device number.
+cat > k.c <<'EOF' || framework_failure_
+#include <stdio.h>
+#include <mntent.h>
+
+struct mntent *getmntent (FILE *fp)
+{
+ /* Prove that LD_PRELOAD works. */
+ static int done = 0;
+ if (!done)
+ {
+ fclose (fopen ("x", "w"));
+ ++done;
+ }
+
+ static struct mntent mntent;
+
+ while (done++ < 3)
+ {
+ mntent.mnt_fsname = "fsname";
+ mntent.mnt_dir = "/";
+ mntent.mnt_type = "-";
+
+ return &mntent;
+ }
+ return NULL;
+}
+EOF
+
+# Then compile/link it:
+gcc --std=gnu99 -shared -fPIC -ldl -O2 k.c -o k.so \
+ || skip_ "getmntent hack does not work on this platform"
+
+# Test if LD_PRELOAD works:
+LD_PRELOAD=./k.so df
+test -f x || skip_ "internal test failure: maybe LD_PRELOAD doesn't work?"
+
+# The fake mtab file should only contain 2 entries, both
+# having the same device number; thus the output should
+# consist of a header and one entry.
+LD_PRELOAD=./k.so df >out || fail=1
+test $(wc -l <out) -eq 2 || { fail=1; cat out; }
+
+# Ensure that filtering duplicates does not affect -a processing.
+LD_PRELOAD=./k.so df -a >out || fail=1
+test $(wc -l <out) -eq 3 || { fail=1; cat out; }
+
+# Ensure that filtering duplcates does not affect
+# argument processing (now without the fake getmntent()).
+df '.' '.' >out || fail=1
+test $(wc -l <out) -eq 3 || { fail=1; cat out; }
+
+Exit $fail
diff -urNp coreutils-8.12-orig/tests/df/skip-rootfs coreutils-8.12/tests/df/skip-rootfs
--- coreutils-8.12-orig/tests/df/skip-rootfs 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.12/tests/df/skip-rootfs 2012-12-12 13:28:29.591024467 +0100
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Test df's behavior for skipping the pseudo "rootfs" file system.
+
+# Copyright (C) 2012 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/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+print_ver_ df
+
+df || skip_ "df fails"
+
+# Verify that rootfs is in mtab (and shown when the -a option is specified).
+df -a >out || fail=1
+grep '^rootfs' out || skip_ "no rootfs in mtab"
+
+# Ensure that rootfs is supressed when no options is specified.
+df >out || fail=1
+grep '^rootfs' out && { fail=1; cat out; }
+
+# Ensure that the rootfs is shown when explicitly specifying "-t rootfs".
+df -t rootfs >out || fail=1
+grep '^rootfs' out || { fail=1; cat out; }
+
+# Ensure that the rootfs is shown when explicitly specifying "-t rootfs",
+# even when the -a option is specified.
+df -t rootfs -a >out || fail=1
+grep '^rootfs' out || { fail=1; cat out; }
+
+# Ensure that the rootfs is omitted in all_fs mode when it is explicitly
+# black-listed.
+df -a -x rootfs >out || fail=1
+grep '^rootfs' out && { fail=1; cat out; }
+
+Exit $fail
diff -urNp coreutils-8.12-orig/tests/Makefile.am coreutils-8.12/tests/Makefile.am
--- coreutils-8.12-orig/tests/Makefile.am 2011-04-25 11:45:27.000000000 +0200
+++ coreutils-8.12/tests/Makefile.am 2012-12-12 13:28:29.592155734 +0100
@@ -352,6 +352,8 @@ TESTS = \
cp/symlink-slash \
cp/thru-dangling \
df/unreadable \
+ df/skip-duplicates \
+ df/skip-rootfs \
dd/direct \
dd/misc \
dd/nocache \

View File

@ -16,7 +16,7 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
}
+#else
+ {
+ struct utsname u;
+ static struct utsname u;
+ uname(&u);
+ element = u.machine;
+ }
@ -38,7 +38,7 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
}
+#else
+ {
+ struct utsname u;
+ static struct utsname u;
+ uname(&u);
+ element = u.machine;
+ if(strlen(element)==4 && element[0]=='i' && element[2]=='8' && element[3]=='6')

View File

@ -106,7 +106,7 @@ index f8f5b61..811aad7 100644
static struct option const longopts[] =
{
{"command", required_argument, NULL, 'c'},
@@ -200,7 +224,164 @@ log_su (struct passwd const *pw, bool successful)
@@ -200,7 +224,174 @@ log_su (struct passwd const *pw, bool successful)
}
#endif
@ -168,7 +168,7 @@ index f8f5b61..811aad7 100644
+create_watching_parent (void)
+{
+ pid_t child;
+ sigset_t ourset;
+ sigset_t ourset, blockset;
+ int status = 0;
+
+ retval = pam_open_session (pamh, 0);
@ -230,7 +230,17 @@ index f8f5b61..811aad7 100644
+
+ if (pid != (pid_t)-1 && WIFSTOPPED (status))
+ {
+ /* tcsh sends SIGTSTP to the process group, and so is already pending */
+ kill (getpid (), SIGSTOP);
+ if (WSTOPSIG(status) != SIGSTOP) {
+ sigemptyset(&blockset);
+ if (sigaddset(&blockset, WSTOPSIG(status)) ||
+ sigprocmask(SIG_UNBLOCK, &blockset, &ourset) ||
+ sigprocmask(SIG_SETMASK, &ourset, NULL))
+ {
+ error (0, errno, _("cannot set signal handler"));
+ }
+ }
+ /* once we get here, we must have resumed */
+ kill (pid, SIGCONT);
+ }
@ -271,7 +281,7 @@ index f8f5b61..811aad7 100644
Return true if the user gives the correct password for entry PW,
false if not. Return true without asking for a password if run by UID 0
or if PW has an empty password. */
@@ -208,10 +389,52 @@ log_su (struct passwd const *pw, bool successful)
@@ -208,10 +399,52 @@ log_su (struct passwd const *pw, bool successful)
static bool
correct_password (const struct passwd *pw)
{
@ -325,7 +335,7 @@ index f8f5b61..811aad7 100644
endspent ();
if (sp)
@@ -232,6 +455,7 @@ correct_password (const struct passwd *pw)
@@ -232,6 +465,7 @@ correct_password (const struct passwd *pw)
encrypted = crypt (unencrypted, correct);
memset (unencrypted, 0, strlen (unencrypted));
return STREQ (encrypted, correct);
@ -333,7 +343,7 @@ index f8f5b61..811aad7 100644
}
/* Update `environ' for the new shell based on PW, with SHELL being
@@ -274,19 +498,41 @@ modify_environment (const struct passwd *pw, const char *shell)
@@ -274,19 +508,41 @@ modify_environment (const struct passwd *pw, const char *shell)
}
}
}
@ -377,7 +387,7 @@ index f8f5b61..811aad7 100644
if (setgid (pw->pw_gid))
error (EXIT_CANCELED, errno, _("cannot set group id"));
if (setuid (pw->pw_uid))
@@ -500,9 +746,21 @@ main (int argc, char **argv)
@@ -500,9 +756,21 @@ main (int argc, char **argv)
shell = NULL;
}
shell = xstrdup (shell ? shell : pw->pw_shell);

View File

@ -0,0 +1,74 @@
From 95f7c57ff4090a5dee062044d2c7b99879077808 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka <at> redhat.com>
Date: Fri, 22 Jul 2011 14:48:42 +0200
Subject: [PATCH] file-has-acl: use acl_extended_file_nofollow if available
* lib/acl-internal.h (HAVE_ACL_EXTENDED_FILE): New macro.
(acl_extended_file): New macro.
* lib/file-has-acl.c (file_has_acl): Use acl_extended_file_nofollow.
* m4/acl.m4 (gl_FUNC_ACL): Check for acl_extended_file_nofollow.
This addresses http://bugzilla.redhat.com/692823.
---
lib/acl-internal.h | 6 ++++++
lib/file-has-acl.c | 10 +++++++++-
m4/acl.m4 | 2 +-
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index b3160a7..b509666 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -133,6 +133,12 @@ rpl_acl_set_fd (int fd, acl_t acl)
# endif
/* Linux-specific */
+# ifndef HAVE_ACL_EXTENDED_FILE_NOFOLLOW
+# define HAVE_ACL_EXTENDED_FILE_NOFOLLOW false
+# define acl_extended_file_nofollow(name) (-1)
+# endif
+
+/* Linux-specific */
# ifndef HAVE_ACL_FROM_MODE
# define HAVE_ACL_FROM_MODE false
# define acl_from_mode(mode) (NULL)
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index 3d4d5c1..2ee6ba2 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -366,12 +366,20 @@ file_has_acl (char const *name, struct stat const *sb)
/* Linux, FreeBSD, MacOS X, IRIX, Tru64 */
int ret;
- if (HAVE_ACL_EXTENDED_FILE) /* Linux */
+ if (HAVE_ACL_EXTENDED_FILE || HAVE_ACL_EXTENDED_FILE_NOFOLLOW) /* Linux */
{
+# if HAVE_ACL_EXTENDED_FILE_NOFOLLOW
+ /* acl_extended_file_nofollow() uses lgetxattr() in order to prevent
+ unnecessary mounts, but it returns the same result as we already
+ know that NAME is not a symbolic link at this point (modulo the
+ TOCTTOU race condition). */
+ ret = acl_extended_file_nofollow (name);
+# else
/* On Linux, acl_extended_file is an optimized function: It only
makes two calls to getxattr(), one for ACL_TYPE_ACCESS, one for
ACL_TYPE_DEFAULT. */
ret = acl_extended_file (name);
+# endif
}
else /* FreeBSD, MacOS X, IRIX, Tru64 */
{
diff --git a/m4/acl.m4 b/m4/acl.m4
index d6a448a..ecf0384 100644
--- a/m4/acl.m4
+++ b/m4/acl.m4
@@ -33,7 +33,7 @@ AC_DEFUN([gl_FUNC_ACL],
AC_CHECK_FUNCS(
[acl_get_file acl_get_fd acl_set_file acl_set_fd \
acl_free acl_from_mode acl_from_text \
- acl_delete_def_file acl_extended_file \
+ acl_delete_def_file acl_extended_file acl_extended_file_nofollow \
acl_delete_fd_np acl_delete_file_np \
acl_copy_ext_native acl_create_entry_np \
acl_to_short_text acl_free_text])
--
1.7.6.586.g302e6

View File

@ -1,4 +1,3 @@
#! /bin/csh -f
# color-ls initialization
if ( $?USER_LS_COLORS ) then
if ( "$USER_LS_COLORS" != "" ) then
@ -15,12 +14,12 @@ if ($?TERM) then
if ( -e "/etc/DIR_COLORS.$TERM" ) then
set COLORS="/etc/DIR_COLORS.$TERM"
endif
endif
if ( -e "/etc/DIR_COLORS.256color" ) then
if ( "`tty -s && tput colors`" == "256" ) then
set COLORS=/etc/DIR_COLORS.256color
if ( -e "/etc/DIR_COLORS.256color" ) then
if ( "`tput colors`" == "256" ) then
set COLORS=/etc/DIR_COLORS.256color
endif
endif
endif
if ( -f ~/.dircolors ) set COLORS=~/.dircolors
if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
if ($?TERM) then

View File

@ -67,7 +67,7 @@ diff -urNp coreutils-8.11-orig/src/df.c coreutils-8.11/src/df.c
+ char *resolved = canonicalize_file_name (name);
+ if (resolved)
+ {
+ get_dev (NULL, resolved, NULL, NULL, false, false, NULL);
+ get_dev (NULL, resolved, NULL, NULL, false, false, NULL, false);
+ free (resolved);
+ return;
+ }

View File

@ -1,6 +1,6 @@
diff -urNp coreutils-8.10-orig/lib/linebuffer.h coreutils-8.10/lib/linebuffer.h
--- coreutils-8.10-orig/lib/linebuffer.h 2011-01-06 09:47:56.000000000 +0100
+++ coreutils-8.10/lib/linebuffer.h 2011-02-04 20:13:23.985464731 +0100
diff -urNp coreutils-8.12-orig/lib/linebuffer.h coreutils-8.12/lib/linebuffer.h
--- coreutils-8.12-orig/lib/linebuffer.h 2011-04-24 19:21:45.000000000 +0200
+++ coreutils-8.12/lib/linebuffer.h 2012-03-26 10:10:44.383439379 +0200
@@ -21,6 +21,11 @@
# include <stdio.h>
@ -23,9 +23,9 @@ diff -urNp coreutils-8.10-orig/lib/linebuffer.h coreutils-8.10/lib/linebuffer.h
};
/* Initialize linebuffer LINEBUFFER for use. */
diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
--- coreutils-8.10-orig/src/cut.c 2011-01-31 13:40:38.000000000 +0100
+++ coreutils-8.10/src/cut.c 2011-02-04 20:13:23.988464025 +0100
diff -urNp coreutils-8.12-orig/src/cut.c coreutils-8.12/src/cut.c
--- coreutils-8.12-orig/src/cut.c 2011-02-19 18:17:03.000000000 +0100
+++ coreutils-8.12/src/cut.c 2012-03-26 10:10:44.385806690 +0200
@@ -28,6 +28,11 @@
#include <assert.h>
#include <getopt.h>
@ -75,7 +75,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
+ while (0)
+
+/* Get wide character on BUFPOS. BUFPOS is not included after that.
+ If byte sequence is not valid as a character, CONVFAIL is 1. Otherwise 0. */
+ If byte sequence is not valid as a character, CONVFAIL is 1. Otherwise 0. */
+#define GET_NEXT_WC_FROM_BUFFER(WC, BUFPOS, BUFLEN, MBLENGTH, STATE, CONVFAIL) \
+ do \
+ { \
@ -226,7 +226,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
}
max_range_endpoint = 0;
@@ -580,6 +662,63 @@ cut_bytes (FILE *stream)
@@ -582,6 +664,77 @@ cut_bytes (FILE *stream)
}
}
@ -234,11 +234,11 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
+/* This function is in use for the following case.
+
+ 1. Read from the stream STREAM, printing to standard output any selected
+ characters.
+ characters.
+
+ 2. Read from stream STREAM, printing to standard output any selected bytes,
+ without splitting multibyte characters. */
+
+
+static void
+cut_characters_or_cut_bytes_no_split (FILE *stream)
+{
@ -251,6 +251,9 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
+ as same character as WC. */
+ mbstate_t state; /* State of the stream. */
+ int convfail = 0; /* 1, when conversion is failed. Otherwise 0. */
+ /* Whether to begin printing delimiters between ranges for the current line.
+ Set after we've begun printing data corresponding to the first range. */
+ bool print_delimiter = false;
+
+ idx = 0;
+ buflen = 0;
@ -273,12 +276,23 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
+ {
+ putchar ('\n');
+ idx = 0;
+ print_delimiter = false;
+ }
+ else
+ {
+ bool range_start;
+ bool *rs = output_delimiter_specified ? &range_start : NULL;
+ idx += (operating_mode == byte_mode) ? mblength : 1;
+ if (print_kth (idx, NULL))
+ fwrite (bufpos, mblength, sizeof(char), stdout);
+ if (print_kth (idx, rs))
+ {
+ if (rs && *rs && print_delimiter)
+ {
+ fwrite (output_delimiter_string, sizeof (char),
+ output_delimiter_length, stdout);
+ }
+ print_delimiter = true;
+ fwrite (bufpos, mblength, sizeof(char), stdout);
+ }
+ }
+
+ buflen -= mblength;
@ -286,11 +300,11 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
+ }
+}
+#endif
+
+
/* Read from stream STREAM, printing to standard output any selected fields. */
static void
@@ -702,13 +841,192 @@ cut_fields (FILE *stream)
@@ -704,13 +857,195 @@ cut_fields (FILE *stream)
}
}
@ -310,7 +324,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
+ size_t mblength; /* The byte size of a multibyte character which shows
+ as same character as WC. */
+ mbstate_t state; /* State of the stream. */
+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
+ int convfail = 0; /* 1, when conversion is failed. Otherwise 0. */
+
+ found_any_selected_field = 0;
+ field_idx = 1;
@ -321,7 +335,10 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
+ c = getc (stream);
+ empty_input = (c == EOF);
+ if (c != EOF)
+ {
+ ungetc (c, stream);
+ wc = 0;
+ }
+ else
+ wc = WEOF;
+
@ -359,7 +376,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
+ break;
+ }
+
+ if (wc == WEOF)
+ if (len<=0 && wc == WEOF)
+ break;
+
+ /* If the first field extends to the end of line (it is not
@ -486,7 +503,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
}
/* Process file FILE to standard output.
@@ -760,6 +1078,8 @@ main (int argc, char **argv)
@@ -762,6 +1097,8 @@ main (int argc, char **argv)
bool ok;
bool delim_specified = false;
char *spec_list_string IF_LINT ( = NULL);
@ -495,7 +512,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -782,7 +1102,6 @@ main (int argc, char **argv)
@@ -784,7 +1121,6 @@ main (int argc, char **argv)
switch (optc)
{
case 'b':
@ -503,7 +520,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
/* Build the byte list. */
if (operating_mode != undefined_mode)
FATAL_ERROR (_("only one type of list may be specified"));
@@ -790,6 +1109,14 @@ main (int argc, char **argv)
@@ -792,6 +1128,14 @@ main (int argc, char **argv)
spec_list_string = optarg;
break;
@ -518,7 +535,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
case 'f':
/* Build the field list. */
if (operating_mode != undefined_mode)
@@ -801,10 +1128,35 @@ main (int argc, char **argv)
@@ -803,10 +1147,35 @@ main (int argc, char **argv)
case 'd':
/* New delimiter. */
/* Interpret -d '' to mean `use the NUL byte as the delimiter.' */
@ -558,7 +575,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
break;
case OUTPUT_DELIMITER_OPTION:
@@ -817,6 +1169,7 @@ main (int argc, char **argv)
@@ -819,6 +1188,7 @@ main (int argc, char **argv)
break;
case 'n':
@ -566,7 +583,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
break;
case 's':
@@ -839,7 +1192,7 @@ main (int argc, char **argv)
@@ -841,7 +1211,7 @@ main (int argc, char **argv)
if (operating_mode == undefined_mode)
FATAL_ERROR (_("you must specify a list of bytes, characters, or fields"));
@ -575,7 +592,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
FATAL_ERROR (_("an input delimiter may be specified only\
when operating on fields"));
@@ -866,15 +1219,34 @@ main (int argc, char **argv)
@@ -868,15 +1238,34 @@ main (int argc, char **argv)
}
if (!delim_specified)
@ -607,7 +624,7 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
+ if (MB_CUR_MAX <= 1 || force_singlebyte_mode)
+#endif
+ {
+ static char dummy[2];
+ static char dummy[2];
+ dummy[0] = delim;
+ dummy[1] = '\0';
+ output_delimiter_string = dummy;
@ -616,9 +633,9 @@ diff -urNp coreutils-8.10-orig/src/cut.c coreutils-8.10/src/cut.c
}
if (optind == argc)
diff -urNp coreutils-8.10-orig/src/expand.c coreutils-8.10/src/expand.c
--- coreutils-8.10-orig/src/expand.c 2011-01-31 13:40:38.000000000 +0100
+++ coreutils-8.10/src/expand.c 2011-02-04 20:13:23.990463571 +0100
diff -urNp coreutils-8.12-orig/src/expand.c coreutils-8.12/src/expand.c
--- coreutils-8.12-orig/src/expand.c 2011-02-19 18:17:03.000000000 +0100
+++ coreutils-8.12/src/expand.c 2012-03-26 10:10:44.386455034 +0200
@@ -38,12 +38,29 @@
#include <stdio.h>
#include <getopt.h>
@ -716,7 +733,7 @@ diff -urNp coreutils-8.10-orig/src/expand.c coreutils-8.10/src/expand.c
+ if (convert)
+ {
+ ++column;
+ if (convert_entire_line == 0)
+ if (convert_entire_line == 0 && !isblank(*bufpos))
+ convert = 0;
+ }
+ putchar (*bufpos);
@ -776,7 +793,7 @@ diff -urNp coreutils-8.10-orig/src/expand.c coreutils-8.10/src/expand.c
+
+ width = wcwidth (wc);
+ column += (width > 0) ? width : 0;
+ if (convert_entire_line == 0)
+ if (convert_entire_line == 0 && !iswblank(wc))
+ convert = 0;
+ }
+ }
@ -806,9 +823,9 @@ diff -urNp coreutils-8.10-orig/src/expand.c coreutils-8.10/src/expand.c
if (have_read_stdin && fclose (stdin) != 0)
error (EXIT_FAILURE, errno, "-");
diff -urNp coreutils-8.10-orig/src/fold.c coreutils-8.10/src/fold.c
--- coreutils-8.10-orig/src/fold.c 2011-01-31 13:40:38.000000000 +0100
+++ coreutils-8.10/src/fold.c 2011-02-04 20:13:23.992463115 +0100
diff -urNp coreutils-8.12-orig/src/fold.c coreutils-8.12/src/fold.c
--- coreutils-8.12-orig/src/fold.c 2011-02-19 18:17:03.000000000 +0100
+++ coreutils-8.12/src/fold.c 2012-03-26 10:10:44.388464872 +0200
@@ -22,12 +22,34 @@
#include <getopt.h>
#include <sys/types.h>
@ -1067,7 +1084,7 @@ diff -urNp coreutils-8.10-orig/src/fold.c coreutils-8.10/src/fold.c
+ fwrite (line_out, sizeof(char), offset_out, stdout);
+ START_NEW_LINE;
+ continue;
+
+
+ case L'\b':
+ increment = (column > 0) ? -1 : 0;
+ break;
@ -1179,7 +1196,7 @@ diff -urNp coreutils-8.10-orig/src/fold.c coreutils-8.10/src/fold.c
if (ferror (istream))
{
error (0, saved_errno, "%s", filename);
@@ -254,7 +502,8 @@ main (int argc, char **argv)
@@ -254,7 +501,8 @@ main (int argc, char **argv)
atexit (close_stdout);
@ -1189,7 +1206,7 @@ diff -urNp coreutils-8.10-orig/src/fold.c coreutils-8.10/src/fold.c
while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
{
@@ -263,7 +512,15 @@ main (int argc, char **argv)
@@ -263,7 +511,15 @@ main (int argc, char **argv)
switch (optc)
{
case 'b': /* Count bytes rather than columns. */
@ -1206,9 +1223,9 @@ diff -urNp coreutils-8.10-orig/src/fold.c coreutils-8.10/src/fold.c
break;
case 's': /* Break at word boundaries. */
diff -urNp coreutils-8.10-orig/src/join.c coreutils-8.10/src/join.c
--- coreutils-8.10-orig/src/join.c 2011-01-31 13:40:38.000000000 +0100
+++ coreutils-8.10/src/join.c 2011-02-04 20:20:15.985114387 +0100
diff -urNp coreutils-8.12-orig/src/join.c coreutils-8.12/src/join.c
--- coreutils-8.12-orig/src/join.c 2011-02-19 18:17:03.000000000 +0100
+++ coreutils-8.12/src/join.c 2012-03-26 10:10:44.390449445 +0200
@@ -22,18 +22,32 @@
#include <sys/types.h>
#include <getopt.h>
@ -1423,7 +1440,7 @@ diff -urNp coreutils-8.10-orig/src/join.c coreutils-8.10/src/join.c
+ extract_field (line, ptr, lim - ptr);
+}
+#endif
+
+
static void
freeline (struct line *line)
{
@ -1551,7 +1568,7 @@ diff -urNp coreutils-8.10-orig/src/join.c coreutils-8.10/src/join.c
- return xmemcoll (beg1, len1, beg2, len2);
- diff = memcmp (beg1, beg2, MIN (len1, len2));
+ copy[0] = (unsigned char *) beg[0];
+ copy[1] = (unsigned char *) beg[1];
+ copy[1] = (unsigned char *) beg[1];
}
+ if (hard_LC_COLLATE)
@ -1632,7 +1649,7 @@ diff -urNp coreutils-8.10-orig/src/join.c coreutils-8.10/src/join.c
case 't':
{
- unsigned char newtab = optarg[0];
+ char *newtab;
+ char *newtab = NULL;
+ size_t newtablen;
+ newtab = xstrdup (optarg);
+#if HAVE_MBRTOWC
@ -1653,8 +1670,9 @@ diff -urNp coreutils-8.10-orig/src/join.c coreutils-8.10/src/join.c
+#endif
+ newtablen = 1;
if (! newtab)
- newtab = '\n'; /* '' => process the whole line. */
+ {
newtab = '\n'; /* '' => process the whole line. */
+ newtab = "\n"; /* '' => process the whole line. */
+ }
else if (optarg[1])
{
@ -1683,9 +1701,9 @@ diff -urNp coreutils-8.10-orig/src/join.c coreutils-8.10/src/join.c
break;
case NOCHECK_ORDER_OPTION:
diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
--- coreutils-8.10-orig/src/pr.c 2011-01-31 13:40:38.000000000 +0100
+++ coreutils-8.10/src/pr.c 2011-02-04 20:13:24.002460897 +0100
diff -urNp coreutils-8.12-orig/src/pr.c coreutils-8.12/src/pr.c
--- coreutils-8.12-orig/src/pr.c 2011-04-25 11:45:49.000000000 +0200
+++ coreutils-8.12/src/pr.c 2012-03-26 10:10:44.394824042 +0200
@@ -312,6 +312,32 @@
#include <getopt.h>
@ -1963,7 +1981,19 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
if (*arg)
{
long int tmp_long;
@@ -1249,7 +1375,7 @@ init_parameters (int number_of_files)
@@ -1212,6 +1338,11 @@ static void
init_parameters (int number_of_files)
{
int chars_used_by_number = 0;
+ int mb_len = 1;
+#if HAVE_MBRTOWC
+ if (MB_CUR_MAX > 1)
+ mb_len = MB_LEN_MAX;
+#endif
lines_per_body = lines_per_page - lines_per_header - lines_per_footer;
if (lines_per_body <= 0)
@@ -1249,7 +1380,7 @@ init_parameters (int number_of_files)
else
col_sep_string = column_separator;
@ -1972,7 +2002,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
use_col_separator = true;
}
/* It's rather pointless to define a TAB separator with column
@@ -1280,11 +1406,11 @@ init_parameters (int number_of_files)
@@ -1280,11 +1411,11 @@ init_parameters (int number_of_files)
TAB_WIDTH (chars_per_input_tab, chars_per_number); */
/* Estimate chars_per_text without any margin and keep it constant. */
@ -1986,7 +2016,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
/* The number is part of the column width unless we are
printing files in parallel. */
@@ -1299,7 +1425,7 @@ init_parameters (int number_of_files)
@@ -1299,7 +1430,7 @@ init_parameters (int number_of_files)
}
chars_per_column = (chars_per_line - chars_used_by_number -
@ -1995,7 +2025,16 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
if (chars_per_column < 1)
error (EXIT_FAILURE, 0, _("page width too narrow"));
@@ -1424,7 +1550,7 @@ init_funcs (void)
@@ -1316,7 +1447,7 @@ init_parameters (int number_of_files)
We've to use 8 as the lower limit, if we use chars_per_default_tab = 8
to expand a tab which is not an input_tab-char. */
free (clump_buff);
- clump_buff = xmalloc (MAX (8, chars_per_input_tab));
+ clump_buff = xmalloc (mb_len * MAX (8, chars_per_input_tab));
}
/* Open the necessary files,
@@ -1424,7 +1555,7 @@ init_funcs (void)
/* Enlarge p->start_position of first column to use the same form of
padding_not_printed with all columns. */
@ -2004,7 +2043,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
/* This loop takes care of all but the rightmost column. */
@@ -1458,7 +1584,7 @@ init_funcs (void)
@@ -1458,7 +1589,7 @@ init_funcs (void)
}
else
{
@ -2013,7 +2052,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
h_next = h + chars_per_column;
}
}
@@ -1749,9 +1875,9 @@ static void
@@ -1749,9 +1880,9 @@ static void
align_column (COLUMN *p)
{
padding_not_printed = p->start_position;
@ -2025,7 +2064,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
padding_not_printed = ANYWHERE;
}
@@ -2022,13 +2148,13 @@ store_char (char c)
@@ -2022,13 +2153,13 @@ store_char (char c)
/* May be too generous. */
buff = X2REALLOC (buff, &buff_allocated);
}
@ -2041,7 +2080,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
char *s;
int left_cut;
@@ -2051,22 +2177,24 @@ add_line_number (COLUMN *p)
@@ -2051,22 +2182,24 @@ add_line_number (COLUMN *p)
/* Tabification is assumed for multiple columns, also for n-separators,
but `default n-separator = TAB' hasn't been given priority over
equal column_width also specified by POSIX. */
@ -2070,7 +2109,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
output_position = POS_AFTER_TAB (chars_per_output_tab,
output_position);
}
@@ -2227,7 +2355,7 @@ print_white_space (void)
@@ -2227,7 +2360,7 @@ print_white_space (void)
while (goal - h_old > 1
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
{
@ -2079,7 +2118,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
h_old = h_new;
}
while (++h_old <= goal)
@@ -2247,6 +2375,7 @@ print_sep_string (void)
@@ -2247,6 +2380,7 @@ print_sep_string (void)
{
char *s;
int l = col_sep_length;
@ -2087,7 +2126,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
s = col_sep_string;
@@ -2260,6 +2389,7 @@ print_sep_string (void)
@@ -2260,6 +2394,7 @@ print_sep_string (void)
{
for (; separators_not_printed > 0; --separators_not_printed)
{
@ -2095,7 +2134,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
while (l-- > 0)
{
/* 3 types of sep_strings: spaces only, spaces and chars,
@@ -2273,12 +2403,15 @@ print_sep_string (void)
@@ -2273,12 +2408,15 @@ print_sep_string (void)
}
else
{
@ -2112,7 +2151,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
/* sep_string ends with some spaces */
if (spaces_not_printed > 0)
print_white_space ();
@@ -2306,7 +2439,7 @@ print_clump (COLUMN *p, int n, char *clu
@@ -2306,7 +2444,7 @@ print_clump (COLUMN *p, int n, char *clu
required number of tabs and spaces. */
static void
@ -2121,7 +2160,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
{
if (tabify_output)
{
@@ -2330,6 +2463,74 @@ print_char (char c)
@@ -2330,6 +2468,74 @@ print_char (char c)
putchar (c);
}
@ -2196,7 +2235,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
/* Skip to page PAGE before printing.
PAGE may be larger than total number of pages. */
@@ -2509,9 +2710,9 @@ read_line (COLUMN *p)
@@ -2509,9 +2715,9 @@ read_line (COLUMN *p)
align_empty_cols = false;
}
@ -2208,7 +2247,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
padding_not_printed = ANYWHERE;
}
@@ -2612,9 +2813,9 @@ print_stored (COLUMN *p)
@@ -2612,9 +2818,9 @@ print_stored (COLUMN *p)
}
}
@ -2220,7 +2259,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
padding_not_printed = ANYWHERE;
}
@@ -2627,8 +2828,8 @@ print_stored (COLUMN *p)
@@ -2627,8 +2833,8 @@ print_stored (COLUMN *p)
if (spaces_not_printed == 0)
{
output_position = p->start_position + end_vector[line];
@ -2231,7 +2270,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
}
return true;
@@ -2647,7 +2848,7 @@ print_stored (COLUMN *p)
@@ -2647,7 +2853,7 @@ print_stored (COLUMN *p)
number of characters is 1.) */
static int
@ -2240,7 +2279,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
{
unsigned char uc = c;
char *s = clump_buff;
@@ -2657,10 +2858,10 @@ char_to_clump (char c)
@@ -2657,10 +2863,10 @@ char_to_clump (char c)
int chars;
int chars_per_c = 8;
@ -2253,7 +2292,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
{
width = TAB_WIDTH (chars_per_c, input_position);
@@ -2741,6 +2942,154 @@ char_to_clump (char c)
@@ -2741,6 +2947,154 @@ char_to_clump (char c)
return chars;
}
@ -2298,7 +2337,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
+ width = +4;
+ chars = +4;
+ *s++ = '\\';
+ sprintf (esc_buff, "%03o", mbc[0]);
+ sprintf (esc_buff, "%03o", (unsigned char) mbc[0]);
+ for (i = 0; i <= 2; ++i)
+ *s++ = (int) esc_buff[i];
+ }
@ -2347,7 +2386,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
+ width += 4;
+ chars += 4;
+ *s++ = '\\';
+ sprintf (esc_buff, "%03o", c);
+ sprintf (esc_buff, "%03o", (unsigned char) mbc[i]);
+ for (j = 0; j <= 2; ++j)
+ *s++ = (int) esc_buff[j];
+ }
@ -2368,7 +2407,7 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
+ width += 4;
+ chars += 4;
+ *s++ = '\\';
+ sprintf (esc_buff, "%03o", c);
+ sprintf (esc_buff, "%03o", (unsigned char) mbc[i]);
+ for (j = 0; j <= 2; ++j)
+ *s++ = (int) esc_buff[j];
+ }
@ -2408,9 +2447,9 @@ diff -urNp coreutils-8.10-orig/src/pr.c coreutils-8.10/src/pr.c
/* We've just printed some files and need to clean up things before
looking for more options and printing the next batch of files.
diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
--- coreutils-8.10-orig/src/sort.c 2011-02-03 11:24:35.000000000 +0100
+++ coreutils-8.10/src/sort.c 2011-02-04 20:15:44.160384535 +0100
diff -urNp coreutils-8.12-orig/src/sort.c coreutils-8.12/src/sort.c
--- coreutils-8.12-orig/src/sort.c 2011-04-25 11:45:49.000000000 +0200
+++ coreutils-8.12/src/sort.c 2012-03-26 10:12:38.009431063 +0200
@@ -22,11 +22,20 @@
#include <config.h>
@ -2432,7 +2471,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
#include "system.h"
#include "argmatch.h"
#include "error.h"
@@ -163,12 +172,34 @@ static int thousands_sep;
@@ -167,12 +176,34 @@ static int thousands_sep;
/* Nonzero if the corresponding locales are hard. */
static bool hard_LC_COLLATE;
@ -2468,7 +2507,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
/* The kind of blanks for '-b' to skip in various options. */
enum blanktype { bl_start, bl_end, bl_both };
@@ -335,13 +366,11 @@ static bool reverse;
@@ -343,13 +374,11 @@ static bool reverse;
they were read if all keys compare equal. */
static bool stable;
@ -2485,7 +2524,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
/* Flag to remove consecutive duplicate lines from the output.
Only the last of a sequence of equal lines will be output. */
@@ -775,6 +804,46 @@ reap_all (void)
@@ -783,6 +812,46 @@ reap_all (void)
reap (-1);
}
@ -2532,7 +2571,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
/* Clean up any remaining temporary files. */
static void
@@ -1207,7 +1276,7 @@ zaptemp (char const *name)
@@ -1215,7 +1284,7 @@ zaptemp (char const *name)
free (node);
}
@ -2541,7 +2580,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
static int
struct_month_cmp (void const *m1, void const *m2)
@@ -1222,7 +1291,7 @@ struct_month_cmp (void const *m1, void c
@@ -1230,7 +1299,7 @@ struct_month_cmp (void const *m1, void c
/* Initialize the character class tables. */
static void
@ -2550,7 +2589,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
{
size_t i;
@@ -1234,7 +1303,7 @@ inittables (void)
@@ -1242,7 +1311,7 @@ inittables (void)
fold_toupper[i] = toupper (i);
}
@ -2559,7 +2598,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
/* If we're not in the "C" locale, read different names for months. */
if (hard_LC_TIME)
{
@@ -1316,6 +1385,84 @@ specify_nmerge (int oi, char c, char con
@@ -1324,6 +1393,84 @@ specify_nmerge (int oi, char c, char con
xstrtol_fatal (e, oi, c, long_options, s);
}
@ -2644,7 +2683,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
/* Specify the amount of main memory to use when sorting. */
static void
specify_sort_size (int oi, char c, char const *s)
@@ -1544,7 +1691,7 @@ buffer_linelim (struct buffer const *buf
@@ -1552,7 +1699,7 @@ buffer_linelim (struct buffer const *buf
by KEY in LINE. */
static char *
@ -2653,7 +2692,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t sword = key->sword;
@@ -1553,10 +1700,10 @@ begfield (struct line const *line, struc
@@ -1561,10 +1708,10 @@ begfield (struct line const *line, struc
/* The leading field separator itself is included in a field when -t
is absent. */
@ -2666,7 +2705,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
++ptr;
if (ptr < lim)
++ptr;
@@ -1582,11 +1729,70 @@ begfield (struct line const *line, struc
@@ -1590,11 +1737,70 @@ begfield (struct line const *line, struc
return ptr;
}
@ -2738,7 +2777,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar;
@@ -1601,10 +1807,10 @@ limfield (struct line const *line, struc
@@ -1609,10 +1815,10 @@ limfield (struct line const *line, struc
`beginning' is the first character following the delimiting TAB.
Otherwise, leave PTR pointing at the first `blank' character after
the preceding field. */
@ -2751,7 +2790,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
++ptr;
if (ptr < lim && (eword || echar))
++ptr;
@@ -1650,10 +1856,10 @@ limfield (struct line const *line, struc
@@ -1658,10 +1864,10 @@ limfield (struct line const *line, struc
*/
/* Make LIM point to the end of (one byte past) the current field. */
@ -2764,7 +2803,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
if (newlim)
lim = newlim;
}
@@ -1684,6 +1890,130 @@ limfield (struct line const *line, struc
@@ -1692,6 +1898,130 @@ limfield (struct line const *line, struc
return ptr;
}
@ -2895,7 +2934,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
/* Fill BUF reading from FP, moving buf->left bytes from the end
of buf->buf to the beginning first. If EOF is reached and the
file wasn't terminated by a newline, supply one. Set up BUF's line
@@ -1770,8 +2100,22 @@ fillbuf (struct buffer *buf, FILE *fp, c
@@ -1778,8 +2108,22 @@ fillbuf (struct buffer *buf, FILE *fp, c
else
{
if (key->skipsblanks)
@ -2920,7 +2959,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
line->keybeg = line_start;
}
}
@@ -1892,7 +2236,7 @@ human_numcompare (char const *a, char co
@@ -1900,7 +2244,7 @@ human_numcompare (char const *a, char co
hideously fast. */
static int
@ -2929,7 +2968,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
{
while (blanks[to_uchar (*a)])
a++;
@@ -1902,6 +2246,25 @@ numcompare (char const *a, char const *b
@@ -1910,6 +2254,25 @@ numcompare (char const *a, char const *b
return strnumcmp (a, b, decimal_point, thousands_sep);
}
@ -2955,7 +2994,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
static int
general_numcompare (char const *sa, char const *sb)
{
@@ -1934,7 +2297,7 @@ general_numcompare (char const *sa, char
@@ -1942,7 +2305,7 @@ general_numcompare (char const *sa, char
Return 0 if the name in S is not recognized. */
static int
@ -2964,7 +3003,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
{
size_t lo = 0;
size_t hi = MONTHS_PER_YEAR;
@@ -2209,15 +2572,14 @@ debug_key (struct line const *line, stru
@@ -2217,15 +2580,14 @@ debug_key (struct line const *line, stru
char saved = *lim;
*lim = '\0';
@ -2982,7 +3021,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
else if (key->general_numeric)
ignore_value (strtold (beg, &tighter_lim));
else if (key->numeric || key->human_numeric)
@@ -2361,7 +2723,7 @@ key_warnings (struct keyfield const *gke
@@ -2369,7 +2731,7 @@ key_warnings (struct keyfield const *gke
bool maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key)
&& !(key->schar || key->echar);
bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */
@ -2991,7 +3030,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
&& ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned))
|| (!key->skipsblanks && key->schar)
|| (!key->skipeblanks && key->echar)))
@@ -2419,11 +2781,83 @@ key_warnings (struct keyfield const *gke
@@ -2427,11 +2789,83 @@ key_warnings (struct keyfield const *gke
error (0, 0, _("option `-r' only applies to last-resort comparison"));
}
@ -3057,12 +3096,12 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
+ }
+ while (hi - lo > 1);
+
+ if (ea)
+ *ea = (char *) month;
+
+ result = (!strncmp (month, monthtab[lo].name, strlen (monthtab[lo].name))
+ ? monthtab[lo].val : 0);
+
+ if (ea && result)
+ *ea = s + strlen (monthtab[lo].name);
+
+ return result;
+}
+#endif
@ -3076,7 +3115,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
{
struct keyfield *key = keylist;
@@ -2508,7 +2942,7 @@ keycompare (struct line const *a, struct
@@ -2516,7 +2950,7 @@ keycompare (struct line const *a, struct
else if (key->human_numeric)
diff = human_numcompare (ta, tb);
else if (key->month)
@ -3085,7 +3124,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
else if (key->random)
diff = compare_random (ta, tlena, tb, tlenb);
else if (key->version)
@@ -2624,6 +3058,179 @@ keycompare (struct line const *a, struct
@@ -2632,6 +3066,180 @@ keycompare (struct line const *a, struct
return key->reverse ? -diff : diff;
}
@ -3167,7 +3206,8 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
+ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \
+ STATE = state_bak; \
+ if (!ignore) \
+ COPY[NEW_LEN++] = TEXT[i++]; \
+ COPY[NEW_LEN++] = TEXT[i]; \
+ i++; \
+ continue; \
+ } \
+ \
@ -3265,7 +3305,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
/* Compare two lines A and B, returning negative, zero, or positive
depending on whether A compares less than, equal to, or greater than B. */
@@ -4087,7 +4694,7 @@ main (int argc, char **argv)
@@ -4095,7 +4703,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE);
@ -3274,7 +3314,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
hard_LC_TIME = hard_locale (LC_TIME);
#endif
@@ -4108,6 +4715,29 @@ main (int argc, char **argv)
@@ -4116,6 +4724,29 @@ main (int argc, char **argv)
thousands_sep = -1;
}
@ -3304,7 +3344,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
have_read_stdin = false;
inittables ();
@@ -4378,13 +5008,34 @@ main (int argc, char **argv)
@@ -4386,13 +5017,34 @@ main (int argc, char **argv)
case 't':
{
@ -3343,7 +3383,7 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
else
{
/* Provoke with `sort -txx'. Complain about
@@ -4395,9 +5046,12 @@ main (int argc, char **argv)
@@ -4403,9 +5055,12 @@ main (int argc, char **argv)
quote (optarg));
}
}
@ -3358,9 +3398,9 @@ diff -urNp coreutils-8.10-orig/src/sort.c coreutils-8.10/src/sort.c
}
break;
diff -urNp coreutils-8.10-orig/src/unexpand.c coreutils-8.10/src/unexpand.c
--- coreutils-8.10-orig/src/unexpand.c 2011-01-31 13:40:38.000000000 +0100
+++ coreutils-8.10/src/unexpand.c 2011-02-04 20:13:24.015458014 +0100
diff -urNp coreutils-8.12-orig/src/unexpand.c coreutils-8.12/src/unexpand.c
--- coreutils-8.12-orig/src/unexpand.c 2011-02-19 18:17:03.000000000 +0100
+++ coreutils-8.12/src/unexpand.c 2012-03-26 10:10:44.401556558 +0200
@@ -39,12 +39,29 @@
#include <stdio.h>
#include <getopt.h>
@ -3614,9 +3654,9 @@ diff -urNp coreutils-8.10-orig/src/unexpand.c coreutils-8.10/src/unexpand.c
if (have_read_stdin && fclose (stdin) != 0)
error (EXIT_FAILURE, errno, "-");
diff -urNp coreutils-8.10-orig/src/uniq.c coreutils-8.10/src/uniq.c
--- coreutils-8.10-orig/src/uniq.c 2011-01-31 13:40:38.000000000 +0100
+++ coreutils-8.10/src/uniq.c 2011-02-04 20:13:24.018457349 +0100
diff -urNp coreutils-8.12-orig/src/uniq.c coreutils-8.12/src/uniq.c
--- coreutils-8.12-orig/src/uniq.c 2011-04-25 11:45:49.000000000 +0200
+++ coreutils-8.12/src/uniq.c 2012-03-26 10:10:44.403559433 +0200
@@ -21,6 +21,16 @@
#include <getopt.h>
#include <sys/types.h>
@ -3671,7 +3711,7 @@ diff -urNp coreutils-8.10-orig/src/uniq.c coreutils-8.10/src/uniq.c
static char *
-find_field (struct linebuffer const *line)
+find_field_uni (struct linebuffer *line)
+find_field_uni (struct linebuffer const *line)
{
size_t count;
char const *lp = line->buffer;
@ -3725,7 +3765,7 @@ diff -urNp coreutils-8.10-orig/src/uniq.c coreutils-8.10/src/uniq.c
+ while (pos < size)
+ {
+ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail);
+
+
+ if (convfail || !iswblank (wc))
+ {
+ pos += mblength;
@ -3952,7 +3992,7 @@ diff -urNp coreutils-8.10-orig/src/uniq.c coreutils-8.10/src/uniq.c
match = !different (thisfield, prevfield, thislen, prevlen);
match_count += match;
@@ -383,6 +612,9 @@ check_file (const char *infile, const ch
@@ -383,6 +611,9 @@ check_file (const char *infile, const ch
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
@ -3962,7 +4002,7 @@ diff -urNp coreutils-8.10-orig/src/uniq.c coreutils-8.10/src/uniq.c
if (!match)
match_count = 0;
}
@@ -428,6 +660,19 @@ main (int argc, char **argv)
@@ -428,6 +659,19 @@ main (int argc, char **argv)
atexit (close_stdout);
@ -3982,10 +4022,10 @@ diff -urNp coreutils-8.10-orig/src/uniq.c coreutils-8.10/src/uniq.c
skip_chars = 0;
skip_fields = 0;
check_chars = SIZE_MAX;
diff -urNp coreutils-8.10-orig/tests/Makefile.am coreutils-8.10/tests/Makefile.am
--- coreutils-8.10-orig/tests/Makefile.am 2011-02-04 20:12:58.236173903 +0100
+++ coreutils-8.10/tests/Makefile.am 2011-02-04 20:13:24.020456905 +0100
@@ -235,6 +235,7 @@ TESTS = \
diff -urNp coreutils-8.12-orig/tests/Makefile.am coreutils-8.12/tests/Makefile.am
--- coreutils-8.12-orig/tests/Makefile.am 2012-03-26 10:10:12.786431587 +0200
+++ coreutils-8.12/tests/Makefile.am 2012-03-26 10:10:44.404540015 +0200
@@ -236,6 +236,7 @@ TESTS = \
misc/sort-debug-keys \
misc/sort-debug-warn \
misc/sort-files0-from \
@ -3993,7 +4033,7 @@ diff -urNp coreutils-8.10-orig/tests/Makefile.am coreutils-8.10/tests/Makefile.a
misc/sort-float \
misc/sort-merge \
misc/sort-merge-fdlimit \
@@ -505,6 +506,10 @@ TESTS = \
@@ -511,6 +512,10 @@ TESTS = \
$(root_tests)
pr_data = \
@ -4004,9 +4044,9 @@ diff -urNp coreutils-8.10-orig/tests/Makefile.am coreutils-8.10/tests/Makefile.a
pr/0F \
pr/0FF \
pr/0FFnt \
diff -urNp coreutils-8.10-orig/tests/misc/cut coreutils-8.10/tests/misc/cut
--- coreutils-8.10-orig/tests/misc/cut 2011-01-31 13:40:38.000000000 +0100
+++ coreutils-8.10/tests/misc/cut 2011-02-04 20:13:24.021456684 +0100
diff -urNp coreutils-8.12-orig/tests/misc/cut coreutils-8.12/tests/misc/cut
--- coreutils-8.12-orig/tests/misc/cut 2011-02-07 09:25:51.000000000 +0100
+++ coreutils-8.12/tests/misc/cut 2012-03-26 10:10:44.405558576 +0200
@@ -26,7 +26,7 @@ use strict;
my $prog = 'cut';
my $try = "Try \`$prog --help' for more information.\n";
@ -4025,41 +4065,41 @@ diff -urNp coreutils-8.10-orig/tests/misc/cut coreutils-8.10/tests/misc/cut
['inval2', qw(-f -), {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
['inval3', '-f', '4,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
['inval4', '-f', '1-2,-', {IN=>''}, {OUT=>''}, {EXIT=>1},
diff -urNp coreutils-8.10-orig/tests/misc/mb1.I coreutils-8.10/tests/misc/mb1.I
--- coreutils-8.10-orig/tests/misc/mb1.I 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.10/tests/misc/mb1.I 2011-02-04 20:13:24.022456462 +0100
diff -urNp coreutils-8.12-orig/tests/misc/mb1.I coreutils-8.12/tests/misc/mb1.I
--- coreutils-8.12-orig/tests/misc/mb1.I 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.12/tests/misc/mb1.I 2012-03-26 10:10:44.406556899 +0200
@@ -0,0 +1,4 @@
+Apple10
+Banana5
+Citrus20
+Cherry30
diff -urNp coreutils-8.10-orig/tests/misc/mb1.X coreutils-8.10/tests/misc/mb1.X
--- coreutils-8.10-orig/tests/misc/mb1.X 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.10/tests/misc/mb1.X 2011-02-04 20:13:24.023456240 +0100
diff -urNp coreutils-8.12-orig/tests/misc/mb1.X coreutils-8.12/tests/misc/mb1.X
--- coreutils-8.12-orig/tests/misc/mb1.X 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.12/tests/misc/mb1.X 2012-03-26 10:10:44.406556899 +0200
@@ -0,0 +1,4 @@
+Banana5
+Apple10
+Citrus20
+Cherry30
diff -urNp coreutils-8.10-orig/tests/misc/mb2.I coreutils-8.10/tests/misc/mb2.I
--- coreutils-8.10-orig/tests/misc/mb2.I 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.10/tests/misc/mb2.I 2011-02-04 20:13:24.024456019 +0100
diff -urNp coreutils-8.12-orig/tests/misc/mb2.I coreutils-8.12/tests/misc/mb2.I
--- coreutils-8.12-orig/tests/misc/mb2.I 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.12/tests/misc/mb2.I 2012-03-26 10:10:44.407556588 +0200
@@ -0,0 +1,4 @@
+Apple1020
+Banana530
+Citrus205
+Cherry3010
diff -urNp coreutils-8.10-orig/tests/misc/mb2.X coreutils-8.10/tests/misc/mb2.X
--- coreutils-8.10-orig/tests/misc/mb2.X 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.10/tests/misc/mb2.X 2011-02-04 20:13:24.024456019 +0100
diff -urNp coreutils-8.12-orig/tests/misc/mb2.X coreutils-8.12/tests/misc/mb2.X
--- coreutils-8.12-orig/tests/misc/mb2.X 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.12/tests/misc/mb2.X 2012-03-26 10:10:44.407556588 +0200
@@ -0,0 +1,4 @@
+Citrus205
+Cherry3010
+Apple1020
+Banana530
diff -urNp coreutils-8.10-orig/tests/misc/sort-mb-tests coreutils-8.10/tests/misc/sort-mb-tests
--- coreutils-8.10-orig/tests/misc/sort-mb-tests 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.10/tests/misc/sort-mb-tests 2011-02-04 20:13:24.025455797 +0100
diff -urNp coreutils-8.12-orig/tests/misc/sort-mb-tests coreutils-8.12/tests/misc/sort-mb-tests
--- coreutils-8.12-orig/tests/misc/sort-mb-tests 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.12/tests/misc/sort-mb-tests 2012-03-26 10:10:44.408558435 +0200
@@ -0,0 +1,58 @@
+#! /bin/sh
+case $# in
@ -4079,7 +4119,7 @@ diff -urNp coreutils-8.10-orig/tests/misc/sort-mb-tests coreutils-8.10/tests/mis
+$xx -t -k2 -n misc/mb1.I > misc/mb1.O
+code=$?
+if test $code != 0; then
+ $echo "Test mb1 failed: $xx return code $code differs from expected value 0" 1>&2
+ $echo "Test mb1 failed: $xx return code $code differs from expected value 0"
+ errors=`expr $errors + 1`
+else
+ cmp misc/mb1.O $srcdir/misc/mb1.X > /dev/null 2>&1

View File

@ -4,7 +4,7 @@ auth sufficient pam_rootok.so
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth required pam_wheel.so use_uid
auth include system-auth
auth substack system-auth
auth include postlogin
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.12
Release: 2%{?dist}
Release: 9%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -18,6 +18,9 @@ Source202: coreutils-su-l.pamd
Source203: coreutils-runuser-l.pamd
# From upstream
Patch1: coreutils-8.12-chown.patch
Patch2: coreutils-8.17-cp-freememoryread.patch
Patch3: coreutils-8.17-df-duplicates.patch
# Our patches
#general patch to workaround koji build system issues
@ -32,6 +35,8 @@ Patch103: coreutils-8.2-uname-processortype.patch
Patch104: coreutils-df-direct.patch
#add note about mkdir --mode behaviour into info documentation(#610559)
Patch107: coreutils-8.4-mkdir-modenote.patch
#use acl_extended_file_nofollow if available (#692823)
Patch108: coreutils-acl-extended-file-nofollow.patch
# sh-utils
#add info about TZ envvar to date manpage
@ -57,6 +62,9 @@ Patch908: coreutils-getgrouplist.patch
Patch912: coreutils-overflow.patch
#compile su with pie flag and RELRO protection
Patch917: coreutils-8.4-su-pie.patch
#fix rshowing ls ACLs with acl_extended_file_nofollow
Patch918: coreutils-8.12-lssymlinkacl.patch
#SELINUX Patch - implements Redhat changes
#(upstream did some SELinux implementation unlike with RedHat patch)
@ -80,7 +88,7 @@ Requires(pre): /sbin/install-info
Requires(preun): /sbin/install-info
Requires(post): /sbin/install-info
Requires(post): grep
%{?!nopam:Requires: pam }
%{?!nopam:Requires: pam >= 1.1.3-7}
Requires: ncurses
Requires: gmp
Requires: %{name}-libs = %{version}-%{release}
@ -91,6 +99,7 @@ Provides: stat = %{version}-%{release}
Provides: textutils = %{version}-%{release}
#old mktemp package had epoch 3, so we have to use 4 for coreutils
Provides: mktemp = 4:%{version}-%{release}
Provides: bundled(gnulib)
Obsoletes: mktemp < 4:%{version}-%{release}
Obsoletes: fileutils <= 4.1.9
Obsoletes: sh-utils <= 2.0.12
@ -113,6 +122,9 @@ Libraries for coreutils package.
%setup -q
# From upstream
%patch1 -p1 -b .chown
%patch2 -p1 -b .cpfmr
%patch3 -p1 -b .duplic
# Our patches
%patch100 -p1 -b .configure
@ -121,6 +133,7 @@ Libraries for coreutils package.
%patch103 -p1 -b .sysinfo
%patch104 -p1 -b .dfdirect
%patch107 -p1 -b .mkdirmode
%patch108 -p1 -b .nofollow
# sh-utils
%patch703 -p1 -b .dateman
@ -142,7 +155,10 @@ Libraries for coreutils package.
%patch950 -p1 -b .selinux
%patch951 -p1 -b .selinuxman
chmod a+x tests/misc/sort-mb-tests tests/df/direct || :
#later applied
%patch918 -p1 -b .aclsymlink
chmod a+x tests/misc/sort-mb-tests tests/df/direct tests/chown/basic || :
#fix typos/mistakes in localized documentation(#439410, #440056)
find ./po/ -name "*.p*" | xargs \
@ -326,9 +342,45 @@ fi
%files libs
%defattr(-, root, root, -)
%{_libdir}/coreutils
%{_libexecdir}/coreutils
%changelog
* Wed Dec 12 2012 Ondrej Vasik <ovasik@redhat.com> - 8.12-9
- fix showing duplicates in df (#709351, O.Oprala, B.Voelker)
- df: work around long-named /dev/disk/by-uuid/... symlinks
* Mon Nov 05 2012 Ondrej Vasik <ovasik@redhat.com> - 8.12-8
- fix support for ecryptfs mount of "Private" in su (#722323)
- cp: avoid data-corrupting free-memory-read (upstream fix)
- multibyte fixes in cut and expand (by M.Briza, #821260)
- fix the tcsh colorls.csh behaviour in non-interactive
mode (#804604)
- add virtual provides for bundled(gnulib) copylib (#821748)
* Mon Mar 26 2012 Ondrej Vasik <ovasik@redhat.com> - 8.12-7
- fix sort segfault with multibyte locales (by P.Brady)
- fix showing ACLs in ls (#805398, caused by #692823 fix)
* Mon Jan 30 2012 Kamil Dudka <kdudka@redhat.com> - 8.12-6
- do not use shebang in sourced colorls.csh
- su: fix shell suspend in tcsh (#597928)
- variable "u" should be static in uname processor type patch
- various multibyte patch fixes:
- fix cut output-delimiter option
- prevent infinite loop in sort when ignoring chars
- prevent using unitialized variable in cut
- fix pr -c and pr -v segfault with multibyte locales
- fix stack smashing, buffer overflow and invalid output of pr (#772172)
* Sun Jan 29 2012 Kamil Dudka <kdudka@redhat.com> - 8.12-5
- output the correct ownership in chown -v (upstream bug #10636)
* Mon Oct 24 2011 Ondrej Vasik <ovasik@redhat.com> - 8.12-4
- require at least pam >= 1.1.3-7 (#748215)
* Fri Jul 29 2011 Ondrej Vasik <ovasik@redhat.com> - 8.12-3
- use acl_extended_file_nofollow() if available (#692823)
* Fri Jul 15 2011 Ondrej Vasik <ovasik@redhat.com> - 8.12-2
- support ecryptfs mount of Private (postlogin into su.pamd)
(#722323)
@ -367,7 +419,7 @@ fi
- new upstream release coreutils-8.10
* Sat Jan 08 2011 Dennis Gilmore <dennis@ausil.us> - 8.9-2
- drop no longer needed mkstemp patch for sparc
- drop no longer needed mkstemp patch for sparc
* Tue Jan 04 2011 Ondrej Vasik <ovasik@redhat.com> - 8.9-1
- new upstream release coreutils-8.9