SHA256
1
0
forked from pool/coreutils

Accepting request 149348 from Base:System

- Avoid segmentation fault in "join -i" with long line input (bnc#798541, VUL-1)
- Avoid segmentation fault in "sort -d" and "sort -M" with long line input
  (bnc#798538, VUL-1)
- Avoid segmentation fault in "uniq" with long line input (bnc#796243, VUL-1)
- Fix test-suite errors (bnc#798261).

OBS-URL: https://build.opensuse.org/request/show/149348
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/coreutils?expand=0&rev=84
This commit is contained in:
Stephan Kulow 2013-01-22 14:08:43 +00:00 committed by Git OBS Bridge
commit 1086fe454c
27 changed files with 554 additions and 227 deletions

View File

@ -6,12 +6,12 @@ Subject: [PATCH 7/7] compile su with -fpie
--- ---
lib/Makefile.am | 2 +- lib/Makefile.am | 2 +-
src/Makefile.am | 5 +++++ src/Makefile.am | 5 +++++
2 files changed, 6 insertions(+), 1 deletions(-) 2 files changed, 6 insertions(+), 1 deletion(-)
Index: lib/Makefile.am Index: lib/Makefile.am
=================================================================== ===================================================================
--- lib/Makefile.am.orig 2012-04-16 13:18:02.444819167 +0200 --- lib/Makefile.am.orig
+++ lib/Makefile.am 2012-04-16 13:18:07.729692419 +0200 +++ lib/Makefile.am
@@ -28,7 +28,7 @@ noinst_LIBRARIES = @@ -28,7 +28,7 @@ noinst_LIBRARIES =
include gnulib.mk include gnulib.mk
@ -23,8 +23,8 @@ Index: lib/Makefile.am
buffer-lcm.c buffer-lcm.h buffer-lcm.c buffer-lcm.h
Index: src/Makefile.am Index: src/Makefile.am
=================================================================== ===================================================================
--- src/Makefile.am.orig 2012-04-16 13:18:07.714692779 +0200 --- src/Makefile.am.orig
+++ src/Makefile.am 2012-04-16 13:18:07.730692395 +0200 +++ src/Makefile.am
@@ -361,6 +361,11 @@ uptime_LDADD += $(GETLOADAVG_LIBS) @@ -361,6 +361,11 @@ uptime_LDADD += $(GETLOADAVG_LIBS)
su_SOURCES = su.c getdef.c su_SOURCES = su.c getdef.c
su_LDADD += $(LIB_CRYPT) $(PAM_LIBS) su_LDADD += $(LIB_CRYPT) $(PAM_LIBS)

View File

@ -4,18 +4,19 @@ Date: Mon, 9 Aug 2010 16:03:12 +0200
Subject: [PATCH 5/7] honor settings in /etc/default/su resp /etc/login.defs Subject: [PATCH 5/7] honor settings in /etc/default/su resp /etc/login.defs
--- ---
src/Makefile.am | 1 + src/Makefile.am | 1
src/getdef.c | 259 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.in | 4
src/getdef.c | 259 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/getdef.h | 29 ++++++ src/getdef.h | 29 ++++++
src/su.c | 13 +++- src/su.c | 13 ++
4 files changed, 300 insertions(+), 2 deletions(-) 5 files changed, 302 insertions(+), 4 deletions(-)
create mode 100644 src/getdef.c create mode 100644 src/getdef.c
create mode 100644 src/getdef.h create mode 100644 src/getdef.h
Index: src/Makefile.am Index: src/Makefile.am
=================================================================== ===================================================================
--- src/Makefile.am.orig 2012-04-16 13:18:07.682693547 +0200 --- src/Makefile.am.orig
+++ src/Makefile.am 2012-04-16 13:18:34.609047413 +0200 +++ src/Makefile.am
@@ -358,6 +358,7 @@ factor_LDADD += $(LIB_GMP) @@ -358,6 +358,7 @@ factor_LDADD += $(LIB_GMP)
uptime_LDADD += $(GETLOADAVG_LIBS) uptime_LDADD += $(GETLOADAVG_LIBS)
@ -24,10 +25,25 @@ Index: src/Makefile.am
su_LDADD += $(LIB_CRYPT) $(PAM_LIBS) su_LDADD += $(LIB_CRYPT) $(PAM_LIBS)
# for various ACL functions # for various ACL functions
Index: src/Makefile.in
===================================================================
--- src/Makefile.in.orig
+++ src/Makefile.in
@@ -592,8 +592,8 @@ stdbuf_DEPENDENCIES = $(am__DEPENDENCIES
stty_SOURCES = stty.c
stty_OBJECTS = stty.$(OBJEXT)
stty_DEPENDENCIES = $(am__DEPENDENCIES_2)
-su_SOURCES = su.c
-su_OBJECTS = su.$(OBJEXT)
+su_SOURCES = su.c getdef.c
+su_OBJECTS = su.$(OBJEXT) getdef.$(OBJEXT)
su_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1)
sum_SOURCES = sum.c
sum_OBJECTS = sum.$(OBJEXT)
Index: src/getdef.c Index: src/getdef.c
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null
+++ src/getdef.c 2012-04-16 13:18:07.714692779 +0200 +++ src/getdef.c
@@ -0,0 +1,259 @@ @@ -0,0 +1,259 @@
+/* Copyright (C) 2003, 2004, 2005 Thorsten Kukuk +/* Copyright (C) 2003, 2004, 2005 Thorsten Kukuk
+ Author: Thorsten Kukuk <kukuk@suse.de> + Author: Thorsten Kukuk <kukuk@suse.de>
@ -290,8 +306,8 @@ Index: src/getdef.c
+#endif +#endif
Index: src/getdef.h Index: src/getdef.h
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null
+++ src/getdef.h 2012-04-16 13:18:07.714692779 +0200 +++ src/getdef.h
@@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
+/* Copyright (C) 2003, 2005 Thorsten Kukuk +/* Copyright (C) 2003, 2005 Thorsten Kukuk
+ Author: Thorsten Kukuk <kukuk@suse.de> + Author: Thorsten Kukuk <kukuk@suse.de>
@ -324,8 +340,8 @@ Index: src/getdef.h
+#endif /* _GETDEF_H_ */ +#endif /* _GETDEF_H_ */
Index: src/su.c Index: src/su.c
=================================================================== ===================================================================
--- src/su.c.orig 2012-04-16 13:18:07.706692971 +0200 --- src/su.c.orig
+++ src/su.c 2012-04-16 13:18:34.630046909 +0200 +++ src/su.c
@@ -111,6 +111,8 @@ @@ -111,6 +111,8 @@
# include <paths.h> # include <paths.h>
#endif #endif

View File

@ -7,10 +7,10 @@ Subject: [PATCH 3/7] log all su attempts
src/su.c | 3 +++ src/su.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-) 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/su.c b/src/su.c Index: coreutils-8.17/src/su.c
index 1d3d007..2a9e423 100644 ===================================================================
--- a/src/su.c --- coreutils-8.17.orig/src/su.c
+++ b/src/su.c +++ coreutils-8.17/src/su.c
@@ -75,6 +75,9 @@ @@ -75,6 +75,9 @@
#if HAVE_SYSLOG_H && HAVE_SYSLOG #if HAVE_SYSLOG_H && HAVE_SYSLOG
@ -21,6 +21,3 @@ index 1d3d007..2a9e423 100644
#else #else
# undef SYSLOG_SUCCESS # undef SYSLOG_SUCCESS
# undef SYSLOG_FAILURE # undef SYSLOG_FAILURE
--
1.7.1

View File

@ -9,8 +9,8 @@ Subject: [PATCH 6/7] make sure /sbin resp /usr/sbin are in PATH
Index: src/su.c Index: src/su.c
=================================================================== ===================================================================
--- src/su.c.orig 2012-04-16 13:00:25.489424170 +0200 --- src/su.c.orig
+++ src/su.c 2012-04-16 13:01:12.161193827 +0200 +++ src/su.c
@@ -458,6 +458,117 @@ correct_password (const struct passwd *p @@ -458,6 +458,117 @@ correct_password (const struct passwd *p
#endif /* !USE_PAM */ #endif /* !USE_PAM */
} }

View File

@ -11,8 +11,8 @@ Subject: [PATCH 1/7] pam support for su
Index: configure.ac Index: configure.ac
=================================================================== ===================================================================
--- configure.ac.orig 2012-03-24 19:22:13.000000000 +0100 --- configure.ac.orig
+++ configure.ac 2012-04-16 12:59:28.737919405 +0200 +++ configure.ac
@@ -185,6 +185,20 @@ fi @@ -185,6 +185,20 @@ fi
AC_FUNC_FORK AC_FUNC_FORK
@ -36,8 +36,8 @@ Index: configure.ac
gl_ADD_PROG([optional_bin_progs], [chroot])) gl_ADD_PROG([optional_bin_progs], [chroot]))
Index: src/Makefile.am Index: src/Makefile.am
=================================================================== ===================================================================
--- src/Makefile.am.orig 2012-03-24 19:22:13.000000000 +0100 --- src/Makefile.am.orig
+++ src/Makefile.am 2012-04-16 12:59:28.737919405 +0200 +++ src/Makefile.am
@@ -357,8 +357,8 @@ factor_LDADD += $(LIB_GMP) @@ -357,8 +357,8 @@ factor_LDADD += $(LIB_GMP)
# for getloadavg # for getloadavg
uptime_LDADD += $(GETLOADAVG_LIBS) uptime_LDADD += $(GETLOADAVG_LIBS)
@ -51,8 +51,8 @@ Index: src/Makefile.am
copy_LDADD += $(LIB_ACL) copy_LDADD += $(LIB_ACL)
Index: src/su.c Index: src/su.c
=================================================================== ===================================================================
--- src/su.c.orig 2012-03-24 19:22:13.000000000 +0100 --- src/su.c.orig
+++ src/su.c 2012-04-16 13:00:06.496924665 +0200 +++ src/su.c
@@ -37,6 +37,16 @@ @@ -37,6 +37,16 @@
restricts who can su to UID 0 accounts. RMS considers that to restricts who can su to UID 0 accounts. RMS considers that to
be fascist. be fascist.

View File

@ -7,10 +7,10 @@ Subject: [PATCH 4/7] set sane default path
src/su.c | 12 ++---------- src/su.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-) 1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/su.c b/src/su.c Index: coreutils-8.17/src/su.c
index 2a9e423..0071622 100644 ===================================================================
--- a/src/su.c --- coreutils-8.17.orig/src/su.c
+++ b/src/su.c +++ coreutils-8.17/src/su.c
@@ -112,18 +112,10 @@ @@ -112,18 +112,10 @@
#endif #endif
@ -32,6 +32,3 @@ index 2a9e423..0071622 100644
/* The shell to run if none is given in the user's passwd entry. */ /* The shell to run if none is given in the user's passwd entry. */
#define DEFAULT_SHELL "/bin/sh" #define DEFAULT_SHELL "/bin/sh"
--
1.7.1

