Compare commits

...

10 Commits
rawhide ... f17

Author SHA1 Message Date
Ondřej Vašík 00aaa7359d release++ :) 2013-01-30 16:38:31 +01:00
Ondřej Vašík 7491020ff9 fix multiple segmantation faults in i18n patch (by SUSE) (#869442, #902917)- CVE2013-0223/CVE2013-0221/CVE2013-0222 2013-01-30 16:38:00 +01:00
Ondřej Vašík d1f444bc8f fix showing duplicates in df (#709351, O.Oprala, B.Voelker) 2012-12-12 12:17:01 +01:00
Ondřej Vašík ccb0912e0f fix possible free memory read and dataloss in sort -u (upstream fix) 2012-11-05 14:09:06 +01:00
Ondřej Vašík f5df66531d cp: avoid data-corrupting free-memory-read (upstream fix) 2012-11-05 14:03:54 +01:00
Ondřej Vašík ebd00e34aa multibyte fix in cut 2012-11-05 14:02:51 +01:00
Ondřej Vašík 48e9badb85 multibyte fixes in cut and expand (by M.Briza, #821260) 2012-11-05 14:00:26 +01:00
Ondřej Vašík 3758df913e fix support for ecryptfs mount of Private in su (#722323) 2012-11-05 13:54:24 +01:00
Ondřej Vašík c5c5fb3d96 release++ 2012-07-13 13:46:45 +02:00
Ondřej Vašík b626b61fa3 cumulative update for F17 - various fixes 2012-07-13 13:45:52 +02:00
12 changed files with 685 additions and 126 deletions

View File

@ -0,0 +1,103 @@
From 3d53e7fe1c31aa440cc9708c7c51db6b78c07653 Mon Sep 17 00:00:00 2001
From: =?utf8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Thu, 12 Apr 2012 12:47:30 +0100
Subject: [PATCH 1/1] cp: change --attributes-only to not truncate existing files
* src/copy.c (copy_reg): Don't truncate an existing file,
to support copying attributes between existing files.
The original use case only considered creating new files,
and it would be a very unusual use case to be relying
on the truncating behavior.
* doc/coreutils.texi (cp invocation): Mention the non
truncating behavior.
* tests/cp/attr-existing: A new test to ensure O_TRUNC skipped.
* tests/Makefile.am: Reference the new test.
---
doc/coreutils.texi | 6 +++---
src/copy.c | 4 +++-
tests/Makefile.am | 1 +
tests/cp/attr-existing | 29 +++++++++++++++++++++++++++++
4 files changed, 36 insertions(+), 4 deletions(-)
create mode 100755 tests/cp/attr-existing
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 510abb9..1fbf051 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7649,9 +7649,9 @@ Equivalent to @option{-dR --preserve=all} with the reduced diagnostics.
@itemx --attributes-only
@opindex --attributes-only
-Preserve the specified attributes of the original files in the copy,
-but do not copy any data. See the @option{--preserve} option for
-controlling which attributes to copy.
+Copy only the specified attributes of the source file to the destination.
+If the destination already exists, do not alter its contents.
+See the @option{--preserve} option for controlling which attributes to copy.
@item -b
@itemx @w{@kbd{--backup}[=@var{method}]}
diff --git a/src/copy.c b/src/copy.c
index f63a726..414fbe0 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -826,7 +826,9 @@ copy_reg (char const *src_name, char const *dst_name,
by the specs for both cp and mv. */
if (! *new_dst)
{
- dest_desc = open (dst_name, O_WRONLY | O_TRUNC | O_BINARY);
+ int open_flags =
+ O_WRONLY | O_BINARY | (x->data_copy_required ? O_TRUNC : 0);
+ dest_desc = open (dst_name, open_flags);
dest_errno = errno;
/* When using cp --preserve=context to copy to an existing destination,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 011051a..4d73a92 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -320,6 +320,7 @@ TESTS = \
chown/separator \
cp/abuse \
cp/acl \
+ cp/attr-existing \
cp/backup-1 \
cp/backup-dir \
cp/backup-is-src \
diff --git a/tests/cp/attr-existing b/tests/cp/attr-existing
new file mode 100755
index 0000000..9cf0ffc
--- /dev/null
+++ b/tests/cp/attr-existing
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Make sure cp --attributes-only doesn't truncate existing data
+
+# Copyright 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_ cp
+
+printf '1' > file1
+printf '2' > file2
+printf '2' > file2.exp
+
+cp --attributes-only file1 file2 || fail=1
+cmp file2 file2.exp || fail=1
+
+Exit $fail
--
1.7.2.5

View File

@ -0,0 +1,43 @@
diff --git a/src/du.c b/src/du.c
index e4e36df..41c9535 100644
--- a/src/du.c
+++ b/src/du.c
@@ -443,7 +443,14 @@ process_file (FTS *fts, FTSENT *ent)
return false;
}
- if (fts->fts_options & FTS_XDEV && fts->fts_dev != sb->st_dev)
+ /* The --one-file-system (-x) option cannot exclude anything
+ specified on the command-line. By definition, it can exclude
+ a file or directory only when its device number is different
+ from that of its just-processed parent directory, and du does
+ not process the parent of a command-line argument. */
+ if (fts->fts_options & FTS_XDEV
+ && FTS_ROOTLEVEL < ent->fts_level
+ && fts->fts_dev != sb->st_dev)
excluded = true;
}
diff --git a/tests/du/one-file-system b/tests/du/one-file-system
index f0d264a..110080f 100755
--- a/tests/du/one-file-system
+++ b/tests/du/one-file-system
@@ -43,7 +43,15 @@ compare exp out || fail=1
du -xL d > u || fail=1
sed 's/^[0-9][0-9]* //' u > out1
echo d > exp1 || fail=1
-
compare exp1 out1 || fail=1
+# With coreutils-8.15, "du -xs FILE" would print no output.
+touch f
+for opt in -x -xs; do
+ du $opt f > u || fail=1
+ sed 's/^[0-9][0-9]* //' u > out2
+ echo f > exp2 || fail=1
+ compare exp2 out2 || fail=1
+done
+
Exit $fail
--
cgit v0.9.0.2

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,264 @@
diff -urNp coreutils-8.17-orig/doc/coreutils.texi coreutils-8.17/doc/coreutils.texi
--- coreutils-8.17-orig/doc/coreutils.texi 2012-05-10 09:14:30.000000000 +0200
+++ coreutils-8.17/doc/coreutils.texi 2012-12-11 11:30:38.730760947 +0100
@@ -10561,6 +10561,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.17-orig/src/df.c coreutils-8.17/src/df.c
--- coreutils-8.17-orig/src/df.c 2012-05-01 22:55:08.000000000 +0200
+++ coreutils-8.17/src/df.c 2012-12-11 11:30:38.803069545 +0100
@@ -46,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;
@@ -57,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;
@@ -350,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
@@ -474,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,
@@ -972,6 +1021,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. */
@@ -1105,6 +1155,14 @@ main (int argc, char **argv)
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.17-orig/tests/df/skip-duplicates coreutils-8.17/tests/df/skip-duplicates
--- coreutils-8.17-orig/tests/df/skip-duplicates 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.17/tests/df/skip-duplicates 2012-12-11 11:30:38.820762450 +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.17-orig/tests/df/skip-rootfs coreutils-8.17/tests/df/skip-rootfs
--- coreutils-8.17-orig/tests/df/skip-rootfs 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.17/tests/df/skip-rootfs 2012-12-11 11:30:38.821762595 +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.17-orig/tests/Makefile.am coreutils-8.17/tests/Makefile.am
--- coreutils-8.17-orig/tests/Makefile.am 2012-05-10 16:36:42.000000000 +0200
+++ coreutils-8.17/tests/Makefile.am 2012-12-11 11:32:23.021760237 +0100
@@ -373,6 +373,8 @@ TESTS = \
cp/symlink-slash \
cp/thru-dangling \
df/unreadable \
+ df/skip-duplicates \
+ df/skip-rootfs \
dd/direct \
dd/misc \
dd/nocache \

View File

@ -0,0 +1,51 @@
diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
--- coreutils-8.17-orig/src/sort.c 2012-08-20 13:15:39.703470009 +0200
+++ coreutils-8.17/src/sort.c 2012-08-20 13:29:47.177468563 +0200
@@ -292,6 +292,9 @@ struct merge_node_queue
when popping. */
};
+/* Used to implement --unique (-u). */
+static struct line saved_line;
+
/* FIXME: None of these tables work with multibyte character sets.
Also, there are many other bugs when handling multibyte characters.
One way to fix this is to rewrite `sort' to use wide characters
@@ -3943,13 +3946,12 @@ queue_pop (struct merge_node_queue *queu
static void
write_unique (struct line const *line, FILE *tfp, char const *temp_output)
{
- static struct line saved;
if (unique)
{
- if (saved.text && ! compare (line, &saved))
+ if (saved_line.text && ! compare (line, &saved_line))
return;
- saved = *line;
+ saved_line = *line;
}
write_line (line, tfp, temp_output);
@@ -4451,6 +4453,7 @@ sort (char *const *files, size_t nfiles,
break;
}
+ saved_line.text = NULL;
line = buffer_linelim (&buf);
if (buf.eof && !nfiles && !ntemps && !buf.left)
{
diff -urNp coreutils-8.17-orig/tests/misc/sort coreutils-8.17/tests/misc/sort
--- coreutils-8.17-orig/tests/misc/sort 2012-02-03 10:22:06.000000000 +0100
+++ coreutils-8.17/tests/misc/sort 2012-08-20 13:31:38.685565488 +0200
@@ -226,6 +226,10 @@ my @Tests =
["15c", '-i -u', {IN=>"a\1\na\n"}, {OUT=>"a\1\n"}],
["15d", '-i -u', {IN=>"\1a\na\n"}, {OUT=>"\1a\n"}],
["15e", '-i -u', {IN=>"a\n\1\1\1\1\1a\1\1\1\1\n"}, {OUT=>"a\n"}],
+# Before 8.19, this would trigger a free-memory read.
+["unique-free-mem-read", '-u --p=1 -S32b',
+ {IN=>"a\n"."b"x900 ."\n"},
+ {OUT=>"a\n"."b"x900 ."\n"}],
# From Erick Branderhorst -- fixed around 1.19e
["16a", '-f',

View File

@ -240,5 +240,7 @@ EXEC 01;32
.xml 00;33
.epub 00;33
.abw 00;33
.htm 00;33
.html 00;33
.shtml 00;33
.wpd 00;33

View File

@ -213,5 +213,7 @@ EXEC 38;5;34
.xml 00;33
.epub 00;33
.abw 00;33
.htm 00;33
.html 00;33
.shtml 00;33
.wpd 00;33

View File

@ -216,5 +216,7 @@ EXEC 00;32
.xml 00;33
.epub 00;33
.abw 00;33
.htm 00;33
.html 00;33
.shtml 00;33
.wpd 00;33

View File

@ -14,10 +14,10 @@ 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

View File

@ -1,6 +1,6 @@
diff -urNp coreutils-8.13-orig/lib/linebuffer.h coreutils-8.13/lib/linebuffer.h
--- coreutils-8.13-orig/lib/linebuffer.h 2011-04-24 19:21:45.000000000 +0200
+++ coreutils-8.13/lib/linebuffer.h 2011-09-09 10:23:14.163704760 +0200
diff -urNp coreutils-8.15-orig/lib/linebuffer.h coreutils-8.15/lib/linebuffer.h
--- coreutils-8.15-orig/lib/linebuffer.h 2012-01-06 10:14:31.000000000 +0100
+++ coreutils-8.15/lib/linebuffer.h 2013-01-30 13:40:37.339145671 +0100
@@ -21,6 +21,11 @@
# include <stdio.h>
@ -23,9 +23,9 @@ diff -urNp coreutils-8.13-orig/lib/linebuffer.h coreutils-8.13/lib/linebuffer.h
};
/* Initialize linebuffer LINEBUFFER for use. */
diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c
--- coreutils-8.13-orig/src/cut.c 2011-07-28 12:38:27.000000000 +0200
+++ coreutils-8.13/src/cut.c 2011-09-09 10:23:14.165701039 +0200
diff -urNp coreutils-8.15-orig/src/cut.c coreutils-8.15/src/cut.c
--- coreutils-8.15-orig/src/cut.c 2012-01-01 10:04:06.000000000 +0100
+++ coreutils-8.15/src/cut.c 2013-01-30 13:40:37.341145459 +0100
@@ -28,6 +28,11 @@
#include <assert.h>
#include <getopt.h>
@ -304,7 +304,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c
/* Read from stream STREAM, printing to standard output any selected fields. */
static void
@@ -704,13 +843,195 @@ cut_fields (FILE *stream)
@@ -704,13 +857,195 @@ cut_fields (FILE *stream)
}
}
@ -376,7 +376,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/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
@ -503,7 +503,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c
}
/* Process file FILE to standard output.
@@ -762,6 +1080,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);
@ -512,7 +512,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -784,7 +1104,6 @@ main (int argc, char **argv)
@@ -784,7 +1121,6 @@ main (int argc, char **argv)
switch (optc)
{
case 'b':
@ -520,7 +520,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c
/* Build the byte list. */
if (operating_mode != undefined_mode)
FATAL_ERROR (_("only one type of list may be specified"));
@@ -792,6 +1111,14 @@ main (int argc, char **argv)
@@ -792,6 +1128,14 @@ main (int argc, char **argv)
spec_list_string = optarg;
break;
@ -535,7 +535,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c
case 'f':
/* Build the field list. */
if (operating_mode != undefined_mode)
@@ -803,10 +1130,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.' */
@ -575,7 +575,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c
break;
case OUTPUT_DELIMITER_OPTION:
@@ -819,6 +1171,7 @@ main (int argc, char **argv)
@@ -819,6 +1188,7 @@ main (int argc, char **argv)
break;
case 'n':
@ -583,7 +583,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c
break;
case 's':
@@ -841,7 +1194,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"));
@ -592,7 +592,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c
FATAL_ERROR (_("an input delimiter may be specified only\
when operating on fields"));
@@ -868,15 +1221,34 @@ main (int argc, char **argv)
@@ -868,15 +1238,34 @@ main (int argc, char **argv)
}
if (!delim_specified)
@ -633,9 +633,9 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c
}
if (optind == argc)
diff -urNp coreutils-8.13-orig/src/expand.c coreutils-8.13/src/expand.c
--- coreutils-8.13-orig/src/expand.c 2011-07-28 12:38:27.000000000 +0200
+++ coreutils-8.13/src/expand.c 2011-09-09 10:23:14.167583399 +0200
diff -urNp coreutils-8.15-orig/src/expand.c coreutils-8.15/src/expand.c
--- coreutils-8.15-orig/src/expand.c 2012-01-01 10:04:06.000000000 +0100
+++ coreutils-8.15/src/expand.c 2013-01-30 13:40:37.343145830 +0100
@@ -38,12 +38,29 @@
#include <stdio.h>
#include <getopt.h>
@ -733,7 +733,7 @@ diff -urNp coreutils-8.13-orig/src/expand.c coreutils-8.13/src/expand.c
+ if (convert)
+ {
+ ++column;
+ if (convert_entire_line == 0)
+ if (convert_entire_line == 0 && !isblank(*bufpos))
+ convert = 0;
+ }
+ putchar (*bufpos);
@ -793,7 +793,7 @@ diff -urNp coreutils-8.13-orig/src/expand.c coreutils-8.13/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;
+ }
+ }
@ -823,9 +823,9 @@ diff -urNp coreutils-8.13-orig/src/expand.c coreutils-8.13/src/expand.c
if (have_read_stdin && fclose (stdin) != 0)
error (EXIT_FAILURE, errno, "-");
diff -urNp coreutils-8.13-orig/src/fold.c coreutils-8.13/src/fold.c
--- coreutils-8.13-orig/src/fold.c 2011-07-28 12:38:27.000000000 +0200
+++ coreutils-8.13/src/fold.c 2011-09-09 10:23:14.169583741 +0200
diff -urNp coreutils-8.15-orig/src/fold.c coreutils-8.15/src/fold.c
--- coreutils-8.15-orig/src/fold.c 2012-01-01 10:04:06.000000000 +0100
+++ coreutils-8.15/src/fold.c 2013-01-30 13:40:37.344145705 +0100
@@ -22,12 +22,34 @@
#include <getopt.h>
#include <sys/types.h>
@ -1223,9 +1223,9 @@ diff -urNp coreutils-8.13-orig/src/fold.c coreutils-8.13/src/fold.c
break;
case 's': /* Break at word boundaries. */
diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
--- coreutils-8.13-orig/src/join.c 2011-08-08 10:16:09.000000000 +0200
+++ coreutils-8.13/src/join.c 2011-09-09 10:23:14.172687087 +0200
diff -urNp coreutils-8.15-orig/src/join.c coreutils-8.15/src/join.c
--- coreutils-8.15-orig/src/join.c 2012-01-01 10:04:06.000000000 +0100
+++ coreutils-8.15/src/join.c 2013-01-30 15:59:19.544250392 +0100
@@ -22,18 +22,32 @@
#include <sys/types.h>
#include <getopt.h>
@ -1444,7 +1444,7 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
static void
freeline (struct line *line)
{
@@ -314,56 +473,115 @@ keycmp (struct line const *line1, struct
@@ -314,56 +473,129 @@ keycmp (struct line const *line1, struct
size_t jf_1, size_t jf_2)
{
/* Start of field to compare in each file. */
@ -1458,6 +1458,7 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
+ size_t len[2]; /* Length of fields to compare. */
int diff;
+ int i, j;
+ int mallocd = 0;
if (jf_1 < line1->nfields)
{
@ -1513,7 +1514,8 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
+
+ for (i = 0; i < 2; i++)
+ {
+ copy[i] = alloca (len[i] + 1);
+ copy[i] = xmalloc (len[i] + 1);
+ mallocd = 1;
+
+ for (j = 0; j < MIN (len[0], len[1]);)
+ {
@ -1553,7 +1555,8 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
+ {
+ for (i = 0; i < 2; i++)
+ {
+ copy[i] = alloca (len[i] + 1);
+ copy[i] = xmalloc (len[i] + 1);
+ mallocd = 1;
+
+ for (j = 0; j < MIN (len[0], len[1]); j++)
+ copy[i][j] = toupper (beg[i][j]);
@ -1569,13 +1572,24 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
- diff = memcmp (beg1, beg2, MIN (len1, len2));
+ copy[0] = (unsigned char *) beg[0];
+ copy[1] = (unsigned char *) beg[1];
}
+ }
+
+ if (hard_LC_COLLATE)
+ return xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]);
+ {
+ diff = xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]);
+
+ if (mallocd)
+ for (i = 0; i < 2; i++)
+ free (copy[i]);
+
+ return diff;
}
+ diff = memcmp (copy[0], copy[1], MIN (len[0], len[1]));
+
+
+ if (mallocd)
+ for (i = 0; i < 2; i++)
+ free (copy[i]);
if (diff)
return diff;
- return len1 < len2 ? -1 : len1 != len2;
@ -1583,7 +1597,7 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
}
/* Check that successive input lines PREV and CURRENT from input file
@@ -455,6 +673,11 @@ get_line (FILE *fp, struct line **linep,
@@ -455,6 +687,11 @@ get_line (FILE *fp, struct line **linep,
}
++line_no[which - 1];
@ -1595,7 +1609,7 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
xfields (line);
if (prevline[which - 1])
@@ -554,21 +777,28 @@ prfield (size_t n, struct line const *li
@@ -554,21 +791,28 @@ prfield (size_t n, struct line const *li
/* Output all the fields in line, other than the join field. */
@ -1627,7 +1641,7 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
prfield (i, line);
}
}
@@ -579,7 +809,6 @@ static void
@@ -579,7 +823,6 @@ static void
prjoin (struct line const *line1, struct line const *line2)
{
const struct outlist *outlist;
@ -1635,7 +1649,7 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
size_t field;
struct line const *line;
@@ -613,7 +842,7 @@ prjoin (struct line const *line1, struct
@@ -613,7 +856,7 @@ prjoin (struct line const *line1, struct
o = o->next;
if (o == NULL)
break;
@ -1644,7 +1658,7 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
}
putchar ('\n');
}
@@ -1091,21 +1320,46 @@ main (int argc, char **argv)
@@ -1091,21 +1334,46 @@ main (int argc, char **argv)
case 't':
{
@ -1670,8 +1684,8 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
+#endif
+ newtablen = 1;
if (! newtab)
+ {
- newtab = '\n'; /* '' => process the whole line. */
+ {
+ newtab = "\n"; /* '' => process the whole line. */
+ }
else if (optarg[1])
@ -1701,9 +1715,9 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c
break;
case NOCHECK_ORDER_OPTION:
diff -urNp coreutils-8.13-orig/src/pr.c coreutils-8.13/src/pr.c
--- coreutils-8.13-orig/src/pr.c 2011-08-30 23:01:40.000000000 +0200
+++ coreutils-8.13/src/pr.c 2011-09-09 10:23:14.177658905 +0200
diff -urNp coreutils-8.15-orig/src/pr.c coreutils-8.15/src/pr.c
--- coreutils-8.15-orig/src/pr.c 2012-01-01 10:04:06.000000000 +0100
+++ coreutils-8.15/src/pr.c 2013-01-30 13:40:37.350146206 +0100
@@ -312,6 +312,32 @@
#include <getopt.h>
@ -2151,7 +2165,7 @@ diff -urNp coreutils-8.13-orig/src/pr.c coreutils-8.13/src/pr.c
/* sep_string ends with some spaces */
if (spaces_not_printed > 0)
print_white_space ();
@@ -2305,7 +2443,7 @@ print_clump (COLUMN *p, int n, char *clump)
@@ -2305,7 +2443,7 @@ print_clump (COLUMN *p, int n, char *clu
required number of tabs and spaces. */
static void
@ -2447,9 +2461,9 @@ diff -urNp coreutils-8.13-orig/src/pr.c coreutils-8.13/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.13-orig/src/sort.c coreutils-8.13/src/sort.c
--- coreutils-8.13-orig/src/sort.c 2011-07-29 10:12:25.000000000 +0200
+++ coreutils-8.13/src/sort.c 2011-09-09 10:23:14.183686800 +0200
diff -urNp coreutils-8.15-orig/src/sort.c coreutils-8.15/src/sort.c
--- coreutils-8.15-orig/src/sort.c 2013-01-30 13:39:59.892046631 +0100
+++ coreutils-8.15/src/sort.c 2013-01-30 15:56:48.675032507 +0100
@@ -22,11 +22,20 @@
#include <config.h>
@ -2507,7 +2521,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
/* The kind of blanks for '-b' to skip in various options. */
enum blanktype { bl_start, bl_end, bl_both };
@@ -343,13 +374,11 @@ static bool reverse;
@@ -346,13 +377,11 @@ static bool reverse;
they were read if all keys compare equal. */
static bool stable;
@ -2524,7 +2538,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
/* Flag to remove consecutive duplicate lines from the output.
Only the last of a sequence of equal lines will be output. */
@@ -783,6 +812,46 @@ reap_all (void)
@@ -786,6 +815,46 @@ reap_all (void)
reap (-1);
}
@ -2571,7 +2585,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
/* Clean up any remaining temporary files. */
static void
@@ -1215,7 +1284,7 @@ zaptemp (char const *name)
@@ -1218,7 +1287,7 @@ zaptemp (char const *name)
free (node);
}
@ -2580,7 +2594,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
static int
struct_month_cmp (void const *m1, void const *m2)
@@ -1230,7 +1299,7 @@ struct_month_cmp (void const *m1, void c
@@ -1233,7 +1302,7 @@ struct_month_cmp (void const *m1, void c
/* Initialize the character class tables. */
static void
@ -2589,7 +2603,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
{
size_t i;
@@ -1242,7 +1311,7 @@ inittables (void)
@@ -1245,7 +1314,7 @@ inittables (void)
fold_toupper[i] = toupper (i);
}
@ -2598,7 +2612,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
/* If we're not in the "C" locale, read different names for months. */
if (hard_LC_TIME)
{
@@ -1324,6 +1393,84 @@ specify_nmerge (int oi, char c, char con
@@ -1327,6 +1396,84 @@ specify_nmerge (int oi, char c, char con
xstrtol_fatal (e, oi, c, long_options, s);
}
@ -2683,7 +2697,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/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)
@@ -1552,7 +1699,7 @@ buffer_linelim (struct buffer const *buf
@@ -1555,7 +1702,7 @@ buffer_linelim (struct buffer const *buf
by KEY in LINE. */
static char *
@ -2692,7 +2706,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t sword = key->sword;
@@ -1561,10 +1708,10 @@ begfield (struct line const *line, struc
@@ -1564,10 +1711,10 @@ begfield (struct line const *line, struc
/* The leading field separator itself is included in a field when -t
is absent. */
@ -2705,7 +2719,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
++ptr;
if (ptr < lim)
++ptr;
@@ -1590,11 +1737,70 @@ begfield (struct line const *line, struc
@@ -1593,11 +1740,70 @@ begfield (struct line const *line, struc
return ptr;
}
@ -2777,7 +2791,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar;
@@ -1609,10 +1815,10 @@ limfield (struct line const *line, struc
@@ -1612,10 +1818,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. */
@ -2790,7 +2804,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
++ptr;
if (ptr < lim && (eword || echar))
++ptr;
@@ -1658,10 +1864,10 @@ limfield (struct line const *line, struc
@@ -1661,10 +1867,10 @@ limfield (struct line const *line, struc
*/
/* Make LIM point to the end of (one byte past) the current field. */
@ -2803,7 +2817,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
if (newlim)
lim = newlim;
}
@@ -1692,6 +1898,130 @@ limfield (struct line const *line, struc
@@ -1695,6 +1901,130 @@ limfield (struct line const *line, struc
return ptr;
}
@ -2934,7 +2948,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/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
@@ -1778,8 +2108,22 @@ fillbuf (struct buffer *buf, FILE *fp, c
@@ -1781,8 +2111,22 @@ fillbuf (struct buffer *buf, FILE *fp, c
else
{
if (key->skipsblanks)
@ -2959,7 +2973,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
line->keybeg = line_start;
}
}
@@ -1900,7 +2244,7 @@ human_numcompare (char const *a, char co
@@ -1903,7 +2247,7 @@ human_numcompare (char const *a, char co
hideously fast. */
static int
@ -2968,7 +2982,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
{
while (blanks[to_uchar (*a)])
a++;
@@ -1910,6 +2254,25 @@ numcompare (char const *a, char const *b
@@ -1913,6 +2257,25 @@ numcompare (char const *a, char const *b
return strnumcmp (a, b, decimal_point, thousands_sep);
}
@ -2994,7 +3008,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
/* Work around a problem whereby the long double value returned by glibc's
strtold ("NaN", ...) contains uninitialized bits: clear all bytes of
A and B before calling strtold. FIXME: remove this function once
@@ -1942,7 +2305,7 @@ general_numcompare (char const *sa, char
@@ -1963,7 +2326,7 @@ general_numcompare (char const *sa, char
Return 0 if the name in S is not recognized. */
static int
@ -3003,7 +3017,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
{
size_t lo = 0;
size_t hi = MONTHS_PER_YEAR;
@@ -2217,15 +2580,14 @@ debug_key (struct line const *line, stru
@@ -2238,15 +2601,14 @@ debug_key (struct line const *line, stru
char saved = *lim;
*lim = '\0';
@ -3021,7 +3035,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
else if (key->general_numeric)
ignore_value (strtold (beg, &tighter_lim));
else if (key->numeric || key->human_numeric)
@@ -2369,7 +2731,7 @@ key_warnings (struct keyfield const *gke
@@ -2390,7 +2752,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 */
@ -3030,7 +3044,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
&& ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned))
|| (!key->skipsblanks && key->schar)
|| (!key->skipeblanks && key->echar)))
@@ -2427,11 +2789,83 @@ key_warnings (struct keyfield const *gke
@@ -2448,11 +2810,87 @@ key_warnings (struct keyfield const *gke
error (0, 0, _("option `-r' only applies to last-resort comparison"));
}
@ -3057,13 +3071,13 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
+ if (len == 0)
+ return 0;
+
+ month = (char *) alloca (len + 1);
+ month = (char *) xmalloc (len + 1);
+
+ tmp = (char *) alloca (len + 1);
+ tmp = (char *) xmalloc (len + 1);
+ memcpy (tmp, s, len);
+ tmp[len] = '\0';
+ pp = (const char **)&tmp;
+ month_wcs = (wchar_t *) alloca ((len + 1) * sizeof (wchar_t));
+ month_wcs = (wchar_t *) xmalloc ((len + 1) * sizeof (wchar_t));
+ memset (&state, '\0', sizeof(mbstate_t));
+
+ wclength = mbsrtowcs (month_wcs, pp, len + 1, &state);
@ -3096,12 +3110,16 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/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);
+
+ free (month);
+ free (tmp);
+ free (month_wcs);
+
+ return result;
+}
+#endif
@ -3115,7 +3133,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
{
struct keyfield *key = keylist;
@@ -2516,7 +2950,7 @@ keycompare (struct line const *a, struct
@@ -2537,7 +2975,7 @@ keycompare (struct line const *a, struct
else if (key->human_numeric)
diff = human_numcompare (ta, tb);
else if (key->month)
@ -3124,7 +3142,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
else if (key->random)
diff = compare_random (ta, tlena, tb, tlenb);
else if (key->version)
@@ -2632,6 +3066,180 @@ keycompare (struct line const *a, struct
@@ -2653,6 +3091,181 @@ keycompare (struct line const *a, struct
return key->reverse ? -diff : diff;
}
@ -3180,7 +3198,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
+ {
+ if (ignore || translate)
+ {
+ char *copy_a = (char *) alloca (lena + 1 + lenb + 1);
+ char *copy_a = (char *) xmalloc (lena + 1 + lenb + 1);
+ char *copy_b = copy_a + lena + 1;
+ size_t new_len_a, new_len_b;
+ size_t i, j;
@ -3256,6 +3274,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
+ IGNORE_CHARS (new_len_b, lenb, textb, copy_b,
+ wc_b, mblength_b, state_b);
+ diff = xmemcoll (copy_a, new_len_a, copy_b, new_len_b);
+ free(copy_a);
+ }
+ else if (lena == 0)
+ diff = - NONZERO (lenb);
@ -3305,7 +3324,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/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. */
@@ -4095,7 +4702,7 @@ main (int argc, char **argv)
@@ -4113,7 +4726,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE);
@ -3314,7 +3333,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
hard_LC_TIME = hard_locale (LC_TIME);
#endif
@@ -4116,6 +4723,29 @@ main (int argc, char **argv)
@@ -4134,6 +4747,29 @@ main (int argc, char **argv)
thousands_sep = -1;
}
@ -3344,7 +3363,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
have_read_stdin = false;
inittables ();
@@ -4386,13 +5016,34 @@ main (int argc, char **argv)
@@ -4404,13 +5040,34 @@ main (int argc, char **argv)
case 't':
{
@ -3383,7 +3402,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
else
{
/* Provoke with `sort -txx'. Complain about
@@ -4403,9 +5054,12 @@ main (int argc, char **argv)
@@ -4421,9 +5078,12 @@ main (int argc, char **argv)
quote (optarg));
}
}
@ -3398,9 +3417,9 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c
}
break;
diff -urNp coreutils-8.13-orig/src/unexpand.c coreutils-8.13/src/unexpand.c
--- coreutils-8.13-orig/src/unexpand.c 2011-07-28 12:38:27.000000000 +0200
+++ coreutils-8.13/src/unexpand.c 2011-09-09 10:23:14.185647633 +0200
diff -urNp coreutils-8.15-orig/src/unexpand.c coreutils-8.15/src/unexpand.c
--- coreutils-8.15-orig/src/unexpand.c 2012-01-01 10:04:06.000000000 +0100
+++ coreutils-8.15/src/unexpand.c 2013-01-30 13:40:37.358398268 +0100
@@ -39,12 +39,29 @@
#include <stdio.h>
#include <getopt.h>
@ -3654,9 +3673,9 @@ diff -urNp coreutils-8.13-orig/src/unexpand.c coreutils-8.13/src/unexpand.c
if (have_read_stdin && fclose (stdin) != 0)
error (EXIT_FAILURE, errno, "-");
diff -urNp coreutils-8.13-orig/src/uniq.c coreutils-8.13/src/uniq.c
--- coreutils-8.13-orig/src/uniq.c 2011-07-28 12:38:27.000000000 +0200
+++ coreutils-8.13/src/uniq.c 2011-09-09 10:24:19.631560964 +0200
diff -urNp coreutils-8.15-orig/src/uniq.c coreutils-8.15/src/uniq.c
--- coreutils-8.15-orig/src/uniq.c 2012-01-01 10:04:06.000000000 +0100
+++ coreutils-8.15/src/uniq.c 2013-01-30 15:54:04.584020982 +0100
@@ -21,6 +21,16 @@
#include <getopt.h>
#include <sys/types.h>
@ -3808,7 +3827,7 @@ diff -urNp coreutils-8.13-orig/src/uniq.c coreutils-8.13/src/uniq.c
if (check_chars < oldlen)
oldlen = check_chars;
if (check_chars < newlen)
@@ -242,14 +347,92 @@ different (char *old, char *new, size_t
@@ -242,14 +347,100 @@ different (char *old, char *new, size_t
if (ignore_case)
{
@ -3816,14 +3835,18 @@ diff -urNp coreutils-8.13-orig/src/uniq.c coreutils-8.13/src/uniq.c
- return oldlen != newlen || memcasecmp (old, new, oldlen);
+ size_t i;
+
+ copy_old = alloca (oldlen + 1);
+ copy_new = alloca (oldlen + 1);
+ copy_old = xmalloc (oldlen + 1);
+ copy_new = xmalloc (oldlen + 1);
+
+ for (i = 0; i < oldlen; i++)
+ {
+ copy_old[i] = toupper (old[i]);
+ copy_new[i] = toupper (new[i]);
+ }
+ bool rc = xmemcoll (copy_old, oldlen, copy_new, newlen);
+ free (copy_old);
+ free (copy_new);
+ return rc;
}
- else if (hard_LC_COLLATE)
- return xmemcoll (old, oldlen, new, newlen) != 0;
@ -3859,7 +3882,7 @@ diff -urNp coreutils-8.13-orig/src/uniq.c coreutils-8.13/src/uniq.c
+
+ for (i = 0; i < 2; i++)
+ {
+ copy[i] = alloca (len[i] + 1);
+ copy[i] = xmalloc (len[i] + 1);
+
+ for (j = 0, chars = 0; j < len[i] && chars < check_chars; chars++)
+ {
@ -3900,13 +3923,17 @@ diff -urNp coreutils-8.13-orig/src/uniq.c coreutils-8.13/src/uniq.c
+ len[i] = j;
+ }
+
+ return xmemcoll (copy[0], len[0], copy[1], len[1]);
+ int rc = xmemcoll (copy[0], len[0], copy[1], len[1]);
+ free (copy[0]);
+ free (copy[1]);
+ return rc;
+
}
+#endif
/* Output the line in linebuffer LINE to standard output
provided that the switches say it should be output.
@@ -305,15 +488,43 @@ check_file (const char *infile, const ch
@@ -305,15 +496,43 @@ check_file (const char *infile, const ch
{
char *prevfield IF_LINT ( = NULL);
size_t prevlen IF_LINT ( = 0);
@ -3950,7 +3977,7 @@ diff -urNp coreutils-8.13-orig/src/uniq.c coreutils-8.13/src/uniq.c
if (prevline->length == 0
|| different (thisfield, prevfield, thislen, prevlen))
{
@@ -332,17 +543,26 @@ check_file (const char *infile, const ch
@@ -332,17 +551,26 @@ check_file (const char *infile, const ch
size_t prevlen;
uintmax_t match_count = 0;
bool first_delimiter = true;
@ -3977,7 +4004,7 @@ diff -urNp coreutils-8.13-orig/src/uniq.c coreutils-8.13/src/uniq.c
if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
{
if (ferror (stdin))
@@ -351,6 +571,14 @@ check_file (const char *infile, const ch
@@ -351,6 +579,14 @@ check_file (const char *infile, const ch
}
thisfield = find_field (thisline);
thislen = thisline->length - 1 - (thisfield - thisline->buffer);
@ -3992,7 +4019,7 @@ diff -urNp coreutils-8.13-orig/src/uniq.c coreutils-8.13/src/uniq.c
match = !different (thisfield, prevfield, thislen, prevlen);
match_count += match;
@@ -383,6 +611,9 @@ check_file (const char *infile, const ch
@@ -383,6 +619,9 @@ check_file (const char *infile, const ch
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
@ -4002,7 +4029,7 @@ diff -urNp coreutils-8.13-orig/src/uniq.c coreutils-8.13/src/uniq.c
if (!match)
match_count = 0;
}
@@ -428,6 +659,19 @@ main (int argc, char **argv)
@@ -428,6 +667,19 @@ main (int argc, char **argv)
atexit (close_stdout);
@ -4022,10 +4049,10 @@ diff -urNp coreutils-8.13-orig/src/uniq.c coreutils-8.13/src/uniq.c
skip_chars = 0;
skip_fields = 0;
check_chars = SIZE_MAX;
diff -urNp coreutils-8.13-orig/tests/Makefile.am coreutils-8.13/tests/Makefile.am
--- coreutils-8.13-orig/tests/Makefile.am 2011-09-09 10:22:43.352561668 +0200
+++ coreutils-8.13/tests/Makefile.am 2011-09-09 10:23:14.189688942 +0200
@@ -238,6 +238,7 @@ TESTS = \
diff -urNp coreutils-8.15-orig/tests/Makefile.am coreutils-8.15/tests/Makefile.am
--- coreutils-8.15-orig/tests/Makefile.am 2013-01-30 13:39:59.940175847 +0100
+++ coreutils-8.15/tests/Makefile.am 2013-01-30 13:40:37.361294753 +0100
@@ -240,6 +240,7 @@ TESTS = \
misc/sort-debug-keys \
misc/sort-debug-warn \
misc/sort-files0-from \
@ -4033,7 +4060,7 @@ diff -urNp coreutils-8.13-orig/tests/Makefile.am coreutils-8.13/tests/Makefile.a
misc/sort-float \
misc/sort-merge \
misc/sort-merge-fdlimit \
@@ -518,6 +519,10 @@ TESTS = \
@@ -529,6 +530,10 @@ TESTS = \
$(root_tests)
pr_data = \
@ -4044,10 +4071,10 @@ diff -urNp coreutils-8.13-orig/tests/Makefile.am coreutils-8.13/tests/Makefile.a
pr/0F \
pr/0FF \
pr/0FFnt \
diff -urNp coreutils-8.13-orig/tests/misc/cut coreutils-8.13/tests/misc/cut
--- coreutils-8.13-orig/tests/misc/cut 2011-09-02 14:08:40.000000000 +0200
+++ coreutils-8.13/tests/misc/cut 2011-09-09 10:23:14.190686793 +0200
@@ -23,14 +23,15 @@ my $mb_locale = $ENV{LOCALE_FR_UTF8};
diff -urNp coreutils-8.15-orig/tests/misc/cut coreutils-8.15/tests/misc/cut
--- coreutils-8.15-orig/tests/misc/cut 2012-01-01 10:04:06.000000000 +0100
+++ coreutils-8.15/tests/misc/cut 2013-01-30 13:40:37.361294753 +0100
@@ -23,14 +23,15 @@ use strict;
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
@ -4067,7 +4094,7 @@ diff -urNp coreutils-8.13-orig/tests/misc/cut coreutils-8.13/tests/misc/cut
my $no_endpoint = "$prog: invalid range with no endpoint: -\n$try";
my @Tests =
@@ -147,7 +147,7 @@ my @Tests =
@@ -147,7 +148,7 @@ my @Tests =
# None of the following invalid ranges provoked an error up to coreutils-6.9.
['inval1', qw(-f 2-0), {IN=>''}, {OUT=>''}, {EXIT=>1},
@ -4076,41 +4103,41 @@ diff -urNp coreutils-8.13-orig/tests/misc/cut coreutils-8.13/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.13-orig/tests/misc/mb1.I coreutils-8.13/tests/misc/mb1.I
--- coreutils-8.13-orig/tests/misc/mb1.I 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.13/tests/misc/mb1.I 2011-09-09 10:23:14.191687037 +0200
diff -urNp coreutils-8.15-orig/tests/misc/mb1.I coreutils-8.15/tests/misc/mb1.I
--- coreutils-8.15-orig/tests/misc/mb1.I 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.15/tests/misc/mb1.I 2013-01-30 13:40:37.362395749 +0100
@@ -0,0 +1,4 @@
+Apple10
+Banana5
+Citrus20
+Cherry30
diff -urNp coreutils-8.13-orig/tests/misc/mb1.X coreutils-8.13/tests/misc/mb1.X
--- coreutils-8.13-orig/tests/misc/mb1.X 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.13/tests/misc/mb1.X 2011-09-09 10:23:14.192581910 +0200
diff -urNp coreutils-8.15-orig/tests/misc/mb1.X coreutils-8.15/tests/misc/mb1.X
--- coreutils-8.15-orig/tests/misc/mb1.X 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.15/tests/misc/mb1.X 2013-01-30 13:40:37.363395657 +0100
@@ -0,0 +1,4 @@
+Banana5
+Apple10
+Citrus20
+Cherry30
diff -urNp coreutils-8.13-orig/tests/misc/mb2.I coreutils-8.13/tests/misc/mb2.I
--- coreutils-8.13-orig/tests/misc/mb2.I 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.13/tests/misc/mb2.I 2011-09-09 10:23:14.192581910 +0200
diff -urNp coreutils-8.15-orig/tests/misc/mb2.I coreutils-8.15/tests/misc/mb2.I
--- coreutils-8.15-orig/tests/misc/mb2.I 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.15/tests/misc/mb2.I 2013-01-30 13:40:37.363395657 +0100
@@ -0,0 +1,4 @@
+Apple1020
+Banana530
+Citrus205
+Cherry3010
diff -urNp coreutils-8.13-orig/tests/misc/mb2.X coreutils-8.13/tests/misc/mb2.X
--- coreutils-8.13-orig/tests/misc/mb2.X 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.13/tests/misc/mb2.X 2011-09-09 10:23:14.193687456 +0200
diff -urNp coreutils-8.15-orig/tests/misc/mb2.X coreutils-8.15/tests/misc/mb2.X
--- coreutils-8.15-orig/tests/misc/mb2.X 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.15/tests/misc/mb2.X 2013-01-30 13:40:37.364411214 +0100
@@ -0,0 +1,4 @@
+Citrus205
+Cherry3010
+Apple1020
+Banana530
diff -urNp coreutils-8.13-orig/tests/misc/sort-mb-tests coreutils-8.13/tests/misc/sort-mb-tests
--- coreutils-8.13-orig/tests/misc/sort-mb-tests 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.13/tests/misc/sort-mb-tests 2011-09-09 10:23:14.194687565 +0200
diff -urNp coreutils-8.15-orig/tests/misc/sort-mb-tests coreutils-8.15/tests/misc/sort-mb-tests
--- coreutils-8.15-orig/tests/misc/sort-mb-tests 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.15/tests/misc/sort-mb-tests 2013-01-30 13:40:37.365177992 +0100
@@ -0,0 +1,58 @@
+#! /bin/sh
+case $# in

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.15
Release: 6%{?dist}
Release: 10%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -18,6 +18,11 @@ Source202: coreutils-su-l.pamd
Source203: coreutils-runuser-l.pamd
# From upstream
Patch1: coreutils-8.15-cp-attribute-truncate.patch
Patch2: coreutils-8.15-du-x-nondir.patch
Patch3: coreutils-8.17-cp-freememoryread.patch
Patch4: coreutils-8.17-sort-uniq-fmr.patch
Patch5: coreutils-8.17-df-duplicates.patch
# Our patches
#general patch to workaround koji build system issues
@ -121,6 +126,7 @@ Requires(post): grep
Requires: ncurses
Requires: gmp
Provides: bundled(gnulib)
Provides: fileutils = %{version}-%{release}
Provides: sh-utils = %{version}-%{release}
Provides: stat = %{version}-%{release}
@ -143,6 +149,11 @@ the old GNU fileutils, sh-utils, and textutils packages.
%setup -q
# From upstream
%patch1 -p1 -b .trunc
%patch2 -p1 -b .xnondir
%patch3 -p1 -b .cpfmr
%patch4 -p1 -b .sortfmr
%patch5 -p1 -b .duplic
# Our patches
%patch100 -p1 -b .configure
@ -173,7 +184,7 @@ the old GNU fileutils, sh-utils, and textutils packages.
%patch951 -p1 -b .selinuxman
%patch952 -p1 -b .cpZ
chmod a+x tests/misc/sort-mb-tests tests/df/direct || :
chmod a+x tests/misc/sort-mb-tests tests/df/direct tests/cp/attr-existing || :
#fix typos/mistakes in localized documentation(#439410, #440056)
find ./po/ -name "*.p*" | xargs \
@ -416,6 +427,31 @@ fi
%{?!norunuser:%{_sbindir}/runuser}
%changelog
* Wed Jan 30 2013 Ondrej Vasik <ovasik@redhat.com> 8.15-10
- fix multiple segmantation faults in i18n patch (by SUSE)
(#869442, #902917)- CVE2013-0223/CVE2013-0221/CVE2013-0222
* Wed Dec 12 2012 Ondrej Vasik <ovasik@redhat.com> 8.15-9
- fix showing duplicates in df (#709351, O.Oprala, B.Voelker)
* Mon Nov 05 2012 Ondrej Vasik <ovasik@redhat.com> 8.15-8
- fix support for ecryptfs mount of "Private" in su (#722323)
- cp: avoid data-corrupting free-memory-read (upstream fix)
- fix possible free memory read and dataloss in sort -u
(upstream fix)
- multibyte fixes in cut and expand (by M.Briza, #821260)
* Fri Jul 13 2012 Ondrej Vasik <ovasik@redhat.com> 8.15-7
- fix the tcsh colorls.csh behaviour in non-interactive
mode (#804604)
- add .htm and .shtml to colorized DIR_COLORS document
type (#817218)
- fix regression in du -x with nondir argument (by J.Meyering)
- fix sort segfault with multibyte locales (by P.Brady)
- add virtual provides for bundled(gnulib) copylib (#821748)
- cp: change --attribute-only to not truncate existing files
(#811746)
* Fri Feb 10 2012 Harald Hoyer <harald@redhat.com> 8.15-6
- turn on testsuite again