View File

@ -9,9 +9,9 @@ Subject: [PATCH 2/7] update man page for pam
Index: doc/coreutils.texi Index: doc/coreutils.texi
=================================================================== ===================================================================
--- doc/coreutils.texi.orig 2012-04-16 13:18:07.651694291 +0200 --- doc/coreutils.texi.orig
+++ doc/coreutils.texi 2012-04-16 13:18:14.825522204 +0200 +++ doc/coreutils.texi
@@ -15796,8 +15796,11 @@ to certain shells, etc.). @@ -15806,8 +15806,11 @@ to certain shells, etc.).
@findex syslog @findex syslog
@command{su} can optionally be compiled to use @code{syslog} to report @command{su} can optionally be compiled to use @code{syslog} to report
failed, and optionally successful, @command{su} attempts. (If the system failed, and optionally successful, @command{su} attempts. (If the system
@ -25,7 +25,7 @@ Index: doc/coreutils.texi
The program accepts the following options. Also see @ref{Common options}. The program accepts the following options. Also see @ref{Common options}.
@@ -15878,33 +15881,6 @@ Exit status: @@ -15888,33 +15891,6 @@ Exit status:
the exit status of the subshell otherwise the exit status of the subshell otherwise
@end display @end display

View File

@ -2,7 +2,7 @@ Index: src/sort.c
=================================================================== ===================================================================
--- src/sort.c.orig --- src/sort.c.orig
+++ src/sort.c +++ src/sort.c
@@ -5288,7 +5288,11 @@ main (int argc, char **argv) @@ -5291,7 +5291,11 @@ main (int argc, char **argv)
{ {
if (!nthreads) if (!nthreads)
{ {

View File

@ -12,8 +12,8 @@ Date: Fri Jul 22 14:48:42 2011 +0200
Index: lib/acl-internal.h Index: lib/acl-internal.h
=================================================================== ===================================================================
--- lib/acl-internal.h.orig 2012-03-09 08:31:00.000000000 +0100 --- lib/acl-internal.h.orig
+++ lib/acl-internal.h 2012-04-16 13:17:12.470016537 +0200 +++ lib/acl-internal.h
@@ -142,6 +142,12 @@ rpl_acl_set_fd (int fd, acl_t acl) @@ -142,6 +142,12 @@ rpl_acl_set_fd (int fd, acl_t acl)
# endif # endif
@ -29,8 +29,8 @@ Index: lib/acl-internal.h
# define acl_from_mode(mode) (NULL) # define acl_from_mode(mode) (NULL)
Index: lib/file-has-acl.c Index: lib/file-has-acl.c
=================================================================== ===================================================================
--- lib/file-has-acl.c.orig 2012-03-09 08:31:00.000000000 +0100 --- lib/file-has-acl.c.orig
+++ lib/file-has-acl.c 2012-04-16 13:17:12.471016513 +0200 +++ lib/file-has-acl.c
@@ -492,12 +492,20 @@ file_has_acl (char const *name, struct s @@ -492,12 +492,20 @@ file_has_acl (char const *name, struct s
/* Linux, FreeBSD, MacOS X, IRIX, Tru64 */ /* Linux, FreeBSD, MacOS X, IRIX, Tru64 */
int ret; int ret;
@ -55,8 +55,8 @@ Index: lib/file-has-acl.c
{ {
Index: m4/acl.m4 Index: m4/acl.m4
=================================================================== ===================================================================
--- m4/acl.m4.orig 2012-01-06 10:14:31.000000000 +0100 --- m4/acl.m4.orig
+++ m4/acl.m4 2012-04-16 13:17:12.471016513 +0200 +++ m4/acl.m4
@@ -33,7 +33,7 @@ AC_DEFUN([gl_FUNC_ACL], @@ -33,7 +33,7 @@ AC_DEFUN([gl_FUNC_ACL],
AC_CHECK_FUNCS( AC_CHECK_FUNCS(
[acl_get_file acl_get_fd acl_set_file acl_set_fd \ [acl_get_file acl_get_fd acl_set_file acl_set_fd \
@ -68,9 +68,9 @@ Index: m4/acl.m4
acl_to_short_text acl_free_text]) acl_to_short_text acl_free_text])
Index: ChangeLog Index: ChangeLog
=================================================================== ===================================================================
--- ChangeLog.orig 2012-03-26 14:15:03.000000000 +0200 --- ChangeLog.orig
+++ ChangeLog 2012-04-16 13:17:12.474016441 +0200 +++ ChangeLog
@@ -2815,6 +2815,14 @@ @@ -3272,6 +3272,14 @@
MacOS X 10.7 has an fdatasync that is not declared, and is rumored to MacOS X 10.7 has an fdatasync that is not declared, and is rumored to
be ineffective. (Bug#9141) be ineffective. (Bug#9141)

View File

@ -1,8 +1,8 @@
Index: doc/coreutils.texi Index: doc/coreutils.texi
=================================================================== ===================================================================
--- doc/coreutils.texi.orig 2012-04-16 13:12:04.624344318 +0200 --- doc/coreutils.texi.orig
+++ doc/coreutils.texi 2012-04-16 13:13:08.231837183 +0200 +++ doc/coreutils.texi
@@ -12447,6 +12447,16 @@ This section describes commands that man @@ -12457,6 +12457,16 @@ This section describes commands that man
@command{basename} removes any leading directory components from @command{basename} removes any leading directory components from
@var{name}. Synopsis: @var{name}. Synopsis:

View File

@ -1,8 +1,8 @@
Index: doc/coreutils.info Index: doc/coreutils.info
=================================================================== ===================================================================
--- doc/coreutils.info.orig 2012-03-26 14:08:30.000000000 +0200 --- doc/coreutils.info.orig
+++ doc/coreutils.info 2012-04-18 11:17:09.917545246 +0200 +++ doc/coreutils.info
@@ -12788,6 +12788,10 @@ and optionally successful, `su' attempts @@ -12796,6 +12796,10 @@ and optionally successful, `su' attempts
`syslog'.) However, GNU `su' does not check if the user is a member of `syslog'.) However, GNU `su' does not check if the user is a member of
the `wheel' group; see below. the `wheel' group; see below.
@ -13,7 +13,7 @@ Index: doc/coreutils.info
The program accepts the following options. Also see *note Common The program accepts the following options. Also see *note Common
options::. options::.
@@ -12796,6 +12800,12 @@ options::. @@ -12804,6 +12808,12 @@ options::.
Pass COMMAND, a single command line to run, to the shell with a Pass COMMAND, a single command line to run, to the shell with a
`-c' option instead of starting an interactive shell. `-c' option instead of starting an interactive shell.
@ -28,8 +28,8 @@ Index: doc/coreutils.info
Pass the `-f' option to the shell. This probably only makes sense Pass the `-f' option to the shell. This probably only makes sense
Index: src/su.c Index: src/su.c
=================================================================== ===================================================================
--- src/su.c.orig 2012-04-18 11:17:09.856546407 +0200 --- src/su.c.orig
+++ src/su.c 2012-04-18 11:17:09.917545246 +0200 +++ src/su.c
@@ -141,6 +141,9 @@ static bool simulate_login; @@ -141,6 +141,9 @@ static bool simulate_login;
/* If true, change some environment vars to indicate the user su'd to. */ /* If true, change some environment vars to indicate the user su'd to. */
static bool change_environment; static bool change_environment;

View File

@ -53,7 +53,7 @@ Index: tests/cp/fiemap-FMR
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ tests/cp/fiemap-FMR +++ tests/cp/fiemap-FMR
@@ -0,0 +1,31 @@ @@ -0,0 +1,41 @@
+#!/bin/sh +#!/bin/sh
+# Trigger a free-memory read bug in cp from coreutils-[8.11..8.19] +# Trigger a free-memory read bug in cp from coreutils-[8.11..8.19]
+ +
@ -72,9 +72,19 @@ Index: tests/cp/fiemap-FMR
+# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <http://www.gnu.org/licenses/>.
+ +
+. "${srcdir=.}/init.sh"; path_prepend_ ./src +. "${srcdir=.}/init.sh"; path_prepend_ ../src
+print_ver_ cp +print_ver_ cp
+ +
+# Skip the current test if valgrind doesn't work,
+# which could happen if not installed,
+# or hasn't support for the built architecture,
+# or hasn't appropriate error suppressions installed etc.
+require_valgrind_()
+{
+ valgrind --error-exitcode=1 true 2>/dev/null ||
+ skip_ "requires a working valgrind"
+}
+
+require_valgrind_ +require_valgrind_
+require_perl_ +require_perl_
+: ${PERL=perl} +: ${PERL=perl}

View File

@ -1,7 +1,7 @@
Index: gnulib-tests/test-getaddrinfo.c Index: gnulib-tests/test-getaddrinfo.c
=================================================================== ===================================================================
--- gnulib-tests/test-getaddrinfo.c.orig 2012-04-16 13:18:02.424819645 +0200 --- gnulib-tests/test-getaddrinfo.c.orig
+++ gnulib-tests/test-getaddrinfo.c 2012-04-16 13:18:07.737692228 +0200 +++ gnulib-tests/test-getaddrinfo.c
@@ -86,11 +86,7 @@ simple (char const *host, char const *se @@ -86,11 +86,7 @@ simple (char const *host, char const *se
the test merely because someone is down the country on their the test merely because someone is down the country on their
in-law's farm. */ in-law's farm. */

View File

@ -1,8 +1,8 @@
Index: m4/gnulib-comp.m4 Index: m4/gnulib-comp.m4
=================================================================== ===================================================================
--- m4/gnulib-comp.m4.orig 2012-03-20 23:34:39.000000000 +0100 --- m4/gnulib-comp.m4.orig
+++ m4/gnulib-comp.m4 2012-04-16 12:57:23.373219154 +0200 +++ m4/gnulib-comp.m4
@@ -1584,7 +1584,6 @@ gl_POSIXTM @@ -1597,7 +1597,6 @@ gl_POSIXTM
gl_POSIXVER gl_POSIXVER
gl_FUNC_PRINTF_FREXP gl_FUNC_PRINTF_FREXP
gl_FUNC_PRINTF_FREXPL gl_FUNC_PRINTF_FREXPL

View File

@ -1,14 +0,0 @@
Index: src/sort.c
===================================================================
--- src/sort.c.orig 2012-04-16 13:23:11.726363043 +0200
+++ src/sort.c 2012-04-16 13:23:20.474151036 +0200
@@ -3161,7 +3161,8 @@ keycompare_mb (const struct line *a, con
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; \
} \
\

View File

@ -1,16 +0,0 @@
Index: src/cut.c
===================================================================
--- src/cut.c.orig 2012-04-16 13:17:12.321020103 +0200
+++ src/cut.c 2012-04-16 13:17:12.333019817 +0200
@@ -869,7 +869,10 @@ cut_fields_mb (FILE *stream)
c = getc (stream);
empty_input = (c == EOF);
if (c != EOF)
- ungetc (c, stream);
+ {
+ ungetc (c, stream);
+ wc = 0;
+ }
else
wc = WEOF;

View File

@ -19,8 +19,8 @@
Index: lib/linebuffer.h Index: lib/linebuffer.h
=================================================================== ===================================================================
--- lib/linebuffer.h.orig 2012-01-06 10:14:31.000000000 +0100 --- lib/linebuffer.h.orig
+++ lib/linebuffer.h 2012-06-19 12:13:47.369654318 +0200 +++ lib/linebuffer.h
@@ -21,6 +21,11 @@ @@ -21,6 +21,11 @@
# include <stdio.h> # include <stdio.h>
@ -45,8 +45,8 @@ Index: lib/linebuffer.h
/* Initialize linebuffer LINEBUFFER for use. */ /* Initialize linebuffer LINEBUFFER for use. */
Index: src/cut.c Index: src/cut.c
=================================================================== ===================================================================
--- src/cut.c.orig 2012-05-02 10:31:47.000000000 +0200 --- src/cut.c.orig
+++ src/cut.c 2012-06-19 12:13:47.370654294 +0200 +++ src/cut.c
@@ -28,6 +28,11 @@ @@ -28,6 +28,11 @@
#include <assert.h> #include <assert.h>
#include <getopt.h> #include <getopt.h>
@ -136,7 +136,7 @@ Index: src/cut.c
static size_t field_1_bufsize; static size_t field_1_bufsize;
-/* The largest field or byte index used as an endpoint of a closed -/* The largest field or byte index used as an endpoint of a closed
+/* The largest field, character or byte index used as an endpoint of a closed +/* The largest byte, character or field index used as an endpoint of a closed
or degenerate range specification; this doesn't include the starting or degenerate range specification; this doesn't include the starting
index of right-open-ended ranges. For example, with either range spec index of right-open-ended ranges. For example, with either range spec
'2-5,9-', '2-3,5,9-' this variable would be set to 5. */ '2-5,9-', '2-3,5,9-' this variable would be set to 5. */
@ -247,7 +247,7 @@ Index: src/cut.c
} }
max_range_endpoint = 0; max_range_endpoint = 0;
@@ -581,6 +663,63 @@ cut_bytes (FILE *stream) @@ -581,6 +663,77 @@ cut_bytes (FILE *stream)
} }
} }
@ -271,7 +271,10 @@ Index: src/cut.c
+ size_t mblength; /* The byte size of a multibyte character which shows + size_t mblength; /* The byte size of a multibyte character which shows
+ as same character as WC. */ + as same character as WC. */
+ mbstate_t state; /* State of the stream. */ + 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. */
+ /* 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; + idx = 0;
+ buflen = 0; + buflen = 0;
@ -294,12 +297,23 @@ Index: src/cut.c
+ { + {
+ putchar ('\n'); + putchar ('\n');
+ idx = 0; + idx = 0;
+ print_delimiter = false;
+ } + }
+ else + else
+ { + {
+ bool range_start;
+ bool *rs = output_delimiter_specified ? &range_start : NULL;
+ idx += (operating_mode == byte_mode) ? mblength : 1; + idx += (operating_mode == byte_mode) ? mblength : 1;
+ if (print_kth (idx, NULL)) + if (print_kth (idx, rs))
+ fwrite (bufpos, mblength, sizeof(char), stdout); + {
+ 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; + buflen -= mblength;
@ -311,7 +325,7 @@ Index: src/cut.c
/* Read from stream STREAM, printing to standard output any selected fields. */ /* Read from stream STREAM, printing to standard output any selected fields. */
static void static void
@@ -703,13 +842,192 @@ cut_fields (FILE *stream) @@ -703,13 +856,195 @@ cut_fields (FILE *stream)
} }
} }
@ -331,7 +345,7 @@ Index: src/cut.c
+ size_t mblength; /* The byte size of a multibyte character which shows + size_t mblength; /* The byte size of a multibyte character which shows
+ as same character as WC. */ + as same character as WC. */
+ mbstate_t state; /* State of the stream. */ + 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; + found_any_selected_field = 0;
+ field_idx = 1; + field_idx = 1;
@ -342,7 +356,10 @@ Index: src/cut.c
+ c = getc (stream); + c = getc (stream);
+ empty_input = (c == EOF); + empty_input = (c == EOF);
+ if (c != EOF) + if (c != EOF)
+ {
+ ungetc (c, stream); + ungetc (c, stream);
+ wc = 0;
+ }
+ else + else
+ wc = WEOF; + wc = WEOF;
+ +
@ -380,7 +397,7 @@ Index: src/cut.c
+ break; + break;
+ } + }
+ +
+ if (wc == WEOF) + if (len <= 0 && wc == WEOF)
+ break; + break;
+ +
+ /* If the first field extends to the end of line (it is not + /* If the first field extends to the end of line (it is not
@ -507,7 +524,7 @@ Index: src/cut.c
} }
/* Process file FILE to standard output. /* Process file FILE to standard output.
@@ -761,6 +1079,8 @@ main (int argc, char **argv) @@ -761,6 +1096,8 @@ main (int argc, char **argv)
bool ok; bool ok;
bool delim_specified = false; bool delim_specified = false;
char *spec_list_string IF_LINT ( = NULL); char *spec_list_string IF_LINT ( = NULL);
@ -516,7 +533,7 @@ Index: src/cut.c
initialize_main (&argc, &argv); initialize_main (&argc, &argv);
set_program_name (argv[0]); set_program_name (argv[0]);
@@ -783,7 +1103,6 @@ main (int argc, char **argv) @@ -783,7 +1120,6 @@ main (int argc, char **argv)
switch (optc) switch (optc)
{ {
case 'b': case 'b':
@ -524,7 +541,7 @@ Index: src/cut.c
/* Build the byte list. */ /* Build the byte list. */
if (operating_mode != undefined_mode) if (operating_mode != undefined_mode)
FATAL_ERROR (_("only one type of list may be specified")); FATAL_ERROR (_("only one type of list may be specified"));
@@ -791,6 +1110,14 @@ main (int argc, char **argv) @@ -791,6 +1127,14 @@ main (int argc, char **argv)
spec_list_string = optarg; spec_list_string = optarg;
break; break;
@ -539,7 +556,7 @@ Index: src/cut.c
case 'f': case 'f':
/* Build the field list. */ /* Build the field list. */
if (operating_mode != undefined_mode) if (operating_mode != undefined_mode)
@@ -802,10 +1129,35 @@ main (int argc, char **argv) @@ -802,10 +1146,35 @@ main (int argc, char **argv)
case 'd': case 'd':
/* New delimiter. */ /* New delimiter. */
/* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */ /* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */
@ -579,7 +596,7 @@ Index: src/cut.c
break; break;
case OUTPUT_DELIMITER_OPTION: case OUTPUT_DELIMITER_OPTION:
@@ -818,6 +1170,7 @@ main (int argc, char **argv) @@ -818,6 +1187,7 @@ main (int argc, char **argv)
break; break;
case 'n': case 'n':
@ -587,7 +604,7 @@ Index: src/cut.c
break; break;
case 's': case 's':
@@ -840,7 +1193,7 @@ main (int argc, char **argv) @@ -840,7 +1210,7 @@ main (int argc, char **argv)
if (operating_mode == undefined_mode) if (operating_mode == undefined_mode)
FATAL_ERROR (_("you must specify a list of bytes, characters, or fields")); FATAL_ERROR (_("you must specify a list of bytes, characters, or fields"));
@ -596,7 +613,7 @@ Index: src/cut.c
FATAL_ERROR (_("an input delimiter may be specified only\ FATAL_ERROR (_("an input delimiter may be specified only\
when operating on fields")); when operating on fields"));
@@ -867,15 +1220,34 @@ main (int argc, char **argv) @@ -867,15 +1237,34 @@ main (int argc, char **argv)
} }
if (!delim_specified) if (!delim_specified)
@ -639,8 +656,8 @@ Index: src/cut.c
if (optind == argc) if (optind == argc)
Index: src/expand.c Index: src/expand.c
=================================================================== ===================================================================
--- src/expand.c.orig 2012-05-01 22:55:08.000000000 +0200 --- src/expand.c.orig
+++ src/expand.c 2012-06-19 12:13:47.370654294 +0200 +++ src/expand.c
@@ -37,12 +37,29 @@ @@ -37,12 +37,29 @@
#include <stdio.h> #include <stdio.h>
#include <getopt.h> #include <getopt.h>
@ -830,8 +847,8 @@ Index: src/expand.c
error (EXIT_FAILURE, errno, "-"); error (EXIT_FAILURE, errno, "-");
Index: src/fold.c Index: src/fold.c
=================================================================== ===================================================================
--- src/fold.c.orig 2012-04-29 13:45:30.000000000 +0200 --- src/fold.c.orig
+++ src/fold.c 2012-06-19 12:13:47.370654294 +0200 +++ src/fold.c
@@ -22,12 +22,34 @@ @@ -22,12 +22,34 @@
#include <getopt.h> #include <getopt.h>
#include <sys/types.h> #include <sys/types.h>
@ -1232,8 +1249,8 @@ Index: src/fold.c
case 's': /* Break at word boundaries. */ case 's': /* Break at word boundaries. */
Index: src/join.c Index: src/join.c
=================================================================== ===================================================================
--- src/join.c.orig 2012-05-02 10:31:47.000000000 +0200 --- src/join.c.orig
+++ src/join.c 2012-06-19 12:13:47.371654270 +0200 +++ src/join.c
@@ -22,18 +22,32 @@ @@ -22,18 +22,32 @@
#include <sys/types.h> #include <sys/types.h>
#include <getopt.h> #include <getopt.h>
@ -1452,7 +1469,7 @@ Index: src/join.c
static void static void
freeline (struct line *line) freeline (struct line *line)
{ {
@@ -313,56 +472,115 @@ keycmp (struct line const *line1, struct @@ -313,56 +472,130 @@ keycmp (struct line const *line1, struct
size_t jf_1, size_t jf_2) size_t jf_1, size_t jf_2)
{ {
/* Start of field to compare in each file. */ /* Start of field to compare in each file. */
@ -1466,6 +1483,7 @@ Index: src/join.c
+ size_t len[2]; /* Length of fields to compare. */ + size_t len[2]; /* Length of fields to compare. */
int diff; int diff;
+ int i, j; + int i, j;
+ int mallocd = 0;
if (jf_1 < line1->nfields) if (jf_1 < line1->nfields)
{ {
@ -1521,7 +1539,8 @@ Index: src/join.c
+ +
+ for (i = 0; i < 2; i++) + for (i = 0; i < 2; i++)
+ { + {
+ copy[i] = alloca (len[i] + 1); + mallocd = 1;
+ copy[i] = xmalloc (len[i] + 1);
+ +
+ for (j = 0; j < MIN (len[0], len[1]);) + for (j = 0; j < MIN (len[0], len[1]);)
+ { + {
@ -1561,7 +1580,8 @@ Index: src/join.c
+ { + {
+ for (i = 0; i < 2; i++) + for (i = 0; i < 2; i++)
+ { + {
+ copy[i] = alloca (len[i] + 1); + mallocd = 1;
+ copy[i] = xmalloc (len[i] + 1);
+ +
+ for (j = 0; j < MIN (len[0], len[1]); j++) + for (j = 0; j < MIN (len[0], len[1]); j++)
+ copy[i][j] = toupper (beg[i][j]); + copy[i][j] = toupper (beg[i][j]);
@ -1577,12 +1597,24 @@ Index: src/join.c
- diff = memcmp (beg1, beg2, MIN (len1, len2)); - diff = memcmp (beg1, beg2, MIN (len1, len2));
+ copy[0] = (unsigned char *) beg[0]; + copy[0] = (unsigned char *) beg[0];
+ copy[1] = (unsigned char *) beg[1]; + copy[1] = (unsigned char *) beg[1];
+ }
+
+ if (hard_LC_COLLATE)
+ {
+ 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;
} }
+ if (hard_LC_COLLATE)
+ return xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]);
+ diff = memcmp (copy[0], copy[1], MIN (len[0], len[1])); + diff = memcmp (copy[0], copy[1], MIN (len[0], len[1]));
+ +
+ if (mallocd)
+ for (i = 0; i < 2; i++)
+ free (copy[i]);
+ +
if (diff) if (diff)
return diff; return diff;
@ -1591,7 +1623,7 @@ Index: src/join.c
} }
/* Check that successive input lines PREV and CURRENT from input file /* Check that successive input lines PREV and CURRENT from input file
@@ -454,6 +672,12 @@ get_line (FILE *fp, struct line **linep, @@ -454,6 +687,12 @@ get_line (FILE *fp, struct line **linep,
} }
++line_no[which - 1]; ++line_no[which - 1];
@ -1604,7 +1636,7 @@ Index: src/join.c
xfields (line); xfields (line);
if (prevline[which - 1]) if (prevline[which - 1])
@@ -552,22 +776,29 @@ prfield (size_t n, struct line const *li @@ -552,22 +791,29 @@ prfield (size_t n, struct line const *li
} }
/* Output all the fields in line, other than the join field. */ /* Output all the fields in line, other than the join field. */
@ -1637,7 +1669,7 @@ Index: src/join.c
prfield (i, line); prfield (i, line);
} }
} }
@@ -578,7 +809,6 @@ static void @@ -578,7 +824,6 @@ static void
prjoin (struct line const *line1, struct line const *line2) prjoin (struct line const *line1, struct line const *line2)
{ {
const struct outlist *outlist; const struct outlist *outlist;
@ -1645,7 +1677,7 @@ Index: src/join.c
size_t field; size_t field;
struct line const *line; struct line const *line;
@@ -612,7 +842,7 @@ prjoin (struct line const *line1, struct @@ -612,7 +857,7 @@ prjoin (struct line const *line1, struct
o = o->next; o = o->next;
if (o == NULL) if (o == NULL)
break; break;
@ -1654,7 +1686,7 @@ Index: src/join.c
} }
putchar ('\n'); putchar ('\n');
} }
@@ -1090,21 +1320,46 @@ main (int argc, char **argv) @@ -1090,21 +1335,46 @@ main (int argc, char **argv)
case 't': case 't':
{ {
@ -1712,8 +1744,8 @@ Index: src/join.c
case NOCHECK_ORDER_OPTION: case NOCHECK_ORDER_OPTION:
Index: src/pr.c Index: src/pr.c
=================================================================== ===================================================================
--- src/pr.c.orig 2012-05-10 09:14:30.000000000 +0200 --- src/pr.c.orig
+++ src/pr.c 2012-06-19 12:15:34.144102794 +0200 +++ src/pr.c
@@ -312,6 +312,32 @@ @@ -312,6 +312,32 @@
#include <getopt.h> #include <getopt.h>
@ -2438,8 +2470,8 @@ Index: src/pr.c
Index: src/sort.c Index: src/sort.c
=================================================================== ===================================================================
--- src/sort.c.orig 2012-05-04 12:06:22.000000000 +0200 --- src/sort.c.orig
+++ src/sort.c 2012-06-19 12:16:37.982577478 +0200 +++ src/sort.c
@@ -22,12 +22,21 @@ @@ -22,12 +22,21 @@
#include <config.h> #include <config.h>
@ -3021,7 +3053,7 @@ Index: src/sort.c
&& ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned)) && ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned))
|| (!key->skipsblanks && key->schar) || (!key->skipsblanks && key->schar)
|| (!key->skipeblanks && key->echar))) || (!key->skipeblanks && key->echar)))
@@ -2442,11 +2804,83 @@ key_warnings (struct keyfield const *gke @@ -2442,11 +2804,87 @@ key_warnings (struct keyfield const *gke
error (0, 0, _("option '-r' only applies to last-resort comparison")); error (0, 0, _("option '-r' only applies to last-resort comparison"));
} }
@ -3048,13 +3080,13 @@ Index: src/sort.c
+ if (len == 0) + if (len == 0)
+ return 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); + memcpy (tmp, s, len);
+ tmp[len] = '\0'; + tmp[len] = '\0';
+ pp = (const char **)&tmp; + 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)); + memset (&state, '\0', sizeof(mbstate_t));
+ +
+ wclength = mbsrtowcs (month_wcs, pp, len + 1, &state); + wclength = mbsrtowcs (month_wcs, pp, len + 1, &state);
@ -3093,6 +3125,10 @@ Index: src/sort.c
+ result = (!strncmp (month, monthtab[lo].name, strlen (monthtab[lo].name)) + result = (!strncmp (month, monthtab[lo].name, strlen (monthtab[lo].name))
+ ? monthtab[lo].val : 0); + ? monthtab[lo].val : 0);
+ +
+ free (month);
+ free (tmp);
+ free (month_wcs);
+
+ return result; + return result;
+} +}
+#endif +#endif
@ -3106,7 +3142,7 @@ Index: src/sort.c
{ {
struct keyfield *key = keylist; struct keyfield *key = keylist;
@@ -2531,7 +2965,7 @@ keycompare (struct line const *a, struct @@ -2531,7 +2969,7 @@ keycompare (struct line const *a, struct
else if (key->human_numeric) else if (key->human_numeric)
diff = human_numcompare (ta, tb); diff = human_numcompare (ta, tb);
else if (key->month) else if (key->month)
@ -3115,7 +3151,7 @@ Index: src/sort.c
else if (key->random) else if (key->random)
diff = compare_random (ta, tlena, tb, tlenb); diff = compare_random (ta, tlena, tb, tlenb);
else if (key->version) else if (key->version)
@@ -2647,6 +3081,179 @@ keycompare (struct line const *a, struct @@ -2647,6 +3085,181 @@ keycompare (struct line const *a, struct
return key->reverse ? -diff : diff; return key->reverse ? -diff : diff;
} }
@ -3171,7 +3207,7 @@ Index: src/sort.c
+ { + {
+ if (ignore || translate) + if (ignore || translate)
+ { + {
+ char *copy_a = (char *) alloca (lena + 1 + lenb + 1); + char *copy_a = xmalloc (lena + 1 + lenb + 1);
+ char *copy_b = copy_a + lena + 1; + char *copy_b = copy_a + lena + 1;
+ size_t new_len_a, new_len_b; + size_t new_len_a, new_len_b;
+ size_t i, j; + size_t i, j;
@ -3197,7 +3233,8 @@ Index: src/sort.c
+ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \ + if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \
+ STATE = state_bak; \ + STATE = state_bak; \
+ if (!ignore) \ + if (!ignore) \
+ COPY[NEW_LEN++] = TEXT[i++]; \ + COPY[NEW_LEN++] = TEXT[i]; \
+ i++; \
+ continue; \ + continue; \
+ } \ + } \
+ \ + \
@ -3246,6 +3283,7 @@ Index: src/sort.c
+ IGNORE_CHARS (new_len_b, lenb, textb, copy_b, + IGNORE_CHARS (new_len_b, lenb, textb, copy_b,
+ wc_b, mblength_b, state_b); + wc_b, mblength_b, state_b);
+ diff = xmemcoll (copy_a, new_len_a, copy_b, new_len_b); + diff = xmemcoll (copy_a, new_len_a, copy_b, new_len_b);
+ free(copy_a);
+ } + }
+ else if (lena == 0) + else if (lena == 0)
+ diff = - NONZERO (lenb); + diff = - NONZERO (lenb);
@ -3295,7 +3333,7 @@ Index: src/sort.c
/* Compare two lines A and B, returning negative, zero, or positive /* Compare two lines A and B, returning negative, zero, or positive
depending on whether A compares less than, equal to, or greater than B. */ depending on whether A compares less than, equal to, or greater than B. */
@@ -4107,7 +4714,7 @@ main (int argc, char **argv) @@ -4107,7 +4720,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE); initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE); hard_LC_COLLATE = hard_locale (LC_COLLATE);
@ -3304,7 +3342,7 @@ Index: src/sort.c
hard_LC_TIME = hard_locale (LC_TIME); hard_LC_TIME = hard_locale (LC_TIME);
#endif #endif
@@ -4128,6 +4735,29 @@ main (int argc, char **argv) @@ -4128,6 +4741,29 @@ main (int argc, char **argv)
thousands_sep = -1; thousands_sep = -1;
} }
@ -3334,7 +3372,7 @@ Index: src/sort.c
have_read_stdin = false; have_read_stdin = false;
inittables (); inittables ();
@@ -4398,13 +5028,34 @@ main (int argc, char **argv) @@ -4398,13 +5034,34 @@ main (int argc, char **argv)
case 't': case 't':
{ {
@ -3373,7 +3411,7 @@ Index: src/sort.c
else else
{ {
/* Provoke with 'sort -txx'. Complain about /* Provoke with 'sort -txx'. Complain about
@@ -4415,9 +5066,12 @@ main (int argc, char **argv) @@ -4415,9 +5072,12 @@ main (int argc, char **argv)
quote (optarg)); quote (optarg));
} }
} }
@ -3390,8 +3428,8 @@ Index: src/sort.c
Index: src/unexpand.c Index: src/unexpand.c
=================================================================== ===================================================================
--- src/unexpand.c.orig 2012-05-01 22:55:08.000000000 +0200 --- src/unexpand.c.orig
+++ src/unexpand.c 2012-06-19 12:13:47.373654222 +0200 +++ src/unexpand.c
@@ -38,12 +38,29 @@ @@ -38,12 +38,29 @@
#include <stdio.h> #include <stdio.h>
#include <getopt.h> #include <getopt.h>
@ -3647,8 +3685,8 @@ Index: src/unexpand.c
error (EXIT_FAILURE, errno, "-"); error (EXIT_FAILURE, errno, "-");
Index: src/uniq.c Index: src/uniq.c
=================================================================== ===================================================================
--- src/uniq.c.orig 2012-05-01 22:55:08.000000000 +0200 --- src/uniq.c.orig
+++ src/uniq.c 2012-06-19 12:13:47.374654199 +0200 +++ src/uniq.c
@@ -21,6 +21,16 @@ @@ -21,6 +21,16 @@
#include <getopt.h> #include <getopt.h>
#include <sys/types.h> #include <sys/types.h>
@ -3800,7 +3838,7 @@ Index: src/uniq.c
if (check_chars < oldlen) if (check_chars < oldlen)
oldlen = check_chars; oldlen = check_chars;
if (check_chars < newlen) if (check_chars < newlen)
@@ -241,14 +346,92 @@ different (char *old, char *new, size_t @@ -241,14 +346,100 @@ different (char *old, char *new, size_t
if (ignore_case) if (ignore_case)
{ {
@ -3808,14 +3846,19 @@ Index: src/uniq.c
- return oldlen != newlen || memcasecmp (old, new, oldlen); - return oldlen != newlen || memcasecmp (old, new, oldlen);
+ size_t i; + size_t i;
+ +
+ copy_old = alloca (oldlen + 1); + copy_old = xmalloc (sizeof(char) * (oldlen + 1));
+ copy_new = alloca (oldlen + 1); + copy_new = xmalloc (sizeof(char) * (oldlen + 1));
+ +
+ for (i = 0; i < oldlen; i++) + for (i = 0; i < oldlen; i++)
+ { + {
+ copy_old[i] = toupper (old[i]); + copy_old[i] = toupper (old[i]);
+ copy_new[i] = toupper (new[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) - else if (hard_LC_COLLATE)
- return xmemcoll (old, oldlen, new, newlen) != 0; - return xmemcoll (old, oldlen, new, newlen) != 0;
@ -3851,7 +3894,7 @@ Index: src/uniq.c
+ +
+ for (i = 0; i < 2; i++) + 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++) + for (j = 0, chars = 0; j < len[i] && chars < check_chars; chars++)
+ { + {
@ -3892,13 +3935,16 @@ Index: src/uniq.c
+ len[i] = j; + 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 +#endif
/* Output the line in linebuffer LINE to standard output /* Output the line in linebuffer LINE to standard output
provided that the switches say it should be output. provided that the switches say it should be output.
@@ -304,15 +487,43 @@ check_file (const char *infile, const ch @@ -304,15 +495,43 @@ check_file (const char *infile, const ch
{ {
char *prevfield IF_LINT ( = NULL); char *prevfield IF_LINT ( = NULL);
size_t prevlen IF_LINT ( = 0); size_t prevlen IF_LINT ( = 0);
@ -3942,7 +3988,7 @@ Index: src/uniq.c
if (prevline->length == 0 if (prevline->length == 0
|| different (thisfield, prevfield, thislen, prevlen)) || different (thisfield, prevfield, thislen, prevlen))
{ {
@@ -331,17 +542,26 @@ check_file (const char *infile, const ch @@ -331,17 +550,26 @@ check_file (const char *infile, const ch
size_t prevlen; size_t prevlen;
uintmax_t match_count = 0; uintmax_t match_count = 0;
bool first_delimiter = true; bool first_delimiter = true;
@ -3969,7 +4015,7 @@ Index: src/uniq.c
if (readlinebuffer_delim (thisline, stdin, delimiter) == 0) if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
{ {
if (ferror (stdin)) if (ferror (stdin))
@@ -350,6 +570,15 @@ check_file (const char *infile, const ch @@ -350,6 +578,15 @@ check_file (const char *infile, const ch
} }
thisfield = find_field (thisline); thisfield = find_field (thisline);
thislen = thisline->length - 1 - (thisfield - thisline->buffer); thislen = thisline->length - 1 - (thisfield - thisline->buffer);
@ -3985,7 +4031,7 @@ Index: src/uniq.c
match = !different (thisfield, prevfield, thislen, prevlen); match = !different (thisfield, prevfield, thislen, prevlen);
match_count += match; match_count += match;
@@ -382,6 +611,9 @@ check_file (const char *infile, const ch @@ -382,6 +619,9 @@ check_file (const char *infile, const ch
SWAP_LINES (prevline, thisline); SWAP_LINES (prevline, thisline);
prevfield = thisfield; prevfield = thisfield;
prevlen = thislen; prevlen = thislen;
@ -3995,7 +4041,7 @@ Index: src/uniq.c
if (!match) if (!match)
match_count = 0; match_count = 0;
} }
@@ -427,6 +659,19 @@ main (int argc, char **argv) @@ -427,6 +667,19 @@ main (int argc, char **argv)
atexit (close_stdout); atexit (close_stdout);
@ -4017,8 +4063,8 @@ Index: src/uniq.c
check_chars = SIZE_MAX; check_chars = SIZE_MAX;
Index: tests/Makefile.am Index: tests/Makefile.am
=================================================================== ===================================================================
--- tests/Makefile.am.orig 2012-05-10 16:36:42.000000000 +0200 --- tests/Makefile.am.orig
+++ tests/Makefile.am 2012-06-19 12:13:47.374654199 +0200 +++ tests/Makefile.am
@@ -247,6 +247,7 @@ TESTS = \ @@ -247,6 +247,7 @@ TESTS = \
misc/sort-debug-warn \ misc/sort-debug-warn \
misc/sort-discrim \ misc/sort-discrim \
@ -4040,8 +4086,8 @@ Index: tests/Makefile.am
pr/0FFnt \ pr/0FFnt \
Index: tests/misc/cut Index: tests/misc/cut
=================================================================== ===================================================================
--- tests/misc/cut.orig 2012-02-03 10:22:06.000000000 +0100 --- tests/misc/cut.orig
+++ tests/misc/cut 2012-06-19 12:13:47.374654199 +0200 +++ tests/misc/cut
@@ -30,7 +30,7 @@ my $mb_locale = $ENV{LOCALE_FR_UTF8}; @@ -30,7 +30,7 @@ my $mb_locale = $ENV{LOCALE_FR_UTF8};
my $prog = 'cut'; my $prog = 'cut';
my $try = "Try '$prog --help' for more information.\n"; my $try = "Try '$prog --help' for more information.\n";
@ -4060,10 +4106,31 @@ Index: tests/misc/cut
['inval2', qw(-f -), {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], ['inval2', qw(-f -), {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
['inval3', '-f', '4,-', {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}, ['inval4', '-f', '1-2,-', {IN=>''}, {OUT=>''}, {EXIT=>1},
@@ -176,13 +176,13 @@ if ($mb_locale ne 'C')
# non-MB: invalid byte or field list
# MB: invalid byte, character or field list
# Adjust the expected error output accordingly.
- if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval}
- (@new_t))
- {
- my $sub = {ERR_SUBST => 's/, character//'};
- push @new_t, $sub;
- push @$t, $sub;
- }
+# if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval}
+# (@new_t))
+# {
+# my $sub = {ERR_SUBST => 's/, character//'};
+# push @new_t, $sub;
+# push @$t, $sub;
+# }
push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
}
push @Tests, @new;
Index: tests/misc/mb1.I Index: tests/misc/mb1.I
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null
+++ tests/misc/mb1.I 2012-06-19 12:13:47.374654199 +0200 +++ tests/misc/mb1.I
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
+Apple10 +Apple10
+Banana5 +Banana5
@ -4071,8 +4138,8 @@ Index: tests/misc/mb1.I
+Cherry30 +Cherry30
Index: tests/misc/mb1.X Index: tests/misc/mb1.X
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null
+++ tests/misc/mb1.X 2012-06-19 12:13:47.374654199 +0200 +++ tests/misc/mb1.X
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
+Banana5 +Banana5
+Apple10 +Apple10
@ -4080,8 +4147,8 @@ Index: tests/misc/mb1.X
+Cherry30 +Cherry30
Index: tests/misc/mb2.I Index: tests/misc/mb2.I
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null
+++ tests/misc/mb2.I 2012-06-19 12:13:47.374654199 +0200 +++ tests/misc/mb2.I
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
+Apple1020 +Apple1020
+Banana530 +Banana530
@ -4089,8 +4156,8 @@ Index: tests/misc/mb2.I
+Cherry3010 +Cherry3010
Index: tests/misc/mb2.X Index: tests/misc/mb2.X
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null
+++ tests/misc/mb2.X 2012-06-19 12:13:47.374654199 +0200 +++ tests/misc/mb2.X
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
+Citrus205 +Citrus205
+Cherry3010 +Cherry3010
@ -4098,8 +4165,8 @@ Index: tests/misc/mb2.X
+Banana530 +Banana530
Index: tests/misc/sort-mb-tests Index: tests/misc/sort-mb-tests
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null
+++ tests/misc/sort-mb-tests 2012-06-19 12:13:47.375654176 +0200 +++ tests/misc/sort-mb-tests
@@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
+#! /bin/sh +#! /bin/sh
+case $# in +case $# in

View File

@ -13,8 +13,8 @@ Andreas Gruenbacher <agruen@suse.de>
Index: src/chgrp.c Index: src/chgrp.c
=================================================================== ===================================================================
--- src/chgrp.c.orig 2012-03-24 19:22:13.000000000 +0100 --- src/chgrp.c.orig
+++ src/chgrp.c 2012-04-16 13:22:03.004026462 +0200 +++ src/chgrp.c
@@ -88,7 +88,7 @@ parse_group (const char *name) @@ -88,7 +88,7 @@ parse_group (const char *name)
{ {
unsigned long int tmp; unsigned long int tmp;

View File

@ -1,7 +1,7 @@
Index: gnulib-tests/test-isnanl.h Index: gnulib-tests/test-isnanl.h
=================================================================== ===================================================================
--- gnulib-tests/test-isnanl.h.orig 2012-01-06 08:20:50.000000000 +0100 --- gnulib-tests/test-isnanl.h.orig
+++ gnulib-tests/test-isnanl.h 2012-04-16 13:22:02.969027310 +0200 +++ gnulib-tests/test-isnanl.h
@@ -47,7 +47,7 @@ main () @@ -47,7 +47,7 @@ main ()
/* Quiet NaN. */ /* Quiet NaN. */
ASSERT (isnanl (NaNl ())); ASSERT (isnanl (NaNl ()));
@ -29,8 +29,8 @@ Index: gnulib-tests/test-isnanl.h
} }
Index: tests/misc/help-version Index: tests/misc/help-version
=================================================================== ===================================================================
--- tests/misc/help-version.orig 2012-03-24 19:22:13.000000000 +0100 --- tests/misc/help-version.orig
+++ tests/misc/help-version 2012-04-16 13:22:02.970027285 +0200 +++ tests/misc/help-version
@@ -251,6 +251,7 @@ parted_setup () { args="-s $tmp_in mklab @@ -251,6 +251,7 @@ parted_setup () { args="-s $tmp_in mklab
for i in $built_programs; do for i in $built_programs; do
# Skip these. # Skip these.
@ -41,8 +41,8 @@ Index: tests/misc/help-version
echo z |gzip > $zin echo z |gzip > $zin
Index: tests/other-fs-tmpdir Index: tests/other-fs-tmpdir
=================================================================== ===================================================================
--- tests/other-fs-tmpdir.orig 2012-03-24 19:22:13.000000000 +0100 --- tests/other-fs-tmpdir.orig
+++ tests/other-fs-tmpdir 2012-04-16 13:22:02.970027285 +0200 +++ tests/other-fs-tmpdir
@@ -43,6 +43,9 @@ for d in $CANDIDATE_TMP_DIRS; do @@ -43,6 +43,9 @@ for d in $CANDIDATE_TMP_DIRS; do
done done

View File

@ -1,8 +1,8 @@
Index: src/join.c Index: src/join.c
=================================================================== ===================================================================
--- src/join.c.orig 2012-04-16 16:54:22.032279169 +0200 --- src/join.c.orig
+++ src/join.c 2012-04-16 16:54:22.163275636 +0200 +++ src/join.c
@@ -1320,7 +1320,7 @@ main (int argc, char **argv) @@ -1335,7 +1335,7 @@ main (int argc, char **argv)
case 't': case 't':
{ {
@ -11,7 +11,7 @@ Index: src/join.c
size_t newtablen; size_t newtablen;
newtab = xstrdup (optarg); newtab = xstrdup (optarg);
#if HAVE_MBRTOWC #if HAVE_MBRTOWC
@@ -1342,7 +1342,7 @@ main (int argc, char **argv) @@ -1357,7 +1357,7 @@ main (int argc, char **argv)
newtablen = 1; newtablen = 1;
if (! newtab) if (! newtab)
{ {

View File

@ -1,7 +1,7 @@
Index: doc/coreutils.texi Index: doc/coreutils.texi
=================================================================== ===================================================================
--- doc/coreutils.texi.orig 2012-03-26 07:38:37.000000000 +0200 --- doc/coreutils.texi.orig
+++ doc/coreutils.texi 2012-04-16 13:22:12.487797130 +0200 +++ doc/coreutils.texi
@@ -66,7 +66,6 @@ @@ -66,7 +66,6 @@
* groups: (coreutils)groups invocation. Print group names a user is in. * groups: (coreutils)groups invocation. Print group names a user is in.
* head: (coreutils)head invocation. Output the first part of files. * head: (coreutils)head invocation. Output the first part of files.
@ -27,7 +27,7 @@ Index: doc/coreutils.texi
* hostid invocation:: Print numeric host identifier * hostid invocation:: Print numeric host identifier
* uptime invocation:: Print system uptime and load * uptime invocation:: Print system uptime and load
@@ -14135,7 +14133,6 @@ information. @@ -14145,7 +14143,6 @@ information.
* arch invocation:: Print machine hardware name. * arch invocation:: Print machine hardware name.
* nproc invocation:: Print the number of processors. * nproc invocation:: Print the number of processors.
* uname invocation:: Print system information. * uname invocation:: Print system information.
@ -35,7 +35,7 @@ Index: doc/coreutils.texi
* hostid invocation:: Print numeric host identifier. * hostid invocation:: Print numeric host identifier.
* uptime invocation:: Print system uptime and load. * uptime invocation:: Print system uptime and load.
@end menu @end menu
@@ -14922,15 +14919,6 @@ easily available, as is the case with Li @@ -14932,15 +14929,6 @@ easily available, as is the case with Li
Print the machine hardware name (sometimes called the hardware class Print the machine hardware name (sometimes called the hardware class
or hardware type). or hardware type).
@ -51,7 +51,7 @@ Index: doc/coreutils.texi
@item -p @item -p
@itemx --processor @itemx --processor
@opindex -p @opindex -p
@@ -14984,30 +14972,6 @@ Print the kernel version. @@ -14994,30 +14982,6 @@ Print the kernel version.
@exitstatus @exitstatus
@ -84,8 +84,8 @@ Index: doc/coreutils.texi
@section @command{hostid}: Print numeric host identifier @section @command{hostid}: Print numeric host identifier
Index: man/Makefile.am Index: man/Makefile.am
=================================================================== ===================================================================
--- man/Makefile.am.orig 2012-03-26 11:50:41.000000000 +0200 --- man/Makefile.am.orig
+++ man/Makefile.am 2012-04-16 13:22:02.980027043 +0200 +++ man/Makefile.am
@@ -199,7 +199,7 @@ check-x-vs-1: @@ -199,7 +199,7 @@ check-x-vs-1:
@PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \ @PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \
t=$@-t; \ t=$@-t; \
@ -97,9 +97,9 @@ Index: man/Makefile.am
rm $$t rm $$t
Index: man/Makefile.in Index: man/Makefile.in
=================================================================== ===================================================================
--- man/Makefile.in.orig 2012-03-26 11:50:44.000000000 +0200 --- man/Makefile.in.orig
+++ man/Makefile.in 2012-04-16 13:22:02.980027043 +0200 +++ man/Makefile.in
@@ -2030,7 +2030,7 @@ check-x-vs-1: @@ -2065,7 +2065,7 @@ check-x-vs-1:
@PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \ @PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \
t=$@-t; \ t=$@-t; \
(cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\ (cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\

View File

@ -0,0 +1,29 @@
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Sun, 20 Jan 2013 14:12:00 +0200
Subject: [PATCH] Skip tests/du/slink on OBS
This test does not work on OBS infrastructure.
Discussed at:
http://lists.gnu.org/archive/html/coreutils/2013-01/msg00053.html
The test will be removed upstreams with coreutils-8.21.
Until then, skip this test.
---
tests/du/slink | 2 ++
1 file changed, 2 insertions(+)
Index: coreutils-8.17/tests/du/slink
===================================================================
--- coreutils-8.17.orig/tests/du/slink
+++ coreutils-8.17/tests/du/slink
@@ -19,6 +19,8 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../src
print_ver_ du
+skip_ "test does not work on OpenSUSE Build Service infrastructure"
+
# Determine if '.' is on a local (would non-NFS be sufficient?) file system.
# At least on OSF/1 4.0d, when using an nfsv3 file system,
# each created symlink can end up having a size of 0.

View File

@ -1,7 +1,7 @@
Index: src/uname.c Index: src/uname.c
=================================================================== ===================================================================
--- src/uname.c.orig 2012-03-24 21:26:51.000000000 +0100 --- src/uname.c.orig
+++ src/uname.c 2012-04-16 13:22:02.996026656 +0200 +++ src/uname.c
@@ -337,6 +337,36 @@ main (int argc, char **argv) @@ -337,6 +337,36 @@ main (int argc, char **argv)
# endif # endif
} }

View File

@ -1,3 +1,99 @@
-------------------------------------------------------------------
Sun Jan 20 13:18:28 UTC 2013 - mail@bernhard-voelker.de
- Avoid segmentation fault in "join -i" with long line input (bnc#798541, VUL-1)
* src/join.c: Instead of usig unreliable alloca() stack allocation,
use heap allocation via xmalloc()+free().
(coreutils-i18n.patch, from Philipp Thomas <pth@suse.de>)
- Avoid segmentation fault in "sort -d" and "sort -M" with long line input
(bnc#798538, VUL-1)
* src/sort.c: Instead of usig unreliable alloca() stack allocation,
use heap allocation via xmalloc()+free().
(coreutils-i18n.patch, from Philipp Thomas <pth@suse.de>)
- Avoid segmentation fault in "uniq" with long line input (bnc#796243, VUL-1)
* src/cut.c: Instead of usig unreliable alloca() stack allocation,
use heap allocation via xmalloc()+free().
(coreutils-i18n.patch)
- Fix test-suite errors (bnc#798261).
* tests/cp/fiemap-FMR: Fix path to src directory and declare
require_valgrind_ function.
(coreutils-cp-corrupt-fragmented-sparse.patch)
* tests/misc/cut:
Fix src/cut.c to properly pass output-delimiter tests.
Synchronize cut.c related part of the i18n patch with Fedora's.
Merge coreutils-i18n-infloop.patch into coreutils-i18n.patch.
Merge coreutils-i18n-uninit.patch into coreutils-i18n.patch.
In tests/misc/cut, do not replace the non-i18n error messages.
(coreutils-i18n.patch)
* tests/rm/ext3-perf:
This test failed due to heavy parallel CPU and/or disk load because it
is based on timeouts. Do not run the test-suite with 'make -jN.
(coreutils.spec, coreutils-testsuite.spec)
* tests/du/slink:
This test fails on OBS infrastructure and will be removed upstreams
in coreutils-8.21 anyway. Skip the test until we upgrade.
Upstream discussion:
http://lists.gnu.org/archive/html/coreutils/2013-01/msg00053.html
(coreutils-skip-du-slink-test.patch)
* Further spec changes:
Run more tests: also run "very expensive" tests; add acl, python-pyinotify,
strace and valgrind to the build requirements.
Remove patch5 and patch6 as they are now merged into coreutils-i18n.patch
(see above).
(coreutils.spec, coreutils-testsuite.spec)
- Maintenance changes:
(coreutils.spec, coreutils-testsuite.spec)
* Add perl and texinfo to the build requirements as they are needed to
re-generate the man pages and the texinfo documentation.
* Remove already-active "-Wall" compiler option from CFLAGS variable.
* Install the compressed test-suite.log into the documentation directory
of the coreutils-testsuite package (section %check and %files).
* Properly guard the spec sections for the coreutils and the
coreutils-testsuite package.
* Update patches to reflect new line numbers.
-------------------------------------------------------------------
Thu Jan 10 21:18:52 CET 2013 - phisama@suse.de
- Hardcode the name passed to find_lang so that it works for
coreutils-testsuite too.
-------------------------------------------------------------------
Thu Jan 10 11:58:17 CET 2013 - pth@suse.de
- Don't call autoreconf on distributions older then 12.0
because their autoconf is too old, so also patch Makefile.in
in addition to Makefile.am where needed.
-------------------------------------------------------------------
Tue Dec 4 08:16:35 UTC 2012 - mail@bernhard-voelker.de
- Update default posix version to 200112 (bnc#783352).
- Add coreutils-df-always-hide-rootfs.patch:
Hide rootfs in df (df not using yet /proc/self/mountinfo).
-------------------------------------------------------------------
Mon Nov 19 13:04:44 UTC 2012 - idonmez@suse.com
- Statically link to gmp otherwise expr depends on gmp and gmp
configure script depends on expr which creates a build cycle.
-------------------------------------------------------------------
Thu Nov 8 13:12:25 CET 2012 - pth@suse.de
- Add the missing parts in coreutil.spec so that the testsuite is
only run when coreutils-testsuite is built. Also add additional
BuildRequires for the testsuite.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Nov 6 13:23:45 CET 2012 - pth@suse.de Tue Nov 6 13:23:45 CET 2012 - pth@suse.de

View File

@ -1,7 +1,7 @@
# #
# spec file for package coreutils-testsuite # spec file for package coreutils-testsuite
# #
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -27,9 +27,15 @@ BuildRequires: libacl-devel
BuildRequires: libcap-devel BuildRequires: libcap-devel
BuildRequires: libselinux-devel BuildRequires: libselinux-devel
BuildRequires: pam-devel BuildRequires: pam-devel
BuildRequires: perl
BuildRequires: texinfo
%if "%{name}" == "coreutils-testsuite" %if "%{name}" == "coreutils-testsuite"
BuildRequires: acl
BuildRequires: gdb BuildRequires: gdb
BuildRequires: perl-Expect BuildRequires: perl-Expect
BuildRequires: python-pyinotify
BuildRequires: strace
BuildRequires: valgrind
%endif %endif
BuildRequires: xz BuildRequires: xz
Url: http://www.gnu.org/software/coreutils/ Url: http://www.gnu.org/software/coreutils/
@ -62,8 +68,6 @@ Patch1: coreutils-remove_hostname_documentation.patch
Patch2: coreutils-gl_printf_safe.patch Patch2: coreutils-gl_printf_safe.patch
#Remove the bogus coreutils version from the i18n patch name #Remove the bogus coreutils version from the i18n patch name
Patch4: coreutils-i18n.patch Patch4: coreutils-i18n.patch
Patch5: coreutils-i18n-uninit.patch
Patch6: coreutils-i18n-infloop.patch
Patch8: coreutils-sysinfo.patch Patch8: coreutils-sysinfo.patch
Patch16: coreutils-invalid-ids.patch Patch16: coreutils-invalid-ids.patch
Patch20: coreutils-8.6-pam-support-for-su.diff Patch20: coreutils-8.6-pam-support-for-su.diff
@ -82,11 +86,14 @@ Patch36: coreutils-basename_documentation.patch
Patch37: coreutils-bnc#697897-setsid.patch Patch37: coreutils-bnc#697897-setsid.patch
Patch38: coreutils-cp-corrupt-fragmented-sparse.patch Patch38: coreutils-cp-corrupt-fragmented-sparse.patch
Patch39: coreutils-no_silent-rule.patch Patch39: coreutils-no_silent-rule.patch
Patch40: coreutils-df-always-hide-rootfs.patch
Patch41: coreutils-skip-du-slink-test.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
# this will create a cycle, broken up randomly - coreutils is just too core to have other # this will create a cycle, broken up randomly - coreutils is just too core to have other
# prerequires # prerequires
#PreReq: permissions #PreReq: permissions
# ================================================
%description %description
Basic file, shell, and text manipulation utilities. The package Basic file, shell, and text manipulation utilities. The package
contains the following programs: contains the following programs:
@ -100,12 +107,11 @@ sha224sum sha256sum sha384sum sha512sum shred shuf sleep sort split
stat stty su sum sync tac tail tee test timeout touch tr true tsort tty stat stty su sum sync tac tail tee test timeout touch tr true tsort tty
uname unexpand uniq unlink uptime users vdir wc who whoami yes uname unexpand uniq unlink uptime users vdir wc who whoami yes
# ================================================
%lang_package %lang_package
%prep %prep
%setup -q -n coreutils-%{version} %setup -q -n coreutils-%{version}
%patch4 %patch4
%patch5
%patch6
%patch0 %patch0
%patch1 %patch1
%patch2 %patch2
@ -117,7 +123,6 @@ uname unexpand uniq unlink uptime users vdir wc who whoami yes
%patch23 -p1 %patch23 -p1
%patch24 %patch24
%patch25 %patch25
#
%patch30 %patch30
%patch31 %patch31
%patch32 %patch32
@ -129,27 +134,42 @@ uname unexpand uniq unlink uptime users vdir wc who whoami yes
%if 0%{suse_version} < 1200 %if 0%{suse_version} < 1200
%patch39 %patch39
%endif %endif
%patch40 -p1
%patch41 -p1
xz -dc %{S:4} >po/de.po xz -dc %{S:4} >po/de.po
# We need to statically link to gmp, otherwise we have a build loop
sed -i s,'$(LIB_GMP)',%{_libdir}/libgmp.a,g src/Makefile.am
# ================================================
%build %build
%if 0%{suse_version} >= 1200
AUTOPOINT=true autoreconf -fi AUTOPOINT=true autoreconf -fi
export CFLAGS="%optflags -Wall" %endif
export CFLAGS="%optflags"
%configure --libexecdir=%{_libdir} --without-included-regex \ %configure --libexecdir=%{_libdir} --without-included-regex \
--enable-install-program=arch,su \ --enable-install-program=arch,su \
gl_cv_func_printf_directive_n=yes \ gl_cv_func_printf_directive_n=yes \
gl_cv_func_isnanl_works=yes \ gl_cv_func_isnanl_works=yes \
DEFAULT_POSIX2_VERSION=199209 DEFAULT_POSIX2_VERSION=200112 alternative=199209
make -C po update-po make -C po update-po
make %{?_smp_mflags} V=1 make %{?_smp_mflags} V=1
%if "%{name}" == "coreutils-testsuite" # ================================================
%check %check
make %{?_smp_mflags} check-very-expensive %if "%{name}" == "coreutils-testsuite"
# Avoid parallel make, because otherwise some timeout based tests like
# rm/ext3-perf may fail due to high CPU or IO load.
make check-very-expensive
install -d -m 755 %{buildroot}%{_docdir}/%{name}
xz -c tests/test-suite.log > %{buildroot}%{_docdir}/%{name}/test-suite.log.xz
%endif %endif
# ================================================
%install %install
%if "%{name}" == "coreutils"
%makeinstall pkglibexecdir=%{_libdir}/%{name} %makeinstall pkglibexecdir=%{_libdir}/%{name}
test -f %{buildroot}%{_bindir}/su || \ test -f %{buildroot}%{_bindir}/su || \
install src/su %{buildroot}%{_bindir}/su install src/su %{buildroot}%{_bindir}/su
@ -157,7 +177,7 @@ test -f %{buildroot}%{_bindir}/su || \
install -d %{buildroot}/bin install -d %{buildroot}/bin
for i in arch basename cat chgrp chmod chown cp date dd df echo false kill ln ls mkdir mknod mktemp mv pwd rm rmdir sleep sort stat stty su sync touch true uname readlink md5sum for i in arch basename cat chgrp chmod chown cp date dd df echo false kill ln ls mkdir mknod mktemp mv pwd rm rmdir sleep sort stat stty su sync touch true uname readlink md5sum
do do
ln -sf %{_bindir}/$i %{buildroot}/bin/$i ln -sf %{_bindir}/$i %{buildroot}/bin/$i
done done
#EndUsrMerge #EndUsrMerge
install -d -m 755 %{buildroot}/etc/pam.d install -d -m 755 %{buildroot}/etc/pam.d
@ -166,20 +186,27 @@ install -m 644 %{S:1} %{buildroot}/etc/pam.d/su-l
install -d -m 755 %{buildroot}/etc/default install -d -m 755 %{buildroot}/etc/default
install -m 644 %{S:2} %{buildroot}/etc/default/su install -m 644 %{S:2} %{buildroot}/etc/default/su
echo '.so man1/test.1' > %{buildroot}/%{_mandir}/man1/\[.1 echo '.so man1/test.1' > %{buildroot}/%{_mandir}/man1/\[.1
%find_lang %name %find_lang coreutils
%endif
# ================================================
%post %post
%install_info --info-dir=%{_infodir} %{_infodir}/coreutils.info.gz %install_info --info-dir=%{_infodir} %{_infodir}/coreutils.info.gz
# may fail if permissions is not there, but there is no way around that # may fail if permissions is not there, but there is no way around that
%set_permissions %{_bindir}/su %set_permissions %{_bindir}/su
# ================================================
%postun %postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/coreutils.info.gz %install_info_delete --info-dir=%{_infodir} %{_infodir}/coreutils.info.gz
# ================================================
%verifyscript %verifyscript
%verify_permissions -e %{_bindir}/su %verify_permissions -e %{_bindir}/su
# ================================================
%files %files
%if "%{name}" == "coreutils"
%defattr(-,root,root) %defattr(-,root,root)
%doc README NEWS %doc README NEWS
%config %{_sysconfdir}/pam.d/su %config %{_sysconfdir}/pam.d/su
@ -195,7 +222,17 @@ echo '.so man1/test.1' > %{buildroot}/%{_mandir}/man1/\[.1
%doc %{_mandir}/man1/*.1.gz %doc %{_mandir}/man1/*.1.gz
%dir %{_prefix}/share/locale/*/LC_TIME %dir %{_prefix}/share/locale/*/LC_TIME
%files lang -f %name.lang %files lang -f coreutils.lang
%defattr(-,root,root) %defattr(-,root,root)
%else
# test-suite
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/test-suite.log.xz
%endif
# ================================================
%changelog %changelog

View File

@ -1,3 +1,79 @@
-------------------------------------------------------------------
Sun Jan 20 13:18:28 UTC 2013 - mail@bernhard-voelker.de
- Avoid segmentation fault in "join -i" with long line input (bnc#798541, VUL-1)
* src/join.c: Instead of usig unreliable alloca() stack allocation,
use heap allocation via xmalloc()+free().
(coreutils-i18n.patch, from Philipp Thomas <pth@suse.de>)
- Avoid segmentation fault in "sort -d" and "sort -M" with long line input
(bnc#798538, VUL-1)
* src/sort.c: Instead of usig unreliable alloca() stack allocation,
use heap allocation via xmalloc()+free().
(coreutils-i18n.patch, from Philipp Thomas <pth@suse.de>)
- Avoid segmentation fault in "uniq" with long line input (bnc#796243, VUL-1)
* src/cut.c: Instead of usig unreliable alloca() stack allocation,
use heap allocation via xmalloc()+free().
(coreutils-i18n.patch)
- Fix test-suite errors (bnc#798261).
* tests/cp/fiemap-FMR: Fix path to src directory and declare
require_valgrind_ function.
(coreutils-cp-corrupt-fragmented-sparse.patch)
* tests/misc/cut:
Fix src/cut.c to properly pass output-delimiter tests.
Synchronize cut.c related part of the i18n patch with Fedora's.
Merge coreutils-i18n-infloop.patch into coreutils-i18n.patch.
Merge coreutils-i18n-uninit.patch into coreutils-i18n.patch.
In tests/misc/cut, do not replace the non-i18n error messages.
(coreutils-i18n.patch)
* tests/rm/ext3-perf:
This test failed due to heavy parallel CPU and/or disk load because it
is based on timeouts. Do not run the test-suite with 'make -jN.
(coreutils.spec, coreutils-testsuite.spec)
* tests/du/slink:
This test fails on OBS infrastructure and will be removed upstreams
in coreutils-8.21 anyway. Skip the test until we upgrade.
Upstream discussion:
http://lists.gnu.org/archive/html/coreutils/2013-01/msg00053.html
(coreutils-skip-du-slink-test.patch)
* Further spec changes:
Run more tests: also run "very expensive" tests; add acl, python-pyinotify,
strace and valgrind to the build requirements.
Remove patch5 and patch6 as they are now merged into coreutils-i18n.patch
(see above).
(coreutils.spec, coreutils-testsuite.spec)
- Maintenance changes:
(coreutils.spec, coreutils-testsuite.spec)
* Add perl and texinfo to the build requirements as they are needed to
re-generate the man pages and the texinfo documentation.
* Remove already-active "-Wall" compiler option from CFLAGS variable.
* Install the compressed test-suite.log into the documentation directory
of the coreutils-testsuite package (section %check and %files).
* Properly guard the spec sections for the coreutils and the
coreutils-testsuite package.
* Update patches to reflect new line numbers.
-------------------------------------------------------------------
Thu Jan 10 21:18:52 CET 2013 - phisama@suse.de
- Hardcode the name passed to find_lang so that it works for
coreutils-testsuite too.
-------------------------------------------------------------------
Thu Jan 10 11:58:17 CET 2013 - pth@suse.de
- Don't call autoreconf on distributions older then 12.0
because their autoconf is too old, so also patch Makefile.in
in addition to Makefile.am where needed.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Dec 4 08:16:35 UTC 2012 - mail@bernhard-voelker.de Tue Dec 4 08:16:35 UTC 2012 - mail@bernhard-voelker.de

View File

@ -1,7 +1,7 @@
# #
# spec file for package coreutils # spec file for package coreutils
# #
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -27,9 +27,15 @@ BuildRequires: libacl-devel
BuildRequires: libcap-devel BuildRequires: libcap-devel
BuildRequires: libselinux-devel BuildRequires: libselinux-devel
BuildRequires: pam-devel BuildRequires: pam-devel
BuildRequires: perl
BuildRequires: texinfo
%if "%{name}" == "coreutils-testsuite" %if "%{name}" == "coreutils-testsuite"
BuildRequires: acl
BuildRequires: gdb BuildRequires: gdb
BuildRequires: perl-Expect BuildRequires: perl-Expect
BuildRequires: python-pyinotify
BuildRequires: strace
BuildRequires: valgrind
%endif %endif
BuildRequires: xz BuildRequires: xz
Url: http://www.gnu.org/software/coreutils/ Url: http://www.gnu.org/software/coreutils/
@ -62,8 +68,6 @@ Patch1: coreutils-remove_hostname_documentation.patch
Patch2: coreutils-gl_printf_safe.patch Patch2: coreutils-gl_printf_safe.patch
#Remove the bogus coreutils version from the i18n patch name #Remove the bogus coreutils version from the i18n patch name
Patch4: coreutils-i18n.patch Patch4: coreutils-i18n.patch
Patch5: coreutils-i18n-uninit.patch
Patch6: coreutils-i18n-infloop.patch
Patch8: coreutils-sysinfo.patch Patch8: coreutils-sysinfo.patch
Patch16: coreutils-invalid-ids.patch Patch16: coreutils-invalid-ids.patch
Patch20: coreutils-8.6-pam-support-for-su.diff Patch20: coreutils-8.6-pam-support-for-su.diff
@ -83,11 +87,13 @@ Patch37: coreutils-bnc#697897-setsid.patch
Patch38: coreutils-cp-corrupt-fragmented-sparse.patch Patch38: coreutils-cp-corrupt-fragmented-sparse.patch
Patch39: coreutils-no_silent-rule.patch Patch39: coreutils-no_silent-rule.patch
Patch40: coreutils-df-always-hide-rootfs.patch Patch40: coreutils-df-always-hide-rootfs.patch
Patch41: coreutils-skip-du-slink-test.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
# this will create a cycle, broken up randomly - coreutils is just too core to have other # this will create a cycle, broken up randomly - coreutils is just too core to have other
# prerequires # prerequires
#PreReq: permissions #PreReq: permissions
# ================================================
%description %description
Basic file, shell, and text manipulation utilities. The package Basic file, shell, and text manipulation utilities. The package
contains the following programs: contains the following programs:
@ -101,12 +107,11 @@ sha224sum sha256sum sha384sum sha512sum shred shuf sleep sort split
stat stty su sum sync tac tail tee test timeout touch tr true tsort tty stat stty su sum sync tac tail tee test timeout touch tr true tsort tty
uname unexpand uniq unlink uptime users vdir wc who whoami yes uname unexpand uniq unlink uptime users vdir wc who whoami yes
# ================================================
%lang_package %lang_package
%prep %prep
%setup -q -n coreutils-%{version} %setup -q -n coreutils-%{version}
%patch4 %patch4
%patch5
%patch6
%patch0 %patch0
%patch1 %patch1
%patch2 %patch2
@ -118,7 +123,6 @@ uname unexpand uniq unlink uptime users vdir wc who whoami yes
%patch23 -p1 %patch23 -p1
%patch24 %patch24
%patch25 %patch25
#
%patch30 %patch30
%patch31 %patch31
%patch32 %patch32
@ -131,15 +135,19 @@ uname unexpand uniq unlink uptime users vdir wc who whoami yes
%patch39 %patch39
%endif %endif
%patch40 -p1 %patch40 -p1
%patch41 -p1
xz -dc %{S:4} >po/de.po xz -dc %{S:4} >po/de.po
# We need to statically link to gmp, otherwise we have a build loop # We need to statically link to gmp, otherwise we have a build loop
sed -i s,'$(LIB_GMP)',%{_libdir}/libgmp.a,g src/Makefile.am sed -i s,'$(LIB_GMP)',%{_libdir}/libgmp.a,g src/Makefile.am
# ================================================
%build %build
%if 0%{suse_version} >= 1200
AUTOPOINT=true autoreconf -fi AUTOPOINT=true autoreconf -fi
export CFLAGS="%optflags -Wall" %endif
export CFLAGS="%optflags"
%configure --libexecdir=%{_libdir} --without-included-regex \ %configure --libexecdir=%{_libdir} --without-included-regex \
--enable-install-program=arch,su \ --enable-install-program=arch,su \
gl_cv_func_printf_directive_n=yes \ gl_cv_func_printf_directive_n=yes \
@ -149,12 +157,19 @@ export CFLAGS="%optflags -Wall"
make -C po update-po make -C po update-po
make %{?_smp_mflags} V=1 make %{?_smp_mflags} V=1
%if "%{name}" == "coreutils-testsuite" # ================================================
%check %check
make %{?_smp_mflags} check-very-expensive %if "%{name}" == "coreutils-testsuite"
# Avoid parallel make, because otherwise some timeout based tests like
# rm/ext3-perf may fail due to high CPU or IO load.
make check-very-expensive
install -d -m 755 %{buildroot}%{_docdir}/%{name}
xz -c tests/test-suite.log > %{buildroot}%{_docdir}/%{name}/test-suite.log.xz
%endif %endif
# ================================================
%install %install
%if "%{name}" == "coreutils"
%makeinstall pkglibexecdir=%{_libdir}/%{name} %makeinstall pkglibexecdir=%{_libdir}/%{name}
test -f %{buildroot}%{_bindir}/su || \ test -f %{buildroot}%{_bindir}/su || \
install src/su %{buildroot}%{_bindir}/su install src/su %{buildroot}%{_bindir}/su
@ -162,7 +177,7 @@ test -f %{buildroot}%{_bindir}/su || \
install -d %{buildroot}/bin install -d %{buildroot}/bin
for i in arch basename cat chgrp chmod chown cp date dd df echo false kill ln ls mkdir mknod mktemp mv pwd rm rmdir sleep sort stat stty su sync touch true uname readlink md5sum for i in arch basename cat chgrp chmod chown cp date dd df echo false kill ln ls mkdir mknod mktemp mv pwd rm rmdir sleep sort stat stty su sync touch true uname readlink md5sum
do do
ln -sf %{_bindir}/$i %{buildroot}/bin/$i ln -sf %{_bindir}/$i %{buildroot}/bin/$i
done done
#EndUsrMerge #EndUsrMerge
install -d -m 755 %{buildroot}/etc/pam.d install -d -m 755 %{buildroot}/etc/pam.d
@ -171,20 +186,27 @@ install -m 644 %{S:1} %{buildroot}/etc/pam.d/su-l
install -d -m 755 %{buildroot}/etc/default install -d -m 755 %{buildroot}/etc/default
install -m 644 %{S:2} %{buildroot}/etc/default/su install -m 644 %{S:2} %{buildroot}/etc/default/su
echo '.so man1/test.1' > %{buildroot}/%{_mandir}/man1/\[.1 echo '.so man1/test.1' > %{buildroot}/%{_mandir}/man1/\[.1
%find_lang %name %find_lang coreutils
%endif
# ================================================
%post %post
%install_info --info-dir=%{_infodir} %{_infodir}/coreutils.info.gz %install_info --info-dir=%{_infodir} %{_infodir}/coreutils.info.gz
# may fail if permissions is not there, but there is no way around that # may fail if permissions is not there, but there is no way around that
%set_permissions %{_bindir}/su %set_permissions %{_bindir}/su
# ================================================
%postun %postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/coreutils.info.gz %install_info_delete --info-dir=%{_infodir} %{_infodir}/coreutils.info.gz
# ================================================
%verifyscript %verifyscript
%verify_permissions -e %{_bindir}/su %verify_permissions -e %{_bindir}/su
# ================================================
%files %files
%if "%{name}" == "coreutils"
%defattr(-,root,root) %defattr(-,root,root)
%doc README NEWS %doc README NEWS
%config %{_sysconfdir}/pam.d/su %config %{_sysconfdir}/pam.d/su
@ -200,7 +222,17 @@ echo '.so man1/test.1' > %{buildroot}/%{_mandir}/man1/\[.1
%doc %{_mandir}/man1/*.1.gz %doc %{_mandir}/man1/*.1.gz
%dir %{_prefix}/share/locale/*/LC_TIME %dir %{_prefix}/share/locale/*/LC_TIME
%files lang -f %name.lang %files lang -f coreutils.lang
%defattr(-,root,root) %defattr(-,root,root)
%else
# test-suite
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/test-suite.log.xz
%endif
# ================================================
%changelog %changelog