From 45ce637bf48d3bab2b2804735c720c0c1e41e92c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?=
Date: Fri, 22 Apr 2016 14:14:54 +0100
Subject: [PATCH 001/232] maint: remove build workarounds for old upstream bugs
* coreutils.spec: coreutils 8.25 fixed a couple of issues,
so remove our workarounds.
---
coreutils.spec | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/coreutils.spec b/coreutils.spec
index a056fe0..783c211 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -219,10 +219,9 @@ for type in separate single; do
%configure $config_single \
--cache-file=../config.cache \
--enable-install-program=arch \
- --enable-no-install-program=uptime \
+ --enable-no-install-program=kill,uptime \
--with-tty-group \
DEFAULT_POSIX2_VERSION=200112 alternative=199209 || :
- mkdir src # not needed with coreutils > 8.24
make all %{?_smp_mflags})
done
@@ -276,15 +275,6 @@ install -p -c -m644 %SOURCE103 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS.256color
install -p -c -m644 %SOURCE105 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.sh
install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.csh
-# These come from util-linux and/or procps.
-# With coreutils > 8.24 one can just add to --enable-no-install-program
-# rather than manually removing here, since tests depending on
-# built utilities are correctly skipped if not present.
-for i in kill ; do
- rm -f $RPM_BUILD_ROOT{%{_bindir}/$i,%{_mandir}/man1/$i.1}
- rm -f $RPM_BUILD_ROOT%{_bindir}/$i.single
-done
-
# Compress ChangeLogs from before the fileutils/textutils/etc merge
bzip2 -f9 old/*/C*
From ffecc6b864a4cb936ae43567677fb00ee26d149c Mon Sep 17 00:00:00 2001
From: Jakub Martisko
Date: Tue, 14 Jun 2016 12:47:41 +0200
Subject: [PATCH 002/232] (un)expand: fix regression in handling of input
files, where only the first file was processed.
---
coreutils-i18n-fix2-expand-unexpand.patch | 104 ++++++++++++++++++++++
coreutils.spec | 9 +-
2 files changed, 112 insertions(+), 1 deletion(-)
create mode 100644 coreutils-i18n-fix2-expand-unexpand.patch
diff --git a/coreutils-i18n-fix2-expand-unexpand.patch b/coreutils-i18n-fix2-expand-unexpand.patch
new file mode 100644
index 0000000..1f02c5e
--- /dev/null
+++ b/coreutils-i18n-fix2-expand-unexpand.patch
@@ -0,0 +1,104 @@
+diff -up ./src/expand.c.orig ./src/expand.c
+--- ./src/expand.c.orig 2016-06-01 12:42:49.330373488 +0200
++++ ./src/expand.c 2016-06-07 14:35:16.011142041 +0200
+@@ -173,15 +173,19 @@ expand (void)
+
+ do
+ {
+- do {
++ while (true) {
+ mbf_getc (c, mbf);
+- if (mb_iseof (c))
++ if ((mb_iseof (c)) && (fp = next_file (fp)))
+ {
+- mbf_init (mbf, fp = next_file (fp));
++ mbf_init (mbf, fp);
+ continue;
+ }
++ else
++ {
++ break;
++ }
+ }
+- while (false);
++
+
+ if (convert)
+ {
+diff -up ./src/unexpand.c.orig ./src/unexpand.c
+--- ./src/unexpand.c.orig 2016-06-07 14:26:57.380746446 +0200
++++ ./src/unexpand.c 2016-06-07 14:34:54.059256698 +0200
+@@ -220,15 +220,19 @@ unexpand (void)
+
+ do
+ {
+- do {
++ while (true) {
+ mbf_getc (c, mbf);
+- if (mb_iseof (c))
++ if ((mb_iseof (c)) && (fp = next_file (fp)))
+ {
+- mbf_init (mbf, fp = next_file (fp));
++ mbf_init (mbf, fp);
+ continue;
+ }
++ else
++ {
++ break;
++ }
+ }
+- while (false);
++
+
+ if (convert)
+ {
+diff -up ./tests/expand/mb.sh.orig ./tests/expand/mb.sh
+--- ./tests/expand/mb.sh.orig 2016-05-11 14:13:53.095289000 +0200
++++ ./tests/expand/mb.sh 2016-06-07 14:38:48.259033445 +0200
+@@ -44,6 +44,20 @@ EOF
+ expand < in > out || fail=1
+ compare exp out > /dev/null 2>&1 || fail=1
+
++#multiple files as an input
++cat <<\EOF >> exp || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++expand ./in ./in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
+ #test characters with display widths != 1
+ env printf '12345678
+ e\t|ascii(1)
+diff -up ./tests/unexpand/mb.sh.orig ./tests/unexpand/mb.sh
+--- ./tests/unexpand/mb.sh.orig 2016-06-07 14:41:44.210106466 +0200
++++ ./tests/unexpand/mb.sh 2016-06-07 14:52:28.848639772 +0200
+@@ -44,6 +44,22 @@ EOF
+ unexpand -a < in > out || fail=1
+ compare exp out > /dev/null 2>&1 || fail=1
+
++
++#multiple files as an input
++cat >> exp <<\EOF
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++
++unexpand -a ./in ./in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
+ #test characters with a display width larger than 1
+
+ env printf '12345678
diff --git a/coreutils.spec b/coreutils.spec
index 783c211..8423c32 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 5%{?dist}
+Release: 6%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -49,6 +49,8 @@ Patch802: coreutils-i18n-cut.patch
Patch804: coreutils-i18n-cut-old.patch
# The unexpand patch above is not correct. Sent to the patch authors
Patch803: coreutils-i18n-fix-unexpand.patch
+#(un)expand - allow multiple files on input - broken by patch 801
+Patch805: coreutils-i18n-fix2-expand-unexpand.patch
#getgrouplist() patch from Ulrich Drepper.
Patch908: coreutils-getgrouplist.patch
@@ -181,6 +183,7 @@ including documentation and translations.
#%%patch802 -p1 -b .i18n-cut
%patch803 -p1 -b .i18n-fix-expand
%patch804 -p1 -b .i18n-cutold
+%patch805 -p1 -b .i18n-fix2-expand-unexpand
# Coreutils
%patch908 -p1 -b .getgrouplist
@@ -342,6 +345,10 @@ fi
%license COPYING
%changelog
+* Thu Jun 09 2016 Jakub Martisko - 8.25-6
+- (un)expand: fix regression in handling input files, where only
+ the first file was processed.
+
* Sat Mar 05 2016 Ondrej Vasik - 8.25-5
- cut: move back to the old i18n implementation (#1314722)
From 8236de4f4bb46d0145978c6c9abc4160240e82f0 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Wed, 15 Jun 2016 17:31:56 +0200
Subject: [PATCH 003/232] handle info doc in RPM scriptlets of coreutils-common
... which provides it
---
coreutils.spec | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/coreutils.spec b/coreutils.spec
index 8423c32..fd2fad2 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 6%{?dist}
+Release: 7%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -297,7 +297,7 @@ grep LC_TIME %name.lang | cut -d'/' -f1-6 | sed -e 's/) /) %%dir /g' >>%name.lan
# (sb) Deal with Installed (but unpackaged) file(s) found
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
-%pre
+%pre common
# We must deinstall these info files since they're merged in
# coreutils.info. else their postun'll be run too late
# and install-info will fail badly because of duplicates
@@ -307,14 +307,14 @@ for file in sh-utils textutils fileutils; do
fi
done
-%preun
+%preun common
if [ $1 = 0 ]; then
if [ -f %{_infodir}/%{name}.info.gz ]; then
/sbin/install-info --delete %{_infodir}/%{name}.info.gz %{_infodir}/dir || :
fi
fi
-%post
+%post common
%{_bindir}/grep -v '(sh-utils)\|(fileutils)\|(textutils)' %{_infodir}/dir > \
%{_infodir}/dir.rpmmodify || exit 0
/bin/mv -f %{_infodir}/dir.rpmmodify %{_infodir}/dir
@@ -345,6 +345,9 @@ fi
%license COPYING
%changelog
+* Wed Jun 15 2016 Kamil Dudka - 8.25-7
+- handle info doc in RPM scriptlets of coreutils-common, which provides it
+
* Thu Jun 09 2016 Jakub Martisko - 8.25-6
- (un)expand: fix regression in handling input files, where only
the first file was processed.
From 28edec2fbc57acadc5f76950f371cdb93186bdad Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Wed, 15 Jun 2016 17:32:29 +0200
Subject: [PATCH 004/232] make sure that the license file is installed
... even if coreutils-common is not
---
coreutils.spec | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/coreutils.spec b/coreutils.spec
index fd2fad2..48340ea 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -332,6 +332,9 @@ fi
%{_bindir}/*.single
%{_sbindir}/chroot.single
%{_libexecdir}/coreutils/*.so.single
+# duplicate the license because coreutils-common does not need to be installed
+%{!?_licensedir:%global license %%doc}
+%license COPYING
%files common -f %{name}.lang
%defattr(-,root,root,-)
@@ -341,12 +344,12 @@ fi
%{_mandir}/man*/*
# The following go to /usr/share/doc/coreutils-common
%doc ABOUT-NLS NEWS README THANKS TODO
-%{!?_licensedir:%global license %%doc}
%license COPYING
%changelog
* Wed Jun 15 2016 Kamil Dudka - 8.25-7
- handle info doc in RPM scriptlets of coreutils-common, which provides it
+- make sure that the license file is installed, even if coreutils-common is not
* Thu Jun 09 2016 Jakub Martisko - 8.25-6
- (un)expand: fix regression in handling input files, where only
From 50e40c5f2b836e68c4da7987cd4ffee22594a1c4 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Fri, 17 Jun 2016 16:19:35 +0200
Subject: [PATCH 005/232] Resolve: #1335320 - sync /etc/DIR_COLORS with latest
upstream
---
coreutils-DIR_COLORS | 113 +++++++---------------------
coreutils-DIR_COLORS.256color | 101 ++++++++-----------------
coreutils-DIR_COLORS.lightbgcolor | 119 ++++++++----------------------
coreutils.spec | 5 +-
4 files changed, 95 insertions(+), 243 deletions(-)
diff --git a/coreutils-DIR_COLORS b/coreutils-DIR_COLORS
index ecffc65..27af9d7 100644
--- a/coreutils-DIR_COLORS
+++ b/coreutils-DIR_COLORS
@@ -1,34 +1,23 @@
-# Configuration file for the color ls utility
-# Synchronized with coreutils 8.5 dircolors
+# Configuration file for dircolors, a utility to help you set the
+# LS_COLORS environment variable used by GNU ls with the --color option.
+
# This file goes in the /etc directory, and must be world readable.
# You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults.
-# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
-# pipes. 'all' adds color characters to all output. 'none' shuts colorization
-# off.
-COLOR tty
+# Copyright (C) 1996-2016 Free Software Foundation, Inc.
+# Copying and distribution of this file, with or without modification,
+# are permitted provided the copyright notice and this notice are preserved.
-# Extra command line options for ls go here.
-# Basically these ones are:
-# -F = show '/' for dirs, '*' for executables, etc.
-# -T 0 = don't trust tab spacing when formatting ls output.
-OPTIONS -F -T 0
+# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
+# slackware version of dircolors) are recognized but ignored.
-# Below, there should be one TERM entry for each termtype that is colorizable
+# Below are TERM entries, which can be a glob patterns, to match
+# against the TERM environment variable to determine if it is colorizable.
TERM Eterm
TERM ansi
TERM color-xterm
-TERM con132x25
-TERM con132x30
-TERM con132x43
-TERM con132x60
-TERM con80x25
-TERM con80x28
-TERM con80x30
-TERM con80x43
-TERM con80x50
-TERM con80x60
+TERM con[0-9]*x[0-9]*
TERM cons25
TERM console
TERM cygwin
@@ -47,34 +36,14 @@ TERM mach-gnu-color
TERM mlterm
TERM putty
TERM putty-256color
-TERM rxvt
-TERM rxvt-256color
-TERM rxvt-cygwin
-TERM rxvt-cygwin-native
-TERM rxvt-unicode
-TERM rxvt-unicode-256color
-TERM rxvt-unicode256
-TERM screen
-TERM screen-256color
-TERM screen-256color-bce
-TERM screen-bce
-TERM screen-w
-TERM screen.Eterm
-TERM screen.rxvt
-TERM screen.linux
+TERM rxvt*
+TERM screen*
TERM st
TERM st-256color
TERM terminator
+TERM tmux*
TERM vt100
-TERM xterm
-TERM xterm-16color
-TERM xterm-256color
-TERM xterm-88color
-TERM xterm-color
-TERM xterm-debian
-
-# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
-EIGHTBIT 1
+TERM xterm*
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
@@ -85,18 +54,18 @@ EIGHTBIT 1
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
#NORMAL 00 # no color code at all
-#FILE 00 # normal file, use no color at all
+#FILE 00 # regular file: use no color at all
RESET 0 # reset to "normal" color
DIR 01;34 # directory
-LINK 01;36 # symbolic link (If you set this to 'target' instead of a
- # numerical value, the color is as for the file pointed to.)
-MULTIHARDLINK 00 # regular file with more than one link
+LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
+ # numerical value, the color is as for the file pointed to.)
+MULTIHARDLINK 00 # regular file with more than one link
FIFO 40;33 # pipe
SOCK 01;35 # socket
DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
-ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
+ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
MISSING 01;05;37;41 # ... and the files they point to
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
@@ -111,16 +80,19 @@ EXEC 01;32
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
-# executables (bright green)
-#.cmd 01;32
+
+# If you use DOS-style suffixes, you may want to uncomment the following:
+#.cmd 01;32 # executables (bright green)
#.exe 01;32
#.com 01;32
#.btm 01;32
#.bat 01;32
+# Or if you want to colorize scripts even if they do not have the
+# executable bit actually set.
#.sh 01;32
#.csh 01;32
-# archives or compressed (bright red)
+ # archives or compressed (bright red)
.tar 01;31
.tgz 01;31
.arc 01;31
@@ -163,7 +135,7 @@ EXEC 01;32
.rz 01;31
.cab 01;31
-# image formats (magenta)
+# image formats
.jpg 01;35
.jpeg 01;35
.gif 01;35
@@ -214,7 +186,7 @@ EXEC 01;32
.ogv 01;35
.ogx 01;35
-# audio formats (cyan)
+# audio formats
.aac 01;36
.au 01;36
.flac 01;36
@@ -233,32 +205,3 @@ EXEC 01;32
.opus 01;36
.spx 01;36
.xspf 01;36
-
-# colorize binary documents (brown)
-#.pdf 00;33
-#.ps 00;33
-#.ps.gz 00;33
-#.tex 00;33
-#.xls 00;33
-#.xlsx 00;33
-#.ppt 00;33
-#.pptx 00;33
-#.rtf 00;33
-#.doc 00;33
-#.docx 00;33
-#.odt 00;33
-#.ods 00;33
-#.odp 00;33
-#.epub 00;33
-#.abw 00;33
-#.wpd 00;33
-#
-# colorize text documents (brown)
-#.txt 00;33
-#.patch 00;33
-#.diff 00;33
-#.log 00;33
-#.htm 00;33
-#.html 00;33
-#.shtml 00;33
-#.xml 00;33
diff --git a/coreutils-DIR_COLORS.256color b/coreutils-DIR_COLORS.256color
index cc8cf40..74c34ba 100644
--- a/coreutils-DIR_COLORS.256color
+++ b/coreutils-DIR_COLORS.256color
@@ -1,39 +1,28 @@
# Configuration file for the 256color ls utility
+
# This file goes in the /etc directory, and must be world readable.
-# Synchronized with coreutils 8.5 dircolors
# You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults.
-# In the case that you are not satisfied with supplied colors, please
-# submit your color configuration or attach your file with colors readable
-# on ALL color background schemas (white,gray,black) to RedHat Bugzilla
-# ticket on https://bugzilla.redhat.com/show_bug.cgi?id=429121 . TIA.
-# Please just keep ls color conventions from 8 color scheme.
-# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
-# pipes. 'all' adds color characters to all output. 'none' shuts colorization
-# off.
-COLOR tty
+# Copyright (C) 1996-2016 Free Software Foundation, Inc.
+# Copying and distribution of this file, with or without modification,
+# are permitted provided the copyright notice and this notice are preserved.
-# Extra command line options for ls go here.
-# Basically these ones are:
-# -F = show '/' for dirs, '*' for executables, etc.
-# -T 0 = don't trust tab spacing when formatting ls output.
-OPTIONS -F -T 0
+# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
+# slackware version of dircolors) are recognized but ignored.
-# Below, there should be one TERM entry for each termtype that is colorizable
+# Below are TERM entries, which can be a glob patterns, to match
+# against the TERM environment variable to determine if it is colorizable.
TERM *256color*
TERM rxvt-unicode256
-# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
-EIGHTBIT 1
-
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
-# Text color(8 colors mode) codes:
+# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
-# Background color(8 colors mode) codes:
+# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
# Text color(256 colors mode) codes:
# Valid syntax for text 256color is 38;5; , where color number
@@ -46,20 +35,20 @@ EIGHTBIT 1
# You may find following command useful to search the best one for you:
# for ((x=0; x<=255; x++));do echo -e "${x}:\033[48;5;${x}mcolor\033[000m";done
-#NORMAL 00 # global default, no color code at all
-#FILE 00 # normal file, use no color at all
-RESET 0 # reset to "normal" color
+#NORMAL 00 # no color code at all
+#FILE 00 # regular file: use no color at all
+RESET 0 # reset to "normal" color
DIR 38;5;33 # directory
-LINK 38;5;51 # symbolic link (If you set this to 'target' instead of a
- # numerical value, the color is as for the file pointed to.)
-MULTIHARDLINK 00 # regular file with more than one link
+LINK 38;5;51 # symbolic link. (If you set this to 'target' instead of a
+ # numerical value, the color is as for the file pointed to.)
+MULTIHARDLINK 00 # regular file with more than one link
FIFO 40;38;5;11 # pipe
SOCK 38;5;13 # socket
DOOR 38;5;5 # door
BLK 48;5;232;38;5;11 # block device driver
CHR 48;5;232;38;5;3 # character device driver
-ORPHAN 48;5;232;38;5;9 # symlink to nonexistent file, or non-stat'able file
-MISSING 01;05;37;41 # ... and the files they point to
+ORPHAN 48;5;232;38;5;9 # symlink to nonexistent file, or non-stat'able file ...
+MISSING 01;05;37;41 # ... and the files they point to
SETUID 48;5;196;38;5;15 # file that is setuid (u+s)
SETGID 48;5;11;38;5;16 # file that is setgid (g+s)
CAPABILITY 48;5;196;38;5;226 # file with capability
@@ -73,16 +62,19 @@ EXEC 38;5;40
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
-# executables (bright green)
-#.cmd 38;5;34
-#.exe 38;5;34
-#.com 38;5;34
-#.btm 38;5;34
-#.bat 38;5;34
-#.sh 38;5;34
-#.csh 38;5;34
-# archives or compressed (bright red)
+# If you use DOS-style suffixes, you may want to uncomment the following:
+#.cmd 01;32 # executables (bright green)
+#.exe 01;32
+#.com 01;32
+#.btm 01;32
+#.bat 01;32
+# Or if you want to colorize scripts even if they do not have the
+# executable bit actually set.
+#.sh 01;32
+#.csh 01;32
+
+ # archives or compressed (bright red)
.tar 38;5;9
.tgz 38;5;9
.arc 38;5;9
@@ -125,7 +117,7 @@ EXEC 38;5;40
.rz 38;5;9
.cab 38;5;9
-# image formats (magenta)
+# image formats
.jpg 38;5;13
.jpeg 38;5;13
.gif 38;5;13
@@ -176,7 +168,7 @@ EXEC 38;5;40
.ogv 38;5;13
.ogx 38;5;13
-# audio formats (cyan)
+# audio formats
.aac 38;5;45
.au 38;5;45
.flac 38;5;45
@@ -195,32 +187,3 @@ EXEC 38;5;40
.opus 38;5;45
.spx 38;5;45
.xspf 38;5;45
-
-# colorize binary documents (brown)
-#.pdf 00;33
-#.ps 00;33
-#.ps.gz 00;33
-#.tex 00;33
-#.xls 00;33
-#.xlsx 00;33
-#.ppt 00;33
-#.pptx 00;33
-#.rtf 00;33
-#.doc 00;33
-#.docx 00;33
-#.odt 00;33
-#.ods 00;33
-#.odp 00;33
-#.epub 00;33
-#.abw 00;33
-#.wpd 00;33
-#
-# colorize text documents (brown)
-#.txt 00;33
-#.patch 00;33
-#.diff 00;33
-#.log 00;33
-#.htm 00;33
-#.html 00;33
-#.shtml 00;33
-#.xml 00;33
diff --git a/coreutils-DIR_COLORS.lightbgcolor b/coreutils-DIR_COLORS.lightbgcolor
index 450deb0..95d6879 100644
--- a/coreutils-DIR_COLORS.lightbgcolor
+++ b/coreutils-DIR_COLORS.lightbgcolor
@@ -1,34 +1,22 @@
# Configuration file for the color ls utility - modified for lighter backgrounds
-# Synchronized with coreutils 8.5 dircolors
+
# This file goes in the /etc directory, and must be world readable.
# You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults.
-# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
-# pipes. 'all' adds color characters to all output. 'none' shuts colorization
-# off.
-COLOR tty
+# Copyright (C) 1996-2016 Free Software Foundation, Inc.
+# Copying and distribution of this file, with or without modification,
+# are permitted provided the copyright notice and this notice are preserved.
-# Extra command line options for ls go here.
-# Basically these ones are:
-# -F = show '/' for dirs, '*' for executables, etc.
-# -T 0 = don't trust tab spacing when formatting ls output.
-OPTIONS -F -T 0
+# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
+# slackware version of dircolors) are recognized but ignored.
-# Below, there should be one TERM entry for each termtype that is colorizable
+# Below are TERM entries, which can be a glob patterns, to match
+# against the TERM environment variable to determine if it is colorizable.
TERM Eterm
TERM ansi
TERM color-xterm
-TERM con132x25
-TERM con132x30
-TERM con132x43
-TERM con132x60
-TERM con80x25
-TERM con80x28
-TERM con80x30
-TERM con80x43
-TERM con80x50
-TERM con80x60
+TERM con[0-9]*x[0-9]*
TERM cons25
TERM console
TERM cygwin
@@ -47,34 +35,14 @@ TERM mach-gnu-color
TERM mlterm
TERM putty
TERM putty-256color
-TERM rxvt
-TERM rxvt-256color
-TERM rxvt-cygwin
-TERM rxvt-cygwin-native
-TERM rxvt-unicode
-TERM rxvt-unicode-256color
-TERM rxvt-unicode256
-TERM screen
-TERM screen-256color
-TERM screen-256color-bce
-TERM screen-bce
-TERM screen-w
-TERM screen.Eterm
-TERM screen.rxvt
-TERM screen.linux
+TERM rxvt*
+TERM screen*
TERM st
TERM st-256color
TERM terminator
+TERM tmux*
TERM vt100
-TERM xterm
-TERM xterm-16color
-TERM xterm-256color
-TERM xterm-88color
-TERM xterm-color
-TERM xterm-debian
-
-# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
-EIGHTBIT 1
+TERM xterm*
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
@@ -85,18 +53,18 @@ EIGHTBIT 1
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
#NORMAL 00 # no color code at all
-#FILE 00 # normal file, use no color at all
+#FILE 00 # regular file: use no color at all
RESET 0 # reset to "normal" color
DIR 00;34 # directory
-LINK 00;36 # symbolic link (If you set this to 'target' instead of a
- # numerical value, the color is as for the file pointed to.)
-MULTIHARDLINK 00 # regular file with more than one link
+LINK 00;36 # symbolic link. (If you set this to 'target' instead of a
+ # numerical value, the color is as for the file pointed to.)
+MULTIHARDLINK 00 # regular file with more than one link
FIFO 40;33 # pipe
SOCK 00;35 # socket
DOOR 00;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
-ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
+ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
MISSING 01;05;37;41 # ... and the files they point to
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
@@ -111,13 +79,17 @@ EXEC 00;32
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
-#.cmd 00;32 # executables (green)
-#.exe 00;32
-#.com 00;32
-#.btm 00;32
-#.bat 00;32
-#.sh 00;32
-#.csh 00;32
+
+# If you use DOS-style suffixes, you may want to uncomment the following:
+#.cmd 01;32 # executables (bright green)
+#.exe 01;32
+#.com 01;32
+#.btm 01;32
+#.bat 01;32
+# Or if you want to colorize scripts even if they do not have the
+# executable bit actually set.
+#.sh 01;32
+#.csh 01;32
# archives or compressed (red)
.tar 00;31
@@ -162,7 +134,7 @@ EXEC 00;32
.rz 00;31
.cab 00;31
-# image formats (magenta)
+# image formats
.jpg 00;35
.jpeg 00;35
.gif 00;35
@@ -213,7 +185,7 @@ EXEC 00;32
.ogv 00;35
.ogx 00;35
-# audio formats (cyan)
+# audio formats
.aac 00;36
.au 00;36
.flac 00;36
@@ -232,32 +204,3 @@ EXEC 00;32
.opus 00;36
.spx 00;36
.xspf 00;36
-
-# colorize binary documents (brown)
-#.pdf 00;33
-#.ps 00;33
-#.ps.gz 00;33
-#.tex 00;33
-#.xls 00;33
-#.xlsx 00;33
-#.ppt 00;33
-#.pptx 00;33
-#.rtf 00;33
-#.doc 00;33
-#.docx 00;33
-#.odt 00;33
-#.ods 00;33
-#.odp 00;33
-#.epub 00;33
-#.abw 00;33
-#.wpd 00;33
-#
-# colorize text documents (brown)
-#.txt 00;33
-#.patch 00;33
-#.diff 00;33
-#.log 00;33
-#.htm 00;33
-#.html 00;33
-#.shtml 00;33
-#.xml 00;33
diff --git a/coreutils.spec b/coreutils.spec
index 48340ea..c181af7 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 7%{?dist}
+Release: 8%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -347,6 +347,9 @@ fi
%license COPYING
%changelog
+* Fri Jun 17 2016 Kamil Dudka - 8.25-8
+- sync /etc/DIR_COLORS with latest upstream (#1335320)
+
* Wed Jun 15 2016 Kamil Dudka - 8.25-7
- handle info doc in RPM scriptlets of coreutils-common, which provides it
- make sure that the license file is installed, even if coreutils-common is not
From 46ebf91d5fec0925458d6ddd5965d226f09d3797 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Fri, 17 Jun 2016 17:07:27 +0200
Subject: [PATCH 006/232] Related: #1335320 - maintain downstream DIR_COLOR*
files as a patch
... against src/dircolors.hin rather than full copies of the file.
There should be no user-visible change introduced by this commit.
This is just to ease the maintenance -- the resulting files cannot
diverge from upstream without any notice.
---
coreutils-8.25-DIR_COLORS.patch | 643 ++++++++++++++++++++++++++++++
coreutils-DIR_COLORS | 207 ----------
coreutils-DIR_COLORS.256color | 189 ---------
coreutils-DIR_COLORS.lightbgcolor | 206 ----------
coreutils.spec | 14 +-
5 files changed, 651 insertions(+), 608 deletions(-)
create mode 100644 coreutils-8.25-DIR_COLORS.patch
delete mode 100644 coreutils-DIR_COLORS
delete mode 100644 coreutils-DIR_COLORS.256color
delete mode 100644 coreutils-DIR_COLORS.lightbgcolor
diff --git a/coreutils-8.25-DIR_COLORS.patch b/coreutils-8.25-DIR_COLORS.patch
new file mode 100644
index 0000000..546241b
--- /dev/null
+++ b/coreutils-8.25-DIR_COLORS.patch
@@ -0,0 +1,643 @@
+From a13bc34f1eeebdf8b87e4b5a570341bb77a62f76 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Fri, 17 Jun 2016 16:58:18 +0200
+Subject: [PATCH] downstream changes to default DIR_COLORS
+
+---
+ DIR_COLORS | 38 ++++---
+ DIR_COLORS.256color | 290 +++++++++++++++++++++++-------------------------
+ DIR_COLORS.lightbgcolor | 197 ++++++++++++++++----------------
+ 3 files changed, 259 insertions(+), 266 deletions(-)
+
+diff --git a/DIR_COLORS b/DIR_COLORS
+index d2ea453..27af9d7 100644
+--- a/DIR_COLORS
++++ b/DIR_COLORS
+@@ -1,6 +1,10 @@
+ # Configuration file for dircolors, a utility to help you set the
+ # LS_COLORS environment variable used by GNU ls with the --color option.
+
++# This file goes in the /etc directory, and must be world readable.
++# You can copy this file to .dir_colors in your $HOME directory to override
++# the system defaults.
++
+ # Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ # Copying and distribution of this file, with or without modification,
+ # are permitted provided the copyright notice and this notice are preserved.
+@@ -62,7 +66,7 @@ DOOR 01;35 # door
+ BLK 40;33;01 # block device driver
+ CHR 40;33;01 # character device driver
+ ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
+-MISSING 00 # ... and the files they point to
++MISSING 01;05;37;41 # ... and the files they point to
+ SETUID 37;41 # file that is setuid (u+s)
+ SETGID 30;43 # file that is setgid (g+s)
+ CAPABILITY 30;41 # file with capability
+@@ -183,21 +187,21 @@ EXEC 01;32
+ .ogx 01;35
+
+ # audio formats
+-.aac 00;36
+-.au 00;36
+-.flac 00;36
+-.m4a 00;36
+-.mid 00;36
+-.midi 00;36
+-.mka 00;36
+-.mp3 00;36
+-.mpc 00;36
+-.ogg 00;36
+-.ra 00;36
+-.wav 00;36
++.aac 01;36
++.au 01;36
++.flac 01;36
++.m4a 01;36
++.mid 01;36
++.midi 01;36
++.mka 01;36
++.mp3 01;36
++.mpc 01;36
++.ogg 01;36
++.ra 01;36
++.wav 01;36
+
+ # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+-.oga 00;36
+-.opus 00;36
+-.spx 00;36
+-.xspf 00;36
++.oga 01;36
++.opus 01;36
++.spx 01;36
++.xspf 01;36
+diff --git a/DIR_COLORS.256color b/DIR_COLORS.256color
+index d2ea453..74c34ba 100644
+--- a/DIR_COLORS.256color
++++ b/DIR_COLORS.256color
+@@ -1,5 +1,8 @@
+-# Configuration file for dircolors, a utility to help you set the
+-# LS_COLORS environment variable used by GNU ls with the --color option.
++# Configuration file for the 256color ls utility
++
++# This file goes in the /etc directory, and must be world readable.
++# You can copy this file to .dir_colors in your $HOME directory to override
++# the system defaults.
+
+ # Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ # Copying and distribution of this file, with or without modification,
+@@ -10,36 +13,8 @@
+
+ # Below are TERM entries, which can be a glob patterns, to match
+ # against the TERM environment variable to determine if it is colorizable.
+-TERM Eterm
+-TERM ansi
+-TERM color-xterm
+-TERM con[0-9]*x[0-9]*
+-TERM cons25
+-TERM console
+-TERM cygwin
+-TERM dtterm
+-TERM eterm-color
+-TERM gnome
+-TERM gnome-256color
+-TERM hurd
+-TERM jfbterm
+-TERM konsole
+-TERM kterm
+-TERM linux
+-TERM linux-c
+-TERM mach-color
+-TERM mach-gnu-color
+-TERM mlterm
+-TERM putty
+-TERM putty-256color
+-TERM rxvt*
+-TERM screen*
+-TERM st
+-TERM st-256color
+-TERM terminator
+-TERM tmux*
+-TERM vt100
+-TERM xterm*
++TERM *256color*
++TERM rxvt-unicode256
+
+ # Below are the color init strings for the basic file types. A color init
+ # string consists of one or more of the following numeric codes:
+@@ -49,29 +24,40 @@ TERM xterm*
+ # 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
+ # Background color codes:
+ # 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
++# Text color(256 colors mode) codes:
++# Valid syntax for text 256color is 38;5; , where color number
++# is number between 0 and 255.
++# You may find following command useful to search the best one for you:
++# for ((x=0; x<=255; x++));do echo -e "${x}:\033[38;5;${x}mcolor\033[000m";done
++# Background color(256 colors mode) codes:
++# Valid syntax for background 256color is 48;5; , where
++# color number is number between 0 and 255.
++# You may find following command useful to search the best one for you:
++# for ((x=0; x<=255; x++));do echo -e "${x}:\033[48;5;${x}mcolor\033[000m";done
++
+ #NORMAL 00 # no color code at all
+ #FILE 00 # regular file: use no color at all
+ RESET 0 # reset to "normal" color
+-DIR 01;34 # directory
+-LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
++DIR 38;5;33 # directory
++LINK 38;5;51 # symbolic link. (If you set this to 'target' instead of a
+ # numerical value, the color is as for the file pointed to.)
+ MULTIHARDLINK 00 # regular file with more than one link
+-FIFO 40;33 # pipe
+-SOCK 01;35 # socket
+-DOOR 01;35 # door
+-BLK 40;33;01 # block device driver
+-CHR 40;33;01 # character device driver
+-ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
+-MISSING 00 # ... and the files they point to
+-SETUID 37;41 # file that is setuid (u+s)
+-SETGID 30;43 # file that is setgid (g+s)
+-CAPABILITY 30;41 # file with capability
+-STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
+-OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
+-STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
++FIFO 40;38;5;11 # pipe
++SOCK 38;5;13 # socket
++DOOR 38;5;5 # door
++BLK 48;5;232;38;5;11 # block device driver
++CHR 48;5;232;38;5;3 # character device driver
++ORPHAN 48;5;232;38;5;9 # symlink to nonexistent file, or non-stat'able file ...
++MISSING 01;05;37;41 # ... and the files they point to
++SETUID 48;5;196;38;5;15 # file that is setuid (u+s)
++SETGID 48;5;11;38;5;16 # file that is setgid (g+s)
++CAPABILITY 48;5;196;38;5;226 # file with capability
++STICKY_OTHER_WRITABLE 48;5;10;38;5;16 # dir that is sticky and other-writable (+t,o+w)
++OTHER_WRITABLE 48;5;10;38;5;21 # dir that is other-writable (o+w) and not sticky
++STICKY 48;5;21;38;5;15 # dir with the sticky bit set (+t) and not other-writable
+
+ # This is for files with execute permission:
+-EXEC 01;32
++EXEC 38;5;40
+
+ # List any file extensions like '.gz' or '.tar' that you would like ls
+ # to colorize below. Put the extension, a space, and the color init string.
+@@ -89,115 +75,115 @@ EXEC 01;32
+ #.csh 01;32
+
+ # archives or compressed (bright red)
+-.tar 01;31
+-.tgz 01;31
+-.arc 01;31
+-.arj 01;31
+-.taz 01;31
+-.lha 01;31
+-.lz4 01;31
+-.lzh 01;31
+-.lzma 01;31
+-.tlz 01;31
+-.txz 01;31
+-.tzo 01;31
+-.t7z 01;31
+-.zip 01;31
+-.z 01;31
+-.Z 01;31
+-.dz 01;31
+-.gz 01;31
+-.lrz 01;31
+-.lz 01;31
+-.lzo 01;31
+-.xz 01;31
+-.bz2 01;31
+-.bz 01;31
+-.tbz 01;31
+-.tbz2 01;31
+-.tz 01;31
+-.deb 01;31
+-.rpm 01;31
+-.jar 01;31
+-.war 01;31
+-.ear 01;31
+-.sar 01;31
+-.rar 01;31
+-.alz 01;31
+-.ace 01;31
+-.zoo 01;31
+-.cpio 01;31
+-.7z 01;31
+-.rz 01;31
+-.cab 01;31
++.tar 38;5;9
++.tgz 38;5;9
++.arc 38;5;9
++.arj 38;5;9
++.taz 38;5;9
++.lha 38;5;9
++.lz4 38;5;9
++.lzh 38;5;9
++.lzma 38;5;9
++.tlz 38;5;9
++.txz 38;5;9
++.tzo 38;5;9
++.t7z 38;5;9
++.zip 38;5;9
++.z 38;5;9
++.Z 38;5;9
++.dz 38;5;9
++.gz 38;5;9
++.lrz 38;5;9
++.lz 38;5;9
++.lzo 38;5;9
++.xz 38;5;9
++.bz2 38;5;9
++.bz 38;5;9
++.tbz 38;5;9
++.tbz2 38;5;9
++.tz 38;5;9
++.deb 38;5;9
++.rpm 38;5;9
++.jar 38;5;9
++.war 38;5;9
++.ear 38;5;9
++.sar 38;5;9
++.rar 38;5;9
++.alz 38;5;9
++.ace 38;5;9
++.zoo 38;5;9
++.cpio 38;5;9
++.7z 38;5;9
++.rz 38;5;9
++.cab 38;5;9
+
+ # image formats
+-.jpg 01;35
+-.jpeg 01;35
+-.gif 01;35
+-.bmp 01;35
+-.pbm 01;35
+-.pgm 01;35
+-.ppm 01;35
+-.tga 01;35
+-.xbm 01;35
+-.xpm 01;35
+-.tif 01;35
+-.tiff 01;35
+-.png 01;35
+-.svg 01;35
+-.svgz 01;35
+-.mng 01;35
+-.pcx 01;35
+-.mov 01;35
+-.mpg 01;35
+-.mpeg 01;35
+-.m2v 01;35
+-.mkv 01;35
+-.webm 01;35
+-.ogm 01;35
+-.mp4 01;35
+-.m4v 01;35
+-.mp4v 01;35
+-.vob 01;35
+-.qt 01;35
+-.nuv 01;35
+-.wmv 01;35
+-.asf 01;35
+-.rm 01;35
+-.rmvb 01;35
+-.flc 01;35
+-.avi 01;35
+-.fli 01;35
+-.flv 01;35
+-.gl 01;35
+-.dl 01;35
+-.xcf 01;35
+-.xwd 01;35
+-.yuv 01;35
+-.cgm 01;35
+-.emf 01;35
++.jpg 38;5;13
++.jpeg 38;5;13
++.gif 38;5;13
++.bmp 38;5;13
++.pbm 38;5;13
++.pgm 38;5;13
++.ppm 38;5;13
++.tga 38;5;13
++.xbm 38;5;13
++.xpm 38;5;13
++.tif 38;5;13
++.tiff 38;5;13
++.png 38;5;13
++.svg 38;5;13
++.svgz 38;5;13
++.mng 38;5;13
++.pcx 38;5;13
++.mov 38;5;13
++.mpg 38;5;13
++.mpeg 38;5;13
++.m2v 38;5;13
++.mkv 38;5;13
++.webm 38;5;13
++.ogm 38;5;13
++.mp4 38;5;13
++.m4v 38;5;13
++.mp4v 38;5;13
++.vob 38;5;13
++.qt 38;5;13
++.nuv 38;5;13
++.wmv 38;5;13
++.asf 38;5;13
++.rm 38;5;13
++.rmvb 38;5;13
++.flc 38;5;13
++.avi 38;5;13
++.fli 38;5;13
++.flv 38;5;13
++.gl 38;5;13
++.dl 38;5;13
++.xcf 38;5;13
++.xwd 38;5;13
++.yuv 38;5;13
++.cgm 38;5;13
++.emf 38;5;13
+
+ # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+-.ogv 01;35
+-.ogx 01;35
++.ogv 38;5;13
++.ogx 38;5;13
+
+ # audio formats
+-.aac 00;36
+-.au 00;36
+-.flac 00;36
+-.m4a 00;36
+-.mid 00;36
+-.midi 00;36
+-.mka 00;36
+-.mp3 00;36
+-.mpc 00;36
+-.ogg 00;36
+-.ra 00;36
+-.wav 00;36
++.aac 38;5;45
++.au 38;5;45
++.flac 38;5;45
++.m4a 38;5;45
++.mid 38;5;45
++.midi 38;5;45
++.mka 38;5;45
++.mp3 38;5;45
++.mpc 38;5;45
++.ogg 38;5;45
++.ra 38;5;45
++.wav 38;5;45
+
+ # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+-.oga 00;36
+-.opus 00;36
+-.spx 00;36
+-.xspf 00;36
++.oga 38;5;45
++.opus 38;5;45
++.spx 38;5;45
++.xspf 38;5;45
+diff --git a/DIR_COLORS.lightbgcolor b/DIR_COLORS.lightbgcolor
+index d2ea453..95d6879 100644
+--- a/DIR_COLORS.lightbgcolor
++++ b/DIR_COLORS.lightbgcolor
+@@ -1,5 +1,8 @@
+-# Configuration file for dircolors, a utility to help you set the
+-# LS_COLORS environment variable used by GNU ls with the --color option.
++# Configuration file for the color ls utility - modified for lighter backgrounds
++
++# This file goes in the /etc directory, and must be world readable.
++# You can copy this file to .dir_colors in your $HOME directory to override
++# the system defaults.
+
+ # Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ # Copying and distribution of this file, with or without modification,
+@@ -52,17 +55,17 @@ TERM xterm*
+ #NORMAL 00 # no color code at all
+ #FILE 00 # regular file: use no color at all
+ RESET 0 # reset to "normal" color
+-DIR 01;34 # directory
+-LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
++DIR 00;34 # directory
++LINK 00;36 # symbolic link. (If you set this to 'target' instead of a
+ # numerical value, the color is as for the file pointed to.)
+ MULTIHARDLINK 00 # regular file with more than one link
+ FIFO 40;33 # pipe
+-SOCK 01;35 # socket
+-DOOR 01;35 # door
++SOCK 00;35 # socket
++DOOR 00;35 # door
+ BLK 40;33;01 # block device driver
+ CHR 40;33;01 # character device driver
+ ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
+-MISSING 00 # ... and the files they point to
++MISSING 01;05;37;41 # ... and the files they point to
+ SETUID 37;41 # file that is setuid (u+s)
+ SETGID 30;43 # file that is setgid (g+s)
+ CAPABILITY 30;41 # file with capability
+@@ -71,7 +74,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
+ STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
+
+ # This is for files with execute permission:
+-EXEC 01;32
++EXEC 00;32
+
+ # List any file extensions like '.gz' or '.tar' that you would like ls
+ # to colorize below. Put the extension, a space, and the color init string.
+@@ -88,99 +91,99 @@ EXEC 01;32
+ #.sh 01;32
+ #.csh 01;32
+
+- # archives or compressed (bright red)
+-.tar 01;31
+-.tgz 01;31
+-.arc 01;31
+-.arj 01;31
+-.taz 01;31
+-.lha 01;31
+-.lz4 01;31
+-.lzh 01;31
+-.lzma 01;31
+-.tlz 01;31
+-.txz 01;31
+-.tzo 01;31
+-.t7z 01;31
+-.zip 01;31
+-.z 01;31
+-.Z 01;31
+-.dz 01;31
+-.gz 01;31
+-.lrz 01;31
+-.lz 01;31
+-.lzo 01;31
+-.xz 01;31
+-.bz2 01;31
+-.bz 01;31
+-.tbz 01;31
+-.tbz2 01;31
+-.tz 01;31
+-.deb 01;31
+-.rpm 01;31
+-.jar 01;31
+-.war 01;31
+-.ear 01;31
+-.sar 01;31
+-.rar 01;31
+-.alz 01;31
+-.ace 01;31
+-.zoo 01;31
+-.cpio 01;31
+-.7z 01;31
+-.rz 01;31
+-.cab 01;31
++# archives or compressed (red)
++.tar 00;31
++.tgz 00;31
++.arc 00;31
++.arj 00;31
++.taz 00;31
++.lha 00;31
++.lz4 00;31
++.lzh 00;31
++.lzma 00;31
++.tlz 00;31
++.txz 00;31
++.tzo 00;31
++.t7z 00;31
++.zip 00;31
++.z 00;31
++.Z 00;31
++.dz 00;31
++.gz 00;31
++.lrz 00;31
++.lz 00;31
++.lzo 00;31
++.xz 00;31
++.bz2 00;31
++.bz 00;31
++.tbz 00;31
++.tbz2 00;31
++.tz 00;31
++.deb 00;31
++.rpm 00;31
++.jar 00;31
++.war 00;31
++.ear 00;31
++.sar 00;31
++.rar 00;31
++.alz 00;31
++.ace 00;31
++.zoo 00;31
++.cpio 00;31
++.7z 00;31
++.rz 00;31
++.cab 00;31
+
+ # image formats
+-.jpg 01;35
+-.jpeg 01;35
+-.gif 01;35
+-.bmp 01;35
+-.pbm 01;35
+-.pgm 01;35
+-.ppm 01;35
+-.tga 01;35
+-.xbm 01;35
+-.xpm 01;35
+-.tif 01;35
+-.tiff 01;35
+-.png 01;35
+-.svg 01;35
+-.svgz 01;35
+-.mng 01;35
+-.pcx 01;35
+-.mov 01;35
+-.mpg 01;35
+-.mpeg 01;35
+-.m2v 01;35
+-.mkv 01;35
+-.webm 01;35
+-.ogm 01;35
+-.mp4 01;35
+-.m4v 01;35
+-.mp4v 01;35
+-.vob 01;35
+-.qt 01;35
+-.nuv 01;35
+-.wmv 01;35
+-.asf 01;35
+-.rm 01;35
+-.rmvb 01;35
+-.flc 01;35
+-.avi 01;35
+-.fli 01;35
+-.flv 01;35
+-.gl 01;35
+-.dl 01;35
+-.xcf 01;35
+-.xwd 01;35
+-.yuv 01;35
+-.cgm 01;35
+-.emf 01;35
++.jpg 00;35
++.jpeg 00;35
++.gif 00;35
++.bmp 00;35
++.pbm 00;35
++.pgm 00;35
++.ppm 00;35
++.tga 00;35
++.xbm 00;35
++.xpm 00;35
++.tif 00;35
++.tiff 00;35
++.png 00;35
++.svg 00;35
++.svgz 00;35
++.mng 00;35
++.pcx 00;35
++.mov 00;35
++.mpg 00;35
++.mpeg 00;35
++.m2v 00;35
++.mkv 00;35
++.webm 00;35
++.ogm 00;35
++.mp4 00;35
++.m4v 00;35
++.mp4v 00;35
++.vob 00;35
++.qt 00;35
++.nuv 00;35
++.wmv 00;35
++.asf 00;35
++.rm 00;35
++.rmvb 00;35
++.flc 00;35
++.avi 00;35
++.fli 00;35
++.flv 00;35
++.gl 00;35
++.dl 00;35
++.xcf 00;35
++.xwd 00;35
++.yuv 00;35
++.cgm 00;35
++.emf 00;35
+
+ # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+-.ogv 01;35
+-.ogx 01;35
++.ogv 00;35
++.ogx 00;35
+
+ # audio formats
+ .aac 00;36
+--
+2.5.5
+
diff --git a/coreutils-DIR_COLORS b/coreutils-DIR_COLORS
deleted file mode 100644
index 27af9d7..0000000
--- a/coreutils-DIR_COLORS
+++ /dev/null
@@ -1,207 +0,0 @@
-# Configuration file for dircolors, a utility to help you set the
-# LS_COLORS environment variable used by GNU ls with the --color option.
-
-# This file goes in the /etc directory, and must be world readable.
-# You can copy this file to .dir_colors in your $HOME directory to override
-# the system defaults.
-
-# Copyright (C) 1996-2016 Free Software Foundation, Inc.
-# Copying and distribution of this file, with or without modification,
-# are permitted provided the copyright notice and this notice are preserved.
-
-# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
-# slackware version of dircolors) are recognized but ignored.
-
-# Below are TERM entries, which can be a glob patterns, to match
-# against the TERM environment variable to determine if it is colorizable.
-TERM Eterm
-TERM ansi
-TERM color-xterm
-TERM con[0-9]*x[0-9]*
-TERM cons25
-TERM console
-TERM cygwin
-TERM dtterm
-TERM eterm-color
-TERM gnome
-TERM gnome-256color
-TERM hurd
-TERM jfbterm
-TERM konsole
-TERM kterm
-TERM linux
-TERM linux-c
-TERM mach-color
-TERM mach-gnu-color
-TERM mlterm
-TERM putty
-TERM putty-256color
-TERM rxvt*
-TERM screen*
-TERM st
-TERM st-256color
-TERM terminator
-TERM tmux*
-TERM vt100
-TERM xterm*
-
-# Below are the color init strings for the basic file types. A color init
-# string consists of one or more of the following numeric codes:
-# Attribute codes:
-# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
-# Text color codes:
-# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
-# Background color codes:
-# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
-#NORMAL 00 # no color code at all
-#FILE 00 # regular file: use no color at all
-RESET 0 # reset to "normal" color
-DIR 01;34 # directory
-LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
- # numerical value, the color is as for the file pointed to.)
-MULTIHARDLINK 00 # regular file with more than one link
-FIFO 40;33 # pipe
-SOCK 01;35 # socket
-DOOR 01;35 # door
-BLK 40;33;01 # block device driver
-CHR 40;33;01 # character device driver
-ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
-MISSING 01;05;37;41 # ... and the files they point to
-SETUID 37;41 # file that is setuid (u+s)
-SETGID 30;43 # file that is setgid (g+s)
-CAPABILITY 30;41 # file with capability
-STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
-OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
-STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
-
-# This is for files with execute permission:
-EXEC 01;32
-
-# List any file extensions like '.gz' or '.tar' that you would like ls
-# to colorize below. Put the extension, a space, and the color init string.
-# (and any comments you want to add after a '#')
-
-# If you use DOS-style suffixes, you may want to uncomment the following:
-#.cmd 01;32 # executables (bright green)
-#.exe 01;32
-#.com 01;32
-#.btm 01;32
-#.bat 01;32
-# Or if you want to colorize scripts even if they do not have the
-# executable bit actually set.
-#.sh 01;32
-#.csh 01;32
-
- # archives or compressed (bright red)
-.tar 01;31
-.tgz 01;31
-.arc 01;31
-.arj 01;31
-.taz 01;31
-.lha 01;31
-.lz4 01;31
-.lzh 01;31
-.lzma 01;31
-.tlz 01;31
-.txz 01;31
-.tzo 01;31
-.t7z 01;31
-.zip 01;31
-.z 01;31
-.Z 01;31
-.dz 01;31
-.gz 01;31
-.lrz 01;31
-.lz 01;31
-.lzo 01;31
-.xz 01;31
-.bz2 01;31
-.bz 01;31
-.tbz 01;31
-.tbz2 01;31
-.tz 01;31
-.deb 01;31
-.rpm 01;31
-.jar 01;31
-.war 01;31
-.ear 01;31
-.sar 01;31
-.rar 01;31
-.alz 01;31
-.ace 01;31
-.zoo 01;31
-.cpio 01;31
-.7z 01;31
-.rz 01;31
-.cab 01;31
-
-# image formats
-.jpg 01;35
-.jpeg 01;35
-.gif 01;35
-.bmp 01;35
-.pbm 01;35
-.pgm 01;35
-.ppm 01;35
-.tga 01;35
-.xbm 01;35
-.xpm 01;35
-.tif 01;35
-.tiff 01;35
-.png 01;35
-.svg 01;35
-.svgz 01;35
-.mng 01;35
-.pcx 01;35
-.mov 01;35
-.mpg 01;35
-.mpeg 01;35
-.m2v 01;35
-.mkv 01;35
-.webm 01;35
-.ogm 01;35
-.mp4 01;35
-.m4v 01;35
-.mp4v 01;35
-.vob 01;35
-.qt 01;35
-.nuv 01;35
-.wmv 01;35
-.asf 01;35
-.rm 01;35
-.rmvb 01;35
-.flc 01;35
-.avi 01;35
-.fli 01;35
-.flv 01;35
-.gl 01;35
-.dl 01;35
-.xcf 01;35
-.xwd 01;35
-.yuv 01;35
-.cgm 01;35
-.emf 01;35
-
-# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
-.ogv 01;35
-.ogx 01;35
-
-# audio formats
-.aac 01;36
-.au 01;36
-.flac 01;36
-.m4a 01;36
-.mid 01;36
-.midi 01;36
-.mka 01;36
-.mp3 01;36
-.mpc 01;36
-.ogg 01;36
-.ra 01;36
-.wav 01;36
-
-# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
-.oga 01;36
-.opus 01;36
-.spx 01;36
-.xspf 01;36
diff --git a/coreutils-DIR_COLORS.256color b/coreutils-DIR_COLORS.256color
deleted file mode 100644
index 74c34ba..0000000
--- a/coreutils-DIR_COLORS.256color
+++ /dev/null
@@ -1,189 +0,0 @@
-# Configuration file for the 256color ls utility
-
-# This file goes in the /etc directory, and must be world readable.
-# You can copy this file to .dir_colors in your $HOME directory to override
-# the system defaults.
-
-# Copyright (C) 1996-2016 Free Software Foundation, Inc.
-# Copying and distribution of this file, with or without modification,
-# are permitted provided the copyright notice and this notice are preserved.
-
-# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
-# slackware version of dircolors) are recognized but ignored.
-
-# Below are TERM entries, which can be a glob patterns, to match
-# against the TERM environment variable to determine if it is colorizable.
-TERM *256color*
-TERM rxvt-unicode256
-
-# Below are the color init strings for the basic file types. A color init
-# string consists of one or more of the following numeric codes:
-# Attribute codes:
-# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
-# Text color codes:
-# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
-# Background color codes:
-# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
-# Text color(256 colors mode) codes:
-# Valid syntax for text 256color is 38;5; , where color number
-# is number between 0 and 255.
-# You may find following command useful to search the best one for you:
-# for ((x=0; x<=255; x++));do echo -e "${x}:\033[38;5;${x}mcolor\033[000m";done
-# Background color(256 colors mode) codes:
-# Valid syntax for background 256color is 48;5; , where
-# color number is number between 0 and 255.
-# You may find following command useful to search the best one for you:
-# for ((x=0; x<=255; x++));do echo -e "${x}:\033[48;5;${x}mcolor\033[000m";done
-
-#NORMAL 00 # no color code at all
-#FILE 00 # regular file: use no color at all
-RESET 0 # reset to "normal" color
-DIR 38;5;33 # directory
-LINK 38;5;51 # symbolic link. (If you set this to 'target' instead of a
- # numerical value, the color is as for the file pointed to.)
-MULTIHARDLINK 00 # regular file with more than one link
-FIFO 40;38;5;11 # pipe
-SOCK 38;5;13 # socket
-DOOR 38;5;5 # door
-BLK 48;5;232;38;5;11 # block device driver
-CHR 48;5;232;38;5;3 # character device driver
-ORPHAN 48;5;232;38;5;9 # symlink to nonexistent file, or non-stat'able file ...
-MISSING 01;05;37;41 # ... and the files they point to
-SETUID 48;5;196;38;5;15 # file that is setuid (u+s)
-SETGID 48;5;11;38;5;16 # file that is setgid (g+s)
-CAPABILITY 48;5;196;38;5;226 # file with capability
-STICKY_OTHER_WRITABLE 48;5;10;38;5;16 # dir that is sticky and other-writable (+t,o+w)
-OTHER_WRITABLE 48;5;10;38;5;21 # dir that is other-writable (o+w) and not sticky
-STICKY 48;5;21;38;5;15 # dir with the sticky bit set (+t) and not other-writable
-
-# This is for files with execute permission:
-EXEC 38;5;40
-
-# List any file extensions like '.gz' or '.tar' that you would like ls
-# to colorize below. Put the extension, a space, and the color init string.
-# (and any comments you want to add after a '#')
-
-# If you use DOS-style suffixes, you may want to uncomment the following:
-#.cmd 01;32 # executables (bright green)
-#.exe 01;32
-#.com 01;32
-#.btm 01;32
-#.bat 01;32
-# Or if you want to colorize scripts even if they do not have the
-# executable bit actually set.
-#.sh 01;32
-#.csh 01;32
-
- # archives or compressed (bright red)
-.tar 38;5;9
-.tgz 38;5;9
-.arc 38;5;9
-.arj 38;5;9
-.taz 38;5;9
-.lha 38;5;9
-.lz4 38;5;9
-.lzh 38;5;9
-.lzma 38;5;9
-.tlz 38;5;9
-.txz 38;5;9
-.tzo 38;5;9
-.t7z 38;5;9
-.zip 38;5;9
-.z 38;5;9
-.Z 38;5;9
-.dz 38;5;9
-.gz 38;5;9
-.lrz 38;5;9
-.lz 38;5;9
-.lzo 38;5;9
-.xz 38;5;9
-.bz2 38;5;9
-.bz 38;5;9
-.tbz 38;5;9
-.tbz2 38;5;9
-.tz 38;5;9
-.deb 38;5;9
-.rpm 38;5;9
-.jar 38;5;9
-.war 38;5;9
-.ear 38;5;9
-.sar 38;5;9
-.rar 38;5;9
-.alz 38;5;9
-.ace 38;5;9
-.zoo 38;5;9
-.cpio 38;5;9
-.7z 38;5;9
-.rz 38;5;9
-.cab 38;5;9
-
-# image formats
-.jpg 38;5;13
-.jpeg 38;5;13
-.gif 38;5;13
-.bmp 38;5;13
-.pbm 38;5;13
-.pgm 38;5;13
-.ppm 38;5;13
-.tga 38;5;13
-.xbm 38;5;13
-.xpm 38;5;13
-.tif 38;5;13
-.tiff 38;5;13
-.png 38;5;13
-.svg 38;5;13
-.svgz 38;5;13
-.mng 38;5;13
-.pcx 38;5;13
-.mov 38;5;13
-.mpg 38;5;13
-.mpeg 38;5;13
-.m2v 38;5;13
-.mkv 38;5;13
-.webm 38;5;13
-.ogm 38;5;13
-.mp4 38;5;13
-.m4v 38;5;13
-.mp4v 38;5;13
-.vob 38;5;13
-.qt 38;5;13
-.nuv 38;5;13
-.wmv 38;5;13
-.asf 38;5;13
-.rm 38;5;13
-.rmvb 38;5;13
-.flc 38;5;13
-.avi 38;5;13
-.fli 38;5;13
-.flv 38;5;13
-.gl 38;5;13
-.dl 38;5;13
-.xcf 38;5;13
-.xwd 38;5;13
-.yuv 38;5;13
-.cgm 38;5;13
-.emf 38;5;13
-
-# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
-.ogv 38;5;13
-.ogx 38;5;13
-
-# audio formats
-.aac 38;5;45
-.au 38;5;45
-.flac 38;5;45
-.m4a 38;5;45
-.mid 38;5;45
-.midi 38;5;45
-.mka 38;5;45
-.mp3 38;5;45
-.mpc 38;5;45
-.ogg 38;5;45
-.ra 38;5;45
-.wav 38;5;45
-
-# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
-.oga 38;5;45
-.opus 38;5;45
-.spx 38;5;45
-.xspf 38;5;45
diff --git a/coreutils-DIR_COLORS.lightbgcolor b/coreutils-DIR_COLORS.lightbgcolor
deleted file mode 100644
index 95d6879..0000000
--- a/coreutils-DIR_COLORS.lightbgcolor
+++ /dev/null
@@ -1,206 +0,0 @@
-# Configuration file for the color ls utility - modified for lighter backgrounds
-
-# This file goes in the /etc directory, and must be world readable.
-# You can copy this file to .dir_colors in your $HOME directory to override
-# the system defaults.
-
-# Copyright (C) 1996-2016 Free Software Foundation, Inc.
-# Copying and distribution of this file, with or without modification,
-# are permitted provided the copyright notice and this notice are preserved.
-
-# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
-# slackware version of dircolors) are recognized but ignored.
-
-# Below are TERM entries, which can be a glob patterns, to match
-# against the TERM environment variable to determine if it is colorizable.
-TERM Eterm
-TERM ansi
-TERM color-xterm
-TERM con[0-9]*x[0-9]*
-TERM cons25
-TERM console
-TERM cygwin
-TERM dtterm
-TERM eterm-color
-TERM gnome
-TERM gnome-256color
-TERM hurd
-TERM jfbterm
-TERM konsole
-TERM kterm
-TERM linux
-TERM linux-c
-TERM mach-color
-TERM mach-gnu-color
-TERM mlterm
-TERM putty
-TERM putty-256color
-TERM rxvt*
-TERM screen*
-TERM st
-TERM st-256color
-TERM terminator
-TERM tmux*
-TERM vt100
-TERM xterm*
-
-# Below are the color init strings for the basic file types. A color init
-# string consists of one or more of the following numeric codes:
-# Attribute codes:
-# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
-# Text color codes:
-# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
-# Background color codes:
-# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
-#NORMAL 00 # no color code at all
-#FILE 00 # regular file: use no color at all
-RESET 0 # reset to "normal" color
-DIR 00;34 # directory
-LINK 00;36 # symbolic link. (If you set this to 'target' instead of a
- # numerical value, the color is as for the file pointed to.)
-MULTIHARDLINK 00 # regular file with more than one link
-FIFO 40;33 # pipe
-SOCK 00;35 # socket
-DOOR 00;35 # door
-BLK 40;33;01 # block device driver
-CHR 40;33;01 # character device driver
-ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
-MISSING 01;05;37;41 # ... and the files they point to
-SETUID 37;41 # file that is setuid (u+s)
-SETGID 30;43 # file that is setgid (g+s)
-CAPABILITY 30;41 # file with capability
-STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
-OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
-STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
-
-# This is for files with execute permission:
-EXEC 00;32
-
-# List any file extensions like '.gz' or '.tar' that you would like ls
-# to colorize below. Put the extension, a space, and the color init string.
-# (and any comments you want to add after a '#')
-
-# If you use DOS-style suffixes, you may want to uncomment the following:
-#.cmd 01;32 # executables (bright green)
-#.exe 01;32
-#.com 01;32
-#.btm 01;32
-#.bat 01;32
-# Or if you want to colorize scripts even if they do not have the
-# executable bit actually set.
-#.sh 01;32
-#.csh 01;32
-
-# archives or compressed (red)
-.tar 00;31
-.tgz 00;31
-.arc 00;31
-.arj 00;31
-.taz 00;31
-.lha 00;31
-.lz4 00;31
-.lzh 00;31
-.lzma 00;31
-.tlz 00;31
-.txz 00;31
-.tzo 00;31
-.t7z 00;31
-.zip 00;31
-.z 00;31
-.Z 00;31
-.dz 00;31
-.gz 00;31
-.lrz 00;31
-.lz 00;31
-.lzo 00;31
-.xz 00;31
-.bz2 00;31
-.bz 00;31
-.tbz 00;31
-.tbz2 00;31
-.tz 00;31
-.deb 00;31
-.rpm 00;31
-.jar 00;31
-.war 00;31
-.ear 00;31
-.sar 00;31
-.rar 00;31
-.alz 00;31
-.ace 00;31
-.zoo 00;31
-.cpio 00;31
-.7z 00;31
-.rz 00;31
-.cab 00;31
-
-# image formats
-.jpg 00;35
-.jpeg 00;35
-.gif 00;35
-.bmp 00;35
-.pbm 00;35
-.pgm 00;35
-.ppm 00;35
-.tga 00;35
-.xbm 00;35
-.xpm 00;35
-.tif 00;35
-.tiff 00;35
-.png 00;35
-.svg 00;35
-.svgz 00;35
-.mng 00;35
-.pcx 00;35
-.mov 00;35
-.mpg 00;35
-.mpeg 00;35
-.m2v 00;35
-.mkv 00;35
-.webm 00;35
-.ogm 00;35
-.mp4 00;35
-.m4v 00;35
-.mp4v 00;35
-.vob 00;35
-.qt 00;35
-.nuv 00;35
-.wmv 00;35
-.asf 00;35
-.rm 00;35
-.rmvb 00;35
-.flc 00;35
-.avi 00;35
-.fli 00;35
-.flv 00;35
-.gl 00;35
-.dl 00;35
-.xcf 00;35
-.xwd 00;35
-.yuv 00;35
-.cgm 00;35
-.emf 00;35
-
-# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
-.ogv 00;35
-.ogx 00;35
-
-# audio formats
-.aac 00;36
-.au 00;36
-.flac 00;36
-.m4a 00;36
-.mid 00;36
-.midi 00;36
-.mka 00;36
-.mp3 00;36
-.mpc 00;36
-.ogg 00;36
-.ra 00;36
-.wav 00;36
-
-# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
-.oga 00;36
-.opus 00;36
-.spx 00;36
-.xspf 00;36
diff --git a/coreutils.spec b/coreutils.spec
index c181af7..00c5fc6 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -8,9 +8,6 @@ Url: http://www.gnu.org/software/coreutils/
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
Source2: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig
Source50: supported_utils
-Source101: coreutils-DIR_COLORS
-Source102: coreutils-DIR_COLORS.lightbgcolor
-Source103: coreutils-DIR_COLORS.256color
Source105: coreutils-colorls.sh
Source106: coreutils-colorls.csh
@@ -27,6 +24,8 @@ Source10: coreutils-find-requires.sh
Patch100: coreutils-6.10-configuration.patch
#add note about no difference between binary/text mode on Linux - md5sum manpage
Patch101: coreutils-6.10-manpages.patch
+# downstream changes to default DIR_COLORS
+Patch102: coreutils-8.25-DIR_COLORS.patch
#do display processor type for uname -p/-i based on uname(2) syscall
Patch103: coreutils-8.2-uname-processortype.patch
#df --direct
@@ -166,9 +165,13 @@ including documentation and translations.
%prep
%setup -q
+# will be modified by coreutils-8.25-DIR_COLORS.patch
+tee DIR_COLORS{,.256color,.lightbgcolor} < src/dircolors.hin
+
# Our patches
%patch100 -p1 -b .configure
%patch101 -p1 -b .manpages
+%patch102 -p1
%patch103 -p1 -b .sysinfo
%patch104 -p1 -b .dfdirect
%patch107 -p1 -b .mkdirmode
@@ -272,9 +275,8 @@ fi
bzip2 -9f ChangeLog
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
-install -p -c -m644 %SOURCE101 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS
-install -p -c -m644 %SOURCE102 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS.lightbgcolor
-install -p -c -m644 %SOURCE103 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS.256color
+install -p -c -m644 DIR_COLORS{,.256color,.lightbgcolor} \
+ $RPM_BUILD_ROOT%{_sysconfdir}
install -p -c -m644 %SOURCE105 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.sh
install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.csh
From 3b6df16a3d127c6fbe30e77cc907ea38ef916c15 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 20 Jun 2016 16:00:47 +0200
Subject: [PATCH 007/232] Resolves: #1348043 - do not use /bin/mv in %post
... to avoid a circular dependency.
The code where /bin/mv was used does not seem to be useful any more.
Fileutils, Shellutils, and Textutils were merged into GNU Coreutils
in 2002. It should be safe not to handle the transition now in 2016.
---
coreutils.spec | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/coreutils.spec b/coreutils.spec
index 00c5fc6..5206c3f 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 8%{?dist}
+Release: 9%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -114,11 +114,7 @@ BuildRequires: attr
BuildRequires: strace
Requires: %{name}-common = %{version}-%{release}
-Requires(pre): /sbin/install-info
-Requires(preun): /sbin/install-info
-Requires(post): /sbin/install-info
-Requires(post): grep
-Requires: ncurses
+Requires: ncurses
Provides: fileutils = %{version}-%{release}
Provides: sh-utils = %{version}-%{release}
@@ -157,6 +153,9 @@ packaged as a single multicall binary.
# yum obsoleting rules explained at:
# https://bugzilla.redhat.com/show_bug.cgi?id=1107973#c7
Obsoletes: %{name} < 8.24-100
+Requires(pre): /sbin/install-info
+Requires(preun): /sbin/install-info
+Requires(post): /sbin/install-info
Summary: coreutils common optional components
%description common
Optional though recommended components,
@@ -317,9 +316,6 @@ if [ $1 = 0 ]; then
fi
%post common
-%{_bindir}/grep -v '(sh-utils)\|(fileutils)\|(textutils)' %{_infodir}/dir > \
- %{_infodir}/dir.rpmmodify || exit 0
- /bin/mv -f %{_infodir}/dir.rpmmodify %{_infodir}/dir
if [ -f %{_infodir}/%{name}.info.gz ]; then
/sbin/install-info %{_infodir}/%{name}.info.gz %{_infodir}/dir || :
fi
@@ -349,6 +345,9 @@ fi
%license COPYING
%changelog
+* Mon Jun 20 2016 Kamil Dudka - 8.25-9
+- do not use /bin/mv in %%post to avoid a circular dependency (#1348043)
+
* Fri Jun 17 2016 Kamil Dudka - 8.25-8
- sync /etc/DIR_COLORS with latest upstream (#1335320)
From 0433f98b1b33fc061c62eb2cae419d75d31d4530 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 20 Jun 2016 16:37:32 +0200
Subject: [PATCH 008/232] coreutils.spec: sort BuildRequires alphabetically
No observable changes intended. Just to ease the maintenance.
---
coreutils.spec | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/coreutils.spec b/coreutils.spec
index 5206c3f..c6f3770 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -100,18 +100,19 @@ Provides: /bin/touch
Provides: /bin/true
Provides: /bin/uname
-BuildRequires: libselinux-devel
-BuildRequires: libacl-devel
-BuildRequires: gettext bison
-BuildRequires: texinfo
+BuildRequires: attr
BuildRequires: autoconf
BuildRequires: automake
-BuildRequires: libcap-devel
-BuildRequires: libattr-devel
-BuildRequires: openssl-devel
+BuildRequires: bison
+BuildRequires: gettext
BuildRequires: gmp-devel
-BuildRequires: attr
+BuildRequires: libacl-devel
+BuildRequires: libattr-devel
+BuildRequires: libcap-devel
+BuildRequires: libselinux-devel
+BuildRequires: openssl-devel
BuildRequires: strace
+BuildRequires: texinfo
Requires: %{name}-common = %{version}-%{release}
Requires: ncurses
From ee3bfc24ca4a94fb7667021aafc6dc69b9915c0f Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 20 Jun 2016 16:42:47 +0200
Subject: [PATCH 009/232] add BR for glibc-langpack-en to prevent the expand/mb
test from failing
---
coreutils.spec | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/coreutils.spec b/coreutils.spec
index c6f3770..e6cf348 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -114,6 +114,11 @@ BuildRequires: openssl-devel
BuildRequires: strace
BuildRequires: texinfo
+%if 23 < 0%{?fedora} || 7 < 0%{?rhel}
+# needed by i18n test-cases
+BuildRequires: glibc-langpack-en
+%endif
+
Requires: %{name}-common = %{version}-%{release}
Requires: ncurses
@@ -347,6 +352,7 @@ fi
%changelog
* Mon Jun 20 2016 Kamil Dudka - 8.25-9
+- add BR for glibc-langpack-en to prevent the expand/mb test from failing
- do not use /bin/mv in %%post to avoid a circular dependency (#1348043)
* Fri Jun 17 2016 Kamil Dudka - 8.25-8
From 34ffa2ef55d8b8ecfd3d8539f7a07f109726d7c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?=
Date: Fri, 24 Jun 2016 12:45:22 +0200
Subject: [PATCH 010/232] change way of detection of interactive shell in
colorls.sh script
---
coreutils-colorls.sh | 2 +-
coreutils.spec | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/coreutils-colorls.sh b/coreutils-colorls.sh
index cfd2288..ac92268 100755
--- a/coreutils-colorls.sh
+++ b/coreutils-colorls.sh
@@ -1,7 +1,7 @@
# color-ls initialization
# Skip all for noninteractive shells.
-[ -z "$PS1" ] && return
+[ ! -t 0 ] && return
#when USER_LS_COLORS defined do not override user LS_COLORS, but use them.
if [ -z "$USER_LS_COLORS" ]; then
diff --git a/coreutils.spec b/coreutils.spec
index e6cf348..4abace5 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 9%{?dist}
+Release: 10%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -351,6 +351,10 @@ fi
%license COPYING
%changelog
+* Fri Jun 24 2016 Ondrej Vasik - 8.25-10
+- change way of detection of interactive shell in colorls.sh script
+ (#1321648)
+
* Mon Jun 20 2016 Kamil Dudka - 8.25-9
- add BR for glibc-langpack-en to prevent the expand/mb test from failing
- do not use /bin/mv in %%post to avoid a circular dependency (#1348043)
From 0a63fa44ae6dae29c7515b5fa4e6f581c19e46f3 Mon Sep 17 00:00:00 2001
From: Jakub Martisko
Date: Thu, 7 Jul 2016 12:53:26 +0200
Subject: [PATCH 011/232] (un)expand: UTF8-BOM header detection
---
coreutils-i18n-un-expand-BOM.patch | 443 +++++++++++++++++++++++++++++
coreutils.spec | 11 +-
2 files changed, 453 insertions(+), 1 deletion(-)
create mode 100644 coreutils-i18n-un-expand-BOM.patch
diff --git a/coreutils-i18n-un-expand-BOM.patch b/coreutils-i18n-un-expand-BOM.patch
new file mode 100644
index 0000000..44769c6
--- /dev/null
+++ b/coreutils-i18n-un-expand-BOM.patch
@@ -0,0 +1,443 @@
+diff -up ./src/expand-core.c.orig ./src/expand-core.c
+--- ./src/expand-core.c.orig 2016-06-28 14:44:18.281619000 +0200
++++ ./src/expand-core.c 2016-06-30 11:46:50.025109755 +0200
+@@ -18,6 +18,7 @@
+
+ #include
+ #include
++#include
+
+ #include "system.h"
+ #include "error.h"
+@@ -27,6 +28,119 @@
+
+ #include "expand-core.h"
+
++extern inline int
++set_utf_locale (void)
++{
++ /*try using some predefined locale */
++ const char* predef_locales[] = {"C.UTF8","en_US.UTF8","en_GB.UTF8"};
++
++ const int predef_locales_count=3;
++ for (int i=0;ibufcount=0;
++ if (c == 0xEF)
++ {
++ c=fgetc(fp);
++ }
++ else
++ {
++ if (c != EOF)
++ {
++ ungetc(c,fp);
++ }
++ return false;
++ }
++
++ if (c == 0xBB)
++ {
++ c=fgetc(fp);
++ }
++ else
++ {
++ if ( c!= EOF )
++ {
++ mbf->buf[0]=(unsigned char) 0xEF;
++ mbf->bufcount=1;
++ ungetc(c,fp);
++ return false;
++ }
++ else
++ {
++ ungetc(0xEF,fp);
++ return false;
++ }
++ }
++ if (c == 0xBF)
++ {
++ mbf->bufcount=0;
++ return true;
++ }
++ else
++ {
++ if (c != EOF)
++ {
++ mbf->buf[0]=(unsigned char) 0xEF;
++ mbf->buf[1]=(unsigned char) 0xBB;
++ mbf->bufcount=2;
++ ungetc(c,fp);
++ return false;
++ }
++ else
++ {
++ mbf->buf[0]=(unsigned char) 0xEF;
++ mbf->bufcount=1;
++ ungetc(0xBB,fp);
++ return false;
++ }
++ }
++ return false;
++}
++
++extern inline void
++print_bom(void)
++{
++ putc (0xEF, stdout);
++ putc (0xBB, stdout);
++ putc (0xBF, stdout);
++}
++
+ /* Add the comma or blank separated list of tab stops STOPS
+ to the list of tab stops. */
+
+diff -up ./src/expand-core.h.orig ./src/expand-core.h
+--- ./src/expand-core.h.orig 2016-06-28 14:44:18.281619000 +0200
++++ ./src/expand-core.h 2016-06-30 11:47:18.929437205 +0200
+@@ -15,7 +15,7 @@
+ along with this program. If not, see . */
+
+ #ifndef EXPAND_CORE_H_
+-# define EXPAND_CORE_H_
++#define EXPAND_CORE_H_
+
+ extern size_t first_free_tab;
+
+@@ -29,6 +29,18 @@ extern char **file_list;
+
+ extern bool have_read_stdin;
+
++inline int
++set_utf_locale (void);
++
++bool
++check_utf_locale(void);
++
++bool
++check_bom(FILE* fp, mb_file_t *mbf);
++
++inline void
++print_bom(void);
++
+ void
+ parse_tab_stops (char const *stops, void (*add_tab_stop)(uintmax_t));
+
+diff -up ./src/expand.c.orig ./src/expand.c
+--- ./src/expand.c.orig 2016-06-28 14:44:18.286619000 +0200
++++ ./src/expand.c 2016-06-30 11:50:15.077312947 +0200
+@@ -149,11 +149,33 @@ expand (void)
+ FILE *fp = next_file (NULL);
+ mb_file_t mbf;
+ mbf_char_t c;
+-
++ /* True if the starting locale is utf8. */
++ bool using_utf_locale;
++
++ /* True if the first file contains BOM header. */
++ bool found_bom;
++ using_utf_locale=check_utf_locale();
++
+ if (!fp)
+ return;
+-
+ mbf_init (mbf, fp);
++ found_bom=check_bom(fp,&mbf);
++
++ if (using_utf_locale == false && found_bom == true)
++ {
++ /*try using some predefined locale */
++
++ if (set_utf_locale () != 0)
++ {
++ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale"));
++ }
++ }
++
++
++ if (found_bom == true)
++ {
++ print_bom();
++ }
+
+ while (true)
+ {
+@@ -178,6 +200,27 @@ expand (void)
+ if ((mb_iseof (c)) && (fp = next_file (fp)))
+ {
+ mbf_init (mbf, fp);
++ if (fp!=NULL)
++ {
++ if (check_bom(fp,&mbf)==true)
++ {
++ /*Not the first file - check BOM header*/
++ if (using_utf_locale==false && found_bom==false)
++ {
++ /*BOM header in subsequent file but not in the first one. */
++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
++ }
++ }
++ else
++ {
++ if(using_utf_locale==false && found_bom==true)
++ {
++ /*First file conatined BOM header - locale was switched to UTF
++ /*all subsequent files should contain BOM. */
++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
++ }
++ }
++ }
+ continue;
+ }
+ else
+diff -up ./src/unexpand.c.orig ./src/unexpand.c
+--- ./src/unexpand.c.orig 2016-06-28 17:39:22.894259000 +0200
++++ ./src/unexpand.c 2016-07-07 09:48:07.659924755 +0200
+@@ -172,16 +172,36 @@ unexpand (void)
+ include characters other than spaces, so the blanks must be
+ stored, not merely counted. */
+ mbf_char_t *pending_blank;
++ /* True if the starting locale is utf8. */
++ bool using_utf_locale;
++
++ /* True if the first file contains BOM header. */
++ bool found_bom;
++ using_utf_locale=check_utf_locale();
+
+ if (!fp)
+ return;
++ mbf_init (mbf, fp);
++ found_bom=check_bom(fp,&mbf);
+
++ if (using_utf_locale == false && found_bom == true)
++ {
++ /*try using some predefined locale */
++
++ if (set_utf_locale () != 0)
++ {
++ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale"));
++ }
++ }
+ /* The worst case is a non-blank character, then one blank, then a
+ tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
+ allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
+ pending_blank = xmalloc (max_column_width * sizeof (mbf_char_t));
+
+- mbf_init (mbf, fp);
++ if (found_bom == true)
++ {
++ print_bom();
++ }
+
+ while (true)
+ {
+@@ -225,6 +245,27 @@ unexpand (void)
+ if ((mb_iseof (c)) && (fp = next_file (fp)))
+ {
+ mbf_init (mbf, fp);
++ if (fp!=NULL)
++ {
++ if (check_bom(fp,&mbf)==true)
++ {
++ /*Not the first file - check BOM header*/
++ if (using_utf_locale==false && found_bom==false)
++ {
++ /*BOM header in subsequent file but not in the first one. */
++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
++ }
++ }
++ else
++ {
++ if(using_utf_locale==false && found_bom==true)
++ {
++ /*First file conatined BOM header - locale was switched to UTF
++ /*all subsequent files should contain BOM. */
++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
++ }
++ }
++ }
+ continue;
+ }
+ else
+diff -up ./tests/expand/mb.sh.orig ./tests/expand/mb.sh
+--- ./tests/expand/mb.sh.orig 2016-06-28 14:44:18.287619000 +0200
++++ ./tests/expand/mb.sh 2016-06-30 11:57:10.038407216 +0200
+@@ -109,4 +109,75 @@ äbcdef\xFF |
+ expand < in > out || fail=1
+ compare exp out > /dev/null 2>&1 || fail=1
+
++
++
++#BOM header test 1
++printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++EOF
++env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_
++
++printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++
++expand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LANG=C expand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LC_ALL=C expand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++
++printf '\xEF\xBB\xBF' > in1; cat <<\EOF >> in1 || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++EOF
++env printf ' äöü\t. öüä. \tä xx\n' >> in1 || framework_failure_
++
++
++printf '\xEF\xBB\xBF' > exp; cat <<\EOF >> exp || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++expand in1 in1 > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LANG=C expand in1 in1 > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LC_ALL=C expand in1 in1 > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
+ exit $fail
+diff -up ./tests/unexpand/mb.sh.orig ./tests/unexpand/mb.sh
+--- ./tests/unexpand/mb.sh.orig 2016-06-28 17:39:22.895259000 +0200
++++ ./tests/unexpand/mb.sh 2016-07-07 09:55:00.098281917 +0200
+@@ -111,3 +111,62 @@ äbcdef\xFF\t|
+
+ unexpand -a < in > out || fail=1
+ compare exp out > /dev/null 2>&1 || fail=1
++
++#BOM header test 1
++printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_
++
++printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++unexpand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LANG=C unexpand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LC_ALL=C unexpand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++
++printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++
++unexpand in in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LANG=C unexpand in in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LC_ALL=C unexpand in in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
diff --git a/coreutils.spec b/coreutils.spec
index 4abace5..21ec798 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 10%{?dist}
+Release: 11%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -50,6 +50,8 @@ Patch804: coreutils-i18n-cut-old.patch
Patch803: coreutils-i18n-fix-unexpand.patch
#(un)expand - allow multiple files on input - broken by patch 801
Patch805: coreutils-i18n-fix2-expand-unexpand.patch
+#(un)expand - test BOM headers
+Patch806: coreutils-i18n-un-expand-BOM.patch
#getgrouplist() patch from Ulrich Drepper.
Patch908: coreutils-getgrouplist.patch
@@ -192,6 +194,7 @@ tee DIR_COLORS{,.256color,.lightbgcolor} < src/dircolors.hin
%patch803 -p1 -b .i18n-fix-expand
%patch804 -p1 -b .i18n-cutold
%patch805 -p1 -b .i18n-fix2-expand-unexpand
+%patch806 -p1 -b .i18n-BOM-expand-unexpand
# Coreutils
%patch908 -p1 -b .getgrouplist
@@ -351,6 +354,12 @@ fi
%license COPYING
%changelog
+* Thu Jul 07 2016 Jakub Martisko - 8.25-10
+- switch to UTF8 locale when (un)expand input contains BOM header
+ (#1158494)
+- fixed regression where (un)expand would end with "long input line"
+ error when BOM header is present
+
* Fri Jun 24 2016 Ondrej Vasik - 8.25-10
- change way of detection of interactive shell in colorls.sh script
(#1321648)
From 7d9e8632f3705d65e212c081a55d1b3b32542d11 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 11 Jul 2016 17:13:20 +0200
Subject: [PATCH 012/232] coreutils.spec: fix the last change log entry
---
coreutils.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/coreutils.spec b/coreutils.spec
index 21ec798..b9801ec 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -354,7 +354,7 @@ fi
%license COPYING
%changelog
-* Thu Jul 07 2016 Jakub Martisko - 8.25-10
+* Thu Jul 07 2016 Jakub Martisko - 8.25-11
- switch to UTF8 locale when (un)expand input contains BOM header
(#1158494)
- fixed regression where (un)expand would end with "long input line"
From e207ff79a3eb3f451033f49c10f60a14c0d9d8cd Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 11 Jul 2016 17:14:09 +0200
Subject: [PATCH 013/232] Resolves: #1349579 - clarify recognition of
"^COLOR.*none" in /etc/DIR_COLORS
---
coreutils-8.25-DIR_COLORS.patch | 58 ++++++++++++++++++++++++---------
coreutils.spec | 5 ++-
2 files changed, 47 insertions(+), 16 deletions(-)
diff --git a/coreutils-8.25-DIR_COLORS.patch b/coreutils-8.25-DIR_COLORS.patch
index 546241b..54a96eb 100644
--- a/coreutils-8.25-DIR_COLORS.patch
+++ b/coreutils-8.25-DIR_COLORS.patch
@@ -4,16 +4,16 @@ Date: Fri, 17 Jun 2016 16:58:18 +0200
Subject: [PATCH] downstream changes to default DIR_COLORS
---
- DIR_COLORS | 38 ++++---
- DIR_COLORS.256color | 290 +++++++++++++++++++++++-------------------------
- DIR_COLORS.lightbgcolor | 197 ++++++++++++++++----------------
- 3 files changed, 259 insertions(+), 266 deletions(-)
+ DIR_COLORS | 44 +++----
+ DIR_COLORS.256color | 296 +++++++++++++++++++++++-------------------------
+ DIR_COLORS.lightbgcolor | 203 +++++++++++++++++----------------
+ 3 files changed, 271 insertions(+), 272 deletions(-)
diff --git a/DIR_COLORS b/DIR_COLORS
index d2ea453..27af9d7 100644
--- a/DIR_COLORS
+++ b/DIR_COLORS
-@@ -1,6 +1,10 @@
+@@ -1,12 +1,18 @@
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
@@ -24,7 +24,17 @@ index d2ea453..27af9d7 100644
# Copyright (C) 1996-2016 Free Software Foundation, Inc.
# Copying and distribution of this file, with or without modification,
# are permitted provided the copyright notice and this notice are preserved.
-@@ -62,7 +66,7 @@ DOOR 01;35 # door
+
+-# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
+-# slackware version of dircolors) are recognized but ignored.
++# The keywords OPTIONS and EIGHTBIT (honored by the slackware version of
++# dircolors) are recognized but ignored. For compatibility reasons, the
++# pattern "^COLOR.*none" is recognized as a way to disable colorization.
++# See https://bugzilla.redhat.com/1349579 for details.
+
+ # Below are TERM entries, which can be a glob patterns, to match
+ # against the TERM environment variable to determine if it is colorizable.
+@@ -62,7 +68,7 @@ DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
@@ -33,7 +43,7 @@ index d2ea453..27af9d7 100644
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
-@@ -183,21 +187,21 @@ EXEC 01;32
+@@ -183,21 +189,21 @@ EXEC 01;32
.ogx 01;35
# audio formats
@@ -75,7 +85,7 @@ diff --git a/DIR_COLORS.256color b/DIR_COLORS.256color
index d2ea453..74c34ba 100644
--- a/DIR_COLORS.256color
+++ b/DIR_COLORS.256color
-@@ -1,5 +1,8 @@
+@@ -1,45 +1,22 @@
-# Configuration file for dircolors, a utility to help you set the
-# LS_COLORS environment variable used by GNU ls with the --color option.
+# Configuration file for the 256color ls utility
@@ -86,7 +96,14 @@ index d2ea453..74c34ba 100644
# Copyright (C) 1996-2016 Free Software Foundation, Inc.
# Copying and distribution of this file, with or without modification,
-@@ -10,36 +13,8 @@
+ # are permitted provided the copyright notice and this notice are preserved.
+
+-# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
+-# slackware version of dircolors) are recognized but ignored.
++# The keywords OPTIONS and EIGHTBIT (honored by the slackware version of
++# dircolors) are recognized but ignored. For compatibility reasons, the
++# pattern "^COLOR.*none" is recognized as a way to disable colorization.
++# See https://bugzilla.redhat.com/1349579 for details.
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
@@ -125,7 +142,7 @@ index d2ea453..74c34ba 100644
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
-@@ -49,29 +24,40 @@ TERM xterm*
+@@ -49,29 +26,40 @@ TERM xterm*
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
@@ -182,7 +199,7 @@ index d2ea453..74c34ba 100644
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
-@@ -89,115 +75,115 @@ EXEC 01;32
+@@ -89,115 +77,115 @@ EXEC 01;32
#.csh 01;32
# archives or compressed (bright red)
@@ -406,7 +423,7 @@ diff --git a/DIR_COLORS.lightbgcolor b/DIR_COLORS.lightbgcolor
index d2ea453..95d6879 100644
--- a/DIR_COLORS.lightbgcolor
+++ b/DIR_COLORS.lightbgcolor
-@@ -1,5 +1,8 @@
+@@ -1,12 +1,17 @@
-# Configuration file for dircolors, a utility to help you set the
-# LS_COLORS environment variable used by GNU ls with the --color option.
+# Configuration file for the color ls utility - modified for lighter backgrounds
@@ -417,7 +434,18 @@ index d2ea453..95d6879 100644
# Copyright (C) 1996-2016 Free Software Foundation, Inc.
# Copying and distribution of this file, with or without modification,
-@@ -52,17 +55,17 @@ TERM xterm*
+ # are permitted provided the copyright notice and this notice are preserved.
+
+-# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
+-# slackware version of dircolors) are recognized but ignored.
++# The keywords OPTIONS and EIGHTBIT (honored by the slackware version of
++# dircolors) are recognized but ignored. For compatibility reasons, the
++# pattern "^COLOR.*none" is recognized as a way to disable colorization.
++# See https://bugzilla.redhat.com/1349579 for details.
+
+ # Below are TERM entries, which can be a glob patterns, to match
+ # against the TERM environment variable to determine if it is colorizable.
+@@ -52,17 +57,17 @@ TERM xterm*
#NORMAL 00 # no color code at all
#FILE 00 # regular file: use no color at all
RESET 0 # reset to "normal" color
@@ -440,7 +468,7 @@ index d2ea453..95d6879 100644
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
-@@ -71,7 +74,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
+@@ -71,7 +76,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
@@ -449,7 +477,7 @@ index d2ea453..95d6879 100644
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
-@@ -88,99 +91,99 @@ EXEC 01;32
+@@ -88,99 +93,99 @@ EXEC 01;32
#.sh 01;32
#.csh 01;32
diff --git a/coreutils.spec b/coreutils.spec
index b9801ec..e4b0f45 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 11%{?dist}
+Release: 12%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -354,6 +354,9 @@ fi
%license COPYING
%changelog
+* Mon Jul 11 2016 Kamil Dudka - 8.25-12
+- clarify recognition of "^COLOR.*none" in /etc/DIR_COLORS (#1349579)
+
* Thu Jul 07 2016 Jakub Martisko - 8.25-11
- switch to UTF8 locale when (un)expand input contains BOM header
(#1158494)
From 3792f36ae5f2fc5bf735a7080611a71818564eb1 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 11 Jul 2016 17:16:31 +0200
Subject: [PATCH 014/232] Resolves: #1354078 - drop the %pre scriptlet
... which is no longer needed. Fileutils, Shellutils, and Textutils
were merged into GNU Coreutils in 2002. It should be safe not to handle
the transition now in 2016.
---
coreutils.spec | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/coreutils.spec b/coreutils.spec
index e4b0f45..60e8194 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -307,16 +307,6 @@ grep LC_TIME %name.lang | cut -d'/' -f1-6 | sed -e 's/) /) %%dir /g' >>%name.lan
# (sb) Deal with Installed (but unpackaged) file(s) found
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
-%pre common
-# We must deinstall these info files since they're merged in
-# coreutils.info. else their postun'll be run too late
-# and install-info will fail badly because of duplicates
-for file in sh-utils textutils fileutils; do
- if [ -f %{_infodir}/$file.info.gz ]; then
- /sbin/install-info --delete %{_infodir}/$file.info.gz --dir=%{_infodir}/dir &> /dev/null || :
- fi
-done
-
%preun common
if [ $1 = 0 ]; then
if [ -f %{_infodir}/%{name}.info.gz ]; then
@@ -355,6 +345,7 @@ fi
%changelog
* Mon Jul 11 2016 Kamil Dudka - 8.25-12
+- drop the %%pre scriptlet, which is no longer needed (#1354078)
- clarify recognition of "^COLOR.*none" in /etc/DIR_COLORS (#1349579)
* Thu Jul 07 2016 Jakub Martisko - 8.25-11
From 3bf1e52ff3dc979af46ac966c05927b1611231e7 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 11 Jul 2016 17:27:02 +0200
Subject: [PATCH 015/232] Resolves: #1339135 - install -Z now sets default
SELinux context for created directories
---
coreutils-8.25-intall-Z-selinux.patch | 188 ++++++++++++++++++++++++++
coreutils.spec | 9 +-
2 files changed, 196 insertions(+), 1 deletion(-)
create mode 100644 coreutils-8.25-intall-Z-selinux.patch
diff --git a/coreutils-8.25-intall-Z-selinux.patch b/coreutils-8.25-intall-Z-selinux.patch
new file mode 100644
index 0000000..0f5ef33
--- /dev/null
+++ b/coreutils-8.25-intall-Z-selinux.patch
@@ -0,0 +1,188 @@
+From c424bbcb532c5b9924349e3522b3b431eaa7c178 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Fri, 8 Jul 2016 18:59:35 +0200
+Subject: [PATCH] install: with -Z, set default SELinux context for created
+ directories
+
+* doc/coreutils.texi (install invocation): Update -Z documentation.
+* src/install.c (make_ancestor): Set default security context before
+calling mkdir() if the -Z option is given.
+(process_dir): Call restorecon() on the destination directory if the
+-Z option is given.
+(usage): Update -Z documentation.
+* tests/install/install-Z-selinux.sh: A new test for 'install -Z -D'
+and 'install -Z -d' based on tests/mkdir/restorecon.sh.
+* tests/local.mk: Reference the test.
+* NEWS: Mention the improvement.
+Reported at https://bugzilla.redhat.com/1339135
+Fixes http://bugs.gnu.org/23868
+
+Upstream-commit: 502518b44039138d148e2e15157d125c82d02af0
+Signed-off-by: Kamil Dudka
+---
+ doc/coreutils.texi | 2 +-
+ src/install.c | 33 ++++++++++++++++++----
+ tests/install/install-Z-selinux.sh | 58 ++++++++++++++++++++++++++++++++++++++
+ tests/local.mk | 1 +
+ 4 files changed, 88 insertions(+), 6 deletions(-)
+ create mode 100644 tests/install/install-Z-selinux.sh
+
+diff --git a/doc/coreutils.texi b/doc/coreutils.texi
+index 092192c..1543f27 100644
+--- a/doc/coreutils.texi
++++ b/doc/coreutils.texi
+@@ -9208,7 +9208,7 @@ Print the name of each file before moving it.
+ @cindex security context
+ This option functions similarly to the @command{restorecon} command,
+ by adjusting the SELinux security context according
+-to the system default type for destination files.
++to the system default type for destination files and each created directory.
+
+ @end table
+
+diff --git a/src/install.c b/src/install.c
+index 089f298..1b7a209 100644
+--- a/src/install.c
++++ b/src/install.c
+@@ -39,6 +39,7 @@
+ #include "prog-fprintf.h"
+ #include "quote.h"
+ #include "savewd.h"
++#include "selinux.h"
+ #include "stat-time.h"
+ #include "utimens.h"
+ #include "xstrtol.h"
+@@ -423,6 +424,12 @@ announce_mkdir (char const *dir, void *options)
+ static int
+ make_ancestor (char const *dir, char const *component, void *options)
+ {
++ struct cp_options const *x = options;
++ if (x->set_security_context && defaultcon (dir, S_IFDIR) < 0
++ && ! ignorable_ctx_err (errno))
++ error (0, errno, _("failed to set default creation context for %s"),
++ quoteaf (dir));
++
+ int r = mkdir (component, DEFAULT_MODE);
+ if (r == 0)
+ announce_mkdir (dir, options);
+@@ -433,12 +440,28 @@ make_ancestor (char const *dir, char const *component, void *options)
+ static int
+ process_dir (char *dir, struct savewd *wd, void *options)
+ {
+- return (make_dir_parents (dir, wd,
+- make_ancestor, options,
+- dir_mode, announce_mkdir,
+- dir_mode_bits, owner_id, group_id, false)
++ struct cp_options const *x = options;
++
++ int ret = (make_dir_parents (dir, wd, make_ancestor, options,
++ dir_mode, announce_mkdir,
++ dir_mode_bits, owner_id, group_id, false)
+ ? EXIT_SUCCESS
+ : EXIT_FAILURE);
++
++ /* FIXME: Due to the current structure of make_dir_parents()
++ we don't have the facility to call defaultcon() before the
++ final component of DIR is created. So for now, create the
++ final component with the context from previous component
++ and here we set the context for the final component. */
++ if (ret == EXIT_SUCCESS && x->set_security_context)
++ {
++ if (! restorecon (last_component (dir), false, false)
++ && ! ignorable_ctx_err (errno))
++ error (0, errno, _("failed to restore context for %s"),
++ quoteaf (dir));
++ }
++
++ return ret;
+ }
+
+ /* Copy file FROM onto file TO, creating TO if necessary.
+@@ -651,7 +674,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\
+ fputs (_("\
+ -P, --preserve-context preserve SELinux security context (-P deprecated)\n\
+ -Z set SELinux security context of destination\n\
+- file to default type\n\
++ file and each created directory to default type\n\
+ --context[=CTX] like -Z, or if CTX is specified then set the\n\
+ SELinux or SMACK security context to CTX\n\
+ "), stdout);
+diff --git a/tests/install/install-Z-selinux.sh b/tests/install/install-Z-selinux.sh
+new file mode 100644
+index 0000000..9c3b642
+--- /dev/null
++++ b/tests/install/install-Z-selinux.sh
+@@ -0,0 +1,58 @@
++#!/bin/sh
++# test 'install -Z -D' and 'install -Z -d'
++# based on tests/mkdir/restorecon.sh
++
++# Copyright (C) 2013-2016 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 .
++
++. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++print_ver_ ginstall
++require_selinux_
++
++
++get_selinux_type() { ls -Zd "$1" | sed -n 's/.*:\(.*_t\):.*/\1/p'; }
++
++mkdir subdir || framework_failure_
++chcon 'root:object_r:tmp_t:s0' subdir || framework_failure_
++cd subdir
++
++# Since in a tmp_t dir, dirs can be created as user_tmp_t ...
++touch standard || framework_failure_
++mkdir restored || framework_failure_
++if restorecon restored 2>/dev/null; then
++ # ... but when restored can be set to user_home_t
++ # So ensure the type for these mkdir -Z cases matches
++ # the directory type as set by restorecon.
++ ginstall -Z standard single || fail=1
++ ginstall -Z -d single_d || fail=1
++ # Run these as separate processes in case global context
++ # set for an arg, impacts on another arg
++ # TODO: Have the defaultcon() vary over these directories
++ for dst in single_d/existing/file multi/ple/file; do
++ ginstall -Z -D standard "$dst" || fail=1
++ done
++ restored_type=$(get_selinux_type 'restored')
++ test "$(get_selinux_type 'single')" = "$restored_type" || fail=1
++ test "$(get_selinux_type 'single_d')" = "$restored_type" || fail=1
++ test "$(get_selinux_type 'single_d/existing')" = "$restored_type" || fail=1
++ test "$(get_selinux_type 'multi')" = "$restored_type" || fail=1
++ test "$(get_selinux_type 'multi/ple')" = "$restored_type" || fail=1
++fi
++if test "$fail" = '1'; then
++ ls -UZd standard restored
++ ls -UZd single single_d single_d/existing multi multi/ple
++fi
++
++Exit $fail
+diff --git a/tests/local.mk b/tests/local.mk
+index ec23448..42d39f2 100644
+--- a/tests/local.mk
++++ b/tests/local.mk
+@@ -548,6 +548,7 @@ all_tests = \
+ tests/install/d-slashdot.sh \
+ tests/install/install-C.sh \
+ tests/install/install-C-selinux.sh \
++ tests/install/install-Z-selinux.sh \
+ tests/install/strip-program.sh \
+ tests/install/trap.sh \
+ tests/ln/backup-1.sh \
+--
+2.5.5
+
diff --git a/coreutils.spec b/coreutils.spec
index 60e8194..9b1566b 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -18,6 +18,7 @@ Source10: coreutils-find-requires.sh
%global __find_requires %{SOURCE10} %{_rpmconfigdir}/find-requires
# From upstream
+Patch952: coreutils-8.25-intall-Z-selinux.patch
# Our patches
#general patch to workaround koji build system issues
@@ -204,8 +205,13 @@ tee DIR_COLORS{,.256color,.lightbgcolor} < src/dircolors.hin
#SELinux
%patch950 -p1 -b .selinux
%patch951 -p1 -b .selinuxman
+%patch952 -p1
-chmod a+x tests/misc/sort-mb-tests.sh tests/df/direct.sh || :
+chmod a+x \
+ tests/df/direct.sh \
+ tests/install/install-Z-selinux.sh \
+ tests/misc/sort-mb-tests.sh \
+ || :
#fix typos/mistakes in localized documentation(#439410, #440056)
find ./po/ -name "*.p*" | xargs \
@@ -345,6 +351,7 @@ fi
%changelog
* Mon Jul 11 2016 Kamil Dudka - 8.25-12
+- install -Z now sets default SELinux context for created directories (#1339135)
- drop the %%pre scriptlet, which is no longer needed (#1354078)
- clarify recognition of "^COLOR.*none" in /etc/DIR_COLORS (#1349579)
From fe09c9cd04372ee98e07a87ff9a1a7cef8d06b41 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 11 Jul 2016 17:36:22 +0200
Subject: [PATCH 016/232] Related: #1354078 - drop %pre dependency on
install-info
---
coreutils.spec | 1 -
1 file changed, 1 deletion(-)
diff --git a/coreutils.spec b/coreutils.spec
index 9b1566b..f5088d6 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -162,7 +162,6 @@ packaged as a single multicall binary.
# yum obsoleting rules explained at:
# https://bugzilla.redhat.com/show_bug.cgi?id=1107973#c7
Obsoletes: %{name} < 8.24-100
-Requires(pre): /sbin/install-info
Requires(preun): /sbin/install-info
Requires(post): /sbin/install-info
Summary: coreutils common optional components
From 9551d101b0367301507aa1f117e215831cf8e317 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 11 Jul 2016 22:00:42 +0200
Subject: [PATCH 017/232] Related: #1335320 - do not print DIR_COLOR to stdout
---
coreutils.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/coreutils.spec b/coreutils.spec
index f5088d6..e48bca6 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -173,7 +173,7 @@ including documentation and translations.
%setup -q
# will be modified by coreutils-8.25-DIR_COLORS.patch
-tee DIR_COLORS{,.256color,.lightbgcolor} < src/dircolors.hin
+tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null
# Our patches
%patch100 -p1 -b .configure
From fa93a023044cf78ea9c1e2002385f205a2adabba Mon Sep 17 00:00:00 2001
From: Jakub Martisko
Date: Tue, 12 Jul 2016 15:39:43 +0200
Subject: [PATCH 018/232] (un)expand: fix a regression in handling of input
files, where only the first file was processed.
---
coreutils-i18n-fix2-expand-unexpand.patch | 104 ++++++++++++++++++++++
coreutils.spec | 9 +-
2 files changed, 112 insertions(+), 1 deletion(-)
create mode 100644 coreutils-i18n-fix2-expand-unexpand.patch
diff --git a/coreutils-i18n-fix2-expand-unexpand.patch b/coreutils-i18n-fix2-expand-unexpand.patch
new file mode 100644
index 0000000..1f02c5e
--- /dev/null
+++ b/coreutils-i18n-fix2-expand-unexpand.patch
@@ -0,0 +1,104 @@
+diff -up ./src/expand.c.orig ./src/expand.c
+--- ./src/expand.c.orig 2016-06-01 12:42:49.330373488 +0200
++++ ./src/expand.c 2016-06-07 14:35:16.011142041 +0200
+@@ -173,15 +173,19 @@ expand (void)
+
+ do
+ {
+- do {
++ while (true) {
+ mbf_getc (c, mbf);
+- if (mb_iseof (c))
++ if ((mb_iseof (c)) && (fp = next_file (fp)))
+ {
+- mbf_init (mbf, fp = next_file (fp));
++ mbf_init (mbf, fp);
+ continue;
+ }
++ else
++ {
++ break;
++ }
+ }
+- while (false);
++
+
+ if (convert)
+ {
+diff -up ./src/unexpand.c.orig ./src/unexpand.c
+--- ./src/unexpand.c.orig 2016-06-07 14:26:57.380746446 +0200
++++ ./src/unexpand.c 2016-06-07 14:34:54.059256698 +0200
+@@ -220,15 +220,19 @@ unexpand (void)
+
+ do
+ {
+- do {
++ while (true) {
+ mbf_getc (c, mbf);
+- if (mb_iseof (c))
++ if ((mb_iseof (c)) && (fp = next_file (fp)))
+ {
+- mbf_init (mbf, fp = next_file (fp));
++ mbf_init (mbf, fp);
+ continue;
+ }
++ else
++ {
++ break;
++ }
+ }
+- while (false);
++
+
+ if (convert)
+ {
+diff -up ./tests/expand/mb.sh.orig ./tests/expand/mb.sh
+--- ./tests/expand/mb.sh.orig 2016-05-11 14:13:53.095289000 +0200
++++ ./tests/expand/mb.sh 2016-06-07 14:38:48.259033445 +0200
+@@ -44,6 +44,20 @@ EOF
+ expand < in > out || fail=1
+ compare exp out > /dev/null 2>&1 || fail=1
+
++#multiple files as an input
++cat <<\EOF >> exp || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++expand ./in ./in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
+ #test characters with display widths != 1
+ env printf '12345678
+ e\t|ascii(1)
+diff -up ./tests/unexpand/mb.sh.orig ./tests/unexpand/mb.sh
+--- ./tests/unexpand/mb.sh.orig 2016-06-07 14:41:44.210106466 +0200
++++ ./tests/unexpand/mb.sh 2016-06-07 14:52:28.848639772 +0200
+@@ -44,6 +44,22 @@ EOF
+ unexpand -a < in > out || fail=1
+ compare exp out > /dev/null 2>&1 || fail=1
+
++
++#multiple files as an input
++cat >> exp <<\EOF
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++
++unexpand -a ./in ./in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
+ #test characters with a display width larger than 1
+
+ env printf '12345678
diff --git a/coreutils.spec b/coreutils.spec
index a056fe0..b189e36 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 5%{?dist}
+Release: 6%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -49,6 +49,8 @@ Patch802: coreutils-i18n-cut.patch
Patch804: coreutils-i18n-cut-old.patch
# The unexpand patch above is not correct. Sent to the patch authors
Patch803: coreutils-i18n-fix-unexpand.patch
+#(un)expand - allow multiple files on input - broken by patch 801
+Patch805: coreutils-i18n-fix2-expand-unexpand.patch
#getgrouplist() patch from Ulrich Drepper.
Patch908: coreutils-getgrouplist.patch
@@ -181,6 +183,7 @@ including documentation and translations.
#%%patch802 -p1 -b .i18n-cut
%patch803 -p1 -b .i18n-fix-expand
%patch804 -p1 -b .i18n-cutold
+%patch805 -p1 -b .i18n-fix2-expand-unexpand
# Coreutils
%patch908 -p1 -b .getgrouplist
@@ -352,6 +355,10 @@ fi
%license COPYING
%changelog
+* Tue Jul 12 2016 Jakub Martisko - 8.25-6
+- (un)expand fix a regression in handling of input files, where only
+ the first file was procesed.
+
* Sat Mar 05 2016 Ondrej Vasik - 8.25-5
- cut: move back to the old i18n implementation (#1314722)
From d3849ced08d9cfcfa2c4d0eed72bcb305222ebd8 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Thu, 14 Jul 2016 16:29:59 +0200
Subject: [PATCH 019/232] fix patches such that they apply without offset
---
coreutils-4.5.3-langinfo.patch | 2 +-
coreutils-6.10-configuration.patch | 22 +--
coreutils-6.10-manpages.patch | 2 +-
coreutils-8.2-uname-processortype.patch | 7 +-
coreutils-8.4-mkdir-modenote.patch | 2 +-
coreutils-df-direct.patch | 14 +-
coreutils-getgrouplist.patch | 8 +-
coreutils-i18n-cut-old.patch | 2 +-
coreutils-i18n-cut.patch | 42 +++---
coreutils-i18n-expand-unexpand.patch | 102 ++++++++------
coreutils-i18n.patch | 176 ++++++++++++------------
coreutils-overflow.patch | 2 +-
coreutils-selinux.patch | 16 +--
coreutils-selinuxmanpages.patch | 2 +-
sh-utils-2.0.11-dateman.patch | 2 +-
15 files changed, 207 insertions(+), 194 deletions(-)
diff --git a/coreutils-4.5.3-langinfo.patch b/coreutils-4.5.3-langinfo.patch
index 25dec6c..48e0624 100644
--- a/coreutils-4.5.3-langinfo.patch
+++ b/coreutils-4.5.3-langinfo.patch
@@ -1,6 +1,6 @@
--- coreutils-5.92/src/date.c.langinfo 2005-09-16 09:06:57.000000000 +0100
+++ coreutils-5.92/src/date.c 2005-10-24 18:09:16.000000000 +0100
-@@ -451,14 +451,7 @@
+@@ -474,14 +474,7 @@ main (int argc, char **argv)
format = DATE_FMT_LANGINFO ();
if (! *format)
{
diff --git a/coreutils-6.10-configuration.patch b/coreutils-6.10-configuration.patch
index 4c68077..7468ba2 100644
--- a/coreutils-6.10-configuration.patch
+++ b/coreutils-6.10-configuration.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-tests/gnulib.mk
--- coreutils-8.21-orig/gnulib-tests/gnulib.mk 2013-02-07 17:58:44.000000000 +0100
+++ coreutils-8.21/gnulib-tests/gnulib.mk 2013-02-15 10:12:28.110593165 +0100
-@@ -267,9 +267,9 @@ EXTRA_DIST += nap.h test-chown.h test-ch
+@@ -279,9 +279,9 @@ EXTRA_DIST += nap.h test-chown.h test-chown.c signature.h macros.h
## begin gnulib module cloexec-tests
@@ -14,7 +14,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module cloexec-tests
-@@ -378,9 +378,9 @@ EXTRA_DIST += test-dup.c signature.h mac
+@@ -392,9 +392,9 @@ EXTRA_DIST += test-dup.c signature.h macros.h
## begin gnulib module dup2-tests
@@ -27,7 +27,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module dup2-tests
-@@ -439,10 +439,10 @@ EXTRA_DIST += test-fadvise.c
+@@ -453,10 +453,10 @@ EXTRA_DIST += test-fadvise.c
## begin gnulib module fchdir-tests
@@ -42,7 +42,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module fchdir-tests
-@@ -874,9 +874,9 @@ EXTRA_DIST += test-getloadavg.c signatur
+@@ -900,9 +900,9 @@ EXTRA_DIST += test-getloadavg.c signature.h
## begin gnulib module getlogin-tests
@@ -55,7 +55,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module getlogin-tests
-@@ -1119,10 +1119,10 @@ EXTRA_DIST += test-link.h test-link.c si
+@@ -1147,10 +1147,10 @@ EXTRA_DIST += test-link.h test-link.c signature.h macros.h
## begin gnulib module linkat-tests
@@ -70,7 +70,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module linkat-tests
-@@ -1331,9 +1331,9 @@ EXTRA_DIST += test-memcoll.c macros.h
+@@ -1359,9 +1359,9 @@ EXTRA_DIST += test-memcoll.c macros.h
## begin gnulib module memrchr-tests
@@ -83,7 +83,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module memrchr-tests
-@@ -1978,9 +1978,9 @@ EXTRA_DIST += test-statat.c
+@@ -1912,9 +1912,9 @@ EXTRA_DIST += test-statat.c
## begin gnulib module stdalign-tests
@@ -96,7 +96,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module stdalign-tests
-@@ -2323,9 +2323,9 @@ EXTRA_DIST += test-uname.c signature.h m
+@@ -2269,9 +2269,9 @@ EXTRA_DIST += test-uname.c signature.h macros.h
## begin gnulib module unistd-safer-tests
@@ -109,7 +109,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module unistd-safer-tests
-@@ -2438,10 +2438,10 @@ EXTRA_DIST += test-usleep.c signature.h
+@@ -2367,10 +2367,10 @@ EXTRA_DIST += test-userspec.c
## begin gnulib module utimens-tests
@@ -127,7 +127,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk
--- coreutils-8.21-orig/tests/local.mk 2013-02-11 11:30:12.000000000 +0100
+++ coreutils-8.21/tests/local.mk 2013-02-15 10:10:55.890532258 +0100
-@@ -131,6 +131,7 @@ all_root_tests = \
+@@ -134,6 +134,7 @@ all_root_tests = \
tests/rm/no-give-up.sh \
tests/rm/one-file-system.sh \
tests/rm/read-only.sh \
@@ -135,7 +135,7 @@ diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk
tests/tail-2/append-only.sh \
tests/touch/now-owned-by-other.sh
-@@ -163,7 +164,6 @@ all_tests = \
+@@ -168,7 +169,6 @@ all_tests = \
tests/cp/link-heap.sh \
tests/cp/no-ctx.sh \
tests/misc/tty-eof.pl \
diff --git a/coreutils-6.10-manpages.patch b/coreutils-6.10-manpages.patch
index 8d5bc94..c795ca5 100644
--- a/coreutils-6.10-manpages.patch
+++ b/coreutils-6.10-manpages.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-6.12-orig/src/md5sum.c coreutils-6.12/src/md5sum.c
--- coreutils-6.12-orig/src/md5sum.c 2008-05-26 08:40:33.000000000 +0200
+++ coreutils-6.12/src/md5sum.c 2008-10-21 16:07:28.000000000 +0200
-@@ -175,6 +175,9 @@ With no FILE, or when FILE is -, read st
+@@ -200,6 +200,9 @@ Print or check %s (%d-bit) checksums.\n\
fputs (_("\
-t, --text read in text mode (default)\n\
"), stdout);
diff --git a/coreutils-8.2-uname-processortype.patch b/coreutils-8.2-uname-processortype.patch
index 4c83df8..0cb2422 100644
--- a/coreutils-8.2-uname-processortype.patch
+++ b/coreutils-8.2-uname-processortype.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
--- coreutils-8.2-orig/src/uname.c 2009-09-23 10:25:44.000000000 +0200
+++ coreutils-8.2/src/uname.c 2009-12-19 09:09:11.663607110 +0100
-@@ -301,7 +301,7 @@ main (int argc, char **argv)
+@@ -299,13 +299,19 @@ main (int argc, char **argv)
if (toprint & PRINT_PROCESSOR)
{
@@ -10,7 +10,6 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
#if HAVE_SYSINFO && defined SI_ARCHITECTURE
{
static char processor[257];
-@@ -308,6 +308,12 @@ main (int argc, char **argv)
if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
element = processor;
}
@@ -23,7 +22,7 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
#endif
#ifdef UNAME_PROCESSOR
if (element == unknown)
-@@ -351,7 +357,7 @@ main (int argc, char **argv)
+@@ -343,7 +349,7 @@ main (int argc, char **argv)
if (toprint & PRINT_HARDWARE_PLATFORM)
{
@@ -32,7 +31,7 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
#if HAVE_SYSINFO && defined SI_PLATFORM
{
static char hardware_platform[257];
-@@ -353,6 +359,14 @@ main (int argc, char **argv)
+@@ -351,6 +357,14 @@ main (int argc, char **argv)
hardware_platform, sizeof hardware_platform))
element = hardware_platform;
}
diff --git a/coreutils-8.4-mkdir-modenote.patch b/coreutils-8.4-mkdir-modenote.patch
index 3576ec6..1f03c8d 100644
--- a/coreutils-8.4-mkdir-modenote.patch
+++ b/coreutils-8.4-mkdir-modenote.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-8.4-orig/doc/coreutils.texi coreutils-8.4/doc/coreutils.texi
--- coreutils-8.4-orig/doc/coreutils.texi 2011-01-07 15:01:18.575654333 +0100
+++ coreutils-8.4/doc/coreutils.texi 2011-01-07 15:05:38.791655243 +0100
-@@ -9058,6 +9058,8 @@ incorrect. @xref{Directory Setuid and S
+@@ -9993,6 +9993,8 @@ incorrect. @xref{Directory Setuid and Setgid}, for how the
set-user-ID and set-group-ID bits of directories are inherited unless
overridden in this way.
diff --git a/coreutils-df-direct.patch b/coreutils-df-direct.patch
index 361b813..e69cd2b 100644
--- a/coreutils-df-direct.patch
+++ b/coreutils-df-direct.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-8.21-orig/doc/coreutils.texi coreutils-8.21/doc/coreutils.texi
--- coreutils-8.21-orig/doc/coreutils.texi 2013-02-11 10:37:28.000000000 +0100
+++ coreutils-8.21/doc/coreutils.texi 2013-02-15 10:15:26.497593689 +0100
-@@ -10961,6 +10961,13 @@
+@@ -11221,6 +11221,13 @@ some systems (notably SunOS), doing this yields more up to date results,
but in general this option makes @command{df} much slower, especially when
there are many or very busy file systems.
@@ -28,7 +28,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
/* Grand total data. */
static struct fs_usage grand_fsu;
-@@ -238,13 +241,15 @@ enum
+@@ -243,13 +246,15 @@ enum
NO_SYNC_OPTION = CHAR_MAX + 1,
SYNC_OPTION,
TOTAL_OPTION,
@@ -45,7 +45,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
{"inodes", no_argument, NULL, 'i'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, NULL, 'H'},
-@@ -500,7 +505,10 @@ get_header (void)
+@@ -505,7 +510,10 @@ get_header (void)
for (col = 0; col < ncolumns; col++)
{
char *cell = NULL;
@@ -57,7 +57,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
if (columns[col]->field == SIZE_FIELD
&& (header_mode == DEFAULT_MODE
-@@ -1150,6 +1158,19 @@ get_point (const char *point, const stru
+@@ -1352,6 +1360,19 @@ get_point (const char *point, const struct stat *statp)
static void
get_entry (char const *name, struct stat const *statp)
{
@@ -77,7 +77,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
&& get_disk (name))
return;
-@@ -1219,6 +1238,7 @@ or all file systems by default.\n\
+@@ -1422,6 +1443,7 @@ or all file systems by default.\n\
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\
'-BM' prints sizes in units of 1,048,576 bytes;\n\
see SIZE format below\n\
@@ -85,7 +85,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\
-H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\
"), stdout);
-@@ -1305,6 +1325,9 @@ main (int argc, char **argv)
+@@ -1512,6 +1534,9 @@ main (int argc, char **argv)
xstrtol_fatal (e, oi, c, long_options, optarg);
}
break;
@@ -95,7 +95,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
case 'i':
if (header_mode == OUTPUT_MODE)
{
-@@ -1408,6 +1431,13 @@ main (int argc, char **argv)
+@@ -1608,6 +1633,13 @@ main (int argc, char **argv)
}
}
diff --git a/coreutils-getgrouplist.patch b/coreutils-getgrouplist.patch
index 86bbcef..7defd19 100644
--- a/coreutils-getgrouplist.patch
+++ b/coreutils-getgrouplist.patch
@@ -12,7 +12,7 @@ index 299bae6..8ece29b 100644
#include "getugroups.h"
#include
-@@ -123,3 +126,4 @@ getugroups (int maxcount, gid_t *grouplist, char const *username,
+@@ -126,3 +129,4 @@ getugroups (int maxcount, gid_t *grouplist, char const *username,
}
#endif /* HAVE_GRP_H */
@@ -21,7 +21,7 @@ diff --git a/lib/mgetgroups.c b/lib/mgetgroups.c
index 76474c2..0a9d221 100644
--- a/lib/mgetgroups.c
+++ b/lib/mgetgroups.c
-@@ -115,9 +115,17 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
+@@ -121,9 +121,17 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
/* else no username, so fall through and use getgroups. */
#endif
@@ -42,7 +42,7 @@ index 76474c2..0a9d221 100644
/* If we failed to count groups because there is no supplemental
group support, then return an array containing just GID.
-@@ -139,10 +147,25 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
+@@ -145,10 +153,25 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
if (g == NULL)
return -1;
@@ -76,7 +76,7 @@ diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4
index 62777c7..5180243 100644
--- a/m4/jm-macros.m4
+++ b/m4/jm-macros.m4
-@@ -78,6 +78,7 @@
+@@ -82,6 +82,7 @@ AC_DEFUN([coreutils_MACROS],
fchown
fchmod
ftruncate
diff --git a/coreutils-i18n-cut-old.patch b/coreutils-i18n-cut-old.patch
index 29c69fc..008cecb 100644
--- a/coreutils-i18n-cut-old.patch
+++ b/coreutils-i18n-cut-old.patch
@@ -132,7 +132,7 @@ diff -urNp coreutils-8.25-orig/src/cut.c coreutils-8.25/src/cut.c
/* The delimiter for each line/record. */
static unsigned char line_delim = '\n';
-@@ -164,7 +243,7 @@ Print selected parts of lines from each
+@@ -164,7 +243,7 @@ Print selected parts of lines from each FILE to standard output.\n\
-f, --fields=LIST select only these fields; also print any line\n\
that contains no delimiter character, unless\n\
the -s option is specified\n\
diff --git a/coreutils-i18n-cut.patch b/coreutils-i18n-cut.patch
index ec85cf0..f680df6 100644
--- a/coreutils-i18n-cut.patch
+++ b/coreutils-i18n-cut.patch
@@ -12,7 +12,7 @@
#include "system.h"
#include "error.h"
-@@ -90,25 +95,16 @@ add_range_pair (size_t lo, size_t hi)
+@@ -61,25 +66,16 @@
CURRENT_RP.HI then we make CURRENT_RP to point to the next range pair. */
static struct field_range_pair *current_rp;
@@ -42,7 +42,7 @@
/* Output the given delimiter-separated fields. */
field_mode
};
-@@ -120,12 +116,16 @@ static enum operating_mode operating_mod
+@@ -91,12 +87,16 @@ static enum operating_mode operating_mode;
with field mode. */
static bool suppress_non_delimited;
@@ -60,7 +60,7 @@
/* The delimiter for each line/record. */
static unsigned char line_delim = '\n';
-@@ -135,7 +135,7 @@ static size_t output_delimiter_length;
+@@ -109,7 +109,7 @@ static size_t output_delimiter_length;
/* The output field separator string. Defaults to the 1-character
string consisting of the input delimiter. */
@@ -69,7 +69,7 @@
/* True if we have ever read standard input. */
static bool have_read_stdin;
-@@ -189,7 +189,7 @@ Print selected parts of lines from each
+@@ -164,7 +164,7 @@ Print selected parts of lines from each FILE to standard output.\n\
-f, --fields=LIST select only these fields; also print any line\n\
that contains no delimiter character, unless\n\
the -s option is specified\n\
@@ -78,7 +78,7 @@
"), stdout);
fputs (_("\
--complement complement the set of selected bytes, characters\n\
-@@ -435,6 +435,12 @@ next_item (size_t *item_idx)
+@@ -211,6 +211,12 @@ next_item (size_t *item_idx)
current_rp++;
}
@@ -91,7 +91,7 @@
/* Return nonzero if the K'th field or byte is printable. */
static inline bool
-@@ -443,6 +449,15 @@ print_kth (size_t k)
+@@ -219,6 +225,15 @@ print_kth (size_t k)
return current_rp->lo <= k;
}
@@ -107,7 +107,7 @@
/* Return nonzero if K'th byte is the beginning of a range. */
static inline bool
-@@ -505,23 +520,215 @@ cut_bytes (FILE *stream)
+@@ -281,23 +296,215 @@ cut_bytes (FILE *stream)
}
/* Read from stream STREAM, printing to standard output any selected fields. */
@@ -328,7 +328,7 @@
/* To support the semantics of the -s flag, we may have to buffer
all of the first field to determine whether it is 'delimited.'
-@@ -536,10 +744,14 @@ cut_fields (FILE *stream)
+@@ -312,10 +519,14 @@ cut_fields (FILE *stream)
if (field_idx == 1 && buffer_first_field)
{
ssize_t len;
@@ -346,7 +346,7 @@
if (len < 0)
{
free (field_1_buffer);
-@@ -549,15 +761,15 @@ cut_fields (FILE *stream)
+@@ -325,15 +536,15 @@ cut_fields (FILE *stream)
xalloc_die ();
}
@@ -366,7 +366,7 @@
{
if (suppress_non_delimited)
{
-@@ -565,26 +777,30 @@ cut_fields (FILE *stream)
+@@ -341,26 +552,30 @@ cut_fields (FILE *stream)
}
else
{
@@ -405,7 +405,7 @@
found_any_selected_field = true;
}
}
-@@ -594,7 +810,8 @@ cut_fields (FILE *stream)
+@@ -370,7 +585,8 @@ cut_fields (FILE *stream)
next_item (&field_idx);
}
@@ -415,7 +415,7 @@
if (print_kth (field_idx))
{
-@@ -605,42 +822,46 @@ cut_fields (FILE *stream)
+@@ -381,42 +597,46 @@ cut_fields (FILE *stream)
}
found_any_selected_field = true;
@@ -477,7 +477,7 @@
break;
field_idx = 1;
current_rp = frp;
-@@ -652,7 +874,14 @@ static void
+@@ -429,7 +649,14 @@ static void
cut_stream (FILE *stream)
{
if (operating_mode == byte_mode)
@@ -493,7 +493,7 @@
else
cut_fields (stream);
}
-@@ -706,6 +935,7 @@ main (int argc, char **argv)
+@@ -483,6 +710,7 @@ main (int argc, char **argv)
bool ok;
bool delim_specified = false;
char *spec_list_string IF_LINT ( = NULL);
@@ -501,7 +501,7 @@
initialize_main (&argc, &argv);
set_program_name (argv[0]);
-@@ -719,8 +949,10 @@ main (int argc, char **argv)
+@@ -496,8 +724,10 @@ main (int argc, char **argv)
/* By default, all non-delimited lines are printed. */
suppress_non_delimited = false;
@@ -513,7 +513,7 @@
have_read_stdin = false;
while ((optc = getopt_long (argc, argv, "b:c:d:f:nsz", longopts, NULL)) != -1)
-@@ -728,7 +960,6 @@ main (int argc, char **argv)
+@@ -505,7 +735,6 @@ main (int argc, char **argv)
switch (optc)
{
case 'b':
@@ -521,7 +521,7 @@
/* Build the byte list. */
if (operating_mode != undefined_mode)
FATAL_ERROR (_("only one type of list may be specified"));
-@@ -736,6 +967,14 @@ main (int argc, char **argv)
+@@ -513,6 +742,14 @@ main (int argc, char **argv)
spec_list_string = optarg;
break;
@@ -536,7 +536,7 @@
case 'f':
/* Build the field list. */
if (operating_mode != undefined_mode)
-@@ -747,9 +986,17 @@ main (int argc, char **argv)
+@@ -524,9 +761,17 @@ main (int argc, char **argv)
case 'd':
/* New delimiter. */
/* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */
@@ -551,12 +551,12 @@
+ mbi_advance (iter);
+ if (mbi_avail (iter))
FATAL_ERROR (_("the delimiter must be a single character"));
-+ }
- delim = optarg[0];
++ }
delim_specified = true;
break;
-@@ -763,6 +1008,7 @@ main (int argc, char **argv)
+@@ -540,6 +785,7 @@ main (int argc, char **argv)
break;
case 'n':
@@ -564,7 +564,7 @@
break;
case 's':
-@@ -802,15 +1048,12 @@ main (int argc, char **argv)
+@@ -579,15 +825,12 @@ main (int argc, char **argv)
| (complement ? SETFLD_COMPLEMENT : 0) );
if (!delim_specified)
diff --git a/coreutils-i18n-expand-unexpand.patch b/coreutils-i18n-expand-unexpand.patch
index d8a5968..d23e0f0 100644
--- a/coreutils-i18n-expand-unexpand.patch
+++ b/coreutils-i18n-expand-unexpand.patch
@@ -23,19 +23,24 @@ properly.
Co-authored-by: Pádraig Brady
---
- NEWS | 3 +
bootstrap.conf | 1 +
configure.ac | 2 +
+ lib/mbfile.c | 3 +
+ lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ m4/mbfile.m4 | 14 +++
po/POTFILES.in | 1 +
- src/expand-core.c | 150 +++++++++++++++++++++++++++++++++++++++
- src/expand-core.h | 44 ++++++++++++
- src/expand.c | 183 ++++++++++-------------------------------------
+ src/expand-core.c | 150 ++++++++++++++++++++++++++++++
+ src/expand-core.h | 41 +++++++++
+ src/expand.c | 186 ++++++++-----------------------------
src/local.mk | 2 +
- src/unexpand.c | 197 ++++++++++++---------------------------------------
- tests/expand/mb.sh | 98 +++++++++++++++++++++++++
+ src/unexpand.c | 195 ++++++++++-----------------------------
+ tests/expand/mb.sh | 98 ++++++++++++++++++++
tests/local.mk | 2 +
- tests/unexpand/mb.sh | 97 +++++++++++++++++++++++++
- 12 files changed, 482 insertions(+), 298 deletions(-)
+ tests/unexpand/mb.sh | 97 ++++++++++++++++++++
+ 14 files changed, 750 insertions(+), 297 deletions(-)
+ create mode 100644 lib/mbfile.c
+ create mode 100644 lib/mbfile.h
+ create mode 100644 m4/mbfile.m4
create mode 100644 src/expand-core.c
create mode 100644 src/expand-core.h
create mode 100755 tests/expand/mb.sh
@@ -45,7 +50,7 @@ diff --git a/bootstrap.conf b/bootstrap.conf
index ef1c078..ea8cebc 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
-@@ -152,6 +152,7 @@ gnulib_modules="
+@@ -151,6 +151,7 @@ gnulib_modules="
maintainer-makefile
malloc-gnu
manywarnings
@@ -57,7 +62,7 @@ diff --git a/configure.ac b/configure.ac
index 8dc2192..b8b5114 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -422,6 +422,8 @@ gl_WINSIZE_IN_PTEM
+@@ -425,6 +425,8 @@ fi
# I'm leaving it here for now. This whole thing needs to be modernized...
gl_WINSIZE_IN_PTEM
@@ -338,12 +343,10 @@ index 0a40a1a..ed97fd4 100644
static char const shortopts[] = "it:0::1::2::3::4::5::6::7::8::9::";
-@@ -125,128 +129,6 @@
- if (first_free_tab == n_tabs_allocated)
- tab_list = X2NREALLOC (tab_list, &n_tabs_allocated);
+@@ -135,128 +139,6 @@ add_tab_stop (uintmax_t tabval)
tab_list[first_free_tab++] = tabval;
--}
--
+ }
+
-/* Add the comma or blank separated list of tab stops STOPS
- to the list of tab stops. */
-
@@ -464,10 +467,12 @@ index 0a40a1a..ed97fd4 100644
- exit_status = EXIT_FAILURE;
- }
- return NULL;
- }
-
+-}
+-
/* Change tabs to spaces, writing to stdout.
-@@ -265,19 +146,19 @@ expand (void)
+ Read each file in 'file_list', in order. */
+
+@@ -265,19 +147,19 @@ expand (void)
{
/* Input stream. */
FILE *fp = next_file (NULL);
@@ -491,7 +496,7 @@ index 0a40a1a..ed97fd4 100644
/* The following variables have valid values only when CONVERT
is true: */
-@@ -287,17 +168,23 @@ expand (void)
+@@ -287,17 +169,23 @@ expand (void)
/* Index in TAB_LIST of next tab stop to examine. */
size_t tab_index = 0;
@@ -519,7 +524,7 @@ index 0a40a1a..ed97fd4 100644
{
/* Column the next input tab stop is on. */
uintmax_t next_tab_column;
-@@ -328,32 +215,34 @@ expand (void)
+@@ -328,32 +216,34 @@ expand (void)
if (putchar (' ') < 0)
error (EXIT_FAILURE, errno, _("write error"));
@@ -562,7 +567,7 @@ index 0a40a1a..ed97fd4 100644
}
}
-@@ -385,19 +274,19 @@ main (int argc, char **argv)
+@@ -385,19 +275,19 @@ main (int argc, char **argv)
break;
case 't':
@@ -589,7 +594,7 @@ diff --git a/src/local.mk b/src/local.mk
index 536b7cc..bfede88 100644
--- a/src/local.mk
+++ b/src/local.mk
-@@ -362,6 +362,8 @@ src_coreutils_SOURCES = src/coreutils.c
+@@ -361,6 +361,8 @@ src_coreutils_SOURCES = src/coreutils.c
src_cp_SOURCES = src/cp.c $(copy_sources) $(selinux_sources)
src_dir_SOURCES = src/ls.c src/ls-dir.c
@@ -655,7 +660,7 @@ index e0f7c22..48fbb32 100644
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
-@@ -154,128 +156,6 @@ add_tab_stop (uintmax_t tabval)
+@@ -154,128 +158,6 @@ add_tab_stop (uintmax_t tabval)
}
}
@@ -784,7 +789,7 @@ index e0f7c22..48fbb32 100644
/* Change blanks to tabs, writing to stdout.
Read each file in 'file_list', in order. */
-@@ -284,11 +164,12 @@ unexpand (void)
+@@ -284,11 +166,12 @@ unexpand (void)
{
/* Input stream. */
FILE *fp = next_file (NULL);
@@ -798,7 +803,7 @@ index e0f7c22..48fbb32 100644
if (!fp)
return;
-@@ -296,12 +177,14 @@ unexpand (void)
+@@ -296,12 +179,14 @@ unexpand (void)
/* The worst case is a non-blank character, then one blank, then a
tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
@@ -815,7 +820,7 @@ index e0f7c22..48fbb32 100644
/* If true, perform translations. */
bool convert = true;
-@@ -335,12 +218,19 @@ unexpand (void)
+@@ -335,12 +220,19 @@ unexpand (void)
do
{
@@ -838,7 +843,7 @@ index e0f7c22..48fbb32 100644
if (blank)
{
-@@ -372,16 +262,16 @@ unexpand (void)
+@@ -372,16 +264,16 @@ unexpand (void)
if (next_tab_column < column)
error (EXIT_FAILURE, 0, _("input line is too long"));
@@ -858,7 +863,7 @@ index e0f7c22..48fbb32 100644
if (! (prev_blank && column == next_tab_column))
{
-@@ -389,13 +279,14 @@ unexpand (void)
+@@ -389,13 +281,14 @@ unexpand (void)
will be replaced by tabs. */
if (column == next_tab_column)
one_blank_before_tab_stop = true;
@@ -875,7 +880,7 @@ index e0f7c22..48fbb32 100644
}
/* Discard pending blanks, unless it was a single
-@@ -403,7 +294,7 @@ unexpand (void)
+@@ -403,7 +296,7 @@ unexpand (void)
pending = one_blank_before_tab_stop;
}
}
@@ -884,7 +889,7 @@ index e0f7c22..48fbb32 100644
{
/* Go back one column, and force recalculation of the
next tab stop. */
-@@ -413,7 +304,7 @@ unexpand (void)
+@@ -413,7 +306,7 @@ unexpand (void)
}
else
{
@@ -893,7 +898,7 @@ index e0f7c22..48fbb32 100644
if (!column)
error (EXIT_FAILURE, 0, _("input line is too long"));
}
-@@ -421,9 +312,13 @@ unexpand (void)
+@@ -421,9 +314,13 @@ unexpand (void)
if (pending)
{
if (pending > 1 && one_blank_before_tab_stop)
@@ -909,7 +914,7 @@ index e0f7c22..48fbb32 100644
pending = 0;
one_blank_before_tab_stop = false;
}
-@@ -432,16 +327,16 @@ unexpand (void)
+@@ -432,16 +329,16 @@ unexpand (void)
convert &= convert_entire_line || blank;
}
@@ -930,7 +935,7 @@ index e0f7c22..48fbb32 100644
}
}
-@@ -482,7 +377,7 @@ main (int argc, char **argv)
+@@ -482,7 +379,7 @@ main (int argc, char **argv)
break;
case 't':
convert_entire_line = true;
@@ -1047,7 +1052,7 @@ diff --git a/tests/local.mk b/tests/local.mk
index 7df04da..d3462be 100644
--- a/tests/local.mk
+++ b/tests/local.mk
-@@ -532,6 +532,7 @@ all_tests = \
+@@ -536,6 +536,7 @@ all_tests = \
tests/du/threshold.sh \
tests/du/trailing-slash.sh \
tests/du/two-args.sh \
@@ -1055,7 +1060,7 @@ index 7df04da..d3462be 100644
tests/id/gnu-zero-uids.sh \
tests/id/no-context.sh \
tests/id/context.sh \
-@@ -671,6 +672,7 @@ all_tests = \
+@@ -674,6 +675,7 @@ all_tests = \
tests/touch/read-only.sh \
tests/touch/relative.sh \
tests/touch/trailing-slash.sh \
@@ -1166,11 +1171,11 @@ index 0000000..60d4c1a
+
+unexpand -a < in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
---
-2.4.3
-
---- /dev/null 2015-11-30 08:40:17.566742513 +0100
-+++ coreutils-8.24/m4/mbfile.m4 2015-12-01 09:30:55.951149907 +0100
+diff --git a/m4/mbfile.m4 b/m4/mbfile.m4
+new file mode 100644
+index 0000000..8589902
+--- /dev/null
++++ b/m4/mbfile.m4
@@ -0,0 +1,14 @@
+# mbfile.m4 serial 7
+dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc.
@@ -1186,14 +1191,20 @@ index 0000000..60d4c1a
+ AC_REQUIRE([AC_TYPE_MBSTATE_T])
+ :
+])
---- /dev/null 2015-11-30 08:40:17.566742513 +0100
-+++ coreutils-8.24/lib/mbfile.c 2015-12-01 09:28:22.254928468 +0100
+diff --git a/lib/mbfile.c b/lib/mbfile.c
+new file mode 100644
+index 0000000..b0a468e
+--- /dev/null
++++ b/lib/mbfile.c
@@ -0,0 +1,3 @@
+#include
+#define MBFILE_INLINE _GL_EXTERN_INLINE
+#include "mbfile.h"
---- /dev/null 2015-11-30 08:40:17.566742513 +0100
-+++ coreutils-8.24/lib/mbfile.h 2015-12-01 09:28:30.829885570 +0100
+diff --git a/lib/mbfile.h b/lib/mbfile.h
+new file mode 100644
+index 0000000..11f1b12
+--- /dev/null
++++ b/lib/mbfile.h
@@ -0,0 +1,255 @@
+/* Multibyte character I/O: macros for multi-byte encodings.
+ Copyright (C) 2001, 2005, 2009-2015 Free Software Foundation, Inc.
@@ -1450,3 +1461,6 @@ index 0000000..60d4c1a
+_GL_INLINE_HEADER_BEGIN
+
+#endif /* _MBFILE_H */
+--
+2.5.5
+
diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch
index 79449d4..bcce9ff 100644
--- a/coreutils-i18n.patch
+++ b/coreutils-i18n.patch
@@ -106,7 +106,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
{"spaces", no_argument, NULL, 's'},
{"width", required_argument, NULL, 'w'},
{GETOPT_HELP_OPTION_DECL},
-@@ -75,6 +118,7 @@ Wrap input lines in each FILE, writing t
+@@ -75,6 +118,7 @@ Wrap input lines in each FILE, writing to standard output.\n\
fputs (_("\
-b, --bytes count bytes rather than columns\n\
@@ -114,7 +114,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
-s, --spaces break at spaces\n\
-w, --width=WIDTH use WIDTH columns instead of 80\n\
"), stdout);
-@@ -92,7 +136,7 @@ Wrap input lines in each FILE, writing t
+@@ -92,7 +136,7 @@ Wrap input lines in each FILE, writing to standard output.\n\
static size_t
adjust_column (size_t column, char c)
{
@@ -156,7 +156,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
fadvise (istream, FADVISE_SEQUENTIAL);
-@@ -168,6 +196,15 @@ fold_file (char const *filename, size_t
+@@ -168,6 +196,15 @@ fold_file (char const *filename, size_t width)
bool found_blank = false;
size_t logical_end = offset_out;
@@ -172,16 +172,16 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
/* Look for the last blank. */
while (logical_end)
{
-@@ -214,11 +251,221 @@ fold_file (char const *filename, size_t
+@@ -214,11 +251,221 @@ fold_file (char const *filename, size_t width)
line_out[offset_out++] = c;
}
- saved_errno = errno;
+ *saved_errno = errno;
-+
-+ if (offset_out)
-+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
-+
+
+ if (offset_out)
+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
+
+}
+
+#if HAVE_MBRTOWC
@@ -353,10 +353,10 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
+ }
+
+ *saved_errno = errno;
-
- if (offset_out)
- fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
-
++
++ if (offset_out)
++ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
++
+}
+#endif
+
@@ -642,7 +642,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
static void
freeline (struct line *line)
{
-@@ -326,56 +484,133 @@ keycmp (struct line const *line1, struct
+@@ -326,56 +484,133 @@ keycmp (struct line const *line1, struct line const *line2,
size_t jf_1, size_t jf_2)
{
/* Start of field to compare in each file. */
@@ -773,8 +773,8 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
- diff = memcmp (beg1, beg2, MIN (len1, len2));
+ copy[0] = beg[0];
+ copy[1] = beg[1];
-+ }
-+
+ }
+
+ if (hard_LC_COLLATE)
+ {
+ diff = xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]);
@@ -784,14 +784,14 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
+ 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;
@@ -799,7 +799,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
}
/* Check that successive input lines PREV and CURRENT from input file
-@@ -467,6 +702,11 @@ get_line (FILE *fp, struct line **linep,
+@@ -467,6 +702,11 @@ get_line (FILE *fp, struct line **linep, int which)
}
++line_no[which - 1];
@@ -811,7 +811,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
xfields (line);
if (prevline[which - 1])
-@@ -566,21 +806,28 @@ prfield (size_t n, struct line const *li
+@@ -566,21 +806,28 @@ prfield (size_t n, struct line const *line)
/* Output all the fields in line, other than the join field. */
@@ -851,7 +851,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
size_t field;
struct line const *line;
-@@ -625,7 +871,7 @@ prjoin (struct line const *line1, struct
+@@ -625,7 +871,7 @@ prjoin (struct line const *line1, struct line const *line2)
o = o->next;
if (o == NULL)
break;
@@ -920,7 +920,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
--- coreutils-8.24-orig/src/pr.c 2015-06-26 19:05:22.000000000 +0200
+++ coreutils-8.24/src/pr.c 2015-07-05 09:04:33.030546965 +0200
-@@ -312,6 +312,24 @@
+@@ -311,6 +311,24 @@
#include
#include
@@ -945,7 +945,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
#include "system.h"
#include "error.h"
#include "fadvise.h"
-@@ -324,6 +342,18 @@
+@@ -323,6 +341,18 @@
#include "xstrtol.h"
#include "xdectoint.h"
@@ -964,7 +964,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "pr"
-@@ -416,7 +446,20 @@ struct COLUMN
+@@ -415,7 +445,20 @@ struct COLUMN
typedef struct COLUMN COLUMN;
@@ -986,7 +986,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
static bool read_line (COLUMN *p);
static bool print_page (void);
static bool print_stored (COLUMN *p);
-@@ -428,6 +471,7 @@ static void add_line_number (COLUMN *p);
+@@ -427,6 +470,7 @@ static void add_line_number (COLUMN *p);
static void getoptnum (const char *n_str, int min, int *num,
const char *errfmt);
static void getoptarg (char *arg, char switch_char, char *character,
@@ -994,7 +994,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
int *number);
static void print_files (int number_of_files, char **av);
static void init_parameters (int number_of_files);
-@@ -441,7 +485,6 @@ static void store_char (char c);
+@@ -440,7 +484,6 @@ static void store_char (char c);
static void pad_down (unsigned int lines);
static void read_rest_of_line (COLUMN *p);
static void skip_read (COLUMN *p, int column_number);
@@ -1002,7 +1002,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
static void cleanup (void);
static void print_sep_string (void);
static void separator_string (const char *optarg_S);
-@@ -453,7 +496,7 @@ static COLUMN *column_vector;
+@@ -452,7 +495,7 @@ static COLUMN *column_vector;
we store the leftmost columns contiguously in buff.
To print a line from buff, get the index of the first character
from line_vector[i], and print up to line_vector[i + 1]. */
@@ -1011,7 +1011,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* Index of the position in buff where the next character
will be stored. */
-@@ -557,7 +600,7 @@ static int chars_per_column;
+@@ -556,7 +599,7 @@ static int chars_per_column;
static bool untabify_input = false;
/* (-e) The input tab character. */
@@ -1020,7 +1020,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ...
where the leftmost column is 1. */
-@@ -567,7 +610,10 @@ static int chars_per_input_tab = 8;
+@@ -566,7 +609,10 @@ static int chars_per_input_tab = 8;
static bool tabify_output = false;
/* (-i) The output tab character. */
@@ -1032,7 +1032,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* (-i) The width of the output tab. */
static int chars_per_output_tab = 8;
-@@ -637,7 +683,13 @@ static int line_number;
+@@ -636,7 +682,13 @@ static int line_number;
static bool numbered_lines = false;
/* (-n) Character which follows each line number. */
@@ -1047,7 +1047,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* (-n) line counting starts with 1st line of input file (not with 1st
line of 1st page printed). */
-@@ -690,6 +742,7 @@ static bool use_col_separator = false;
+@@ -689,6 +741,7 @@ static bool use_col_separator = false;
-a|COLUMN|-m is a 'space' and with the -J option a 'tab'. */
static char *col_sep_string = (char *) "";
static int col_sep_length = 0;
@@ -1055,7 +1055,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
static char *column_separator = (char *) " ";
static char *line_separator = (char *) "\t";
-@@ -840,6 +893,13 @@ separator_string (const char *optarg_S)
+@@ -839,6 +892,13 @@ separator_string (const char *optarg_S)
col_sep_length = (int) strlen (optarg_S);
col_sep_string = xmalloc (col_sep_length + 1);
strcpy (col_sep_string, optarg_S);
@@ -1069,7 +1069,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
}
int
-@@ -864,6 +924,21 @@ main (int argc, char **argv)
+@@ -863,6 +923,21 @@ main (int argc, char **argv)
atexit (close_stdout);
@@ -1091,7 +1091,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
n_files = 0;
file_names = (argc > 1
? xmalloc ((argc - 1) * sizeof (char *))
-@@ -940,8 +1015,12 @@ main (int argc, char **argv)
+@@ -939,8 +1014,12 @@ main (int argc, char **argv)
break;
case 'e':
if (optarg)
@@ -1106,7 +1106,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* Could check tab width > 0. */
untabify_input = true;
break;
-@@ -954,8 +1033,12 @@ main (int argc, char **argv)
+@@ -953,8 +1032,12 @@ main (int argc, char **argv)
break;
case 'i':
if (optarg)
@@ -1121,7 +1121,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* Could check tab width > 0. */
tabify_output = true;
break;
-@@ -973,8 +1056,8 @@ main (int argc, char **argv)
+@@ -972,8 +1055,8 @@ main (int argc, char **argv)
case 'n':
numbered_lines = true;
if (optarg)
@@ -1132,7 +1132,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
break;
case 'N':
skip_count = false;
-@@ -998,7 +1081,7 @@ main (int argc, char **argv)
+@@ -997,7 +1080,7 @@ main (int argc, char **argv)
old_s = false;
/* Reset an additional input of -s, -S dominates -s */
col_sep_string = bad_cast ("");
@@ -1141,7 +1141,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
use_col_separator = true;
if (optarg)
separator_string (optarg);
-@@ -1152,10 +1235,45 @@ getoptnum (const char *n_str, int min, i
+@@ -1152,10 +1235,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err)
a number. */
static void
@@ -1359,7 +1359,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* sep_string ends with some spaces */
if (spaces_not_printed > 0)
print_white_space ();
-@@ -2259,7 +2389,7 @@ print_clump (COLUMN *p, int n, char *clu
+@@ -2259,7 +2389,7 @@ print_clump (COLUMN *p, int n, char *clump)
required number of tabs and spaces. */
static void
@@ -1701,7 +1701,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
#include "system.h"
#include "argmatch.h"
#include "error.h"
-@@ -164,14 +172,39 @@ static int decimal_point;
+@@ -163,14 +171,39 @@ static int decimal_point;
/* Thousands separator; if -1, then there isn't one. */
static int thousands_sep;
@@ -1742,7 +1742,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
/* The kind of blanks for '-b' to skip in various options. */
enum blanktype { bl_start, bl_end, bl_both };
-@@ -345,13 +378,11 @@ static bool reverse;
+@@ -344,13 +377,11 @@ static bool reverse;
they were read if all keys compare equal. */
static bool stable;
@@ -1815,7 +1815,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
static int
struct_month_cmp (void const *m1, void const *m2)
-@@ -1269,7 +1340,7 @@ struct_month_cmp (void const *m1, void c
+@@ -1269,7 +1340,7 @@ struct_month_cmp (void const *m1, void const *m2)
/* Initialize the character class tables. */
static void
@@ -1833,7 +1833,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
/* If we're not in the "C" locale, read different names for months. */
if (hard_LC_TIME)
{
-@@ -1363,6 +1434,84 @@ specify_nmerge (int oi, char c, char con
+@@ -1363,6 +1434,84 @@ specify_nmerge (int oi, char c, char const *s)
xstrtol_fatal (e, oi, c, long_options, s);
}
@@ -1918,7 +1918,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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)
-@@ -1596,7 +1745,7 @@ buffer_linelim (struct buffer const *buf
+@@ -1596,7 +1745,7 @@ buffer_linelim (struct buffer const *buf)
by KEY in LINE. */
static char *
@@ -1927,7 +1927,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t sword = key->sword;
-@@ -1605,10 +1754,10 @@ begfield (struct line const *line, struc
+@@ -1605,10 +1754,10 @@ begfield (struct line const *line, struct keyfield const *key)
/* The leading field separator itself is included in a field when -t
is absent. */
@@ -1940,7 +1940,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
++ptr;
if (ptr < lim)
++ptr;
-@@ -1634,11 +1783,70 @@ begfield (struct line const *line, struc
+@@ -1634,11 +1783,70 @@ begfield (struct line const *line, struct keyfield const *key)
return ptr;
}
@@ -2012,7 +2012,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar;
-@@ -1653,10 +1861,10 @@ limfield (struct line const *line, struc
+@@ -1653,10 +1861,10 @@ limfield (struct line const *line, struct keyfield const *key)
'beginning' is the first character following the delimiting TAB.
Otherwise, leave PTR pointing at the first 'blank' character after
the preceding field. */
@@ -2025,7 +2025,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
++ptr;
if (ptr < lim && (eword || echar))
++ptr;
-@@ -1702,10 +1910,10 @@ limfield (struct line const *line, struc
+@@ -1702,10 +1910,10 @@ limfield (struct line const *line, struct keyfield const *key)
*/
/* Make LIM point to the end of (one byte past) the current field. */
@@ -2038,7 +2038,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
if (newlim)
lim = newlim;
}
-@@ -1736,6 +1944,130 @@ limfield (struct line const *line, struc
+@@ -1736,6 +1944,130 @@ limfield (struct line const *line, struct keyfield const *key)
return ptr;
}
@@ -2169,7 +2169,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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
-@@ -1822,8 +2154,22 @@ fillbuf (struct buffer *buf, FILE *fp, c
+@@ -1822,8 +2154,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
else
{
if (key->skipsblanks)
@@ -2194,7 +2194,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
line->keybeg = line_start;
}
}
-@@ -1944,7 +2290,7 @@ human_numcompare (char const *a, char co
+@@ -1944,7 +2290,7 @@ human_numcompare (char const *a, char const *b)
hideously fast. */
static int
@@ -2203,7 +2203,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
while (blanks[to_uchar (*a)])
a++;
-@@ -1954,6 +2300,25 @@ numcompare (char const *a, char const *b
+@@ -1954,6 +2300,25 @@ numcompare (char const *a, char const *b)
return strnumcmp (a, b, decimal_point, thousands_sep);
}
@@ -2229,7 +2229,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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
-@@ -2004,7 +2369,7 @@ general_numcompare (char const *sa, char
+@@ -2004,7 +2369,7 @@ general_numcompare (char const *sa, char const *sb)
Return 0 if the name in S is not recognized. */
static int
@@ -2238,7 +2238,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
size_t lo = 0;
size_t hi = MONTHS_PER_YEAR;
-@@ -2279,15 +2644,14 @@ debug_key (struct line const *line, stru
+@@ -2280,15 +2645,14 @@ debug_key (struct line const *line, struct keyfield const *key)
char saved = *lim;
*lim = '\0';
@@ -2256,7 +2256,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
else if (key->general_numeric)
ignore_value (strtold (beg, &tighter_lim));
else if (key->numeric || key->human_numeric)
-@@ -2431,7 +2795,7 @@ key_warnings (struct keyfield const *gke
+@@ -2432,7 +2796,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
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 */
@@ -2265,7 +2265,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
&& ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned))
|| (!key->skipsblanks && key->schar)
|| (!key->skipeblanks && key->echar)))
-@@ -2489,11 +2853,87 @@ key_warnings (struct keyfield const *gke
+@@ -2490,11 +2854,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
error (0, 0, _("option '-r' only applies to last-resort comparison"));
}
@@ -2354,7 +2354,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
struct keyfield *key = keylist;
-@@ -2578,7 +3018,7 @@ keycompare (struct line const *a, struct
+@@ -2579,7 +3019,7 @@ keycompare (struct line const *a, struct line const *b)
else if (key->human_numeric)
diff = human_numcompare (ta, tb);
else if (key->month)
@@ -2363,7 +2363,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
else if (key->random)
diff = compare_random (ta, tlena, tb, tlenb);
else if (key->version)
-@@ -2694,6 +3134,211 @@ keycompare (struct line const *a, struct
+@@ -2695,6 +3135,211 @@ keycompare (struct line const *a, struct line const *b)
return key->reverse ? -diff : diff;
}
@@ -2575,7 +2575,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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. */
-@@ -2721,7 +3366,7 @@ compare (struct line const *a, struct line const *b)
+@@ -2722,7 +3367,7 @@ compare (struct line const *a, struct line const *b)
diff = - NONZERO (blen);
else if (blen == 0)
diff = 1;
@@ -2584,7 +2584,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
/* Note xmemcoll0 is a performance enhancement as
it will not unconditionally write '\0' after the
-@@ -4120,6 +4765,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
+@@ -4121,6 +4766,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
break;
case 'f':
key->translate = fold_toupper;
@@ -2592,7 +2592,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
break;
case 'g':
key->general_numeric = true;
-@@ -4197,7 +4843,7 @@ main (int argc, char **argv)
+@@ -4199,7 +4845,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE);
@@ -2601,7 +2601,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
hard_LC_TIME = hard_locale (LC_TIME);
#endif
-@@ -4218,6 +4864,29 @@ main (int argc, char **argv)
+@@ -4220,6 +4866,29 @@ main (int argc, char **argv)
thousands_sep = -1;
}
@@ -2631,7 +2631,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
have_read_stdin = false;
inittables ();
-@@ -4492,13 +5161,34 @@ main (int argc, char **argv)
+@@ -4494,13 +5163,34 @@ main (int argc, char **argv)
case 't':
{
@@ -2670,7 +2670,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
else
{
/* Provoke with 'sort -txx'. Complain about
-@@ -4509,9 +5199,12 @@ main (int argc, char **argv)
+@@ -4511,9 +5201,12 @@ main (int argc, char **argv)
quote (optarg));
}
}
@@ -2685,7 +2685,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
}
break;
-@@ -5444,12 +5444,10 @@ main (int argc, char **argv)
+@@ -4751,12 +5444,10 @@ main (int argc, char **argv)
sort (files, nfiles, outfile, nthreads);
}
@@ -2719,14 +2719,14 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
#include "system.h"
#include "argmatch.h"
#include "linebuffer.h"
-@@ -32,8 +43,20 @@
+@@ -31,9 +42,21 @@
#include "stdio--.h"
#include "xmemcoll.h"
#include "xstrtol.h"
-#include "memcasecmp.h"
+#include "xmemcoll.h"
#include "quote.h"
-+
+
+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
+ installation; work around this configuration error. */
+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
@@ -2738,9 +2738,10 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
+#endif
+
-
++
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "uniq"
+
@@ -143,6 +166,10 @@ enum
GROUP_OPTION = CHAR_MAX + 1
};
@@ -2752,7 +2753,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
static struct option const longopts[] =
{
{"count", no_argument, NULL, 'c'},
-@@ -251,7 +278,7 @@ size_opt (char const *opt, char const *m
+@@ -252,7 +279,7 @@ size_opt (char const *opt, char const *msgid)
return a pointer to the beginning of the line's field to be compared. */
static char * _GL_ATTRIBUTE_PURE
@@ -2761,7 +2762,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
{
size_t count;
char const *lp = line->buffer;
-@@ -271,6 +298,83 @@ find_field (struct linebuffer const *lin
+@@ -272,6 +299,83 @@ find_field (struct linebuffer const *line)
return line->buffer + i;
}
@@ -2845,7 +2846,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
/* Return false if two strings OLD and NEW match, true if not.
OLD and NEW point not to the beginnings of the lines
but rather to the beginnings of the fields to compare.
-@@ -279,6 +383,8 @@ find_field (struct linebuffer const *lin
+@@ -280,6 +384,8 @@ find_field (struct linebuffer const *line)
static bool
different (char *old, char *new, size_t oldlen, size_t newlen)
{
@@ -2854,7 +2855,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
if (check_chars < oldlen)
oldlen = check_chars;
if (check_chars < newlen)
-@@ -286,15 +392,104 @@ different (char *old, char *new, size_t
+@@ -287,14 +393,103 @@ different (char *old, char *new, size_t oldlen, size_t newlen)
if (ignore_case)
{
@@ -2886,8 +2887,8 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
+
+ return xmemcoll (copy_old, oldlen, copy_new, newlen);
+
- }
-
++}
++
+#if HAVE_MBRTOWC
+static int
+different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate)
@@ -2958,13 +2959,12 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
+ free (copy[1]);
+ return rc;
+
-+}
+ }
+#endif
-+
+
/* Output the line in linebuffer LINE to standard output
provided that the switches say it should be output.
- MATCH is true if the line matches the previous line.
-@@ -358,19 +553,38 @@ check_file (const char *infile, const ch
+@@ -359,19 +554,38 @@ check_file (const char *infile, const char *outfile, char delimiter)
char *prevfield IF_LINT ( = NULL);
size_t prevlen IF_LINT ( = 0);
bool first_group_printed = false;
@@ -3003,7 +3003,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
new_group = (prevline->length == 0
|| different (thisfield, prevfield, thislen, prevlen));
-@@ -388,6 +602,10 @@ check_file (const char *infile, const ch
+@@ -389,6 +603,10 @@ check_file (const char *infile, const char *outfile, char delimiter)
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
@@ -3014,7 +3014,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
first_group_printed = true;
}
}
-@@ -400,17 +618,26 @@ check_file (const char *infile, const ch
+@@ -401,17 +619,26 @@ check_file (const char *infile, const char *outfile, char delimiter)
size_t prevlen;
uintmax_t match_count = 0;
bool first_delimiter = true;
@@ -3041,7 +3041,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
{
if (ferror (stdin))
-@@ -419,6 +646,14 @@ check_file (const char *infile, const ch
+@@ -420,6 +647,14 @@ check_file (const char *infile, const char *outfile, char delimiter)
}
thisfield = find_field (thisline);
thislen = thisline->length - 1 - (thisfield - thisline->buffer);
@@ -3056,7 +3056,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
match = !different (thisfield, prevfield, thislen, prevlen);
match_count += match;
-@@ -451,6 +686,9 @@ check_file (const char *infile, const ch
+@@ -452,6 +687,9 @@ check_file (const char *infile, const char *outfile, char delimiter)
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
@@ -3066,7 +3066,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
if (!match)
match_count = 0;
}
-@@ -497,6 +735,19 @@ main (int argc, char **argv)
+@@ -498,6 +736,19 @@ main (int argc, char **argv)
atexit (close_stdout);
@@ -3122,7 +3122,7 @@ diff -urNp coreutils-8.24-orig/tests/i18n/sort.sh coreutils-8.24/tests/i18n/sort
diff -urNp coreutils-8.24-orig/tests/local.mk coreutils-8.24/tests/local.mk
--- coreutils-8.24-orig/tests/local.mk 2015-07-05 09:00:46.526859558 +0200
+++ coreutils-8.24/tests/local.mk 2015-07-05 09:04:33.033546987 +0200
-@@ -341,6 +341,8 @@ all_tests = \
+@@ -344,6 +344,8 @@ all_tests = \
tests/misc/sort-discrim.sh \
tests/misc/sort-files0-from.pl \
tests/misc/sort-float.sh \
@@ -3148,7 +3148,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/cut.pl coreutils-8.24/tests/misc/cut.p
my $prog = 'cut';
my $try = "Try '$prog --help' for more information.\n";
-@@ -227,6 +229,7 @@ if ($mb_locale ne 'C')
+@@ -240,6 +242,7 @@ if ($mb_locale ne 'C')
my @new_t = @$t;
my $test_name = shift @new_t;
@@ -3304,7 +3304,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/join.pl coreutils-8.24/tests/misc/join
my $delim = chr 0247;
sub t_subst ($)
{
-@@ -326,8 +335,49 @@ foreach my $t (@tv)
+@@ -329,8 +338,49 @@ foreach my $t (@tv)
push @Tests, $new_ent;
}
@@ -3482,7 +3482,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/sort.pl coreutils-8.24/tests/misc/sort
# Since each test is run with a file name and with redirected stdin,
# the name in the diagnostic is either the file name or "-".
# Normalize each diagnostic to use '-'.
-@@ -419,6 +428,38 @@ foreach my $t (@Tests)
+@@ -424,6 +429,38 @@ foreach my $t (@Tests)
}
}
@@ -3521,7 +3521,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/sort.pl coreutils-8.24/tests/misc/sort
@Tests = triple_test \@Tests;
# Remember that triple_test creates from each test with exactly one "IN"
-@@ -428,6 +469,7 @@ foreach my $t (@Tests)
+@@ -433,6 +470,7 @@ foreach my $t (@Tests)
# Remove the IN_PIPE version of the "output-is-input" test above.
# The others aren't susceptible because they have three inputs each.
@Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests;
@@ -3606,7 +3606,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/uniq.pl coreutils-8.24/tests/misc/uniq
# When possible, create a "-z"-testing variant of each test.
sub add_z_variants($)
{
-@@ -261,6 +269,53 @@ foreach my $t (@Tests)
+@@ -262,6 +270,53 @@ foreach my $t (@Tests)
and push @$t, {ENV=>'_POSIX2_VERSION=199209'};
}
diff --git a/coreutils-overflow.patch b/coreutils-overflow.patch
index 0d55a6d..06059a9 100644
--- a/coreutils-overflow.patch
+++ b/coreutils-overflow.patch
@@ -1,6 +1,6 @@
--- coreutils-5.2.1/src/who.c.overflow 2005-05-25 09:59:06.000000000 +0100
+++ coreutils-5.2.1/src/who.c 2005-05-25 10:00:31.000000000 +0100
-@@ -75,7 +75,7 @@
+@@ -79,7 +79,7 @@
# define UT_TYPE_NEW_TIME(U) false
#endif
diff --git a/coreutils-selinux.patch b/coreutils-selinux.patch
index bfcc9d3..9f45177 100644
--- a/coreutils-selinux.patch
+++ b/coreutils-selinux.patch
@@ -20,7 +20,7 @@ diff -urNp coreutils-8.21-orig/man/runcon.x coreutils-8.21/man/runcon.x
diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
--- coreutils-8.21-orig/src/cp.c 2013-02-07 10:37:05.000000000 +0100
+++ coreutils-8.21/src/cp.c 2013-02-15 14:31:58.945468929 +0100
-@@ -201,6 +202,9 @@ Copy SOURCE to DEST, or multiple SOURCE(
+@@ -202,6 +202,9 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
all\n\
"), stdout);
fputs (_("\
@@ -30,7 +30,7 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
--no-preserve=ATTR_LIST don't preserve the specified attributes\n\
--parents use full source file name under DIRECTORY\n\
"), stdout);
-@@ -933,7 +939,7 @@ main (int argc, char **argv)
+@@ -943,7 +946,7 @@ main (int argc, char **argv)
we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
@@ -39,7 +39,7 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
long_opts, NULL))
!= -1)
{
-@@ -981,6 +987,17 @@ main (int argc, char **argv)
+@@ -991,6 +994,17 @@ main (int argc, char **argv)
copy_contents = true;
break;
@@ -60,7 +60,7 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
diff -urNp coreutils-8.21-orig/src/id.c coreutils-8.21/src/id.c
--- coreutils-8.21-orig/src/id.c 2013-01-31 01:46:24.000000000 +0100
+++ coreutils-8.21/src/id.c 2013-02-15 14:31:58.946469154 +0100
-@@ -106,7 +106,7 @@ int
+@@ -113,7 +113,7 @@ int
main (int argc, char **argv)
{
int optc;
@@ -72,7 +72,7 @@ diff -urNp coreutils-8.21-orig/src/id.c coreutils-8.21/src/id.c
diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c
--- coreutils-8.21-orig/src/install.c 2013-02-07 10:37:05.000000000 +0100
+++ coreutils-8.21/src/install.c 2013-02-15 14:31:58.948469440 +0100
-@@ -639,7 +640,7 @@ In the 4th form, create all components o
+@@ -649,7 +649,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\
-v, --verbose print the name of each directory as it is created\n\
"), stdout);
fputs (_("\
@@ -81,7 +81,7 @@ diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c
-Z set SELinux security context of destination\n\
file to default type\n\
--context[=CTX] like -Z, or if CTX is specified then set the\n\
-@@ -782,7 +783,7 @@ main (int argc, char **argv)
+@@ -817,7 +817,7 @@ main (int argc, char **argv)
we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
@@ -90,7 +90,7 @@ diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c
NULL)) != -1)
{
switch (optc)
-@@ -853,6 +854,8 @@ main (int argc, char **argv)
+@@ -878,6 +878,8 @@ main (int argc, char **argv)
no_target_directory = true;
break;
@@ -99,7 +99,7 @@ diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c
case PRESERVE_CONTEXT_OPTION:
if (! selinux_enabled)
{
-@@ -860,6 +862,10 @@ main (int argc, char **argv)
+@@ -885,6 +887,10 @@ main (int argc, char **argv)
"this kernel is not SELinux-enabled"));
break;
}
diff --git a/coreutils-selinuxmanpages.patch b/coreutils-selinuxmanpages.patch
index 7b27f90..1540613 100644
--- a/coreutils-selinuxmanpages.patch
+++ b/coreutils-selinuxmanpages.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-6.10-orig/doc/coreutils.texi coreutils-6.10/doc/coreutils.texi
--- coreutils-6.10-orig/doc/coreutils.texi 2008-04-07 17:52:11.000000000 +0200
+++ coreutils-6.10/doc/coreutils.texi 2008-04-07 18:01:43.000000000 +0200
-@@ -6981,6 +6981,11 @@ for i; do
+@@ -8002,6 +8002,11 @@ done
exit $fail
@end example
diff --git a/sh-utils-2.0.11-dateman.patch b/sh-utils-2.0.11-dateman.patch
index 8684dc7..60cdaa6 100644
--- a/sh-utils-2.0.11-dateman.patch
+++ b/sh-utils-2.0.11-dateman.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-5.97-orig/man/date.x coreutils-5.97/man/date.x
--- coreutils-5.97-orig/man/date.x 1999-11-02 15:07:36.000000000 +0100
+++ coreutils-5.97/man/date.x 2008-10-15 10:13:31.000000000 +0200
-@@ -11,3 +11,8 @@
+@@ -11,3 +11,8 @@ calendar date, time of day, time zone, day of week, relative time,
relative date, and numbers. An empty string indicates the beginning
of the day. The date string format is more complex than is easily
documented here but is fully described in the info documentation.
From 6cf6cd48dd1577f0f69816c3afcd4775b0d281bb Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Thu, 14 Jul 2016 16:50:51 +0200
Subject: [PATCH 020/232] make 'sort -h' work for arbitrary column
... even when using UTF-8 locales
---
coreutils-i18n-sort-human.patch | 35 +++++++++++++++++++++++++++++++++
coreutils.spec | 8 +++++++-
2 files changed, 42 insertions(+), 1 deletion(-)
create mode 100644 coreutils-i18n-sort-human.patch
diff --git a/coreutils-i18n-sort-human.patch b/coreutils-i18n-sort-human.patch
new file mode 100644
index 0000000..2469189
--- /dev/null
+++ b/coreutils-i18n-sort-human.patch
@@ -0,0 +1,35 @@
+From 3976ef5a20369d8b490907ab2cba2d617305a5e0 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Mon, 30 May 2016 16:19:20 +0200
+Subject: [PATCH] sort: do not use static array 'blanks' in human_numcompare()
+
+... because the array is not initialized with MB locales. Note this is
+rather a conservative fix. I plan to do more cleanup of the i18n patch
+in Fedora to prevent mistakes like this in future updates of coreutils.
+---
+ src/sort.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/src/sort.c b/src/sort.c
+index 9e07ad8..e47b039 100644
+--- a/src/sort.c
++++ b/src/sort.c
+@@ -2274,12 +2274,10 @@ find_unit_order (char const *number)
+ < K/k < M < G < T < P < E < Z < Y */
+
+ static int
+-human_numcompare (char const *a, char const *b)
++human_numcompare (char *a, char *b)
+ {
+- while (blanks[to_uchar (*a)])
+- a++;
+- while (blanks[to_uchar (*b)])
+- b++;
++ skipblanks(&a, a + strlen(a));
++ skipblanks(&b, b + strlen(b));
+
+ int diff = find_unit_order (a) - find_unit_order (b);
+ return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep));
+--
+2.5.5
+
diff --git a/coreutils.spec b/coreutils.spec
index e48bca6..010fe77 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 12%{?dist}
+Release: 13%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -53,6 +53,8 @@ Patch803: coreutils-i18n-fix-unexpand.patch
Patch805: coreutils-i18n-fix2-expand-unexpand.patch
#(un)expand - test BOM headers
Patch806: coreutils-i18n-un-expand-BOM.patch
+# make 'sort -h' work for arbitrary column even when using UTF-8 locales
+Patch807: coreutils-i18n-sort-human.patch
#getgrouplist() patch from Ulrich Drepper.
Patch908: coreutils-getgrouplist.patch
@@ -195,6 +197,7 @@ tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null
%patch804 -p1 -b .i18n-cutold
%patch805 -p1 -b .i18n-fix2-expand-unexpand
%patch806 -p1 -b .i18n-BOM-expand-unexpand
+%patch807 -p1
# Coreutils
%patch908 -p1 -b .getgrouplist
@@ -349,6 +352,9 @@ fi
%license COPYING
%changelog
+* Thu Jul 14 2016 Kamil Dudka - 8.25-13
+- make 'sort -h' work for arbitrary column even when using UTF-8 locales
+
* Mon Jul 11 2016 Kamil Dudka - 8.25-12
- install -Z now sets default SELinux context for created directories (#1339135)
- drop the %%pre scriptlet, which is no longer needed (#1354078)
From 8b01f2371c4f35fa629cba7e630183141f24be99 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Tue, 19 Jul 2016 13:52:45 +0200
Subject: [PATCH 021/232] Resolves: #1355780 - fix 'sort -h -k' in locales that
use blank as thousands separator
---
coreutils-8.25-sort-thousands-sep.patch | 332 ++++++++++++++++++++++++
coreutils.spec | 11 +-
2 files changed, 342 insertions(+), 1 deletion(-)
create mode 100644 coreutils-8.25-sort-thousands-sep.patch
diff --git a/coreutils-8.25-sort-thousands-sep.patch b/coreutils-8.25-sort-thousands-sep.patch
new file mode 100644
index 0000000..b9d2b5c
--- /dev/null
+++ b/coreutils-8.25-sort-thousands-sep.patch
@@ -0,0 +1,332 @@
+From c479153d77b419a6cae4551b63d2b73096c1130e Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Mon, 18 Jul 2016 19:04:43 +0200
+Subject: [PATCH 1/3] maint: sort.c: deduplicate code for traversing numbers
+
+* src/sort.c (traverse_raw_number): New function for traversing numbers.
+(find_unit_order): Use traverse_raw_number() instead of open-coding it.
+(debug_key): Likewise.
+---
+ src/sort.c | 63 ++++++++++++++++++++++++++++++++++----------------------------
+ 1 file changed, 35 insertions(+), 28 deletions(-)
+
+diff --git a/src/sort.c b/src/sort.c
+index 5b02343..e28bb6c 100644
+--- a/src/sort.c
++++ b/src/sort.c
+@@ -2231,18 +2231,16 @@ static char const unit_order[UCHAR_LIM] =
+ #endif
+ };
+
+-/* Return an integer that represents the order of magnitude of the
+- unit following the number. The number may contain thousands
+- separators and a decimal point, but it may not contain leading blanks.
+- Negative numbers get negative orders; zero numbers have a zero order. */
+-
+-static int _GL_ATTRIBUTE_PURE
+-find_unit_order (char const *number)
++/* Traverse number given as *number consisting of digits, thousands_sep, and
++ decimal_point chars only. Returns the highest digit found in the number,
++ or '\0' if no digit has been found. Upon return *number points at the
++ character that immediately follows after the given number. */
++static unsigned char
++traverse_raw_number (char const **number)
+ {
+- bool minus_sign = (*number == '-');
+- char const *p = number + minus_sign;
+- int nonzero = 0;
++ char const *p = *number;
+ unsigned char ch;
++ unsigned char max_digit = '\0';
+
+ /* Scan to end of number.
+ Decimals or separators not followed by digits stop the scan.
+@@ -2253,16 +2251,34 @@ find_unit_order (char const *number)
+ do
+ {
+ while (ISDIGIT (ch = *p++))
+- nonzero |= ch - '0';
++ if (max_digit < ch)
++ max_digit = ch;
+ }
+ while (ch == thousands_sep);
+
+ if (ch == decimal_point)
+ while (ISDIGIT (ch = *p++))
+- nonzero |= ch - '0';
++ if (max_digit < ch)
++ max_digit = ch;
++
++ *number = p - 1;
++ return max_digit;
++}
++
++/* Return an integer that represents the order of magnitude of the
++ unit following the number. The number may contain thousands
++ separators and a decimal point, but it may not contain leading blanks.
++ Negative numbers get negative orders; zero numbers have a zero order. */
+
+- if (nonzero)
++static int _GL_ATTRIBUTE_PURE
++find_unit_order (char const *number)
++{
++ bool minus_sign = (*number == '-');
++ char const *p = number + minus_sign;
++ unsigned char max_digit = traverse_raw_number (&p);
++ if ('0' < max_digit)
+ {
++ unsigned char ch = *p;
+ int order = unit_order[ch];
+ return (minus_sign ? -order : order);
+ }
+@@ -2655,23 +2671,14 @@ debug_key (struct line const *line, struct keyfield const *key)
+ ignore_value (strtold (beg, &tighter_lim));
+ else if (key->numeric || key->human_numeric)
+ {
+- char *p = beg + (beg < lim && *beg == '-');
+- bool found_digit = false;
+- unsigned char ch;
+-
+- do
++ char const *p = beg + (beg < lim && *beg == '-');
++ unsigned char max_digit = traverse_raw_number (&p);
++ if ('0' <= max_digit)
+ {
+- while (ISDIGIT (ch = *p++))
+- found_digit = true;
++ unsigned char ch = *p;
++ tighter_lim = (char *) p
++ + (key->human_numeric && unit_order[ch]);
+ }
+- while (ch == thousands_sep);
+-
+- if (ch == decimal_point)
+- while (ISDIGIT (ch = *p++))
+- found_digit = true;
+-
+- if (found_digit)
+- tighter_lim = p - ! (key->human_numeric && unit_order[ch]);
+ }
+ else
+ tighter_lim = lim;
+--
+2.5.5
+
+
+From 8c39465a5b0343ff7a21286dd69ed5430685d2f7 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Mon, 18 Jul 2016 19:04:44 +0200
+Subject: [PATCH 2/3] sort: make -h work with -k and blank used as thousands
+ separator
+
+* src/sort.c (traverse_raw_number): Allow to skip only one occurrence
+of thousands_sep to avoid finding the unit in the next column in case
+thousands_sep matches as blank and is used as column delimiter.
+* tests/misc/sort-h-thousands-sep.sh: Add regression test for this bug.
+* tests/local.mk: Reference the test.
+* NEWS: Mention the bug fix.
+Reported at https://bugzilla.redhat.com/1355780
+Fixes http://bugs.gnu.org/24015
+---
+ src/sort.c | 14 ++++++++----
+ tests/local.mk | 1 +
+ tests/misc/sort-h-thousands-sep.sh | 47 ++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 57 insertions(+), 5 deletions(-)
+ create mode 100755 tests/misc/sort-h-thousands-sep.sh
+
+diff --git a/src/sort.c b/src/sort.c
+index e28bb6c..dd3ba58 100644
+--- a/src/sort.c
++++ b/src/sort.c
+@@ -2248,13 +2248,17 @@ traverse_raw_number (char const **number)
+ to be lacking in units.
+ FIXME: add support for multibyte thousands_sep and decimal_point. */
+
+- do
++ while (ISDIGIT (ch = *p++))
+ {
+- while (ISDIGIT (ch = *p++))
+- if (max_digit < ch)
+- max_digit = ch;
++ if (max_digit < ch)
++ max_digit = ch;
++
++ /* Allow to skip only one occurrence of thousands_sep to avoid finding
++ the unit in the next column in case thousands_sep matches as blank
++ and is used as column delimiter. */
++ if (*p == thousands_sep)
++ ++p;
+ }
+- while (ch == thousands_sep);
+
+ if (ch == decimal_point)
+ while (ISDIGIT (ch = *p++))
+diff --git a/tests/local.mk b/tests/local.mk
+index 42d39f2..dccff8d 100644
+--- a/tests/local.mk
++++ b/tests/local.mk
+@@ -344,6 +344,7 @@ all_tests = \
+ tests/misc/sort-discrim.sh \
+ tests/misc/sort-files0-from.pl \
+ tests/misc/sort-float.sh \
++ tests/misc/sort-h-thousands-sep.sh \
+ tests/misc/sort-mb-tests.sh \
+ tests/i18n/sort.sh \
+ tests/misc/sort-merge.pl \
+diff --git a/tests/misc/sort-h-thousands-sep.sh b/tests/misc/sort-h-thousands-sep.sh
+new file mode 100755
+index 0000000..17f1b6c
+--- /dev/null
++++ b/tests/misc/sort-h-thousands-sep.sh
+@@ -0,0 +1,47 @@
++#!/bin/sh
++# exercise 'sort -h' in locales where thousands separator is blank
++
++# Copyright (C) 2016 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 .
++
++. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++print_ver_ sort
++test "$(LC_ALL=sv_SE locale thousands_sep)" = ' ' \
++ || skip_ 'The Swedish locale with blank thousands separator is unavailable.'
++
++tee exp1 > in << _EOF_
++1 1k 4 003 1M
++2k 2M 4 002 2
++3M 3 4 001 3k
++_EOF_
++
++cat > exp2 << _EOF_
++3M 3 4 001 3k
++1 1k 4 003 1M
++2k 2M 4 002 2
++_EOF_
++
++cat > exp3 << _EOF_
++3M 3 4 001 3k
++2k 2M 4 002 2
++1 1k 4 003 1M
++_EOF_
++
++for i in 1 2 3; do
++ LC_ALL="sv_SE.utf8" sort -h -k $i "in" > "out${i}" || fail=1
++ compare "exp${i}" "out${i}" || fail=1
++done
++
++Exit $fail
+--
+2.5.5
+
+
+From 46ef53f558e7bc1c0bc0abd62a86b40b4141e058 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Mon, 18 Jul 2016 19:04:45 +0200
+Subject: [PATCH 3/3] sort: with -h, disallow thousands separator between
+ number and unit
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+* src/sort.c (traverse_raw_number): Accept thousands separator only
+if it is immediately followed by a digit.
+* tests/misc/sort-h-thousands-sep.sh: Cover the fix for this bug.
+
+Suggested by Pádraig Brady in http://bugs.gnu.org/24015
+---
+ src/sort.c | 11 ++++++++++-
+ tests/misc/sort-h-thousands-sep.sh | 25 +++++++++++++------------
+ 2 files changed, 23 insertions(+), 13 deletions(-)
+
+diff --git a/src/sort.c b/src/sort.c
+index dd3ba58..69ef75f 100644
+--- a/src/sort.c
++++ b/src/sort.c
+@@ -2241,6 +2241,7 @@ traverse_raw_number (char const **number)
+ char const *p = *number;
+ unsigned char ch;
+ unsigned char max_digit = '\0';
++ bool ends_with_thousands_sep = false;
+
+ /* Scan to end of number.
+ Decimals or separators not followed by digits stop the scan.
+@@ -2256,10 +2257,18 @@ traverse_raw_number (char const **number)
+ /* Allow to skip only one occurrence of thousands_sep to avoid finding
+ the unit in the next column in case thousands_sep matches as blank
+ and is used as column delimiter. */
+- if (*p == thousands_sep)
++ ends_with_thousands_sep = (*p == thousands_sep);
++ if (ends_with_thousands_sep)
+ ++p;
+ }
+
++ if (ends_with_thousands_sep)
++ {
++ /* thousands_sep not followed by digit is not allowed. */
++ *number = p - 2;
++ return max_digit;
++ }
++
+ if (ch == decimal_point)
+ while (ISDIGIT (ch = *p++))
+ if (max_digit < ch)
+diff --git a/tests/misc/sort-h-thousands-sep.sh b/tests/misc/sort-h-thousands-sep.sh
+index 17f1b6c..3ffa89e 100755
+--- a/tests/misc/sort-h-thousands-sep.sh
++++ b/tests/misc/sort-h-thousands-sep.sh
+@@ -18,28 +18,29 @@
+
+ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+ print_ver_ sort
++
+ test "$(LC_ALL=sv_SE locale thousands_sep)" = ' ' \
+ || skip_ 'The Swedish locale with blank thousands separator is unavailable.'
+
+-tee exp1 > in << _EOF_
+-1 1k 4 003 1M
+-2k 2M 4 002 2
+-3M 3 4 001 3k
++tee exp1 exp3 > in << _EOF_
++1 1k 1 M 4 003 1M
++2k 2M 2 k 4 002 2
++3M 3 3 G 4 001 3k
+ _EOF_
+
+ cat > exp2 << _EOF_
+-3M 3 4 001 3k
+-1 1k 4 003 1M
+-2k 2M 4 002 2
++3M 3 3 G 4 001 3k
++1 1k 1 M 4 003 1M
++2k 2M 2 k 4 002 2
+ _EOF_
+
+-cat > exp3 << _EOF_
+-3M 3 4 001 3k
+-2k 2M 4 002 2
+-1 1k 4 003 1M
++cat > exp5 << _EOF_
++3M 3 3 G 4 001 3k
++2k 2M 2 k 4 002 2
++1 1k 1 M 4 003 1M
+ _EOF_
+
+-for i in 1 2 3; do
++for i in 1 2 3 5; do
+ LC_ALL="sv_SE.utf8" sort -h -k $i "in" > "out${i}" || fail=1
+ compare "exp${i}" "out${i}" || fail=1
+ done
+--
+2.5.5
+
diff --git a/coreutils.spec b/coreutils.spec
index 010fe77..934e7a3 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 13%{?dist}
+Release: 14%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -19,6 +19,8 @@ Source10: coreutils-find-requires.sh
# From upstream
Patch952: coreutils-8.25-intall-Z-selinux.patch
+# fix 'sort -h -k' in locales that use blank as thousands separator (#1355780)
+Patch953: coreutils-8.25-sort-thousands-sep.patch
# Our patches
#general patch to workaround koji build system issues
@@ -209,9 +211,13 @@ tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null
%patch951 -p1 -b .selinuxman
%patch952 -p1
+# upstream patches
+%patch953 -p1
+
chmod a+x \
tests/df/direct.sh \
tests/install/install-Z-selinux.sh \
+ tests/misc/sort-h-thousands-sep.sh \
tests/misc/sort-mb-tests.sh \
|| :
@@ -352,6 +358,9 @@ fi
%license COPYING
%changelog
+* Tue Jul 19 2016 Kamil Dudka - 8.25-14
+- fix 'sort -h -k' in locales that use blank as thousands separator (#1355780)
+
* Thu Jul 14 2016 Kamil Dudka - 8.25-13
- make 'sort -h' work for arbitrary column even when using UTF-8 locales
From adf19d29ece14ba661d133ebc908843c853c1a8b Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Tue, 19 Jul 2016 14:00:38 +0200
Subject: [PATCH 022/232] drop post-install fix for Japanese locales that no
longer applies
---
coreutils.spec | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/coreutils.spec b/coreutils.spec
index 934e7a3..96ad694 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -286,14 +286,6 @@ for type in separate single; do
fi
done
-# fix japanese catalog file
-if [ -d $RPM_BUILD_ROOT%{_datadir}/locale/ja_JP.EUC/LC_MESSAGES ]; then
- mkdir -p $RPM_BUILD_ROOT%{_datadir}/locale/ja/LC_MESSAGES
- mv $RPM_BUILD_ROOT%{_datadir}/locale/ja_JP.EUC/LC_MESSAGES/*mo \
- $RPM_BUILD_ROOT%{_datadir}/locale/ja/LC_MESSAGES
- rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/ja_JP.EUC
-fi
-
bzip2 -9f ChangeLog
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
@@ -359,6 +351,7 @@ fi
%changelog
* Tue Jul 19 2016 Kamil Dudka - 8.25-14
+- drop post-install fix for Japanese locales that no longer applies
- fix 'sort -h -k' in locales that use blank as thousands separator (#1355780)
* Thu Jul 14 2016 Kamil Dudka - 8.25-13
From 39f7c7c836d63c96a8c9148ddc9c21b567705f1f Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Tue, 19 Jul 2016 15:09:42 +0200
Subject: [PATCH 023/232] run autoreconf in %prep
---
coreutils.spec | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/coreutils.spec b/coreutils.spec
index 96ad694..ca83275 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -111,7 +111,7 @@ BuildRequires: attr
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
-BuildRequires: gettext
+BuildRequires: gettext-devel
BuildRequires: gmp-devel
BuildRequires: libacl-devel
BuildRequires: libattr-devel
@@ -226,14 +226,11 @@ find ./po/ -name "*.p*" | xargs \
sed -i \
-e 's/-dpR/-cdpR/'
+autoreconf -fiv
+
%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fpic"
%{expand:%%global optflags %{optflags} -D_GNU_SOURCE=1}
-#autoreconf -i -v
-touch aclocal.m4 configure config.hin Makefile.in */Makefile.in
-aclocal -I m4
-autoconf --force
-automake --copy --add-missing
for type in separate single; do
mkdir $type && \
(cd $type && ln -s ../configure || exit 1
@@ -351,6 +348,7 @@ fi
%changelog
* Tue Jul 19 2016 Kamil Dudka - 8.25-14
+- run autoreconf in %%prep
- drop post-install fix for Japanese locales that no longer applies
- fix 'sort -h -k' in locales that use blank as thousands separator (#1355780)
From 0e3a55d8dcf4a99b598e96bb812ca5a6d261996a Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Wed, 7 Sep 2016 20:09:15 +0200
Subject: [PATCH 024/232] coreutils.spec: do not compress files that are not
installed
---
coreutils.spec | 5 -----
1 file changed, 5 deletions(-)
diff --git a/coreutils.spec b/coreutils.spec
index ca83275..e1a669f 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -283,17 +283,12 @@ for type in separate single; do
fi
done
-bzip2 -9f ChangeLog
-
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
install -p -c -m644 DIR_COLORS{,.256color,.lightbgcolor} \
$RPM_BUILD_ROOT%{_sysconfdir}
install -p -c -m644 %SOURCE105 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.sh
install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.csh
-# Compress ChangeLogs from before the fileutils/textutils/etc merge
-bzip2 -f9 old/*/C*
-
# Use hard links instead of symbolic links for LC_TIME files (bug #246729).
find %{buildroot}%{_datadir}/locale -type l | \
(while read link
From 380647993e0806d823c4548cb72384bee95db58e Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Wed, 7 Sep 2016 20:17:56 +0200
Subject: [PATCH 025/232] Resolves: #1365933 - ls: allow interruption when
reading slow directories
---
coreutils-8.25-ls-signal.patch | 236 +++++++++++++++++++++++++++++++++
coreutils.spec | 8 +-
2 files changed, 243 insertions(+), 1 deletion(-)
create mode 100644 coreutils-8.25-ls-signal.patch
diff --git a/coreutils-8.25-ls-signal.patch b/coreutils-8.25-ls-signal.patch
new file mode 100644
index 0000000..32cfd3a
--- /dev/null
+++ b/coreutils-8.25-ls-signal.patch
@@ -0,0 +1,236 @@
+From 9338b244572e07bbff314b3570228e8cf43f1300 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Tue, 6 Sep 2016 17:38:26 +0200
+Subject: [PATCH] ls: allow interruption when reading slow directories
+
+Postpone installation of signal handlers until they're needed.
+That is right before the first escape sequence is printed.
+
+* src/ls.c (signal_setup): A new function refactored from main()
+to set and restore signal handlers.
+(main): Move signal handler setup to put_indicator()
+so that the default signal handling is untouched as long as possible.
+Adjusted condition for restoring signal handlers to reflect the change.
+(put_indicator): Install signal handlers if called for the very first
+time. It uses the same code that was in main() prior to this commit.
+* NEWS: Mention the improvement.
+
+See https://bugzilla.redhat.com/1365933
+Fixes http://bugs.gnu.org/24232
+
+Upstream-commit: 5445f7811ff945ea13aa2a0fd797eb4c0a0e4db0
+Signed-off-by: Kamil Dudka
+---
+ src/ls.c | 161 ++++++++++++++++++++++++++++++++++++---------------------------
+ 1 file changed, 93 insertions(+), 68 deletions(-)
+
+diff --git a/src/ls.c b/src/ls.c
+index d976036..66df307 100644
+--- a/src/ls.c
++++ b/src/ls.c
+@@ -1244,13 +1244,12 @@ process_signals (void)
+ }
+ }
+
+-int
+-main (int argc, char **argv)
+-{
+- int i;
+- struct pending *thispend;
+- int n_files;
++/* Setup signal handlers if INIT is true,
++ otherwise restore to the default. */
+
++static void
++signal_setup (bool init)
++{
+ /* The signals that are trapped, and the number of such signals. */
+ static int const sig[] =
+ {
+@@ -1278,8 +1277,77 @@ main (int argc, char **argv)
+ enum { nsigs = ARRAY_CARDINALITY (sig) };
+
+ #if ! SA_NOCLDSTOP
+- bool caught_sig[nsigs];
++ static bool caught_sig[nsigs];
++#endif
++
++ int j;
++
++ if (init)
++ {
++#if SA_NOCLDSTOP
++ struct sigaction act;
++
++ sigemptyset (&caught_signals);
++ for (j = 0; j < nsigs; j++)
++ {
++ sigaction (sig[j], NULL, &act);
++ if (act.sa_handler != SIG_IGN)
++ sigaddset (&caught_signals, sig[j]);
++ }
++
++ act.sa_mask = caught_signals;
++ act.sa_flags = SA_RESTART;
++
++ for (j = 0; j < nsigs; j++)
++ if (sigismember (&caught_signals, sig[j]))
++ {
++ act.sa_handler = sig[j] == SIGTSTP ? stophandler : sighandler;
++ sigaction (sig[j], &act, NULL);
++ }
++#else
++ for (j = 0; j < nsigs; j++)
++ {
++ caught_sig[j] = (signal (sig[j], SIG_IGN) != SIG_IGN);
++ if (caught_sig[j])
++ {
++ signal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler);
++ siginterrupt (sig[j], 0);
++ }
++ }
+ #endif
++ }
++ else /* restore. */
++ {
++#if SA_NOCLDSTOP
++ for (j = 0; j < nsigs; j++)
++ if (sigismember (&caught_signals, sig[j]))
++ signal (sig[j], SIG_DFL);
++#else
++ for (j = 0; j < nsigs; j++)
++ if (caught_sig[j])
++ signal (sig[j], SIG_DFL);
++#endif
++ }
++}
++
++static inline void
++signal_init (void)
++{
++ signal_setup (true);
++}
++
++static inline void
++signal_restore (void)
++{
++ signal_setup (false);
++}
++
++int
++main (int argc, char **argv)
++{
++ int i;
++ struct pending *thispend;
++ int n_files;
+
+ initialize_main (&argc, &argv);
+ set_program_name (argv[0]);
+@@ -1314,46 +1382,6 @@ main (int argc, char **argv)
+ || (is_colored (C_EXEC) && color_symlink_as_referent)
+ || (is_colored (C_MISSING) && format == long_format))
+ check_symlink_color = true;
+-
+- /* If the standard output is a controlling terminal, watch out
+- for signals, so that the colors can be restored to the
+- default state if "ls" is suspended or interrupted. */
+-
+- if (0 <= tcgetpgrp (STDOUT_FILENO))
+- {
+- int j;
+-#if SA_NOCLDSTOP
+- struct sigaction act;
+-
+- sigemptyset (&caught_signals);
+- for (j = 0; j < nsigs; j++)
+- {
+- sigaction (sig[j], NULL, &act);
+- if (act.sa_handler != SIG_IGN)
+- sigaddset (&caught_signals, sig[j]);
+- }
+-
+- act.sa_mask = caught_signals;
+- act.sa_flags = SA_RESTART;
+-
+- for (j = 0; j < nsigs; j++)
+- if (sigismember (&caught_signals, sig[j]))
+- {
+- act.sa_handler = sig[j] == SIGTSTP ? stophandler : sighandler;
+- sigaction (sig[j], &act, NULL);
+- }
+-#else
+- for (j = 0; j < nsigs; j++)
+- {
+- caught_sig[j] = (signal (sig[j], SIG_IGN) != SIG_IGN);
+- if (caught_sig[j])
+- {
+- signal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler);
+- siginterrupt (sig[j], 0);
+- }
+- }
+-#endif
+- }
+ }
+
+ if (dereference == DEREF_UNDEFINED)
+@@ -1466,32 +1494,21 @@ main (int argc, char **argv)
+ print_dir_name = true;
+ }
+
+- if (print_with_color)
++ if (print_with_color && used_color)
+ {
+ int j;
+
+- if (used_color)
+- {
+- /* Skip the restore when it would be a no-op, i.e.,
+- when left is "\033[" and right is "m". */
+- if (!(color_indicator[C_LEFT].len == 2
+- && memcmp (color_indicator[C_LEFT].string, "\033[", 2) == 0
+- && color_indicator[C_RIGHT].len == 1
+- && color_indicator[C_RIGHT].string[0] == 'm'))
+- restore_default_color ();
+- }
++ /* Skip the restore when it would be a no-op, i.e.,
++ when left is "\033[" and right is "m". */
++ if (!(color_indicator[C_LEFT].len == 2
++ && memcmp (color_indicator[C_LEFT].string, "\033[", 2) == 0
++ && color_indicator[C_RIGHT].len == 1
++ && color_indicator[C_RIGHT].string[0] == 'm'))
++ restore_default_color ();
++
+ fflush (stdout);
+
+- /* Restore the default signal handling. */
+-#if SA_NOCLDSTOP
+- for (j = 0; j < nsigs; j++)
+- if (sigismember (&caught_signals, sig[j]))
+- signal (sig[j], SIG_DFL);
+-#else
+- for (j = 0; j < nsigs; j++)
+- if (caught_sig[j])
+- signal (sig[j], SIG_DFL);
+-#endif
++ signal_restore ();
+
+ /* Act on any signals that arrived before the default was restored.
+ This can process signals out of order, but there doesn't seem to
+@@ -4482,6 +4499,14 @@ put_indicator (const struct bin_str *ind)
+ if (! used_color)
+ {
+ used_color = true;
++
++ /* If the standard output is a controlling terminal, watch out
++ for signals, so that the colors can be restored to the
++ default state if "ls" is suspended or interrupted. */
++
++ if (0 <= tcgetpgrp (STDOUT_FILENO))
++ signal_init ();
++
+ prep_non_filename_text ();
+ }
+
+--
+2.7.4
+
diff --git a/coreutils.spec b/coreutils.spec
index e1a669f..daa44fc 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 14%{?dist}
+Release: 15%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -21,6 +21,8 @@ Source10: coreutils-find-requires.sh
Patch952: coreutils-8.25-intall-Z-selinux.patch
# fix 'sort -h -k' in locales that use blank as thousands separator (#1355780)
Patch953: coreutils-8.25-sort-thousands-sep.patch
+# ls: allow interruption when reading slow directories (#1365933)
+Patch954: coreutils-8.25-ls-signal.patch
# Our patches
#general patch to workaround koji build system issues
@@ -213,6 +215,7 @@ tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null
# upstream patches
%patch953 -p1
+%patch954 -p1
chmod a+x \
tests/df/direct.sh \
@@ -342,6 +345,9 @@ fi
%license COPYING
%changelog
+* Wed Sep 07 2016 Kamil Dudka - 8.25-15
+- ls: allow interruption when reading slow directories (#1365933)
+
* Tue Jul 19 2016 Kamil Dudka - 8.25-14
- run autoreconf in %%prep
- drop post-install fix for Japanese locales that no longer applies
From 21de8b5251972b49ed5da467580ce7b0371c7979 Mon Sep 17 00:00:00 2001
From: Tomas Mraz
Date: Tue, 11 Oct 2016 13:25:50 +0200
Subject: [PATCH 026/232] rebuild with OpenSSL 1.1.0
---
coreutils.spec | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/coreutils.spec b/coreutils.spec
index daa44fc..88bab95 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 15%{?dist}
+Release: 16%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -345,6 +345,9 @@ fi
%license COPYING
%changelog
+* Tue Oct 11 2016 Tomáš Mráz - 8.25-16
+- rebuild with OpenSSL 1.1.0
+
* Wed Sep 07 2016 Kamil Dudka - 8.25-15
- ls: allow interruption when reading slow directories (#1365933)
From 3ed22ec3e82e234daf53c2f08387ab755a602fc2 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 31 Oct 2016 17:52:01 +0100
Subject: [PATCH 027/232] md5sum,sha*sum: fix --ignore-missing with checksums
starting with 00
---
coreutils-8.25-sum-ignore-missing.patch | 115 ++++++++++++++++++++++++
coreutils.spec | 8 +-
2 files changed, 122 insertions(+), 1 deletion(-)
create mode 100644 coreutils-8.25-sum-ignore-missing.patch
diff --git a/coreutils-8.25-sum-ignore-missing.patch b/coreutils-8.25-sum-ignore-missing.patch
new file mode 100644
index 0000000..d27d176
--- /dev/null
+++ b/coreutils-8.25-sum-ignore-missing.patch
@@ -0,0 +1,115 @@
+From 1e1a69da31b39e4d672ccb8a3ca0e5400d4720ee Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?=
+Date: Wed, 26 Oct 2016 15:45:01 +0100
+Subject: [PATCH] md5sum,sha*sum: fix --ignore-missing with checksums starting
+ with 00
+
+* NEWS: Mention the fix.
+* src/md5sum.c (digest_file): Add a new MISSING parameter to
+return whether the file was missing, separately from the digest.
+* tests/misc/md5sum.pl: Add a test case.
+Fixes http://bugs.gnu.org/24795
+
+Upstream-commit: d0ddfadfb27def2861f35b1a45190a4c1780b257
+Signed-off-by: Kamil Dudka
+---
+ src/md5sum.c | 20 ++++++++++++--------
+ tests/misc/md5sum.pl | 7 +++++++
+ 2 files changed, 19 insertions(+), 8 deletions(-)
+
+diff --git a/src/md5sum.c b/src/md5sum.c
+index 933ec99..fee28c7 100644
+--- a/src/md5sum.c
++++ b/src/md5sum.c
+@@ -465,15 +465,19 @@ print_filename (char const *file, bool escape)
+ text because it was a terminal.
+
+ Put the checksum in *BIN_RESULT, which must be properly aligned.
++ Put true in *MISSING if the file can't be opened due to ENOENT.
+ Return true if successful. */
+
+ static bool
+-digest_file (const char *filename, int *binary, unsigned char *bin_result)
++digest_file (const char *filename, int *binary, unsigned char *bin_result,
++ bool *missing)
+ {
+ FILE *fp;
+ int err;
+ bool is_stdin = STREQ (filename, "-");
+
++ *missing = false;
++
+ if (is_stdin)
+ {
+ have_read_stdin = true;
+@@ -493,7 +497,7 @@ digest_file (const char *filename, int *binary, unsigned char *bin_result)
+ {
+ if (ignore_missing && errno == ENOENT)
+ {
+- *bin_result = '\0';
++ *missing = true;
+ return true;
+ }
+ error (0, errno, "%s", quotef (filename));
+@@ -606,14 +610,14 @@ digest_check (const char *checkfile_name)
+ '8', '9', 'a', 'b',
+ 'c', 'd', 'e', 'f' };
+ bool ok;
++ bool missing;
+ /* Only escape in the edge case producing multiple lines,
+ to ease automatic processing of status output. */
+ bool needs_escape = ! status_only && strchr (filename, '\n');
+
+ properly_formatted_lines = true;
+
+- *bin_buffer = '\1'; /* flag set to 0 for ignored missing files. */
+- ok = digest_file (filename, &binary, bin_buffer);
++ ok = digest_file (filename, &binary, bin_buffer, &missing);
+
+ if (!ok)
+ {
+@@ -626,10 +630,9 @@ digest_check (const char *checkfile_name)
+ printf (": %s\n", _("FAILED open or read"));
+ }
+ }
+- else if (ignore_missing && ! *bin_buffer)
++ else if (ignore_missing && missing)
+ {
+- /* Treat an empty buffer as meaning a missing file,
+- which is ignored with --ignore-missing. */
++ /* Ignore missing files with --ignore-missing. */
+ ;
+ }
+ else
+@@ -879,8 +882,9 @@ main (int argc, char **argv)
+ else
+ {
+ int file_is_binary = binary;
++ bool missing;
+
+- if (! digest_file (file, &file_is_binary, bin_buffer))
++ if (! digest_file (file, &file_is_binary, bin_buffer, &missing))
+ ok = false;
+ else
+ {
+diff --git a/tests/misc/md5sum.pl b/tests/misc/md5sum.pl
+index 2eb6369..6ea7457 100755
+--- a/tests/misc/md5sum.pl
++++ b/tests/misc/md5sum.pl
+@@ -149,6 +149,13 @@ my @Tests =
+ {ERR=>
+ "md5sum: f.md5: no file was verified\n"},
+ {EXIT=> 1}],
++ # coreutils-8.25 with --ignore-missing treated checksums starting with 00
++ # as if the file was not present
++ ['check-ignore-missing-6', '--check', '--ignore-missing',
++ {AUX=> {f=> '9t'}},
++ {IN=> {'f.md5' =>
++ "006999e6df389641adf1fa3a74801d9d f\n"}},
++ {OUT=>"f: OK\n"}],
+ ['bsd-segv', '--check', {IN=> {'z' => "MD5 ("}}, {EXIT=> 1},
+ {ERR=> "$prog: z: no properly formatted MD5 checksum lines found\n"}],
+
+--
+2.7.4
+
diff --git a/coreutils.spec b/coreutils.spec
index 88bab95..c5a835a 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 16%{?dist}
+Release: 17%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -23,6 +23,8 @@ Patch952: coreutils-8.25-intall-Z-selinux.patch
Patch953: coreutils-8.25-sort-thousands-sep.patch
# ls: allow interruption when reading slow directories (#1365933)
Patch954: coreutils-8.25-ls-signal.patch
+# md5sum,sha*sum: fix --ignore-missing with checksums starting with 00
+Patch955: coreutils-8.25-sum-ignore-missing.patch
# Our patches
#general patch to workaround koji build system issues
@@ -216,6 +218,7 @@ tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null
# upstream patches
%patch953 -p1
%patch954 -p1
+%patch955 -p1
chmod a+x \
tests/df/direct.sh \
@@ -345,6 +348,9 @@ fi
%license COPYING
%changelog
+* Mon Oct 31 2016 Kamil Dudka - 8.25-17
+- md5sum,sha*sum: fix --ignore-missing with checksums starting with 00
+
* Tue Oct 11 2016 Tomáš Mráz - 8.25-16
- rebuild with OpenSSL 1.1.0
From fd6749808310d640f4b5f9d4938e4dce3c1d93c3 Mon Sep 17 00:00:00 2001
From: Jakub Martisko
Date: Thu, 7 Jul 2016 12:53:26 +0200
Subject: [PATCH 028/232] (un)expand: UTF8-BOM header detection
---
coreutils-i18n-un-expand-BOM.patch | 443 +++++++++++++++++++++++++++++
coreutils.spec | 11 +-
2 files changed, 453 insertions(+), 1 deletion(-)
create mode 100644 coreutils-i18n-un-expand-BOM.patch
diff --git a/coreutils-i18n-un-expand-BOM.patch b/coreutils-i18n-un-expand-BOM.patch
new file mode 100644
index 0000000..44769c6
--- /dev/null
+++ b/coreutils-i18n-un-expand-BOM.patch
@@ -0,0 +1,443 @@
+diff -up ./src/expand-core.c.orig ./src/expand-core.c
+--- ./src/expand-core.c.orig 2016-06-28 14:44:18.281619000 +0200
++++ ./src/expand-core.c 2016-06-30 11:46:50.025109755 +0200
+@@ -18,6 +18,7 @@
+
+ #include
+ #include
++#include
+
+ #include "system.h"
+ #include "error.h"
+@@ -27,6 +28,119 @@
+
+ #include "expand-core.h"
+
++extern inline int
++set_utf_locale (void)
++{
++ /*try using some predefined locale */
++ const char* predef_locales[] = {"C.UTF8","en_US.UTF8","en_GB.UTF8"};
++
++ const int predef_locales_count=3;
++ for (int i=0;ibufcount=0;
++ if (c == 0xEF)
++ {
++ c=fgetc(fp);
++ }
++ else
++ {
++ if (c != EOF)
++ {
++ ungetc(c,fp);
++ }
++ return false;
++ }
++
++ if (c == 0xBB)
++ {
++ c=fgetc(fp);
++ }
++ else
++ {
++ if ( c!= EOF )
++ {
++ mbf->buf[0]=(unsigned char) 0xEF;
++ mbf->bufcount=1;
++ ungetc(c,fp);
++ return false;
++ }
++ else
++ {
++ ungetc(0xEF,fp);
++ return false;
++ }
++ }
++ if (c == 0xBF)
++ {
++ mbf->bufcount=0;
++ return true;
++ }
++ else
++ {
++ if (c != EOF)
++ {
++ mbf->buf[0]=(unsigned char) 0xEF;
++ mbf->buf[1]=(unsigned char) 0xBB;
++ mbf->bufcount=2;
++ ungetc(c,fp);
++ return false;
++ }
++ else
++ {
++ mbf->buf[0]=(unsigned char) 0xEF;
++ mbf->bufcount=1;
++ ungetc(0xBB,fp);
++ return false;
++ }
++ }
++ return false;
++}
++
++extern inline void
++print_bom(void)
++{
++ putc (0xEF, stdout);
++ putc (0xBB, stdout);
++ putc (0xBF, stdout);
++}
++
+ /* Add the comma or blank separated list of tab stops STOPS
+ to the list of tab stops. */
+
+diff -up ./src/expand-core.h.orig ./src/expand-core.h
+--- ./src/expand-core.h.orig 2016-06-28 14:44:18.281619000 +0200
++++ ./src/expand-core.h 2016-06-30 11:47:18.929437205 +0200
+@@ -15,7 +15,7 @@
+ along with this program. If not, see . */
+
+ #ifndef EXPAND_CORE_H_
+-# define EXPAND_CORE_H_
++#define EXPAND_CORE_H_
+
+ extern size_t first_free_tab;
+
+@@ -29,6 +29,18 @@ extern char **file_list;
+
+ extern bool have_read_stdin;
+
++inline int
++set_utf_locale (void);
++
++bool
++check_utf_locale(void);
++
++bool
++check_bom(FILE* fp, mb_file_t *mbf);
++
++inline void
++print_bom(void);
++
+ void
+ parse_tab_stops (char const *stops, void (*add_tab_stop)(uintmax_t));
+
+diff -up ./src/expand.c.orig ./src/expand.c
+--- ./src/expand.c.orig 2016-06-28 14:44:18.286619000 +0200
++++ ./src/expand.c 2016-06-30 11:50:15.077312947 +0200
+@@ -149,11 +149,33 @@ expand (void)
+ FILE *fp = next_file (NULL);
+ mb_file_t mbf;
+ mbf_char_t c;
+-
++ /* True if the starting locale is utf8. */
++ bool using_utf_locale;
++
++ /* True if the first file contains BOM header. */
++ bool found_bom;
++ using_utf_locale=check_utf_locale();
++
+ if (!fp)
+ return;
+-
+ mbf_init (mbf, fp);
++ found_bom=check_bom(fp,&mbf);
++
++ if (using_utf_locale == false && found_bom == true)
++ {
++ /*try using some predefined locale */
++
++ if (set_utf_locale () != 0)
++ {
++ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale"));
++ }
++ }
++
++
++ if (found_bom == true)
++ {
++ print_bom();
++ }
+
+ while (true)
+ {
+@@ -178,6 +200,27 @@ expand (void)
+ if ((mb_iseof (c)) && (fp = next_file (fp)))
+ {
+ mbf_init (mbf, fp);
++ if (fp!=NULL)
++ {
++ if (check_bom(fp,&mbf)==true)
++ {
++ /*Not the first file - check BOM header*/
++ if (using_utf_locale==false && found_bom==false)
++ {
++ /*BOM header in subsequent file but not in the first one. */
++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
++ }
++ }
++ else
++ {
++ if(using_utf_locale==false && found_bom==true)
++ {
++ /*First file conatined BOM header - locale was switched to UTF
++ /*all subsequent files should contain BOM. */
++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
++ }
++ }
++ }
+ continue;
+ }
+ else
+diff -up ./src/unexpand.c.orig ./src/unexpand.c
+--- ./src/unexpand.c.orig 2016-06-28 17:39:22.894259000 +0200
++++ ./src/unexpand.c 2016-07-07 09:48:07.659924755 +0200
+@@ -172,16 +172,36 @@ unexpand (void)
+ include characters other than spaces, so the blanks must be
+ stored, not merely counted. */
+ mbf_char_t *pending_blank;
++ /* True if the starting locale is utf8. */
++ bool using_utf_locale;
++
++ /* True if the first file contains BOM header. */
++ bool found_bom;
++ using_utf_locale=check_utf_locale();
+
+ if (!fp)
+ return;
++ mbf_init (mbf, fp);
++ found_bom=check_bom(fp,&mbf);
+
++ if (using_utf_locale == false && found_bom == true)
++ {
++ /*try using some predefined locale */
++
++ if (set_utf_locale () != 0)
++ {
++ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale"));
++ }
++ }
+ /* The worst case is a non-blank character, then one blank, then a
+ tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
+ allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
+ pending_blank = xmalloc (max_column_width * sizeof (mbf_char_t));
+
+- mbf_init (mbf, fp);
++ if (found_bom == true)
++ {
++ print_bom();
++ }
+
+ while (true)
+ {
+@@ -225,6 +245,27 @@ unexpand (void)
+ if ((mb_iseof (c)) && (fp = next_file (fp)))
+ {
+ mbf_init (mbf, fp);
++ if (fp!=NULL)
++ {
++ if (check_bom(fp,&mbf)==true)
++ {
++ /*Not the first file - check BOM header*/
++ if (using_utf_locale==false && found_bom==false)
++ {
++ /*BOM header in subsequent file but not in the first one. */
++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
++ }
++ }
++ else
++ {
++ if(using_utf_locale==false && found_bom==true)
++ {
++ /*First file conatined BOM header - locale was switched to UTF
++ /*all subsequent files should contain BOM. */
++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
++ }
++ }
++ }
+ continue;
+ }
+ else
+diff -up ./tests/expand/mb.sh.orig ./tests/expand/mb.sh
+--- ./tests/expand/mb.sh.orig 2016-06-28 14:44:18.287619000 +0200
++++ ./tests/expand/mb.sh 2016-06-30 11:57:10.038407216 +0200
+@@ -109,4 +109,75 @@ äbcdef\xFF |
+ expand < in > out || fail=1
+ compare exp out > /dev/null 2>&1 || fail=1
+
++
++
++#BOM header test 1
++printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++EOF
++env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_
++
++printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++
++expand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LANG=C expand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LC_ALL=C expand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++
++printf '\xEF\xBB\xBF' > in1; cat <<\EOF >> in1 || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++EOF
++env printf ' äöü\t. öüä. \tä xx\n' >> in1 || framework_failure_
++
++
++printf '\xEF\xBB\xBF' > exp; cat <<\EOF >> exp || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++expand in1 in1 > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LANG=C expand in1 in1 > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LC_ALL=C expand in1 in1 > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
+ exit $fail
+diff -up ./tests/unexpand/mb.sh.orig ./tests/unexpand/mb.sh
+--- ./tests/unexpand/mb.sh.orig 2016-06-28 17:39:22.895259000 +0200
++++ ./tests/unexpand/mb.sh 2016-07-07 09:55:00.098281917 +0200
+@@ -111,3 +111,62 @@ äbcdef\xFF\t|
+
+ unexpand -a < in > out || fail=1
+ compare exp out > /dev/null 2>&1 || fail=1
++
++#BOM header test 1
++printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_
++
++printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++unexpand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LANG=C unexpand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LC_ALL=C unexpand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++
++printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++
++unexpand in in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LANG=C unexpand in in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++LC_ALL=C unexpand in in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
diff --git a/coreutils.spec b/coreutils.spec
index b189e36..bc8ca89 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 6%{?dist}
+Release: 7%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -51,6 +51,8 @@ Patch804: coreutils-i18n-cut-old.patch
Patch803: coreutils-i18n-fix-unexpand.patch
#(un)expand - allow multiple files on input - broken by patch 801
Patch805: coreutils-i18n-fix2-expand-unexpand.patch
+#(un)expand - test BOM headers
+Patch806: coreutils-i18n-un-expand-BOM.patch
#getgrouplist() patch from Ulrich Drepper.
Patch908: coreutils-getgrouplist.patch
@@ -184,6 +186,7 @@ including documentation and translations.
%patch803 -p1 -b .i18n-fix-expand
%patch804 -p1 -b .i18n-cutold
%patch805 -p1 -b .i18n-fix2-expand-unexpand
+%patch806 -p1 -b .i18n-BOM-expand-unexpand
# Coreutils
%patch908 -p1 -b .getgrouplist
@@ -355,6 +358,12 @@ fi
%license COPYING
%changelog
+* Mon Oct 31 2016 Kamil Dudka - 8.25-7
+- switch to UTF8 locale when (un)expand input contains BOM header
+ (#1158494)
+- fixed regression where (un)expand would end with "long input line"
+ error when BOM header is present
+
* Tue Jul 12 2016 Jakub Martisko - 8.25-6
- (un)expand fix a regression in handling of input files, where only
the first file was procesed.
From f90bb3d8a46fcbb8fcd166a5a98f4428071e01d0 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 11 Jul 2016 17:27:02 +0200
Subject: [PATCH 029/232] Resolves: #1339135 - install -Z now sets default
SELinux context for created directories
---
coreutils-8.25-intall-Z-selinux.patch | 188 ++++++++++++++++++++++++++
coreutils.spec | 9 +-
2 files changed, 196 insertions(+), 1 deletion(-)
create mode 100644 coreutils-8.25-intall-Z-selinux.patch
diff --git a/coreutils-8.25-intall-Z-selinux.patch b/coreutils-8.25-intall-Z-selinux.patch
new file mode 100644
index 0000000..0f5ef33
--- /dev/null
+++ b/coreutils-8.25-intall-Z-selinux.patch
@@ -0,0 +1,188 @@
+From c424bbcb532c5b9924349e3522b3b431eaa7c178 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Fri, 8 Jul 2016 18:59:35 +0200
+Subject: [PATCH] install: with -Z, set default SELinux context for created
+ directories
+
+* doc/coreutils.texi (install invocation): Update -Z documentation.
+* src/install.c (make_ancestor): Set default security context before
+calling mkdir() if the -Z option is given.
+(process_dir): Call restorecon() on the destination directory if the
+-Z option is given.
+(usage): Update -Z documentation.
+* tests/install/install-Z-selinux.sh: A new test for 'install -Z -D'
+and 'install -Z -d' based on tests/mkdir/restorecon.sh.
+* tests/local.mk: Reference the test.
+* NEWS: Mention the improvement.
+Reported at https://bugzilla.redhat.com/1339135
+Fixes http://bugs.gnu.org/23868
+
+Upstream-commit: 502518b44039138d148e2e15157d125c82d02af0
+Signed-off-by: Kamil Dudka
+---
+ doc/coreutils.texi | 2 +-
+ src/install.c | 33 ++++++++++++++++++----
+ tests/install/install-Z-selinux.sh | 58 ++++++++++++++++++++++++++++++++++++++
+ tests/local.mk | 1 +
+ 4 files changed, 88 insertions(+), 6 deletions(-)
+ create mode 100644 tests/install/install-Z-selinux.sh
+
+diff --git a/doc/coreutils.texi b/doc/coreutils.texi
+index 092192c..1543f27 100644
+--- a/doc/coreutils.texi
++++ b/doc/coreutils.texi
+@@ -9208,7 +9208,7 @@ Print the name of each file before moving it.
+ @cindex security context
+ This option functions similarly to the @command{restorecon} command,
+ by adjusting the SELinux security context according
+-to the system default type for destination files.
++to the system default type for destination files and each created directory.
+
+ @end table
+
+diff --git a/src/install.c b/src/install.c
+index 089f298..1b7a209 100644
+--- a/src/install.c
++++ b/src/install.c
+@@ -39,6 +39,7 @@
+ #include "prog-fprintf.h"
+ #include "quote.h"
+ #include "savewd.h"
++#include "selinux.h"
+ #include "stat-time.h"
+ #include "utimens.h"
+ #include "xstrtol.h"
+@@ -423,6 +424,12 @@ announce_mkdir (char const *dir, void *options)
+ static int
+ make_ancestor (char const *dir, char const *component, void *options)
+ {
++ struct cp_options const *x = options;
++ if (x->set_security_context && defaultcon (dir, S_IFDIR) < 0
++ && ! ignorable_ctx_err (errno))
++ error (0, errno, _("failed to set default creation context for %s"),
++ quoteaf (dir));
++
+ int r = mkdir (component, DEFAULT_MODE);
+ if (r == 0)
+ announce_mkdir (dir, options);
+@@ -433,12 +440,28 @@ make_ancestor (char const *dir, char const *component, void *options)
+ static int
+ process_dir (char *dir, struct savewd *wd, void *options)
+ {
+- return (make_dir_parents (dir, wd,
+- make_ancestor, options,
+- dir_mode, announce_mkdir,
+- dir_mode_bits, owner_id, group_id, false)
++ struct cp_options const *x = options;
++
++ int ret = (make_dir_parents (dir, wd, make_ancestor, options,
++ dir_mode, announce_mkdir,
++ dir_mode_bits, owner_id, group_id, false)
+ ? EXIT_SUCCESS
+ : EXIT_FAILURE);
++
++ /* FIXME: Due to the current structure of make_dir_parents()
++ we don't have the facility to call defaultcon() before the
++ final component of DIR is created. So for now, create the
++ final component with the context from previous component
++ and here we set the context for the final component. */
++ if (ret == EXIT_SUCCESS && x->set_security_context)
++ {
++ if (! restorecon (last_component (dir), false, false)
++ && ! ignorable_ctx_err (errno))
++ error (0, errno, _("failed to restore context for %s"),
++ quoteaf (dir));
++ }
++
++ return ret;
+ }
+
+ /* Copy file FROM onto file TO, creating TO if necessary.
+@@ -651,7 +674,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\
+ fputs (_("\
+ -P, --preserve-context preserve SELinux security context (-P deprecated)\n\
+ -Z set SELinux security context of destination\n\
+- file to default type\n\
++ file and each created directory to default type\n\
+ --context[=CTX] like -Z, or if CTX is specified then set the\n\
+ SELinux or SMACK security context to CTX\n\
+ "), stdout);
+diff --git a/tests/install/install-Z-selinux.sh b/tests/install/install-Z-selinux.sh
+new file mode 100644
+index 0000000..9c3b642
+--- /dev/null
++++ b/tests/install/install-Z-selinux.sh
+@@ -0,0 +1,58 @@
++#!/bin/sh
++# test 'install -Z -D' and 'install -Z -d'
++# based on tests/mkdir/restorecon.sh
++
++# Copyright (C) 2013-2016 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 .
++
++. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++print_ver_ ginstall
++require_selinux_
++
++
++get_selinux_type() { ls -Zd "$1" | sed -n 's/.*:\(.*_t\):.*/\1/p'; }
++
++mkdir subdir || framework_failure_
++chcon 'root:object_r:tmp_t:s0' subdir || framework_failure_
++cd subdir
++
++# Since in a tmp_t dir, dirs can be created as user_tmp_t ...
++touch standard || framework_failure_
++mkdir restored || framework_failure_
++if restorecon restored 2>/dev/null; then
++ # ... but when restored can be set to user_home_t
++ # So ensure the type for these mkdir -Z cases matches
++ # the directory type as set by restorecon.
++ ginstall -Z standard single || fail=1
++ ginstall -Z -d single_d || fail=1
++ # Run these as separate processes in case global context
++ # set for an arg, impacts on another arg
++ # TODO: Have the defaultcon() vary over these directories
++ for dst in single_d/existing/file multi/ple/file; do
++ ginstall -Z -D standard "$dst" || fail=1
++ done
++ restored_type=$(get_selinux_type 'restored')
++ test "$(get_selinux_type 'single')" = "$restored_type" || fail=1
++ test "$(get_selinux_type 'single_d')" = "$restored_type" || fail=1
++ test "$(get_selinux_type 'single_d/existing')" = "$restored_type" || fail=1
++ test "$(get_selinux_type 'multi')" = "$restored_type" || fail=1
++ test "$(get_selinux_type 'multi/ple')" = "$restored_type" || fail=1
++fi
++if test "$fail" = '1'; then
++ ls -UZd standard restored
++ ls -UZd single single_d single_d/existing multi multi/ple
++fi
++
++Exit $fail
+diff --git a/tests/local.mk b/tests/local.mk
+index ec23448..42d39f2 100644
+--- a/tests/local.mk
++++ b/tests/local.mk
+@@ -548,6 +548,7 @@ all_tests = \
+ tests/install/d-slashdot.sh \
+ tests/install/install-C.sh \
+ tests/install/install-C-selinux.sh \
++ tests/install/install-Z-selinux.sh \
+ tests/install/strip-program.sh \
+ tests/install/trap.sh \
+ tests/ln/backup-1.sh \
+--
+2.5.5
+
diff --git a/coreutils.spec b/coreutils.spec
index bc8ca89..425ab97 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -21,6 +21,7 @@ Source10: coreutils-find-requires.sh
%global __find_requires %{SOURCE10} %{_rpmconfigdir}/find-requires
# From upstream
+Patch952: coreutils-8.25-intall-Z-selinux.patch
# Our patches
#general patch to workaround koji build system issues
@@ -196,8 +197,13 @@ including documentation and translations.
#SELinux
%patch950 -p1 -b .selinux
%patch951 -p1 -b .selinuxman
+%patch952 -p1
-chmod a+x tests/misc/sort-mb-tests.sh tests/df/direct.sh || :
+chmod a+x \
+ tests/df/direct.sh \
+ tests/install/install-Z-selinux.sh \
+ tests/misc/sort-mb-tests.sh \
+ || :
#fix typos/mistakes in localized documentation(#439410, #440056)
find ./po/ -name "*.p*" | xargs \
@@ -359,6 +365,7 @@ fi
%changelog
* Mon Oct 31 2016 Kamil Dudka - 8.25-7
+- install -Z now sets default SELinux context for created directories (#1339135)
- switch to UTF8 locale when (un)expand input contains BOM header
(#1158494)
- fixed regression where (un)expand would end with "long input line"
From fdd7dd0f39e067cf8e933da1d681f0e3768f943f Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Thu, 14 Jul 2016 16:29:59 +0200
Subject: [PATCH 030/232] fix patches such that they apply without offset
---
coreutils-4.5.3-langinfo.patch | 2 +-
coreutils-6.10-configuration.patch | 22 +--
coreutils-6.10-manpages.patch | 2 +-
coreutils-8.2-uname-processortype.patch | 7 +-
coreutils-8.4-mkdir-modenote.patch | 2 +-
coreutils-df-direct.patch | 14 +-
coreutils-getgrouplist.patch | 8 +-
coreutils-i18n-cut-old.patch | 2 +-
coreutils-i18n-cut.patch | 42 +++---
coreutils-i18n-expand-unexpand.patch | 102 ++++++++------
coreutils-i18n.patch | 176 ++++++++++++------------
coreutils-overflow.patch | 2 +-
coreutils-selinux.patch | 16 +--
coreutils-selinuxmanpages.patch | 2 +-
sh-utils-2.0.11-dateman.patch | 2 +-
15 files changed, 207 insertions(+), 194 deletions(-)
diff --git a/coreutils-4.5.3-langinfo.patch b/coreutils-4.5.3-langinfo.patch
index 25dec6c..48e0624 100644
--- a/coreutils-4.5.3-langinfo.patch
+++ b/coreutils-4.5.3-langinfo.patch
@@ -1,6 +1,6 @@
--- coreutils-5.92/src/date.c.langinfo 2005-09-16 09:06:57.000000000 +0100
+++ coreutils-5.92/src/date.c 2005-10-24 18:09:16.000000000 +0100
-@@ -451,14 +451,7 @@
+@@ -474,14 +474,7 @@ main (int argc, char **argv)
format = DATE_FMT_LANGINFO ();
if (! *format)
{
diff --git a/coreutils-6.10-configuration.patch b/coreutils-6.10-configuration.patch
index 4c68077..7468ba2 100644
--- a/coreutils-6.10-configuration.patch
+++ b/coreutils-6.10-configuration.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-tests/gnulib.mk
--- coreutils-8.21-orig/gnulib-tests/gnulib.mk 2013-02-07 17:58:44.000000000 +0100
+++ coreutils-8.21/gnulib-tests/gnulib.mk 2013-02-15 10:12:28.110593165 +0100
-@@ -267,9 +267,9 @@ EXTRA_DIST += nap.h test-chown.h test-ch
+@@ -279,9 +279,9 @@ EXTRA_DIST += nap.h test-chown.h test-chown.c signature.h macros.h
## begin gnulib module cloexec-tests
@@ -14,7 +14,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module cloexec-tests
-@@ -378,9 +378,9 @@ EXTRA_DIST += test-dup.c signature.h mac
+@@ -392,9 +392,9 @@ EXTRA_DIST += test-dup.c signature.h macros.h
## begin gnulib module dup2-tests
@@ -27,7 +27,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module dup2-tests
-@@ -439,10 +439,10 @@ EXTRA_DIST += test-fadvise.c
+@@ -453,10 +453,10 @@ EXTRA_DIST += test-fadvise.c
## begin gnulib module fchdir-tests
@@ -42,7 +42,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module fchdir-tests
-@@ -874,9 +874,9 @@ EXTRA_DIST += test-getloadavg.c signatur
+@@ -900,9 +900,9 @@ EXTRA_DIST += test-getloadavg.c signature.h
## begin gnulib module getlogin-tests
@@ -55,7 +55,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module getlogin-tests
-@@ -1119,10 +1119,10 @@ EXTRA_DIST += test-link.h test-link.c si
+@@ -1147,10 +1147,10 @@ EXTRA_DIST += test-link.h test-link.c signature.h macros.h
## begin gnulib module linkat-tests
@@ -70,7 +70,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module linkat-tests
-@@ -1331,9 +1331,9 @@ EXTRA_DIST += test-memcoll.c macros.h
+@@ -1359,9 +1359,9 @@ EXTRA_DIST += test-memcoll.c macros.h
## begin gnulib module memrchr-tests
@@ -83,7 +83,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module memrchr-tests
-@@ -1978,9 +1978,9 @@ EXTRA_DIST += test-statat.c
+@@ -1912,9 +1912,9 @@ EXTRA_DIST += test-statat.c
## begin gnulib module stdalign-tests
@@ -96,7 +96,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module stdalign-tests
-@@ -2323,9 +2323,9 @@ EXTRA_DIST += test-uname.c signature.h m
+@@ -2269,9 +2269,9 @@ EXTRA_DIST += test-uname.c signature.h macros.h
## begin gnulib module unistd-safer-tests
@@ -109,7 +109,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module unistd-safer-tests
-@@ -2438,10 +2438,10 @@ EXTRA_DIST += test-usleep.c signature.h
+@@ -2367,10 +2367,10 @@ EXTRA_DIST += test-userspec.c
## begin gnulib module utimens-tests
@@ -127,7 +127,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk
--- coreutils-8.21-orig/tests/local.mk 2013-02-11 11:30:12.000000000 +0100
+++ coreutils-8.21/tests/local.mk 2013-02-15 10:10:55.890532258 +0100
-@@ -131,6 +131,7 @@ all_root_tests = \
+@@ -134,6 +134,7 @@ all_root_tests = \
tests/rm/no-give-up.sh \
tests/rm/one-file-system.sh \
tests/rm/read-only.sh \
@@ -135,7 +135,7 @@ diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk
tests/tail-2/append-only.sh \
tests/touch/now-owned-by-other.sh
-@@ -163,7 +164,6 @@ all_tests = \
+@@ -168,7 +169,6 @@ all_tests = \
tests/cp/link-heap.sh \
tests/cp/no-ctx.sh \
tests/misc/tty-eof.pl \
diff --git a/coreutils-6.10-manpages.patch b/coreutils-6.10-manpages.patch
index 8d5bc94..c795ca5 100644
--- a/coreutils-6.10-manpages.patch
+++ b/coreutils-6.10-manpages.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-6.12-orig/src/md5sum.c coreutils-6.12/src/md5sum.c
--- coreutils-6.12-orig/src/md5sum.c 2008-05-26 08:40:33.000000000 +0200
+++ coreutils-6.12/src/md5sum.c 2008-10-21 16:07:28.000000000 +0200
-@@ -175,6 +175,9 @@ With no FILE, or when FILE is -, read st
+@@ -200,6 +200,9 @@ Print or check %s (%d-bit) checksums.\n\
fputs (_("\
-t, --text read in text mode (default)\n\
"), stdout);
diff --git a/coreutils-8.2-uname-processortype.patch b/coreutils-8.2-uname-processortype.patch
index 4c83df8..0cb2422 100644
--- a/coreutils-8.2-uname-processortype.patch
+++ b/coreutils-8.2-uname-processortype.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
--- coreutils-8.2-orig/src/uname.c 2009-09-23 10:25:44.000000000 +0200
+++ coreutils-8.2/src/uname.c 2009-12-19 09:09:11.663607110 +0100
-@@ -301,7 +301,7 @@ main (int argc, char **argv)
+@@ -299,13 +299,19 @@ main (int argc, char **argv)
if (toprint & PRINT_PROCESSOR)
{
@@ -10,7 +10,6 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
#if HAVE_SYSINFO && defined SI_ARCHITECTURE
{
static char processor[257];
-@@ -308,6 +308,12 @@ main (int argc, char **argv)
if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
element = processor;
}
@@ -23,7 +22,7 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
#endif
#ifdef UNAME_PROCESSOR
if (element == unknown)
-@@ -351,7 +357,7 @@ main (int argc, char **argv)
+@@ -343,7 +349,7 @@ main (int argc, char **argv)
if (toprint & PRINT_HARDWARE_PLATFORM)
{
@@ -32,7 +31,7 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
#if HAVE_SYSINFO && defined SI_PLATFORM
{
static char hardware_platform[257];
-@@ -353,6 +359,14 @@ main (int argc, char **argv)
+@@ -351,6 +357,14 @@ main (int argc, char **argv)
hardware_platform, sizeof hardware_platform))
element = hardware_platform;
}
diff --git a/coreutils-8.4-mkdir-modenote.patch b/coreutils-8.4-mkdir-modenote.patch
index 3576ec6..1f03c8d 100644
--- a/coreutils-8.4-mkdir-modenote.patch
+++ b/coreutils-8.4-mkdir-modenote.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-8.4-orig/doc/coreutils.texi coreutils-8.4/doc/coreutils.texi
--- coreutils-8.4-orig/doc/coreutils.texi 2011-01-07 15:01:18.575654333 +0100
+++ coreutils-8.4/doc/coreutils.texi 2011-01-07 15:05:38.791655243 +0100
-@@ -9058,6 +9058,8 @@ incorrect. @xref{Directory Setuid and S
+@@ -9993,6 +9993,8 @@ incorrect. @xref{Directory Setuid and Setgid}, for how the
set-user-ID and set-group-ID bits of directories are inherited unless
overridden in this way.
diff --git a/coreutils-df-direct.patch b/coreutils-df-direct.patch
index 361b813..e69cd2b 100644
--- a/coreutils-df-direct.patch
+++ b/coreutils-df-direct.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-8.21-orig/doc/coreutils.texi coreutils-8.21/doc/coreutils.texi
--- coreutils-8.21-orig/doc/coreutils.texi 2013-02-11 10:37:28.000000000 +0100
+++ coreutils-8.21/doc/coreutils.texi 2013-02-15 10:15:26.497593689 +0100
-@@ -10961,6 +10961,13 @@
+@@ -11221,6 +11221,13 @@ some systems (notably SunOS), doing this yields more up to date results,
but in general this option makes @command{df} much slower, especially when
there are many or very busy file systems.
@@ -28,7 +28,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
/* Grand total data. */
static struct fs_usage grand_fsu;
-@@ -238,13 +241,15 @@ enum
+@@ -243,13 +246,15 @@ enum
NO_SYNC_OPTION = CHAR_MAX + 1,
SYNC_OPTION,
TOTAL_OPTION,
@@ -45,7 +45,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
{"inodes", no_argument, NULL, 'i'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, NULL, 'H'},
-@@ -500,7 +505,10 @@ get_header (void)
+@@ -505,7 +510,10 @@ get_header (void)
for (col = 0; col < ncolumns; col++)
{
char *cell = NULL;
@@ -57,7 +57,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
if (columns[col]->field == SIZE_FIELD
&& (header_mode == DEFAULT_MODE
-@@ -1150,6 +1158,19 @@ get_point (const char *point, const stru
+@@ -1352,6 +1360,19 @@ get_point (const char *point, const struct stat *statp)
static void
get_entry (char const *name, struct stat const *statp)
{
@@ -77,7 +77,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
&& get_disk (name))
return;
-@@ -1219,6 +1238,7 @@ or all file systems by default.\n\
+@@ -1422,6 +1443,7 @@ or all file systems by default.\n\
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\
'-BM' prints sizes in units of 1,048,576 bytes;\n\
see SIZE format below\n\
@@ -85,7 +85,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\
-H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\
"), stdout);
-@@ -1305,6 +1325,9 @@ main (int argc, char **argv)
+@@ -1512,6 +1534,9 @@ main (int argc, char **argv)
xstrtol_fatal (e, oi, c, long_options, optarg);
}
break;
@@ -95,7 +95,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
case 'i':
if (header_mode == OUTPUT_MODE)
{
-@@ -1408,6 +1431,13 @@ main (int argc, char **argv)
+@@ -1608,6 +1633,13 @@ main (int argc, char **argv)
}
}
diff --git a/coreutils-getgrouplist.patch b/coreutils-getgrouplist.patch
index 86bbcef..7defd19 100644
--- a/coreutils-getgrouplist.patch
+++ b/coreutils-getgrouplist.patch
@@ -12,7 +12,7 @@ index 299bae6..8ece29b 100644
#include "getugroups.h"
#include
-@@ -123,3 +126,4 @@ getugroups (int maxcount, gid_t *grouplist, char const *username,
+@@ -126,3 +129,4 @@ getugroups (int maxcount, gid_t *grouplist, char const *username,
}
#endif /* HAVE_GRP_H */
@@ -21,7 +21,7 @@ diff --git a/lib/mgetgroups.c b/lib/mgetgroups.c
index 76474c2..0a9d221 100644
--- a/lib/mgetgroups.c
+++ b/lib/mgetgroups.c
-@@ -115,9 +115,17 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
+@@ -121,9 +121,17 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
/* else no username, so fall through and use getgroups. */
#endif
@@ -42,7 +42,7 @@ index 76474c2..0a9d221 100644
/* If we failed to count groups because there is no supplemental
group support, then return an array containing just GID.
-@@ -139,10 +147,25 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
+@@ -145,10 +153,25 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
if (g == NULL)
return -1;
@@ -76,7 +76,7 @@ diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4
index 62777c7..5180243 100644
--- a/m4/jm-macros.m4
+++ b/m4/jm-macros.m4
-@@ -78,6 +78,7 @@
+@@ -82,6 +82,7 @@ AC_DEFUN([coreutils_MACROS],
fchown
fchmod
ftruncate
diff --git a/coreutils-i18n-cut-old.patch b/coreutils-i18n-cut-old.patch
index 29c69fc..008cecb 100644
--- a/coreutils-i18n-cut-old.patch
+++ b/coreutils-i18n-cut-old.patch
@@ -132,7 +132,7 @@ diff -urNp coreutils-8.25-orig/src/cut.c coreutils-8.25/src/cut.c
/* The delimiter for each line/record. */
static unsigned char line_delim = '\n';
-@@ -164,7 +243,7 @@ Print selected parts of lines from each
+@@ -164,7 +243,7 @@ Print selected parts of lines from each FILE to standard output.\n\
-f, --fields=LIST select only these fields; also print any line\n\
that contains no delimiter character, unless\n\
the -s option is specified\n\
diff --git a/coreutils-i18n-cut.patch b/coreutils-i18n-cut.patch
index ec85cf0..f680df6 100644
--- a/coreutils-i18n-cut.patch
+++ b/coreutils-i18n-cut.patch
@@ -12,7 +12,7 @@
#include "system.h"
#include "error.h"
-@@ -90,25 +95,16 @@ add_range_pair (size_t lo, size_t hi)
+@@ -61,25 +66,16 @@
CURRENT_RP.HI then we make CURRENT_RP to point to the next range pair. */
static struct field_range_pair *current_rp;
@@ -42,7 +42,7 @@
/* Output the given delimiter-separated fields. */
field_mode
};
-@@ -120,12 +116,16 @@ static enum operating_mode operating_mod
+@@ -91,12 +87,16 @@ static enum operating_mode operating_mode;
with field mode. */
static bool suppress_non_delimited;
@@ -60,7 +60,7 @@
/* The delimiter for each line/record. */
static unsigned char line_delim = '\n';
-@@ -135,7 +135,7 @@ static size_t output_delimiter_length;
+@@ -109,7 +109,7 @@ static size_t output_delimiter_length;
/* The output field separator string. Defaults to the 1-character
string consisting of the input delimiter. */
@@ -69,7 +69,7 @@
/* True if we have ever read standard input. */
static bool have_read_stdin;
-@@ -189,7 +189,7 @@ Print selected parts of lines from each
+@@ -164,7 +164,7 @@ Print selected parts of lines from each FILE to standard output.\n\
-f, --fields=LIST select only these fields; also print any line\n\
that contains no delimiter character, unless\n\
the -s option is specified\n\
@@ -78,7 +78,7 @@
"), stdout);
fputs (_("\
--complement complement the set of selected bytes, characters\n\
-@@ -435,6 +435,12 @@ next_item (size_t *item_idx)
+@@ -211,6 +211,12 @@ next_item (size_t *item_idx)
current_rp++;
}
@@ -91,7 +91,7 @@
/* Return nonzero if the K'th field or byte is printable. */
static inline bool
-@@ -443,6 +449,15 @@ print_kth (size_t k)
+@@ -219,6 +225,15 @@ print_kth (size_t k)
return current_rp->lo <= k;
}
@@ -107,7 +107,7 @@
/* Return nonzero if K'th byte is the beginning of a range. */
static inline bool
-@@ -505,23 +520,215 @@ cut_bytes (FILE *stream)
+@@ -281,23 +296,215 @@ cut_bytes (FILE *stream)
}
/* Read from stream STREAM, printing to standard output any selected fields. */
@@ -328,7 +328,7 @@
/* To support the semantics of the -s flag, we may have to buffer
all of the first field to determine whether it is 'delimited.'
-@@ -536,10 +744,14 @@ cut_fields (FILE *stream)
+@@ -312,10 +519,14 @@ cut_fields (FILE *stream)
if (field_idx == 1 && buffer_first_field)
{
ssize_t len;
@@ -346,7 +346,7 @@
if (len < 0)
{
free (field_1_buffer);
-@@ -549,15 +761,15 @@ cut_fields (FILE *stream)
+@@ -325,15 +536,15 @@ cut_fields (FILE *stream)
xalloc_die ();
}
@@ -366,7 +366,7 @@
{
if (suppress_non_delimited)
{
-@@ -565,26 +777,30 @@ cut_fields (FILE *stream)
+@@ -341,26 +552,30 @@ cut_fields (FILE *stream)
}
else
{
@@ -405,7 +405,7 @@
found_any_selected_field = true;
}
}
-@@ -594,7 +810,8 @@ cut_fields (FILE *stream)
+@@ -370,7 +585,8 @@ cut_fields (FILE *stream)
next_item (&field_idx);
}
@@ -415,7 +415,7 @@
if (print_kth (field_idx))
{
-@@ -605,42 +822,46 @@ cut_fields (FILE *stream)
+@@ -381,42 +597,46 @@ cut_fields (FILE *stream)
}
found_any_selected_field = true;
@@ -477,7 +477,7 @@
break;
field_idx = 1;
current_rp = frp;
-@@ -652,7 +874,14 @@ static void
+@@ -429,7 +649,14 @@ static void
cut_stream (FILE *stream)
{
if (operating_mode == byte_mode)
@@ -493,7 +493,7 @@
else
cut_fields (stream);
}
-@@ -706,6 +935,7 @@ main (int argc, char **argv)
+@@ -483,6 +710,7 @@ main (int argc, char **argv)
bool ok;
bool delim_specified = false;
char *spec_list_string IF_LINT ( = NULL);
@@ -501,7 +501,7 @@
initialize_main (&argc, &argv);
set_program_name (argv[0]);
-@@ -719,8 +949,10 @@ main (int argc, char **argv)
+@@ -496,8 +724,10 @@ main (int argc, char **argv)
/* By default, all non-delimited lines are printed. */
suppress_non_delimited = false;
@@ -513,7 +513,7 @@
have_read_stdin = false;
while ((optc = getopt_long (argc, argv, "b:c:d:f:nsz", longopts, NULL)) != -1)
-@@ -728,7 +960,6 @@ main (int argc, char **argv)
+@@ -505,7 +735,6 @@ main (int argc, char **argv)
switch (optc)
{
case 'b':
@@ -521,7 +521,7 @@
/* Build the byte list. */
if (operating_mode != undefined_mode)
FATAL_ERROR (_("only one type of list may be specified"));
-@@ -736,6 +967,14 @@ main (int argc, char **argv)
+@@ -513,6 +742,14 @@ main (int argc, char **argv)
spec_list_string = optarg;
break;
@@ -536,7 +536,7 @@
case 'f':
/* Build the field list. */
if (operating_mode != undefined_mode)
-@@ -747,9 +986,17 @@ main (int argc, char **argv)
+@@ -524,9 +761,17 @@ main (int argc, char **argv)
case 'd':
/* New delimiter. */
/* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */
@@ -551,12 +551,12 @@
+ mbi_advance (iter);
+ if (mbi_avail (iter))
FATAL_ERROR (_("the delimiter must be a single character"));
-+ }
- delim = optarg[0];
++ }
delim_specified = true;
break;
-@@ -763,6 +1008,7 @@ main (int argc, char **argv)
+@@ -540,6 +785,7 @@ main (int argc, char **argv)
break;
case 'n':
@@ -564,7 +564,7 @@
break;
case 's':
-@@ -802,15 +1048,12 @@ main (int argc, char **argv)
+@@ -579,15 +825,12 @@ main (int argc, char **argv)
| (complement ? SETFLD_COMPLEMENT : 0) );
if (!delim_specified)
diff --git a/coreutils-i18n-expand-unexpand.patch b/coreutils-i18n-expand-unexpand.patch
index d8a5968..d23e0f0 100644
--- a/coreutils-i18n-expand-unexpand.patch
+++ b/coreutils-i18n-expand-unexpand.patch
@@ -23,19 +23,24 @@ properly.
Co-authored-by: Pádraig Brady
---
- NEWS | 3 +
bootstrap.conf | 1 +
configure.ac | 2 +
+ lib/mbfile.c | 3 +
+ lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ m4/mbfile.m4 | 14 +++
po/POTFILES.in | 1 +
- src/expand-core.c | 150 +++++++++++++++++++++++++++++++++++++++
- src/expand-core.h | 44 ++++++++++++
- src/expand.c | 183 ++++++++++-------------------------------------
+ src/expand-core.c | 150 ++++++++++++++++++++++++++++++
+ src/expand-core.h | 41 +++++++++
+ src/expand.c | 186 ++++++++-----------------------------
src/local.mk | 2 +
- src/unexpand.c | 197 ++++++++++++---------------------------------------
- tests/expand/mb.sh | 98 +++++++++++++++++++++++++
+ src/unexpand.c | 195 ++++++++++-----------------------------
+ tests/expand/mb.sh | 98 ++++++++++++++++++++
tests/local.mk | 2 +
- tests/unexpand/mb.sh | 97 +++++++++++++++++++++++++
- 12 files changed, 482 insertions(+), 298 deletions(-)
+ tests/unexpand/mb.sh | 97 ++++++++++++++++++++
+ 14 files changed, 750 insertions(+), 297 deletions(-)
+ create mode 100644 lib/mbfile.c
+ create mode 100644 lib/mbfile.h
+ create mode 100644 m4/mbfile.m4
create mode 100644 src/expand-core.c
create mode 100644 src/expand-core.h
create mode 100755 tests/expand/mb.sh
@@ -45,7 +50,7 @@ diff --git a/bootstrap.conf b/bootstrap.conf
index ef1c078..ea8cebc 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
-@@ -152,6 +152,7 @@ gnulib_modules="
+@@ -151,6 +151,7 @@ gnulib_modules="
maintainer-makefile
malloc-gnu
manywarnings
@@ -57,7 +62,7 @@ diff --git a/configure.ac b/configure.ac
index 8dc2192..b8b5114 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -422,6 +422,8 @@ gl_WINSIZE_IN_PTEM
+@@ -425,6 +425,8 @@ fi
# I'm leaving it here for now. This whole thing needs to be modernized...
gl_WINSIZE_IN_PTEM
@@ -338,12 +343,10 @@ index 0a40a1a..ed97fd4 100644
static char const shortopts[] = "it:0::1::2::3::4::5::6::7::8::9::";
-@@ -125,128 +129,6 @@
- if (first_free_tab == n_tabs_allocated)
- tab_list = X2NREALLOC (tab_list, &n_tabs_allocated);
+@@ -135,128 +139,6 @@ add_tab_stop (uintmax_t tabval)
tab_list[first_free_tab++] = tabval;
--}
--
+ }
+
-/* Add the comma or blank separated list of tab stops STOPS
- to the list of tab stops. */
-
@@ -464,10 +467,12 @@ index 0a40a1a..ed97fd4 100644
- exit_status = EXIT_FAILURE;
- }
- return NULL;
- }
-
+-}
+-
/* Change tabs to spaces, writing to stdout.
-@@ -265,19 +146,19 @@ expand (void)
+ Read each file in 'file_list', in order. */
+
+@@ -265,19 +147,19 @@ expand (void)
{
/* Input stream. */
FILE *fp = next_file (NULL);
@@ -491,7 +496,7 @@ index 0a40a1a..ed97fd4 100644
/* The following variables have valid values only when CONVERT
is true: */
-@@ -287,17 +168,23 @@ expand (void)
+@@ -287,17 +169,23 @@ expand (void)
/* Index in TAB_LIST of next tab stop to examine. */
size_t tab_index = 0;
@@ -519,7 +524,7 @@ index 0a40a1a..ed97fd4 100644
{
/* Column the next input tab stop is on. */
uintmax_t next_tab_column;
-@@ -328,32 +215,34 @@ expand (void)
+@@ -328,32 +216,34 @@ expand (void)
if (putchar (' ') < 0)
error (EXIT_FAILURE, errno, _("write error"));
@@ -562,7 +567,7 @@ index 0a40a1a..ed97fd4 100644
}
}
-@@ -385,19 +274,19 @@ main (int argc, char **argv)
+@@ -385,19 +275,19 @@ main (int argc, char **argv)
break;
case 't':
@@ -589,7 +594,7 @@ diff --git a/src/local.mk b/src/local.mk
index 536b7cc..bfede88 100644
--- a/src/local.mk
+++ b/src/local.mk
-@@ -362,6 +362,8 @@ src_coreutils_SOURCES = src/coreutils.c
+@@ -361,6 +361,8 @@ src_coreutils_SOURCES = src/coreutils.c
src_cp_SOURCES = src/cp.c $(copy_sources) $(selinux_sources)
src_dir_SOURCES = src/ls.c src/ls-dir.c
@@ -655,7 +660,7 @@ index e0f7c22..48fbb32 100644
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
-@@ -154,128 +156,6 @@ add_tab_stop (uintmax_t tabval)
+@@ -154,128 +158,6 @@ add_tab_stop (uintmax_t tabval)
}
}
@@ -784,7 +789,7 @@ index e0f7c22..48fbb32 100644
/* Change blanks to tabs, writing to stdout.
Read each file in 'file_list', in order. */
-@@ -284,11 +164,12 @@ unexpand (void)
+@@ -284,11 +166,12 @@ unexpand (void)
{
/* Input stream. */
FILE *fp = next_file (NULL);
@@ -798,7 +803,7 @@ index e0f7c22..48fbb32 100644
if (!fp)
return;
-@@ -296,12 +177,14 @@ unexpand (void)
+@@ -296,12 +179,14 @@ unexpand (void)
/* The worst case is a non-blank character, then one blank, then a
tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
@@ -815,7 +820,7 @@ index e0f7c22..48fbb32 100644
/* If true, perform translations. */
bool convert = true;
-@@ -335,12 +218,19 @@ unexpand (void)
+@@ -335,12 +220,19 @@ unexpand (void)
do
{
@@ -838,7 +843,7 @@ index e0f7c22..48fbb32 100644
if (blank)
{
-@@ -372,16 +262,16 @@ unexpand (void)
+@@ -372,16 +264,16 @@ unexpand (void)
if (next_tab_column < column)
error (EXIT_FAILURE, 0, _("input line is too long"));
@@ -858,7 +863,7 @@ index e0f7c22..48fbb32 100644
if (! (prev_blank && column == next_tab_column))
{
-@@ -389,13 +279,14 @@ unexpand (void)
+@@ -389,13 +281,14 @@ unexpand (void)
will be replaced by tabs. */
if (column == next_tab_column)
one_blank_before_tab_stop = true;
@@ -875,7 +880,7 @@ index e0f7c22..48fbb32 100644
}
/* Discard pending blanks, unless it was a single
-@@ -403,7 +294,7 @@ unexpand (void)
+@@ -403,7 +296,7 @@ unexpand (void)
pending = one_blank_before_tab_stop;
}
}
@@ -884,7 +889,7 @@ index e0f7c22..48fbb32 100644
{
/* Go back one column, and force recalculation of the
next tab stop. */
-@@ -413,7 +304,7 @@ unexpand (void)
+@@ -413,7 +306,7 @@ unexpand (void)
}
else
{
@@ -893,7 +898,7 @@ index e0f7c22..48fbb32 100644
if (!column)
error (EXIT_FAILURE, 0, _("input line is too long"));
}
-@@ -421,9 +312,13 @@ unexpand (void)
+@@ -421,9 +314,13 @@ unexpand (void)
if (pending)
{
if (pending > 1 && one_blank_before_tab_stop)
@@ -909,7 +914,7 @@ index e0f7c22..48fbb32 100644
pending = 0;
one_blank_before_tab_stop = false;
}
-@@ -432,16 +327,16 @@ unexpand (void)
+@@ -432,16 +329,16 @@ unexpand (void)
convert &= convert_entire_line || blank;
}
@@ -930,7 +935,7 @@ index e0f7c22..48fbb32 100644
}
}
-@@ -482,7 +377,7 @@ main (int argc, char **argv)
+@@ -482,7 +379,7 @@ main (int argc, char **argv)
break;
case 't':
convert_entire_line = true;
@@ -1047,7 +1052,7 @@ diff --git a/tests/local.mk b/tests/local.mk
index 7df04da..d3462be 100644
--- a/tests/local.mk
+++ b/tests/local.mk
-@@ -532,6 +532,7 @@ all_tests = \
+@@ -536,6 +536,7 @@ all_tests = \
tests/du/threshold.sh \
tests/du/trailing-slash.sh \
tests/du/two-args.sh \
@@ -1055,7 +1060,7 @@ index 7df04da..d3462be 100644
tests/id/gnu-zero-uids.sh \
tests/id/no-context.sh \
tests/id/context.sh \
-@@ -671,6 +672,7 @@ all_tests = \
+@@ -674,6 +675,7 @@ all_tests = \
tests/touch/read-only.sh \
tests/touch/relative.sh \
tests/touch/trailing-slash.sh \
@@ -1166,11 +1171,11 @@ index 0000000..60d4c1a
+
+unexpand -a < in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
---
-2.4.3
-
---- /dev/null 2015-11-30 08:40:17.566742513 +0100
-+++ coreutils-8.24/m4/mbfile.m4 2015-12-01 09:30:55.951149907 +0100
+diff --git a/m4/mbfile.m4 b/m4/mbfile.m4
+new file mode 100644
+index 0000000..8589902
+--- /dev/null
++++ b/m4/mbfile.m4
@@ -0,0 +1,14 @@
+# mbfile.m4 serial 7
+dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc.
@@ -1186,14 +1191,20 @@ index 0000000..60d4c1a
+ AC_REQUIRE([AC_TYPE_MBSTATE_T])
+ :
+])
---- /dev/null 2015-11-30 08:40:17.566742513 +0100
-+++ coreutils-8.24/lib/mbfile.c 2015-12-01 09:28:22.254928468 +0100
+diff --git a/lib/mbfile.c b/lib/mbfile.c
+new file mode 100644
+index 0000000..b0a468e
+--- /dev/null
++++ b/lib/mbfile.c
@@ -0,0 +1,3 @@
+#include
+#define MBFILE_INLINE _GL_EXTERN_INLINE
+#include "mbfile.h"
---- /dev/null 2015-11-30 08:40:17.566742513 +0100
-+++ coreutils-8.24/lib/mbfile.h 2015-12-01 09:28:30.829885570 +0100
+diff --git a/lib/mbfile.h b/lib/mbfile.h
+new file mode 100644
+index 0000000..11f1b12
+--- /dev/null
++++ b/lib/mbfile.h
@@ -0,0 +1,255 @@
+/* Multibyte character I/O: macros for multi-byte encodings.
+ Copyright (C) 2001, 2005, 2009-2015 Free Software Foundation, Inc.
@@ -1450,3 +1461,6 @@ index 0000000..60d4c1a
+_GL_INLINE_HEADER_BEGIN
+
+#endif /* _MBFILE_H */
+--
+2.5.5
+
diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch
index 79449d4..bcce9ff 100644
--- a/coreutils-i18n.patch
+++ b/coreutils-i18n.patch
@@ -106,7 +106,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
{"spaces", no_argument, NULL, 's'},
{"width", required_argument, NULL, 'w'},
{GETOPT_HELP_OPTION_DECL},
-@@ -75,6 +118,7 @@ Wrap input lines in each FILE, writing t
+@@ -75,6 +118,7 @@ Wrap input lines in each FILE, writing to standard output.\n\
fputs (_("\
-b, --bytes count bytes rather than columns\n\
@@ -114,7 +114,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
-s, --spaces break at spaces\n\
-w, --width=WIDTH use WIDTH columns instead of 80\n\
"), stdout);
-@@ -92,7 +136,7 @@ Wrap input lines in each FILE, writing t
+@@ -92,7 +136,7 @@ Wrap input lines in each FILE, writing to standard output.\n\
static size_t
adjust_column (size_t column, char c)
{
@@ -156,7 +156,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
fadvise (istream, FADVISE_SEQUENTIAL);
-@@ -168,6 +196,15 @@ fold_file (char const *filename, size_t
+@@ -168,6 +196,15 @@ fold_file (char const *filename, size_t width)
bool found_blank = false;
size_t logical_end = offset_out;
@@ -172,16 +172,16 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
/* Look for the last blank. */
while (logical_end)
{
-@@ -214,11 +251,221 @@ fold_file (char const *filename, size_t
+@@ -214,11 +251,221 @@ fold_file (char const *filename, size_t width)
line_out[offset_out++] = c;
}
- saved_errno = errno;
+ *saved_errno = errno;
-+
-+ if (offset_out)
-+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
-+
+
+ if (offset_out)
+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
+
+}
+
+#if HAVE_MBRTOWC
@@ -353,10 +353,10 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
+ }
+
+ *saved_errno = errno;
-
- if (offset_out)
- fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
-
++
++ if (offset_out)
++ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
++
+}
+#endif
+
@@ -642,7 +642,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
static void
freeline (struct line *line)
{
-@@ -326,56 +484,133 @@ keycmp (struct line const *line1, struct
+@@ -326,56 +484,133 @@ keycmp (struct line const *line1, struct line const *line2,
size_t jf_1, size_t jf_2)
{
/* Start of field to compare in each file. */
@@ -773,8 +773,8 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
- diff = memcmp (beg1, beg2, MIN (len1, len2));
+ copy[0] = beg[0];
+ copy[1] = beg[1];
-+ }
-+
+ }
+
+ if (hard_LC_COLLATE)
+ {
+ diff = xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]);
@@ -784,14 +784,14 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
+ 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;
@@ -799,7 +799,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
}
/* Check that successive input lines PREV and CURRENT from input file
-@@ -467,6 +702,11 @@ get_line (FILE *fp, struct line **linep,
+@@ -467,6 +702,11 @@ get_line (FILE *fp, struct line **linep, int which)
}
++line_no[which - 1];
@@ -811,7 +811,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
xfields (line);
if (prevline[which - 1])
-@@ -566,21 +806,28 @@ prfield (size_t n, struct line const *li
+@@ -566,21 +806,28 @@ prfield (size_t n, struct line const *line)
/* Output all the fields in line, other than the join field. */
@@ -851,7 +851,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
size_t field;
struct line const *line;
-@@ -625,7 +871,7 @@ prjoin (struct line const *line1, struct
+@@ -625,7 +871,7 @@ prjoin (struct line const *line1, struct line const *line2)
o = o->next;
if (o == NULL)
break;
@@ -920,7 +920,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
--- coreutils-8.24-orig/src/pr.c 2015-06-26 19:05:22.000000000 +0200
+++ coreutils-8.24/src/pr.c 2015-07-05 09:04:33.030546965 +0200
-@@ -312,6 +312,24 @@
+@@ -311,6 +311,24 @@
#include
#include
@@ -945,7 +945,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
#include "system.h"
#include "error.h"
#include "fadvise.h"
-@@ -324,6 +342,18 @@
+@@ -323,6 +341,18 @@
#include "xstrtol.h"
#include "xdectoint.h"
@@ -964,7 +964,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "pr"
-@@ -416,7 +446,20 @@ struct COLUMN
+@@ -415,7 +445,20 @@ struct COLUMN
typedef struct COLUMN COLUMN;
@@ -986,7 +986,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
static bool read_line (COLUMN *p);
static bool print_page (void);
static bool print_stored (COLUMN *p);
-@@ -428,6 +471,7 @@ static void add_line_number (COLUMN *p);
+@@ -427,6 +470,7 @@ static void add_line_number (COLUMN *p);
static void getoptnum (const char *n_str, int min, int *num,
const char *errfmt);
static void getoptarg (char *arg, char switch_char, char *character,
@@ -994,7 +994,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
int *number);
static void print_files (int number_of_files, char **av);
static void init_parameters (int number_of_files);
-@@ -441,7 +485,6 @@ static void store_char (char c);
+@@ -440,7 +484,6 @@ static void store_char (char c);
static void pad_down (unsigned int lines);
static void read_rest_of_line (COLUMN *p);
static void skip_read (COLUMN *p, int column_number);
@@ -1002,7 +1002,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
static void cleanup (void);
static void print_sep_string (void);
static void separator_string (const char *optarg_S);
-@@ -453,7 +496,7 @@ static COLUMN *column_vector;
+@@ -452,7 +495,7 @@ static COLUMN *column_vector;
we store the leftmost columns contiguously in buff.
To print a line from buff, get the index of the first character
from line_vector[i], and print up to line_vector[i + 1]. */
@@ -1011,7 +1011,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* Index of the position in buff where the next character
will be stored. */
-@@ -557,7 +600,7 @@ static int chars_per_column;
+@@ -556,7 +599,7 @@ static int chars_per_column;
static bool untabify_input = false;
/* (-e) The input tab character. */
@@ -1020,7 +1020,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ...
where the leftmost column is 1. */
-@@ -567,7 +610,10 @@ static int chars_per_input_tab = 8;
+@@ -566,7 +609,10 @@ static int chars_per_input_tab = 8;
static bool tabify_output = false;
/* (-i) The output tab character. */
@@ -1032,7 +1032,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* (-i) The width of the output tab. */
static int chars_per_output_tab = 8;
-@@ -637,7 +683,13 @@ static int line_number;
+@@ -636,7 +682,13 @@ static int line_number;
static bool numbered_lines = false;
/* (-n) Character which follows each line number. */
@@ -1047,7 +1047,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* (-n) line counting starts with 1st line of input file (not with 1st
line of 1st page printed). */
-@@ -690,6 +742,7 @@ static bool use_col_separator = false;
+@@ -689,6 +741,7 @@ static bool use_col_separator = false;
-a|COLUMN|-m is a 'space' and with the -J option a 'tab'. */
static char *col_sep_string = (char *) "";
static int col_sep_length = 0;
@@ -1055,7 +1055,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
static char *column_separator = (char *) " ";
static char *line_separator = (char *) "\t";
-@@ -840,6 +893,13 @@ separator_string (const char *optarg_S)
+@@ -839,6 +892,13 @@ separator_string (const char *optarg_S)
col_sep_length = (int) strlen (optarg_S);
col_sep_string = xmalloc (col_sep_length + 1);
strcpy (col_sep_string, optarg_S);
@@ -1069,7 +1069,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
}
int
-@@ -864,6 +924,21 @@ main (int argc, char **argv)
+@@ -863,6 +923,21 @@ main (int argc, char **argv)
atexit (close_stdout);
@@ -1091,7 +1091,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
n_files = 0;
file_names = (argc > 1
? xmalloc ((argc - 1) * sizeof (char *))
-@@ -940,8 +1015,12 @@ main (int argc, char **argv)
+@@ -939,8 +1014,12 @@ main (int argc, char **argv)
break;
case 'e':
if (optarg)
@@ -1106,7 +1106,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* Could check tab width > 0. */
untabify_input = true;
break;
-@@ -954,8 +1033,12 @@ main (int argc, char **argv)
+@@ -953,8 +1032,12 @@ main (int argc, char **argv)
break;
case 'i':
if (optarg)
@@ -1121,7 +1121,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* Could check tab width > 0. */
tabify_output = true;
break;
-@@ -973,8 +1056,8 @@ main (int argc, char **argv)
+@@ -972,8 +1055,8 @@ main (int argc, char **argv)
case 'n':
numbered_lines = true;
if (optarg)
@@ -1132,7 +1132,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
break;
case 'N':
skip_count = false;
-@@ -998,7 +1081,7 @@ main (int argc, char **argv)
+@@ -997,7 +1080,7 @@ main (int argc, char **argv)
old_s = false;
/* Reset an additional input of -s, -S dominates -s */
col_sep_string = bad_cast ("");
@@ -1141,7 +1141,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
use_col_separator = true;
if (optarg)
separator_string (optarg);
-@@ -1152,10 +1235,45 @@ getoptnum (const char *n_str, int min, i
+@@ -1152,10 +1235,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err)
a number. */
static void
@@ -1359,7 +1359,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* sep_string ends with some spaces */
if (spaces_not_printed > 0)
print_white_space ();
-@@ -2259,7 +2389,7 @@ print_clump (COLUMN *p, int n, char *clu
+@@ -2259,7 +2389,7 @@ print_clump (COLUMN *p, int n, char *clump)
required number of tabs and spaces. */
static void
@@ -1701,7 +1701,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
#include "system.h"
#include "argmatch.h"
#include "error.h"
-@@ -164,14 +172,39 @@ static int decimal_point;
+@@ -163,14 +171,39 @@ static int decimal_point;
/* Thousands separator; if -1, then there isn't one. */
static int thousands_sep;
@@ -1742,7 +1742,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
/* The kind of blanks for '-b' to skip in various options. */
enum blanktype { bl_start, bl_end, bl_both };
-@@ -345,13 +378,11 @@ static bool reverse;
+@@ -344,13 +377,11 @@ static bool reverse;
they were read if all keys compare equal. */
static bool stable;
@@ -1815,7 +1815,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
static int
struct_month_cmp (void const *m1, void const *m2)
-@@ -1269,7 +1340,7 @@ struct_month_cmp (void const *m1, void c
+@@ -1269,7 +1340,7 @@ struct_month_cmp (void const *m1, void const *m2)
/* Initialize the character class tables. */
static void
@@ -1833,7 +1833,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
/* If we're not in the "C" locale, read different names for months. */
if (hard_LC_TIME)
{
-@@ -1363,6 +1434,84 @@ specify_nmerge (int oi, char c, char con
+@@ -1363,6 +1434,84 @@ specify_nmerge (int oi, char c, char const *s)
xstrtol_fatal (e, oi, c, long_options, s);
}
@@ -1918,7 +1918,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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)
-@@ -1596,7 +1745,7 @@ buffer_linelim (struct buffer const *buf
+@@ -1596,7 +1745,7 @@ buffer_linelim (struct buffer const *buf)
by KEY in LINE. */
static char *
@@ -1927,7 +1927,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t sword = key->sword;
-@@ -1605,10 +1754,10 @@ begfield (struct line const *line, struc
+@@ -1605,10 +1754,10 @@ begfield (struct line const *line, struct keyfield const *key)
/* The leading field separator itself is included in a field when -t
is absent. */
@@ -1940,7 +1940,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
++ptr;
if (ptr < lim)
++ptr;
-@@ -1634,11 +1783,70 @@ begfield (struct line const *line, struc
+@@ -1634,11 +1783,70 @@ begfield (struct line const *line, struct keyfield const *key)
return ptr;
}
@@ -2012,7 +2012,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar;
-@@ -1653,10 +1861,10 @@ limfield (struct line const *line, struc
+@@ -1653,10 +1861,10 @@ limfield (struct line const *line, struct keyfield const *key)
'beginning' is the first character following the delimiting TAB.
Otherwise, leave PTR pointing at the first 'blank' character after
the preceding field. */
@@ -2025,7 +2025,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
++ptr;
if (ptr < lim && (eword || echar))
++ptr;
-@@ -1702,10 +1910,10 @@ limfield (struct line const *line, struc
+@@ -1702,10 +1910,10 @@ limfield (struct line const *line, struct keyfield const *key)
*/
/* Make LIM point to the end of (one byte past) the current field. */
@@ -2038,7 +2038,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
if (newlim)
lim = newlim;
}
-@@ -1736,6 +1944,130 @@ limfield (struct line const *line, struc
+@@ -1736,6 +1944,130 @@ limfield (struct line const *line, struct keyfield const *key)
return ptr;
}
@@ -2169,7 +2169,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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
-@@ -1822,8 +2154,22 @@ fillbuf (struct buffer *buf, FILE *fp, c
+@@ -1822,8 +2154,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
else
{
if (key->skipsblanks)
@@ -2194,7 +2194,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
line->keybeg = line_start;
}
}
-@@ -1944,7 +2290,7 @@ human_numcompare (char const *a, char co
+@@ -1944,7 +2290,7 @@ human_numcompare (char const *a, char const *b)
hideously fast. */
static int
@@ -2203,7 +2203,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
while (blanks[to_uchar (*a)])
a++;
-@@ -1954,6 +2300,25 @@ numcompare (char const *a, char const *b
+@@ -1954,6 +2300,25 @@ numcompare (char const *a, char const *b)
return strnumcmp (a, b, decimal_point, thousands_sep);
}
@@ -2229,7 +2229,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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
-@@ -2004,7 +2369,7 @@ general_numcompare (char const *sa, char
+@@ -2004,7 +2369,7 @@ general_numcompare (char const *sa, char const *sb)
Return 0 if the name in S is not recognized. */
static int
@@ -2238,7 +2238,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
size_t lo = 0;
size_t hi = MONTHS_PER_YEAR;
-@@ -2279,15 +2644,14 @@ debug_key (struct line const *line, stru
+@@ -2280,15 +2645,14 @@ debug_key (struct line const *line, struct keyfield const *key)
char saved = *lim;
*lim = '\0';
@@ -2256,7 +2256,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
else if (key->general_numeric)
ignore_value (strtold (beg, &tighter_lim));
else if (key->numeric || key->human_numeric)
-@@ -2431,7 +2795,7 @@ key_warnings (struct keyfield const *gke
+@@ -2432,7 +2796,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
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 */
@@ -2265,7 +2265,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
&& ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned))
|| (!key->skipsblanks && key->schar)
|| (!key->skipeblanks && key->echar)))
-@@ -2489,11 +2853,87 @@ key_warnings (struct keyfield const *gke
+@@ -2490,11 +2854,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
error (0, 0, _("option '-r' only applies to last-resort comparison"));
}
@@ -2354,7 +2354,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
struct keyfield *key = keylist;
-@@ -2578,7 +3018,7 @@ keycompare (struct line const *a, struct
+@@ -2579,7 +3019,7 @@ keycompare (struct line const *a, struct line const *b)
else if (key->human_numeric)
diff = human_numcompare (ta, tb);
else if (key->month)
@@ -2363,7 +2363,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
else if (key->random)
diff = compare_random (ta, tlena, tb, tlenb);
else if (key->version)
-@@ -2694,6 +3134,211 @@ keycompare (struct line const *a, struct
+@@ -2695,6 +3135,211 @@ keycompare (struct line const *a, struct line const *b)
return key->reverse ? -diff : diff;
}
@@ -2575,7 +2575,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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. */
-@@ -2721,7 +3366,7 @@ compare (struct line const *a, struct line const *b)
+@@ -2722,7 +3367,7 @@ compare (struct line const *a, struct line const *b)
diff = - NONZERO (blen);
else if (blen == 0)
diff = 1;
@@ -2584,7 +2584,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
/* Note xmemcoll0 is a performance enhancement as
it will not unconditionally write '\0' after the
-@@ -4120,6 +4765,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
+@@ -4121,6 +4766,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
break;
case 'f':
key->translate = fold_toupper;
@@ -2592,7 +2592,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
break;
case 'g':
key->general_numeric = true;
-@@ -4197,7 +4843,7 @@ main (int argc, char **argv)
+@@ -4199,7 +4845,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE);
@@ -2601,7 +2601,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
hard_LC_TIME = hard_locale (LC_TIME);
#endif
-@@ -4218,6 +4864,29 @@ main (int argc, char **argv)
+@@ -4220,6 +4866,29 @@ main (int argc, char **argv)
thousands_sep = -1;
}
@@ -2631,7 +2631,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
have_read_stdin = false;
inittables ();
-@@ -4492,13 +5161,34 @@ main (int argc, char **argv)
+@@ -4494,13 +5163,34 @@ main (int argc, char **argv)
case 't':
{
@@ -2670,7 +2670,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
else
{
/* Provoke with 'sort -txx'. Complain about
-@@ -4509,9 +5199,12 @@ main (int argc, char **argv)
+@@ -4511,9 +5201,12 @@ main (int argc, char **argv)
quote (optarg));
}
}
@@ -2685,7 +2685,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
}
break;
-@@ -5444,12 +5444,10 @@ main (int argc, char **argv)
+@@ -4751,12 +5444,10 @@ main (int argc, char **argv)
sort (files, nfiles, outfile, nthreads);
}
@@ -2719,14 +2719,14 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
#include "system.h"
#include "argmatch.h"
#include "linebuffer.h"
-@@ -32,8 +43,20 @@
+@@ -31,9 +42,21 @@
#include "stdio--.h"
#include "xmemcoll.h"
#include "xstrtol.h"
-#include "memcasecmp.h"
+#include "xmemcoll.h"
#include "quote.h"
-+
+
+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
+ installation; work around this configuration error. */
+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
@@ -2738,9 +2738,10 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
+#endif
+
-
++
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "uniq"
+
@@ -143,6 +166,10 @@ enum
GROUP_OPTION = CHAR_MAX + 1
};
@@ -2752,7 +2753,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
static struct option const longopts[] =
{
{"count", no_argument, NULL, 'c'},
-@@ -251,7 +278,7 @@ size_opt (char const *opt, char const *m
+@@ -252,7 +279,7 @@ size_opt (char const *opt, char const *msgid)
return a pointer to the beginning of the line's field to be compared. */
static char * _GL_ATTRIBUTE_PURE
@@ -2761,7 +2762,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
{
size_t count;
char const *lp = line->buffer;
-@@ -271,6 +298,83 @@ find_field (struct linebuffer const *lin
+@@ -272,6 +299,83 @@ find_field (struct linebuffer const *line)
return line->buffer + i;
}
@@ -2845,7 +2846,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
/* Return false if two strings OLD and NEW match, true if not.
OLD and NEW point not to the beginnings of the lines
but rather to the beginnings of the fields to compare.
-@@ -279,6 +383,8 @@ find_field (struct linebuffer const *lin
+@@ -280,6 +384,8 @@ find_field (struct linebuffer const *line)
static bool
different (char *old, char *new, size_t oldlen, size_t newlen)
{
@@ -2854,7 +2855,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
if (check_chars < oldlen)
oldlen = check_chars;
if (check_chars < newlen)
-@@ -286,15 +392,104 @@ different (char *old, char *new, size_t
+@@ -287,14 +393,103 @@ different (char *old, char *new, size_t oldlen, size_t newlen)
if (ignore_case)
{
@@ -2886,8 +2887,8 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
+
+ return xmemcoll (copy_old, oldlen, copy_new, newlen);
+
- }
-
++}
++
+#if HAVE_MBRTOWC
+static int
+different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate)
@@ -2958,13 +2959,12 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
+ free (copy[1]);
+ return rc;
+
-+}
+ }
+#endif
-+
+
/* Output the line in linebuffer LINE to standard output
provided that the switches say it should be output.
- MATCH is true if the line matches the previous line.
-@@ -358,19 +553,38 @@ check_file (const char *infile, const ch
+@@ -359,19 +554,38 @@ check_file (const char *infile, const char *outfile, char delimiter)
char *prevfield IF_LINT ( = NULL);
size_t prevlen IF_LINT ( = 0);
bool first_group_printed = false;
@@ -3003,7 +3003,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
new_group = (prevline->length == 0
|| different (thisfield, prevfield, thislen, prevlen));
-@@ -388,6 +602,10 @@ check_file (const char *infile, const ch
+@@ -389,6 +603,10 @@ check_file (const char *infile, const char *outfile, char delimiter)
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
@@ -3014,7 +3014,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
first_group_printed = true;
}
}
-@@ -400,17 +618,26 @@ check_file (const char *infile, const ch
+@@ -401,17 +619,26 @@ check_file (const char *infile, const char *outfile, char delimiter)
size_t prevlen;
uintmax_t match_count = 0;
bool first_delimiter = true;
@@ -3041,7 +3041,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
{
if (ferror (stdin))
-@@ -419,6 +646,14 @@ check_file (const char *infile, const ch
+@@ -420,6 +647,14 @@ check_file (const char *infile, const char *outfile, char delimiter)
}
thisfield = find_field (thisline);
thislen = thisline->length - 1 - (thisfield - thisline->buffer);
@@ -3056,7 +3056,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
match = !different (thisfield, prevfield, thislen, prevlen);
match_count += match;
-@@ -451,6 +686,9 @@ check_file (const char *infile, const ch
+@@ -452,6 +687,9 @@ check_file (const char *infile, const char *outfile, char delimiter)
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
@@ -3066,7 +3066,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
if (!match)
match_count = 0;
}
-@@ -497,6 +735,19 @@ main (int argc, char **argv)
+@@ -498,6 +736,19 @@ main (int argc, char **argv)
atexit (close_stdout);
@@ -3122,7 +3122,7 @@ diff -urNp coreutils-8.24-orig/tests/i18n/sort.sh coreutils-8.24/tests/i18n/sort
diff -urNp coreutils-8.24-orig/tests/local.mk coreutils-8.24/tests/local.mk
--- coreutils-8.24-orig/tests/local.mk 2015-07-05 09:00:46.526859558 +0200
+++ coreutils-8.24/tests/local.mk 2015-07-05 09:04:33.033546987 +0200
-@@ -341,6 +341,8 @@ all_tests = \
+@@ -344,6 +344,8 @@ all_tests = \
tests/misc/sort-discrim.sh \
tests/misc/sort-files0-from.pl \
tests/misc/sort-float.sh \
@@ -3148,7 +3148,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/cut.pl coreutils-8.24/tests/misc/cut.p
my $prog = 'cut';
my $try = "Try '$prog --help' for more information.\n";
-@@ -227,6 +229,7 @@ if ($mb_locale ne 'C')
+@@ -240,6 +242,7 @@ if ($mb_locale ne 'C')
my @new_t = @$t;
my $test_name = shift @new_t;
@@ -3304,7 +3304,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/join.pl coreutils-8.24/tests/misc/join
my $delim = chr 0247;
sub t_subst ($)
{
-@@ -326,8 +335,49 @@ foreach my $t (@tv)
+@@ -329,8 +338,49 @@ foreach my $t (@tv)
push @Tests, $new_ent;
}
@@ -3482,7 +3482,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/sort.pl coreutils-8.24/tests/misc/sort
# Since each test is run with a file name and with redirected stdin,
# the name in the diagnostic is either the file name or "-".
# Normalize each diagnostic to use '-'.
-@@ -419,6 +428,38 @@ foreach my $t (@Tests)
+@@ -424,6 +429,38 @@ foreach my $t (@Tests)
}
}
@@ -3521,7 +3521,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/sort.pl coreutils-8.24/tests/misc/sort
@Tests = triple_test \@Tests;
# Remember that triple_test creates from each test with exactly one "IN"
-@@ -428,6 +469,7 @@ foreach my $t (@Tests)
+@@ -433,6 +470,7 @@ foreach my $t (@Tests)
# Remove the IN_PIPE version of the "output-is-input" test above.
# The others aren't susceptible because they have three inputs each.
@Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests;
@@ -3606,7 +3606,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/uniq.pl coreutils-8.24/tests/misc/uniq
# When possible, create a "-z"-testing variant of each test.
sub add_z_variants($)
{
-@@ -261,6 +269,53 @@ foreach my $t (@Tests)
+@@ -262,6 +270,53 @@ foreach my $t (@Tests)
and push @$t, {ENV=>'_POSIX2_VERSION=199209'};
}
diff --git a/coreutils-overflow.patch b/coreutils-overflow.patch
index 0d55a6d..06059a9 100644
--- a/coreutils-overflow.patch
+++ b/coreutils-overflow.patch
@@ -1,6 +1,6 @@
--- coreutils-5.2.1/src/who.c.overflow 2005-05-25 09:59:06.000000000 +0100
+++ coreutils-5.2.1/src/who.c 2005-05-25 10:00:31.000000000 +0100
-@@ -75,7 +75,7 @@
+@@ -79,7 +79,7 @@
# define UT_TYPE_NEW_TIME(U) false
#endif
diff --git a/coreutils-selinux.patch b/coreutils-selinux.patch
index bfcc9d3..9f45177 100644
--- a/coreutils-selinux.patch
+++ b/coreutils-selinux.patch
@@ -20,7 +20,7 @@ diff -urNp coreutils-8.21-orig/man/runcon.x coreutils-8.21/man/runcon.x
diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
--- coreutils-8.21-orig/src/cp.c 2013-02-07 10:37:05.000000000 +0100
+++ coreutils-8.21/src/cp.c 2013-02-15 14:31:58.945468929 +0100
-@@ -201,6 +202,9 @@ Copy SOURCE to DEST, or multiple SOURCE(
+@@ -202,6 +202,9 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
all\n\
"), stdout);
fputs (_("\
@@ -30,7 +30,7 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
--no-preserve=ATTR_LIST don't preserve the specified attributes\n\
--parents use full source file name under DIRECTORY\n\
"), stdout);
-@@ -933,7 +939,7 @@ main (int argc, char **argv)
+@@ -943,7 +946,7 @@ main (int argc, char **argv)
we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
@@ -39,7 +39,7 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
long_opts, NULL))
!= -1)
{
-@@ -981,6 +987,17 @@ main (int argc, char **argv)
+@@ -991,6 +994,17 @@ main (int argc, char **argv)
copy_contents = true;
break;
@@ -60,7 +60,7 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
diff -urNp coreutils-8.21-orig/src/id.c coreutils-8.21/src/id.c
--- coreutils-8.21-orig/src/id.c 2013-01-31 01:46:24.000000000 +0100
+++ coreutils-8.21/src/id.c 2013-02-15 14:31:58.946469154 +0100
-@@ -106,7 +106,7 @@ int
+@@ -113,7 +113,7 @@ int
main (int argc, char **argv)
{
int optc;
@@ -72,7 +72,7 @@ diff -urNp coreutils-8.21-orig/src/id.c coreutils-8.21/src/id.c
diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c
--- coreutils-8.21-orig/src/install.c 2013-02-07 10:37:05.000000000 +0100
+++ coreutils-8.21/src/install.c 2013-02-15 14:31:58.948469440 +0100
-@@ -639,7 +640,7 @@ In the 4th form, create all components o
+@@ -649,7 +649,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\
-v, --verbose print the name of each directory as it is created\n\
"), stdout);
fputs (_("\
@@ -81,7 +81,7 @@ diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c
-Z set SELinux security context of destination\n\
file to default type\n\
--context[=CTX] like -Z, or if CTX is specified then set the\n\
-@@ -782,7 +783,7 @@ main (int argc, char **argv)
+@@ -817,7 +817,7 @@ main (int argc, char **argv)
we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
@@ -90,7 +90,7 @@ diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c
NULL)) != -1)
{
switch (optc)
-@@ -853,6 +854,8 @@ main (int argc, char **argv)
+@@ -878,6 +878,8 @@ main (int argc, char **argv)
no_target_directory = true;
break;
@@ -99,7 +99,7 @@ diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c
case PRESERVE_CONTEXT_OPTION:
if (! selinux_enabled)
{
-@@ -860,6 +862,10 @@ main (int argc, char **argv)
+@@ -885,6 +887,10 @@ main (int argc, char **argv)
"this kernel is not SELinux-enabled"));
break;
}
diff --git a/coreutils-selinuxmanpages.patch b/coreutils-selinuxmanpages.patch
index 7b27f90..1540613 100644
--- a/coreutils-selinuxmanpages.patch
+++ b/coreutils-selinuxmanpages.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-6.10-orig/doc/coreutils.texi coreutils-6.10/doc/coreutils.texi
--- coreutils-6.10-orig/doc/coreutils.texi 2008-04-07 17:52:11.000000000 +0200
+++ coreutils-6.10/doc/coreutils.texi 2008-04-07 18:01:43.000000000 +0200
-@@ -6981,6 +6981,11 @@ for i; do
+@@ -8002,6 +8002,11 @@ done
exit $fail
@end example
diff --git a/sh-utils-2.0.11-dateman.patch b/sh-utils-2.0.11-dateman.patch
index 8684dc7..60cdaa6 100644
--- a/sh-utils-2.0.11-dateman.patch
+++ b/sh-utils-2.0.11-dateman.patch
@@ -1,7 +1,7 @@
diff -urNp coreutils-5.97-orig/man/date.x coreutils-5.97/man/date.x
--- coreutils-5.97-orig/man/date.x 1999-11-02 15:07:36.000000000 +0100
+++ coreutils-5.97/man/date.x 2008-10-15 10:13:31.000000000 +0200
-@@ -11,3 +11,8 @@
+@@ -11,3 +11,8 @@ calendar date, time of day, time zone, day of week, relative time,
relative date, and numbers. An empty string indicates the beginning
of the day. The date string format is more complex than is easily
documented here but is fully described in the info documentation.
From cd51eb58a57dafbf90455dd3d4f66ff0e1942829 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Thu, 14 Jul 2016 16:50:51 +0200
Subject: [PATCH 031/232] make 'sort -h' work for arbitrary column
... even when using UTF-8 locales
---
coreutils-i18n-sort-human.patch | 35 +++++++++++++++++++++++++++++++++
coreutils.spec | 4 ++++
2 files changed, 39 insertions(+)
create mode 100644 coreutils-i18n-sort-human.patch
diff --git a/coreutils-i18n-sort-human.patch b/coreutils-i18n-sort-human.patch
new file mode 100644
index 0000000..2469189
--- /dev/null
+++ b/coreutils-i18n-sort-human.patch
@@ -0,0 +1,35 @@
+From 3976ef5a20369d8b490907ab2cba2d617305a5e0 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Mon, 30 May 2016 16:19:20 +0200
+Subject: [PATCH] sort: do not use static array 'blanks' in human_numcompare()
+
+... because the array is not initialized with MB locales. Note this is
+rather a conservative fix. I plan to do more cleanup of the i18n patch
+in Fedora to prevent mistakes like this in future updates of coreutils.
+---
+ src/sort.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/src/sort.c b/src/sort.c
+index 9e07ad8..e47b039 100644
+--- a/src/sort.c
++++ b/src/sort.c
+@@ -2274,12 +2274,10 @@ find_unit_order (char const *number)
+ < K/k < M < G < T < P < E < Z < Y */
+
+ static int
+-human_numcompare (char const *a, char const *b)
++human_numcompare (char *a, char *b)
+ {
+- while (blanks[to_uchar (*a)])
+- a++;
+- while (blanks[to_uchar (*b)])
+- b++;
++ skipblanks(&a, a + strlen(a));
++ skipblanks(&b, b + strlen(b));
+
+ int diff = find_unit_order (a) - find_unit_order (b);
+ return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep));
+--
+2.5.5
+
diff --git a/coreutils.spec b/coreutils.spec
index 425ab97..3cbe487 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -54,6 +54,8 @@ Patch803: coreutils-i18n-fix-unexpand.patch
Patch805: coreutils-i18n-fix2-expand-unexpand.patch
#(un)expand - test BOM headers
Patch806: coreutils-i18n-un-expand-BOM.patch
+# make 'sort -h' work for arbitrary column even when using UTF-8 locales
+Patch807: coreutils-i18n-sort-human.patch
#getgrouplist() patch from Ulrich Drepper.
Patch908: coreutils-getgrouplist.patch
@@ -188,6 +190,7 @@ including documentation and translations.
%patch804 -p1 -b .i18n-cutold
%patch805 -p1 -b .i18n-fix2-expand-unexpand
%patch806 -p1 -b .i18n-BOM-expand-unexpand
+%patch807 -p1
# Coreutils
%patch908 -p1 -b .getgrouplist
@@ -365,6 +368,7 @@ fi
%changelog
* Mon Oct 31 2016 Kamil Dudka - 8.25-7
+- make 'sort -h' work for arbitrary column even when using UTF-8 locales
- install -Z now sets default SELinux context for created directories (#1339135)
- switch to UTF8 locale when (un)expand input contains BOM header
(#1158494)
From 1ce862f0bb3cb9a778114dead31afca5dbe5a442 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Tue, 19 Jul 2016 13:52:45 +0200
Subject: [PATCH 032/232] Resolves: #1355780 - fix 'sort -h -k' in locales that
use blank as thousands separator
---
coreutils-8.25-sort-thousands-sep.patch | 332 ++++++++++++++++++++++++
coreutils.spec | 7 +
2 files changed, 339 insertions(+)
create mode 100644 coreutils-8.25-sort-thousands-sep.patch
diff --git a/coreutils-8.25-sort-thousands-sep.patch b/coreutils-8.25-sort-thousands-sep.patch
new file mode 100644
index 0000000..b9d2b5c
--- /dev/null
+++ b/coreutils-8.25-sort-thousands-sep.patch
@@ -0,0 +1,332 @@
+From c479153d77b419a6cae4551b63d2b73096c1130e Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Mon, 18 Jul 2016 19:04:43 +0200
+Subject: [PATCH 1/3] maint: sort.c: deduplicate code for traversing numbers
+
+* src/sort.c (traverse_raw_number): New function for traversing numbers.
+(find_unit_order): Use traverse_raw_number() instead of open-coding it.
+(debug_key): Likewise.
+---
+ src/sort.c | 63 ++++++++++++++++++++++++++++++++++----------------------------
+ 1 file changed, 35 insertions(+), 28 deletions(-)
+
+diff --git a/src/sort.c b/src/sort.c
+index 5b02343..e28bb6c 100644
+--- a/src/sort.c
++++ b/src/sort.c
+@@ -2231,18 +2231,16 @@ static char const unit_order[UCHAR_LIM] =
+ #endif
+ };
+
+-/* Return an integer that represents the order of magnitude of the
+- unit following the number. The number may contain thousands
+- separators and a decimal point, but it may not contain leading blanks.
+- Negative numbers get negative orders; zero numbers have a zero order. */
+-
+-static int _GL_ATTRIBUTE_PURE
+-find_unit_order (char const *number)
++/* Traverse number given as *number consisting of digits, thousands_sep, and
++ decimal_point chars only. Returns the highest digit found in the number,
++ or '\0' if no digit has been found. Upon return *number points at the
++ character that immediately follows after the given number. */
++static unsigned char
++traverse_raw_number (char const **number)
+ {
+- bool minus_sign = (*number == '-');
+- char const *p = number + minus_sign;
+- int nonzero = 0;
++ char const *p = *number;
+ unsigned char ch;
++ unsigned char max_digit = '\0';
+
+ /* Scan to end of number.
+ Decimals or separators not followed by digits stop the scan.
+@@ -2253,16 +2251,34 @@ find_unit_order (char const *number)
+ do
+ {
+ while (ISDIGIT (ch = *p++))
+- nonzero |= ch - '0';
++ if (max_digit < ch)
++ max_digit = ch;
+ }
+ while (ch == thousands_sep);
+
+ if (ch == decimal_point)
+ while (ISDIGIT (ch = *p++))
+- nonzero |= ch - '0';
++ if (max_digit < ch)
++ max_digit = ch;
++
++ *number = p - 1;
++ return max_digit;
++}
++
++/* Return an integer that represents the order of magnitude of the
++ unit following the number. The number may contain thousands
++ separators and a decimal point, but it may not contain leading blanks.
++ Negative numbers get negative orders; zero numbers have a zero order. */
+
+- if (nonzero)
++static int _GL_ATTRIBUTE_PURE
++find_unit_order (char const *number)
++{
++ bool minus_sign = (*number == '-');
++ char const *p = number + minus_sign;
++ unsigned char max_digit = traverse_raw_number (&p);
++ if ('0' < max_digit)
+ {
++ unsigned char ch = *p;
+ int order = unit_order[ch];
+ return (minus_sign ? -order : order);
+ }
+@@ -2655,23 +2671,14 @@ debug_key (struct line const *line, struct keyfield const *key)
+ ignore_value (strtold (beg, &tighter_lim));
+ else if (key->numeric || key->human_numeric)
+ {
+- char *p = beg + (beg < lim && *beg == '-');
+- bool found_digit = false;
+- unsigned char ch;
+-
+- do
++ char const *p = beg + (beg < lim && *beg == '-');
++ unsigned char max_digit = traverse_raw_number (&p);
++ if ('0' <= max_digit)
+ {
+- while (ISDIGIT (ch = *p++))
+- found_digit = true;
++ unsigned char ch = *p;
++ tighter_lim = (char *) p
++ + (key->human_numeric && unit_order[ch]);
+ }
+- while (ch == thousands_sep);
+-
+- if (ch == decimal_point)
+- while (ISDIGIT (ch = *p++))
+- found_digit = true;
+-
+- if (found_digit)
+- tighter_lim = p - ! (key->human_numeric && unit_order[ch]);
+ }
+ else
+ tighter_lim = lim;
+--
+2.5.5
+
+
+From 8c39465a5b0343ff7a21286dd69ed5430685d2f7 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Mon, 18 Jul 2016 19:04:44 +0200
+Subject: [PATCH 2/3] sort: make -h work with -k and blank used as thousands
+ separator
+
+* src/sort.c (traverse_raw_number): Allow to skip only one occurrence
+of thousands_sep to avoid finding the unit in the next column in case
+thousands_sep matches as blank and is used as column delimiter.
+* tests/misc/sort-h-thousands-sep.sh: Add regression test for this bug.
+* tests/local.mk: Reference the test.
+* NEWS: Mention the bug fix.
+Reported at https://bugzilla.redhat.com/1355780
+Fixes http://bugs.gnu.org/24015
+---
+ src/sort.c | 14 ++++++++----
+ tests/local.mk | 1 +
+ tests/misc/sort-h-thousands-sep.sh | 47 ++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 57 insertions(+), 5 deletions(-)
+ create mode 100755 tests/misc/sort-h-thousands-sep.sh
+
+diff --git a/src/sort.c b/src/sort.c
+index e28bb6c..dd3ba58 100644
+--- a/src/sort.c
++++ b/src/sort.c
+@@ -2248,13 +2248,17 @@ traverse_raw_number (char const **number)
+ to be lacking in units.
+ FIXME: add support for multibyte thousands_sep and decimal_point. */
+
+- do
++ while (ISDIGIT (ch = *p++))
+ {
+- while (ISDIGIT (ch = *p++))
+- if (max_digit < ch)
+- max_digit = ch;
++ if (max_digit < ch)
++ max_digit = ch;
++
++ /* Allow to skip only one occurrence of thousands_sep to avoid finding
++ the unit in the next column in case thousands_sep matches as blank
++ and is used as column delimiter. */
++ if (*p == thousands_sep)
++ ++p;
+ }
+- while (ch == thousands_sep);
+
+ if (ch == decimal_point)
+ while (ISDIGIT (ch = *p++))
+diff --git a/tests/local.mk b/tests/local.mk
+index 42d39f2..dccff8d 100644
+--- a/tests/local.mk
++++ b/tests/local.mk
+@@ -344,6 +344,7 @@ all_tests = \
+ tests/misc/sort-discrim.sh \
+ tests/misc/sort-files0-from.pl \
+ tests/misc/sort-float.sh \
++ tests/misc/sort-h-thousands-sep.sh \
+ tests/misc/sort-mb-tests.sh \
+ tests/i18n/sort.sh \
+ tests/misc/sort-merge.pl \
+diff --git a/tests/misc/sort-h-thousands-sep.sh b/tests/misc/sort-h-thousands-sep.sh
+new file mode 100755
+index 0000000..17f1b6c
+--- /dev/null
++++ b/tests/misc/sort-h-thousands-sep.sh
+@@ -0,0 +1,47 @@
++#!/bin/sh
++# exercise 'sort -h' in locales where thousands separator is blank
++
++# Copyright (C) 2016 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 .
++
++. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++print_ver_ sort
++test "$(LC_ALL=sv_SE locale thousands_sep)" = ' ' \
++ || skip_ 'The Swedish locale with blank thousands separator is unavailable.'
++
++tee exp1 > in << _EOF_
++1 1k 4 003 1M
++2k 2M 4 002 2
++3M 3 4 001 3k
++_EOF_
++
++cat > exp2 << _EOF_
++3M 3 4 001 3k
++1 1k 4 003 1M
++2k 2M 4 002 2
++_EOF_
++
++cat > exp3 << _EOF_
++3M 3 4 001 3k
++2k 2M 4 002 2
++1 1k 4 003 1M
++_EOF_
++
++for i in 1 2 3; do
++ LC_ALL="sv_SE.utf8" sort -h -k $i "in" > "out${i}" || fail=1
++ compare "exp${i}" "out${i}" || fail=1
++done
++
++Exit $fail
+--
+2.5.5
+
+
+From 46ef53f558e7bc1c0bc0abd62a86b40b4141e058 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Mon, 18 Jul 2016 19:04:45 +0200
+Subject: [PATCH 3/3] sort: with -h, disallow thousands separator between
+ number and unit
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+* src/sort.c (traverse_raw_number): Accept thousands separator only
+if it is immediately followed by a digit.
+* tests/misc/sort-h-thousands-sep.sh: Cover the fix for this bug.
+
+Suggested by Pádraig Brady in http://bugs.gnu.org/24015
+---
+ src/sort.c | 11 ++++++++++-
+ tests/misc/sort-h-thousands-sep.sh | 25 +++++++++++++------------
+ 2 files changed, 23 insertions(+), 13 deletions(-)
+
+diff --git a/src/sort.c b/src/sort.c
+index dd3ba58..69ef75f 100644
+--- a/src/sort.c
++++ b/src/sort.c
+@@ -2241,6 +2241,7 @@ traverse_raw_number (char const **number)
+ char const *p = *number;
+ unsigned char ch;
+ unsigned char max_digit = '\0';
++ bool ends_with_thousands_sep = false;
+
+ /* Scan to end of number.
+ Decimals or separators not followed by digits stop the scan.
+@@ -2256,10 +2257,18 @@ traverse_raw_number (char const **number)
+ /* Allow to skip only one occurrence of thousands_sep to avoid finding
+ the unit in the next column in case thousands_sep matches as blank
+ and is used as column delimiter. */
+- if (*p == thousands_sep)
++ ends_with_thousands_sep = (*p == thousands_sep);
++ if (ends_with_thousands_sep)
+ ++p;
+ }
+
++ if (ends_with_thousands_sep)
++ {
++ /* thousands_sep not followed by digit is not allowed. */
++ *number = p - 2;
++ return max_digit;
++ }
++
+ if (ch == decimal_point)
+ while (ISDIGIT (ch = *p++))
+ if (max_digit < ch)
+diff --git a/tests/misc/sort-h-thousands-sep.sh b/tests/misc/sort-h-thousands-sep.sh
+index 17f1b6c..3ffa89e 100755
+--- a/tests/misc/sort-h-thousands-sep.sh
++++ b/tests/misc/sort-h-thousands-sep.sh
+@@ -18,28 +18,29 @@
+
+ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+ print_ver_ sort
++
+ test "$(LC_ALL=sv_SE locale thousands_sep)" = ' ' \
+ || skip_ 'The Swedish locale with blank thousands separator is unavailable.'
+
+-tee exp1 > in << _EOF_
+-1 1k 4 003 1M
+-2k 2M 4 002 2
+-3M 3 4 001 3k
++tee exp1 exp3 > in << _EOF_
++1 1k 1 M 4 003 1M
++2k 2M 2 k 4 002 2
++3M 3 3 G 4 001 3k
+ _EOF_
+
+ cat > exp2 << _EOF_
+-3M 3 4 001 3k
+-1 1k 4 003 1M
+-2k 2M 4 002 2
++3M 3 3 G 4 001 3k
++1 1k 1 M 4 003 1M
++2k 2M 2 k 4 002 2
+ _EOF_
+
+-cat > exp3 << _EOF_
+-3M 3 4 001 3k
+-2k 2M 4 002 2
+-1 1k 4 003 1M
++cat > exp5 << _EOF_
++3M 3 3 G 4 001 3k
++2k 2M 2 k 4 002 2
++1 1k 1 M 4 003 1M
+ _EOF_
+
+-for i in 1 2 3; do
++for i in 1 2 3 5; do
+ LC_ALL="sv_SE.utf8" sort -h -k $i "in" > "out${i}" || fail=1
+ compare "exp${i}" "out${i}" || fail=1
+ done
+--
+2.5.5
+
diff --git a/coreutils.spec b/coreutils.spec
index 3cbe487..f9ac6ea 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -22,6 +22,8 @@ Source10: coreutils-find-requires.sh
# From upstream
Patch952: coreutils-8.25-intall-Z-selinux.patch
+# fix 'sort -h -k' in locales that use blank as thousands separator (#1355780)
+Patch953: coreutils-8.25-sort-thousands-sep.patch
# Our patches
#general patch to workaround koji build system issues
@@ -202,9 +204,13 @@ including documentation and translations.
%patch951 -p1 -b .selinuxman
%patch952 -p1
+# upstream patches
+%patch953 -p1
+
chmod a+x \
tests/df/direct.sh \
tests/install/install-Z-selinux.sh \
+ tests/misc/sort-h-thousands-sep.sh \
tests/misc/sort-mb-tests.sh \
|| :
@@ -368,6 +374,7 @@ fi
%changelog
* Mon Oct 31 2016 Kamil Dudka - 8.25-7
+- fix 'sort -h -k' in locales that use blank as thousands separator (#1355780)
- make 'sort -h' work for arbitrary column even when using UTF-8 locales
- install -Z now sets default SELinux context for created directories (#1339135)
- switch to UTF8 locale when (un)expand input contains BOM header
From 1e1a10a04a83d8ea3c4ddb191bfe014cbfe3221b Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Wed, 7 Sep 2016 20:17:56 +0200
Subject: [PATCH 033/232] Resolves: #1365933 - ls: allow interruption when
reading slow directories
---
coreutils-8.25-ls-signal.patch | 236 +++++++++++++++++++++++++++++++++
coreutils.spec | 4 +
2 files changed, 240 insertions(+)
create mode 100644 coreutils-8.25-ls-signal.patch
diff --git a/coreutils-8.25-ls-signal.patch b/coreutils-8.25-ls-signal.patch
new file mode 100644
index 0000000..32cfd3a
--- /dev/null
+++ b/coreutils-8.25-ls-signal.patch
@@ -0,0 +1,236 @@
+From 9338b244572e07bbff314b3570228e8cf43f1300 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Tue, 6 Sep 2016 17:38:26 +0200
+Subject: [PATCH] ls: allow interruption when reading slow directories
+
+Postpone installation of signal handlers until they're needed.
+That is right before the first escape sequence is printed.
+
+* src/ls.c (signal_setup): A new function refactored from main()
+to set and restore signal handlers.
+(main): Move signal handler setup to put_indicator()
+so that the default signal handling is untouched as long as possible.
+Adjusted condition for restoring signal handlers to reflect the change.
+(put_indicator): Install signal handlers if called for the very first
+time. It uses the same code that was in main() prior to this commit.
+* NEWS: Mention the improvement.
+
+See https://bugzilla.redhat.com/1365933
+Fixes http://bugs.gnu.org/24232
+
+Upstream-commit: 5445f7811ff945ea13aa2a0fd797eb4c0a0e4db0
+Signed-off-by: Kamil Dudka
+---
+ src/ls.c | 161 ++++++++++++++++++++++++++++++++++++---------------------------
+ 1 file changed, 93 insertions(+), 68 deletions(-)
+
+diff --git a/src/ls.c b/src/ls.c
+index d976036..66df307 100644
+--- a/src/ls.c
++++ b/src/ls.c
+@@ -1244,13 +1244,12 @@ process_signals (void)
+ }
+ }
+
+-int
+-main (int argc, char **argv)
+-{
+- int i;
+- struct pending *thispend;
+- int n_files;
++/* Setup signal handlers if INIT is true,
++ otherwise restore to the default. */
+
++static void
++signal_setup (bool init)
++{
+ /* The signals that are trapped, and the number of such signals. */
+ static int const sig[] =
+ {
+@@ -1278,8 +1277,77 @@ main (int argc, char **argv)
+ enum { nsigs = ARRAY_CARDINALITY (sig) };
+
+ #if ! SA_NOCLDSTOP
+- bool caught_sig[nsigs];
++ static bool caught_sig[nsigs];
++#endif
++
++ int j;
++
++ if (init)
++ {
++#if SA_NOCLDSTOP
++ struct sigaction act;
++
++ sigemptyset (&caught_signals);
++ for (j = 0; j < nsigs; j++)
++ {
++ sigaction (sig[j], NULL, &act);
++ if (act.sa_handler != SIG_IGN)
++ sigaddset (&caught_signals, sig[j]);
++ }
++
++ act.sa_mask = caught_signals;
++ act.sa_flags = SA_RESTART;
++
++ for (j = 0; j < nsigs; j++)
++ if (sigismember (&caught_signals, sig[j]))
++ {
++ act.sa_handler = sig[j] == SIGTSTP ? stophandler : sighandler;
++ sigaction (sig[j], &act, NULL);
++ }
++#else
++ for (j = 0; j < nsigs; j++)
++ {
++ caught_sig[j] = (signal (sig[j], SIG_IGN) != SIG_IGN);
++ if (caught_sig[j])
++ {
++ signal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler);
++ siginterrupt (sig[j], 0);
++ }
++ }
+ #endif
++ }
++ else /* restore. */
++ {
++#if SA_NOCLDSTOP
++ for (j = 0; j < nsigs; j++)
++ if (sigismember (&caught_signals, sig[j]))
++ signal (sig[j], SIG_DFL);
++#else
++ for (j = 0; j < nsigs; j++)
++ if (caught_sig[j])
++ signal (sig[j], SIG_DFL);
++#endif
++ }
++}
++
++static inline void
++signal_init (void)
++{
++ signal_setup (true);
++}
++
++static inline void
++signal_restore (void)
++{
++ signal_setup (false);
++}
++
++int
++main (int argc, char **argv)
++{
++ int i;
++ struct pending *thispend;
++ int n_files;
+
+ initialize_main (&argc, &argv);
+ set_program_name (argv[0]);
+@@ -1314,46 +1382,6 @@ main (int argc, char **argv)
+ || (is_colored (C_EXEC) && color_symlink_as_referent)
+ || (is_colored (C_MISSING) && format == long_format))
+ check_symlink_color = true;
+-
+- /* If the standard output is a controlling terminal, watch out
+- for signals, so that the colors can be restored to the
+- default state if "ls" is suspended or interrupted. */
+-
+- if (0 <= tcgetpgrp (STDOUT_FILENO))
+- {
+- int j;
+-#if SA_NOCLDSTOP
+- struct sigaction act;
+-
+- sigemptyset (&caught_signals);
+- for (j = 0; j < nsigs; j++)
+- {
+- sigaction (sig[j], NULL, &act);
+- if (act.sa_handler != SIG_IGN)
+- sigaddset (&caught_signals, sig[j]);
+- }
+-
+- act.sa_mask = caught_signals;
+- act.sa_flags = SA_RESTART;
+-
+- for (j = 0; j < nsigs; j++)
+- if (sigismember (&caught_signals, sig[j]))
+- {
+- act.sa_handler = sig[j] == SIGTSTP ? stophandler : sighandler;
+- sigaction (sig[j], &act, NULL);
+- }
+-#else
+- for (j = 0; j < nsigs; j++)
+- {
+- caught_sig[j] = (signal (sig[j], SIG_IGN) != SIG_IGN);
+- if (caught_sig[j])
+- {
+- signal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler);
+- siginterrupt (sig[j], 0);
+- }
+- }
+-#endif
+- }
+ }
+
+ if (dereference == DEREF_UNDEFINED)
+@@ -1466,32 +1494,21 @@ main (int argc, char **argv)
+ print_dir_name = true;
+ }
+
+- if (print_with_color)
++ if (print_with_color && used_color)
+ {
+ int j;
+
+- if (used_color)
+- {
+- /* Skip the restore when it would be a no-op, i.e.,
+- when left is "\033[" and right is "m". */
+- if (!(color_indicator[C_LEFT].len == 2
+- && memcmp (color_indicator[C_LEFT].string, "\033[", 2) == 0
+- && color_indicator[C_RIGHT].len == 1
+- && color_indicator[C_RIGHT].string[0] == 'm'))
+- restore_default_color ();
+- }
++ /* Skip the restore when it would be a no-op, i.e.,
++ when left is "\033[" and right is "m". */
++ if (!(color_indicator[C_LEFT].len == 2
++ && memcmp (color_indicator[C_LEFT].string, "\033[", 2) == 0
++ && color_indicator[C_RIGHT].len == 1
++ && color_indicator[C_RIGHT].string[0] == 'm'))
++ restore_default_color ();
++
+ fflush (stdout);
+
+- /* Restore the default signal handling. */
+-#if SA_NOCLDSTOP
+- for (j = 0; j < nsigs; j++)
+- if (sigismember (&caught_signals, sig[j]))
+- signal (sig[j], SIG_DFL);
+-#else
+- for (j = 0; j < nsigs; j++)
+- if (caught_sig[j])
+- signal (sig[j], SIG_DFL);
+-#endif
++ signal_restore ();
+
+ /* Act on any signals that arrived before the default was restored.
+ This can process signals out of order, but there doesn't seem to
+@@ -4482,6 +4499,14 @@ put_indicator (const struct bin_str *ind)
+ if (! used_color)
+ {
+ used_color = true;
++
++ /* If the standard output is a controlling terminal, watch out
++ for signals, so that the colors can be restored to the
++ default state if "ls" is suspended or interrupted. */
++
++ if (0 <= tcgetpgrp (STDOUT_FILENO))
++ signal_init ();
++
+ prep_non_filename_text ();
+ }
+
+--
+2.7.4
+
diff --git a/coreutils.spec b/coreutils.spec
index f9ac6ea..c364723 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -24,6 +24,8 @@ Source10: coreutils-find-requires.sh
Patch952: coreutils-8.25-intall-Z-selinux.patch
# fix 'sort -h -k' in locales that use blank as thousands separator (#1355780)
Patch953: coreutils-8.25-sort-thousands-sep.patch
+# ls: allow interruption when reading slow directories (#1365933)
+Patch954: coreutils-8.25-ls-signal.patch
# Our patches
#general patch to workaround koji build system issues
@@ -206,6 +208,7 @@ including documentation and translations.
# upstream patches
%patch953 -p1
+%patch954 -p1
chmod a+x \
tests/df/direct.sh \
@@ -374,6 +377,7 @@ fi
%changelog
* Mon Oct 31 2016 Kamil Dudka - 8.25-7
+- ls: allow interruption when reading slow directories (#1365933)
- fix 'sort -h -k' in locales that use blank as thousands separator (#1355780)
- make 'sort -h' work for arbitrary column even when using UTF-8 locales
- install -Z now sets default SELinux context for created directories (#1339135)
From ff7a1bf5b161d26012459080029022df2d407ebd Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 31 Oct 2016 17:52:01 +0100
Subject: [PATCH 034/232] md5sum,sha*sum: fix --ignore-missing with checksums
starting with 00
---
coreutils-8.25-sum-ignore-missing.patch | 115 ++++++++++++++++++++++++
coreutils.spec | 4 +
2 files changed, 119 insertions(+)
create mode 100644 coreutils-8.25-sum-ignore-missing.patch
diff --git a/coreutils-8.25-sum-ignore-missing.patch b/coreutils-8.25-sum-ignore-missing.patch
new file mode 100644
index 0000000..d27d176
--- /dev/null
+++ b/coreutils-8.25-sum-ignore-missing.patch
@@ -0,0 +1,115 @@
+From 1e1a69da31b39e4d672ccb8a3ca0e5400d4720ee Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?=
+Date: Wed, 26 Oct 2016 15:45:01 +0100
+Subject: [PATCH] md5sum,sha*sum: fix --ignore-missing with checksums starting
+ with 00
+
+* NEWS: Mention the fix.
+* src/md5sum.c (digest_file): Add a new MISSING parameter to
+return whether the file was missing, separately from the digest.
+* tests/misc/md5sum.pl: Add a test case.
+Fixes http://bugs.gnu.org/24795
+
+Upstream-commit: d0ddfadfb27def2861f35b1a45190a4c1780b257
+Signed-off-by: Kamil Dudka
+---
+ src/md5sum.c | 20 ++++++++++++--------
+ tests/misc/md5sum.pl | 7 +++++++
+ 2 files changed, 19 insertions(+), 8 deletions(-)
+
+diff --git a/src/md5sum.c b/src/md5sum.c
+index 933ec99..fee28c7 100644
+--- a/src/md5sum.c
++++ b/src/md5sum.c
+@@ -465,15 +465,19 @@ print_filename (char const *file, bool escape)
+ text because it was a terminal.
+
+ Put the checksum in *BIN_RESULT, which must be properly aligned.
++ Put true in *MISSING if the file can't be opened due to ENOENT.
+ Return true if successful. */
+
+ static bool
+-digest_file (const char *filename, int *binary, unsigned char *bin_result)
++digest_file (const char *filename, int *binary, unsigned char *bin_result,
++ bool *missing)
+ {
+ FILE *fp;
+ int err;
+ bool is_stdin = STREQ (filename, "-");
+
++ *missing = false;
++
+ if (is_stdin)
+ {
+ have_read_stdin = true;
+@@ -493,7 +497,7 @@ digest_file (const char *filename, int *binary, unsigned char *bin_result)
+ {
+ if (ignore_missing && errno == ENOENT)
+ {
+- *bin_result = '\0';
++ *missing = true;
+ return true;
+ }
+ error (0, errno, "%s", quotef (filename));
+@@ -606,14 +610,14 @@ digest_check (const char *checkfile_name)
+ '8', '9', 'a', 'b',
+ 'c', 'd', 'e', 'f' };
+ bool ok;
++ bool missing;
+ /* Only escape in the edge case producing multiple lines,
+ to ease automatic processing of status output. */
+ bool needs_escape = ! status_only && strchr (filename, '\n');
+
+ properly_formatted_lines = true;
+
+- *bin_buffer = '\1'; /* flag set to 0 for ignored missing files. */
+- ok = digest_file (filename, &binary, bin_buffer);
++ ok = digest_file (filename, &binary, bin_buffer, &missing);
+
+ if (!ok)
+ {
+@@ -626,10 +630,9 @@ digest_check (const char *checkfile_name)
+ printf (": %s\n", _("FAILED open or read"));
+ }
+ }
+- else if (ignore_missing && ! *bin_buffer)
++ else if (ignore_missing && missing)
+ {
+- /* Treat an empty buffer as meaning a missing file,
+- which is ignored with --ignore-missing. */
++ /* Ignore missing files with --ignore-missing. */
+ ;
+ }
+ else
+@@ -879,8 +882,9 @@ main (int argc, char **argv)
+ else
+ {
+ int file_is_binary = binary;
++ bool missing;
+
+- if (! digest_file (file, &file_is_binary, bin_buffer))
++ if (! digest_file (file, &file_is_binary, bin_buffer, &missing))
+ ok = false;
+ else
+ {
+diff --git a/tests/misc/md5sum.pl b/tests/misc/md5sum.pl
+index 2eb6369..6ea7457 100755
+--- a/tests/misc/md5sum.pl
++++ b/tests/misc/md5sum.pl
+@@ -149,6 +149,13 @@ my @Tests =
+ {ERR=>
+ "md5sum: f.md5: no file was verified\n"},
+ {EXIT=> 1}],
++ # coreutils-8.25 with --ignore-missing treated checksums starting with 00
++ # as if the file was not present
++ ['check-ignore-missing-6', '--check', '--ignore-missing',
++ {AUX=> {f=> '9t'}},
++ {IN=> {'f.md5' =>
++ "006999e6df389641adf1fa3a74801d9d f\n"}},
++ {OUT=>"f: OK\n"}],
+ ['bsd-segv', '--check', {IN=> {'z' => "MD5 ("}}, {EXIT=> 1},
+ {ERR=> "$prog: z: no properly formatted MD5 checksum lines found\n"}],
+
+--
+2.7.4
+
diff --git a/coreutils.spec b/coreutils.spec
index c364723..0e06eea 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -26,6 +26,8 @@ Patch952: coreutils-8.25-intall-Z-selinux.patch
Patch953: coreutils-8.25-sort-thousands-sep.patch
# ls: allow interruption when reading slow directories (#1365933)
Patch954: coreutils-8.25-ls-signal.patch
+# md5sum,sha*sum: fix --ignore-missing with checksums starting with 00
+Patch955: coreutils-8.25-sum-ignore-missing.patch
# Our patches
#general patch to workaround koji build system issues
@@ -209,6 +211,7 @@ including documentation and translations.
# upstream patches
%patch953 -p1
%patch954 -p1
+%patch955 -p1
chmod a+x \
tests/df/direct.sh \
@@ -377,6 +380,7 @@ fi
%changelog
* Mon Oct 31 2016 Kamil Dudka - 8.25-7
+- md5sum,sha*sum: fix --ignore-missing with checksums starting with 00
- ls: allow interruption when reading slow directories (#1365933)
- fix 'sort -h -k' in locales that use blank as thousands separator (#1355780)
- make 'sort -h' work for arbitrary column even when using UTF-8 locales
From 8d9eac4093e3f6c24f5659f64775cb81cb535b57 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Thu, 1 Dec 2016 14:26:30 +0100
Subject: [PATCH 035/232] new upstream release 8.26
---
.gitignore | 20 +-
coreutils-4.5.3-langinfo.patch | 8 +-
coreutils-6.10-configuration.patch | 125 +-
coreutils-6.10-manpages.patch | 9 +-
coreutils-8.2-uname-processortype.patch | 13 +-
coreutils-8.25-DIR_COLORS.patch | 40 +-
coreutils-8.25-intall-Z-selinux.patch | 188 ---
coreutils-8.25-ls-signal.patch | 236 ---
coreutils-8.25-sort-thousands-sep.patch | 332 ----
coreutils-8.25-sum-ignore-missing.patch | 115 --
coreutils-8.26.tar.xz.sig | 17 +
coreutils-8.4-mkdir-modenote.patch | 9 +-
coreutils-df-direct.patch | 38 +-
coreutils-i18n-cut-old.patch | 7 +-
coreutils-i18n-expand-unexpand.patch | 1664 +++++++--------------
coreutils-i18n-fix-unexpand.patch | 80 +-
coreutils-i18n-fix2-expand-unexpand.patch | 32 +-
coreutils-i18n-sort-human.patch | 2 +-
coreutils-i18n-un-expand-BOM.patch | 97 +-
coreutils-i18n.patch | 483 +++---
coreutils-overflow.patch | 8 +-
coreutils-selinux.patch | 61 +-
coreutils-selinuxmanpages.patch | 9 +-
coreutils.spec | 23 +-
sources | 3 +-
supported_utils | 1 +
26 files changed, 1093 insertions(+), 2527 deletions(-)
delete mode 100644 coreutils-8.25-intall-Z-selinux.patch
delete mode 100644 coreutils-8.25-ls-signal.patch
delete mode 100644 coreutils-8.25-sort-thousands-sep.patch
delete mode 100644 coreutils-8.25-sum-ignore-missing.patch
create mode 100644 coreutils-8.26.tar.xz.sig
diff --git a/.gitignore b/.gitignore
index b8fffbf..de62e8f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,19 +1 @@
-/coreutils-8.10.tar.xz
-/coreutils-8.11.tar.xz
-/coreutils-8.12.tar.xz
-/coreutils-8.13.tar.xz
-/coreutils-8.14.tar.xz
-/coreutils-8.15.tar.xz
-/coreutils-8.16.tar.xz
-/coreutils-8.17.tar.xz
-/coreutils-8.18.tar.xz
-/coreutils-8.19.tar.xz
-/coreutils-8.20.tar.xz
-/coreutils-8.21.tar.xz
-/coreutils-8.22.tar.xz
-/coreutils-8.23.tar.xz
-/coreutils-8.23.tar.xz.sig
-/coreutils-8.24.tar.xz
-/coreutils-8.24.tar.xz.sig
-/coreutils-8.25.tar.xz
-/coreutils-8.25.tar.xz.sig
+/coreutils-[0-9.]*.tar.xz
diff --git a/coreutils-4.5.3-langinfo.patch b/coreutils-4.5.3-langinfo.patch
index 48e0624..a8af3bd 100644
--- a/coreutils-4.5.3-langinfo.patch
+++ b/coreutils-4.5.3-langinfo.patch
@@ -1,6 +1,8 @@
---- coreutils-5.92/src/date.c.langinfo 2005-09-16 09:06:57.000000000 +0100
-+++ coreutils-5.92/src/date.c 2005-10-24 18:09:16.000000000 +0100
-@@ -474,14 +474,7 @@ main (int argc, char **argv)
+diff --git a/src/date.c b/src/date.c
+index ddb011e..619a72b 100644
+--- a/src/date.c
++++ b/src/date.c
+@@ -490,14 +490,7 @@ main (int argc, char **argv)
format = DATE_FMT_LANGINFO ();
if (! *format)
{
diff --git a/coreutils-6.10-configuration.patch b/coreutils-6.10-configuration.patch
index 7468ba2..c34fd99 100644
--- a/coreutils-6.10-configuration.patch
+++ b/coreutils-6.10-configuration.patch
@@ -1,6 +1,22 @@
-diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-tests/gnulib.mk
---- coreutils-8.21-orig/gnulib-tests/gnulib.mk 2013-02-07 17:58:44.000000000 +0100
-+++ coreutils-8.21/gnulib-tests/gnulib.mk 2013-02-15 10:12:28.110593165 +0100
+From 54ef056964da3d0987afd9f1e96b9419db0d653a Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Thu, 1 Dec 2016 14:32:46 +0100
+Subject: [PATCH] coreutils-6.10-configuration.patch
+
+TODO: check whether still necessary
+---
+ gnulib-tests/gnulib.mk | 60 +++++++++++++++++++++----------------------
+ man/local.mk | 2 +-
+ tests/df/skip-duplicates.sh | 3 +++
+ tests/local.mk | 2 +-
+ tests/misc/nohup.sh | 2 ++
+ tests/touch/no-dereference.sh | 2 ++
+ 6 files changed, 39 insertions(+), 32 deletions(-)
+
+diff --git a/gnulib-tests/gnulib.mk b/gnulib-tests/gnulib.mk
+index fee978f..8f32431 100644
+--- a/gnulib-tests/gnulib.mk
++++ b/gnulib-tests/gnulib.mk
@@ -279,9 +279,9 @@ EXTRA_DIST += nap.h test-chown.h test-chown.c signature.h macros.h
## begin gnulib module cloexec-tests
@@ -55,7 +71,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module getlogin-tests
-@@ -1147,10 +1147,10 @@ EXTRA_DIST += test-link.h test-link.c signature.h macros.h
+@@ -1148,10 +1148,10 @@ EXTRA_DIST += test-link.h test-link.c signature.h macros.h
## begin gnulib module linkat-tests
@@ -70,7 +86,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module linkat-tests
-@@ -1359,9 +1359,9 @@ EXTRA_DIST += test-memcoll.c macros.h
+@@ -1360,9 +1360,9 @@ EXTRA_DIST += test-memcoll.c macros.h
## begin gnulib module memrchr-tests
@@ -83,7 +99,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module memrchr-tests
-@@ -1912,9 +1912,9 @@ EXTRA_DIST += test-statat.c
+@@ -1913,9 +1913,9 @@ EXTRA_DIST += test-statat.c
## begin gnulib module stdalign-tests
@@ -96,7 +112,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module stdalign-tests
-@@ -2269,9 +2269,9 @@ EXTRA_DIST += test-uname.c signature.h macros.h
+@@ -2270,9 +2270,9 @@ EXTRA_DIST += test-uname.c signature.h macros.h
## begin gnulib module unistd-safer-tests
@@ -109,7 +125,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module unistd-safer-tests
-@@ -2367,10 +2367,10 @@ EXTRA_DIST += test-userspec.c
+@@ -2368,10 +2368,10 @@ EXTRA_DIST += test-userspec.c
## begin gnulib module utimens-tests
@@ -124,9 +140,37 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test
## end gnulib module utimens-tests
-diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk
---- coreutils-8.21-orig/tests/local.mk 2013-02-11 11:30:12.000000000 +0100
-+++ coreutils-8.21/tests/local.mk 2013-02-15 10:10:55.890532258 +0100
+diff --git a/man/local.mk b/man/local.mk
+index a39bb65..535690c 100644
+--- a/man/local.mk
++++ b/man/local.mk
+@@ -41,7 +41,7 @@ distclean-local:
+ test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS)
+
+ # Dependencies common to all man pages. Updated below.
+-mandeps =
++mandeps = $(PROGRAMS)
+
+ # Depend on this to get version number changes.
+ mandeps += .version
+diff --git a/tests/df/skip-duplicates.sh b/tests/df/skip-duplicates.sh
+index f349263..9854f8d 100755
+--- a/tests/df/skip-duplicates.sh
++++ b/tests/df/skip-duplicates.sh
+@@ -26,6 +26,9 @@ require_gcc_shared_
+ df --local --output=target >LOCAL_FS || skip_ 'df fails'
+ grep '^/$' LOCAL_FS || skip_ 'no root file system found'
+
++# mark it expensive, to temporarily skip the test in koji
++expensive_
++
+ # Get real targets to substitute for /NONROOT and /REMOTE below.
+ export CU_NONROOT_FS=$(grep /. LOCAL_FS | head -n1)
+ export CU_REMOTE_FS=$(grep /. LOCAL_FS | tail -n+2 | head -n1)
+diff --git a/tests/local.mk b/tests/local.mk
+index 3335002..568944e 100644
+--- a/tests/local.mk
++++ b/tests/local.mk
@@ -134,6 +134,7 @@ all_root_tests = \
tests/rm/no-give-up.sh \
tests/rm/one-file-system.sh \
@@ -143,21 +187,10 @@ diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk
tests/tail-2/inotify-hash-abuse2.sh \
tests/tail-2/F-vs-missing.sh \
tests/tail-2/F-vs-rename.sh \
-diff -urNp coreutils-8.21-orig/tests/touch/no-dereference.sh coreutils-8.21/tests/touch/no-dereference.sh
---- coreutils-8.21-orig/tests/touch/no-dereference.sh 2013-01-31 01:46:25.000000000 +0100
-+++ coreutils-8.21/tests/touch/no-dereference.sh 2013-02-15 10:10:55.889593383 +0100
-@@ -42,6 +42,8 @@ test -f nowhere && fail=1
- grep '^#define HAVE_UTIMENSAT 1' "$CONFIG_HEADER" > /dev/null ||
- grep '^#define HAVE_LUTIMES 1' "$CONFIG_HEADER" > /dev/null ||
- skip_ 'this system lacks the utimensat function'
-+grep '^#define HAVE_WORKINGKOJI 1' "$CONFIG_HEADER" > /dev/null ||
-+ skip_ 'rest of the test disabled due to koji lack of utimensat function'
-
- # Changing time of dangling symlink is okay.
- # Skip the test if this fails, but the error text corresponds to
-diff -urNp coreutils-8.22-orig/tests/misc/nohup.sh coreutils-8.22/tests/misc/nohup.sh
---- coreutils-8.22-orig/tests/misc/nohup.sh 2013-12-04 15:48:30.000000000 +0100
-+++ coreutils-8.22/tests/misc/nohup.sh 2014-03-02 21:51:01.972887749 +0100
+diff --git a/tests/misc/nohup.sh b/tests/misc/nohup.sh
+index 1b43b60..3fd29e7 100755
+--- a/tests/misc/nohup.sh
++++ b/tests/misc/nohup.sh
@@ -19,6 +19,8 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ nohup
@@ -167,29 +200,19 @@ diff -urNp coreutils-8.22-orig/tests/misc/nohup.sh coreutils-8.22/tests/misc/noh
nohup sh -c 'echo stdout; echo stderr 1>&2' 2>err || fail=1
-diff -urNp coreutils-8.23-orig/tests/df/skip-duplicates.sh coreutils-8.23/tests/df/skip-duplicates.sh
---- coreutils-8.23-orig/tests/df/skip-duplicates.sh 2014-07-14 00:09:52.000000000 +0200
-+++ coreutils-8.23/tests/df/skip-duplicates.sh 2014-07-24 15:53:33.473031545 +0200
-@@ -25,6 +25,10 @@ require_gcc_shared_
- # potentially very many remote mounts.
- df --local || skip_ 'df fails'
+diff --git a/tests/touch/no-dereference.sh b/tests/touch/no-dereference.sh
+index 7994638..72b2222 100755
+--- a/tests/touch/no-dereference.sh
++++ b/tests/touch/no-dereference.sh
+@@ -42,6 +42,8 @@ test -f nowhere && fail=1
+ grep '^#define HAVE_UTIMENSAT 1' "$CONFIG_HEADER" > /dev/null ||
+ grep '^#define HAVE_LUTIMES 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_ 'this system lacks the utimensat function'
++grep '^#define HAVE_WORKINGKOJI 1' "$CONFIG_HEADER" > /dev/null ||
++ skip_ 'rest of the test disabled due to koji lack of utimensat function'
-+#mark it expensive, to temporarily skip the test in koji
-+expensive_
-+
-+
- export CU_NONROOT_FS=$(df --local --output=target 2>&1 | grep /. | head -n1)
- export CU_REMOTE_FS=$(df --local --output=target 2>&1 | grep /. |
- tail -n+2 | head -n1)
-diff -urNp coreutils-8.23-orig/man/local.mk coreutils-8.23/man/local.mk
---- coreutils-8.23-orig/man/local.mk 2014-07-18 03:40:57.000000000 +0200
-+++ coreutils-8.23/man/local.mk 2014-08-05 12:18:20.477524009 +0200
-@@ -41,7 +41,7 @@ distclean-local:
- test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS)
-
- # Dependencies common to all man pages. Updated below.
--mandeps =
-+mandeps = $(PROGRAMS)
-
- # Depend on this to get version number changes.
- mandeps += .version
+ # Changing time of dangling symlink is okay.
+ # Skip the test if this fails, but the error text corresponds to
+--
+2.7.4
+
diff --git a/coreutils-6.10-manpages.patch b/coreutils-6.10-manpages.patch
index c795ca5..5f8bdb2 100644
--- a/coreutils-6.10-manpages.patch
+++ b/coreutils-6.10-manpages.patch
@@ -1,7 +1,8 @@
-diff -urNp coreutils-6.12-orig/src/md5sum.c coreutils-6.12/src/md5sum.c
---- coreutils-6.12-orig/src/md5sum.c 2008-05-26 08:40:33.000000000 +0200
-+++ coreutils-6.12/src/md5sum.c 2008-10-21 16:07:28.000000000 +0200
-@@ -200,6 +200,9 @@ Print or check %s (%d-bit) checksums.\n\
+diff --git a/src/md5sum.c b/src/md5sum.c
+index 8e21609..a857d62 100644
+--- a/src/md5sum.c
++++ b/src/md5sum.c
+@@ -266,6 +266,9 @@ Print or check %s (%d-bit) checksums.\n\
fputs (_("\
-t, --text read in text mode (default)\n\
"), stdout);
diff --git a/coreutils-8.2-uname-processortype.patch b/coreutils-8.2-uname-processortype.patch
index 0cb2422..ed01ab8 100644
--- a/coreutils-8.2-uname-processortype.patch
+++ b/coreutils-8.2-uname-processortype.patch
@@ -1,7 +1,8 @@
-diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
---- coreutils-8.2-orig/src/uname.c 2009-09-23 10:25:44.000000000 +0200
-+++ coreutils-8.2/src/uname.c 2009-12-19 09:09:11.663607110 +0100
-@@ -299,13 +299,19 @@ main (int argc, char **argv)
+diff --git a/src/uname.c b/src/uname.c
+index 6371ca2..1ad8fd7 100644
+--- a/src/uname.c
++++ b/src/uname.c
+@@ -300,13 +300,19 @@ main (int argc, char **argv)
if (toprint & PRINT_PROCESSOR)
{
@@ -22,7 +23,7 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
#endif
#ifdef UNAME_PROCESSOR
if (element == unknown)
-@@ -343,7 +349,7 @@ main (int argc, char **argv)
+@@ -344,7 +350,7 @@ main (int argc, char **argv)
if (toprint & PRINT_HARDWARE_PLATFORM)
{
@@ -31,7 +32,7 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c
#if HAVE_SYSINFO && defined SI_PLATFORM
{
static char hardware_platform[257];
-@@ -351,6 +357,14 @@ main (int argc, char **argv)
+@@ -352,6 +358,14 @@ main (int argc, char **argv)
hardware_platform, sizeof hardware_platform))
element = hardware_platform;
}
diff --git a/coreutils-8.25-DIR_COLORS.patch b/coreutils-8.25-DIR_COLORS.patch
index 54a96eb..a8a2d1a 100644
--- a/coreutils-8.25-DIR_COLORS.patch
+++ b/coreutils-8.25-DIR_COLORS.patch
@@ -4,10 +4,10 @@ Date: Fri, 17 Jun 2016 16:58:18 +0200
Subject: [PATCH] downstream changes to default DIR_COLORS
---
- DIR_COLORS | 44 +++----
- DIR_COLORS.256color | 296 +++++++++++++++++++++++-------------------------
- DIR_COLORS.lightbgcolor | 203 +++++++++++++++++----------------
- 3 files changed, 271 insertions(+), 272 deletions(-)
+ DIR_COLORS | 44 ++++----
+ DIR_COLORS.256color | 294 +++++++++++++++++++++++-------------------------
+ DIR_COLORS.lightbgcolor | 207 +++++++++++++++++-----------------
+ 3 files changed, 271 insertions(+), 274 deletions(-)
diff --git a/DIR_COLORS b/DIR_COLORS
index d2ea453..27af9d7 100644
@@ -34,7 +34,7 @@ index d2ea453..27af9d7 100644
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
-@@ -62,7 +68,7 @@ DOOR 01;35 # door
+@@ -56,7 +62,7 @@ DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
@@ -43,7 +43,7 @@ index d2ea453..27af9d7 100644
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
-@@ -183,21 +189,21 @@ EXEC 01;32
+@@ -181,21 +187,21 @@ EXEC 01;32
.ogx 01;35
# audio formats
@@ -85,7 +85,7 @@ diff --git a/DIR_COLORS.256color b/DIR_COLORS.256color
index d2ea453..74c34ba 100644
--- a/DIR_COLORS.256color
+++ b/DIR_COLORS.256color
-@@ -1,45 +1,22 @@
+@@ -1,39 +1,22 @@
-# Configuration file for dircolors, a utility to help you set the
-# LS_COLORS environment variable used by GNU ls with the --color option.
+# Configuration file for the 256color ls utility
@@ -109,30 +109,24 @@ index d2ea453..74c34ba 100644
# against the TERM environment variable to determine if it is colorizable.
-TERM Eterm
-TERM ansi
--TERM color-xterm
+-TERM *color*
-TERM con[0-9]*x[0-9]*
-TERM cons25
-TERM console
-TERM cygwin
-TERM dtterm
--TERM eterm-color
-TERM gnome
--TERM gnome-256color
-TERM hurd
-TERM jfbterm
-TERM konsole
-TERM kterm
-TERM linux
-TERM linux-c
--TERM mach-color
--TERM mach-gnu-color
-TERM mlterm
-TERM putty
--TERM putty-256color
-TERM rxvt*
-TERM screen*
-TERM st
--TERM st-256color
-TERM terminator
-TERM tmux*
-TERM vt100
@@ -142,7 +136,7 @@ index d2ea453..74c34ba 100644
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
-@@ -49,29 +26,40 @@ TERM xterm*
+@@ -43,29 +26,40 @@ TERM xterm*
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
@@ -199,7 +193,7 @@ index d2ea453..74c34ba 100644
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
-@@ -89,115 +77,115 @@ EXEC 01;32
+@@ -83,119 +77,115 @@ EXEC 01;32
#.csh 01;32
# archives or compressed (bright red)
@@ -225,6 +219,8 @@ index d2ea453..74c34ba 100644
-.lz 01;31
-.lzo 01;31
-.xz 01;31
+-.zst 01;31
+-.tzst 01;31
-.bz2 01;31
-.bz 01;31
-.tbz 01;31
@@ -289,6 +285,8 @@ index d2ea453..74c34ba 100644
# image formats
-.jpg 01;35
-.jpeg 01;35
+-.mjpg 01;35
+-.mjpeg 01;35
-.gif 01;35
-.bmp 01;35
-.pbm 01;35
@@ -445,7 +443,7 @@ index d2ea453..95d6879 100644
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
-@@ -52,17 +57,17 @@ TERM xterm*
+@@ -46,17 +51,17 @@ TERM xterm*
#NORMAL 00 # no color code at all
#FILE 00 # regular file: use no color at all
RESET 0 # reset to "normal" color
@@ -468,7 +466,7 @@ index d2ea453..95d6879 100644
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
-@@ -71,7 +76,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
+@@ -65,7 +70,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
@@ -477,7 +475,7 @@ index d2ea453..95d6879 100644
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
-@@ -88,99 +93,99 @@ EXEC 01;32
+@@ -82,103 +87,99 @@ EXEC 01;32
#.sh 01;32
#.csh 01;32
@@ -504,6 +502,8 @@ index d2ea453..95d6879 100644
-.lz 01;31
-.lzo 01;31
-.xz 01;31
+-.zst 01;31
+-.tzst 01;31
-.bz2 01;31
-.bz 01;31
-.tbz 01;31
@@ -569,6 +569,8 @@ index d2ea453..95d6879 100644
# image formats
-.jpg 01;35
-.jpeg 01;35
+-.mjpg 01;35
+-.mjpeg 01;35
-.gif 01;35
-.bmp 01;35
-.pbm 01;35
diff --git a/coreutils-8.25-intall-Z-selinux.patch b/coreutils-8.25-intall-Z-selinux.patch
deleted file mode 100644
index 0f5ef33..0000000
--- a/coreutils-8.25-intall-Z-selinux.patch
+++ /dev/null
@@ -1,188 +0,0 @@
-From c424bbcb532c5b9924349e3522b3b431eaa7c178 Mon Sep 17 00:00:00 2001
-From: Kamil Dudka
-Date: Fri, 8 Jul 2016 18:59:35 +0200
-Subject: [PATCH] install: with -Z, set default SELinux context for created
- directories
-
-* doc/coreutils.texi (install invocation): Update -Z documentation.
-* src/install.c (make_ancestor): Set default security context before
-calling mkdir() if the -Z option is given.
-(process_dir): Call restorecon() on the destination directory if the
--Z option is given.
-(usage): Update -Z documentation.
-* tests/install/install-Z-selinux.sh: A new test for 'install -Z -D'
-and 'install -Z -d' based on tests/mkdir/restorecon.sh.
-* tests/local.mk: Reference the test.
-* NEWS: Mention the improvement.
-Reported at https://bugzilla.redhat.com/1339135
-Fixes http://bugs.gnu.org/23868
-
-Upstream-commit: 502518b44039138d148e2e15157d125c82d02af0
-Signed-off-by: Kamil Dudka
----
- doc/coreutils.texi | 2 +-
- src/install.c | 33 ++++++++++++++++++----
- tests/install/install-Z-selinux.sh | 58 ++++++++++++++++++++++++++++++++++++++
- tests/local.mk | 1 +
- 4 files changed, 88 insertions(+), 6 deletions(-)
- create mode 100644 tests/install/install-Z-selinux.sh
-
-diff --git a/doc/coreutils.texi b/doc/coreutils.texi
-index 092192c..1543f27 100644
---- a/doc/coreutils.texi
-+++ b/doc/coreutils.texi
-@@ -9208,7 +9208,7 @@ Print the name of each file before moving it.
- @cindex security context
- This option functions similarly to the @command{restorecon} command,
- by adjusting the SELinux security context according
--to the system default type for destination files.
-+to the system default type for destination files and each created directory.
-
- @end table
-
-diff --git a/src/install.c b/src/install.c
-index 089f298..1b7a209 100644
---- a/src/install.c
-+++ b/src/install.c
-@@ -39,6 +39,7 @@
- #include "prog-fprintf.h"
- #include "quote.h"
- #include "savewd.h"
-+#include "selinux.h"
- #include "stat-time.h"
- #include "utimens.h"
- #include "xstrtol.h"
-@@ -423,6 +424,12 @@ announce_mkdir (char const *dir, void *options)
- static int
- make_ancestor (char const *dir, char const *component, void *options)
- {
-+ struct cp_options const *x = options;
-+ if (x->set_security_context && defaultcon (dir, S_IFDIR) < 0
-+ && ! ignorable_ctx_err (errno))
-+ error (0, errno, _("failed to set default creation context for %s"),
-+ quoteaf (dir));
-+
- int r = mkdir (component, DEFAULT_MODE);
- if (r == 0)
- announce_mkdir (dir, options);
-@@ -433,12 +440,28 @@ make_ancestor (char const *dir, char const *component, void *options)
- static int
- process_dir (char *dir, struct savewd *wd, void *options)
- {
-- return (make_dir_parents (dir, wd,
-- make_ancestor, options,
-- dir_mode, announce_mkdir,
-- dir_mode_bits, owner_id, group_id, false)
-+ struct cp_options const *x = options;
-+
-+ int ret = (make_dir_parents (dir, wd, make_ancestor, options,
-+ dir_mode, announce_mkdir,
-+ dir_mode_bits, owner_id, group_id, false)
- ? EXIT_SUCCESS
- : EXIT_FAILURE);
-+
-+ /* FIXME: Due to the current structure of make_dir_parents()
-+ we don't have the facility to call defaultcon() before the
-+ final component of DIR is created. So for now, create the
-+ final component with the context from previous component
-+ and here we set the context for the final component. */
-+ if (ret == EXIT_SUCCESS && x->set_security_context)
-+ {
-+ if (! restorecon (last_component (dir), false, false)
-+ && ! ignorable_ctx_err (errno))
-+ error (0, errno, _("failed to restore context for %s"),
-+ quoteaf (dir));
-+ }
-+
-+ return ret;
- }
-
- /* Copy file FROM onto file TO, creating TO if necessary.
-@@ -651,7 +674,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\
- fputs (_("\
- -P, --preserve-context preserve SELinux security context (-P deprecated)\n\
- -Z set SELinux security context of destination\n\
-- file to default type\n\
-+ file and each created directory to default type\n\
- --context[=CTX] like -Z, or if CTX is specified then set the\n\
- SELinux or SMACK security context to CTX\n\
- "), stdout);
-diff --git a/tests/install/install-Z-selinux.sh b/tests/install/install-Z-selinux.sh
-new file mode 100644
-index 0000000..9c3b642
---- /dev/null
-+++ b/tests/install/install-Z-selinux.sh
-@@ -0,0 +1,58 @@
-+#!/bin/sh
-+# test 'install -Z -D' and 'install -Z -d'
-+# based on tests/mkdir/restorecon.sh
-+
-+# Copyright (C) 2013-2016 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 .
-+
-+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-+print_ver_ ginstall
-+require_selinux_
-+
-+
-+get_selinux_type() { ls -Zd "$1" | sed -n 's/.*:\(.*_t\):.*/\1/p'; }
-+
-+mkdir subdir || framework_failure_
-+chcon 'root:object_r:tmp_t:s0' subdir || framework_failure_
-+cd subdir
-+
-+# Since in a tmp_t dir, dirs can be created as user_tmp_t ...
-+touch standard || framework_failure_
-+mkdir restored || framework_failure_
-+if restorecon restored 2>/dev/null; then
-+ # ... but when restored can be set to user_home_t
-+ # So ensure the type for these mkdir -Z cases matches
-+ # the directory type as set by restorecon.
-+ ginstall -Z standard single || fail=1
-+ ginstall -Z -d single_d || fail=1
-+ # Run these as separate processes in case global context
-+ # set for an arg, impacts on another arg
-+ # TODO: Have the defaultcon() vary over these directories
-+ for dst in single_d/existing/file multi/ple/file; do
-+ ginstall -Z -D standard "$dst" || fail=1
-+ done
-+ restored_type=$(get_selinux_type 'restored')
-+ test "$(get_selinux_type 'single')" = "$restored_type" || fail=1
-+ test "$(get_selinux_type 'single_d')" = "$restored_type" || fail=1
-+ test "$(get_selinux_type 'single_d/existing')" = "$restored_type" || fail=1
-+ test "$(get_selinux_type 'multi')" = "$restored_type" || fail=1
-+ test "$(get_selinux_type 'multi/ple')" = "$restored_type" || fail=1
-+fi
-+if test "$fail" = '1'; then
-+ ls -UZd standard restored
-+ ls -UZd single single_d single_d/existing multi multi/ple
-+fi
-+
-+Exit $fail
-diff --git a/tests/local.mk b/tests/local.mk
-index ec23448..42d39f2 100644
---- a/tests/local.mk
-+++ b/tests/local.mk
-@@ -548,6 +548,7 @@ all_tests = \
- tests/install/d-slashdot.sh \
- tests/install/install-C.sh \
- tests/install/install-C-selinux.sh \
-+ tests/install/install-Z-selinux.sh \
- tests/install/strip-program.sh \
- tests/install/trap.sh \
- tests/ln/backup-1.sh \
---
-2.5.5
-
diff --git a/coreutils-8.25-ls-signal.patch b/coreutils-8.25-ls-signal.patch
deleted file mode 100644
index 32cfd3a..0000000
--- a/coreutils-8.25-ls-signal.patch
+++ /dev/null
@@ -1,236 +0,0 @@
-From 9338b244572e07bbff314b3570228e8cf43f1300 Mon Sep 17 00:00:00 2001
-From: Kamil Dudka
-Date: Tue, 6 Sep 2016 17:38:26 +0200
-Subject: [PATCH] ls: allow interruption when reading slow directories
-
-Postpone installation of signal handlers until they're needed.
-That is right before the first escape sequence is printed.
-
-* src/ls.c (signal_setup): A new function refactored from main()
-to set and restore signal handlers.
-(main): Move signal handler setup to put_indicator()
-so that the default signal handling is untouched as long as possible.
-Adjusted condition for restoring signal handlers to reflect the change.
-(put_indicator): Install signal handlers if called for the very first
-time. It uses the same code that was in main() prior to this commit.
-* NEWS: Mention the improvement.
-
-See https://bugzilla.redhat.com/1365933
-Fixes http://bugs.gnu.org/24232
-
-Upstream-commit: 5445f7811ff945ea13aa2a0fd797eb4c0a0e4db0
-Signed-off-by: Kamil Dudka
----
- src/ls.c | 161 ++++++++++++++++++++++++++++++++++++---------------------------
- 1 file changed, 93 insertions(+), 68 deletions(-)
-
-diff --git a/src/ls.c b/src/ls.c
-index d976036..66df307 100644
---- a/src/ls.c
-+++ b/src/ls.c
-@@ -1244,13 +1244,12 @@ process_signals (void)
- }
- }
-
--int
--main (int argc, char **argv)
--{
-- int i;
-- struct pending *thispend;
-- int n_files;
-+/* Setup signal handlers if INIT is true,
-+ otherwise restore to the default. */
-
-+static void
-+signal_setup (bool init)
-+{
- /* The signals that are trapped, and the number of such signals. */
- static int const sig[] =
- {
-@@ -1278,8 +1277,77 @@ main (int argc, char **argv)
- enum { nsigs = ARRAY_CARDINALITY (sig) };
-
- #if ! SA_NOCLDSTOP
-- bool caught_sig[nsigs];
-+ static bool caught_sig[nsigs];
-+#endif
-+
-+ int j;
-+
-+ if (init)
-+ {
-+#if SA_NOCLDSTOP
-+ struct sigaction act;
-+
-+ sigemptyset (&caught_signals);
-+ for (j = 0; j < nsigs; j++)
-+ {
-+ sigaction (sig[j], NULL, &act);
-+ if (act.sa_handler != SIG_IGN)
-+ sigaddset (&caught_signals, sig[j]);
-+ }
-+
-+ act.sa_mask = caught_signals;
-+ act.sa_flags = SA_RESTART;
-+
-+ for (j = 0; j < nsigs; j++)
-+ if (sigismember (&caught_signals, sig[j]))
-+ {
-+ act.sa_handler = sig[j] == SIGTSTP ? stophandler : sighandler;
-+ sigaction (sig[j], &act, NULL);
-+ }
-+#else
-+ for (j = 0; j < nsigs; j++)
-+ {
-+ caught_sig[j] = (signal (sig[j], SIG_IGN) != SIG_IGN);
-+ if (caught_sig[j])
-+ {
-+ signal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler);
-+ siginterrupt (sig[j], 0);
-+ }
-+ }
- #endif
-+ }
-+ else /* restore. */
-+ {
-+#if SA_NOCLDSTOP
-+ for (j = 0; j < nsigs; j++)
-+ if (sigismember (&caught_signals, sig[j]))
-+ signal (sig[j], SIG_DFL);
-+#else
-+ for (j = 0; j < nsigs; j++)
-+ if (caught_sig[j])
-+ signal (sig[j], SIG_DFL);
-+#endif
-+ }
-+}
-+
-+static inline void
-+signal_init (void)
-+{
-+ signal_setup (true);
-+}
-+
-+static inline void
-+signal_restore (void)
-+{
-+ signal_setup (false);
-+}
-+
-+int
-+main (int argc, char **argv)
-+{
-+ int i;
-+ struct pending *thispend;
-+ int n_files;
-
- initialize_main (&argc, &argv);
- set_program_name (argv[0]);
-@@ -1314,46 +1382,6 @@ main (int argc, char **argv)
- || (is_colored (C_EXEC) && color_symlink_as_referent)
- || (is_colored (C_MISSING) && format == long_format))
- check_symlink_color = true;
--
-- /* If the standard output is a controlling terminal, watch out
-- for signals, so that the colors can be restored to the
-- default state if "ls" is suspended or interrupted. */
--
-- if (0 <= tcgetpgrp (STDOUT_FILENO))
-- {
-- int j;
--#if SA_NOCLDSTOP
-- struct sigaction act;
--
-- sigemptyset (&caught_signals);
-- for (j = 0; j < nsigs; j++)
-- {
-- sigaction (sig[j], NULL, &act);
-- if (act.sa_handler != SIG_IGN)
-- sigaddset (&caught_signals, sig[j]);
-- }
--
-- act.sa_mask = caught_signals;
-- act.sa_flags = SA_RESTART;
--
-- for (j = 0; j < nsigs; j++)
-- if (sigismember (&caught_signals, sig[j]))
-- {
-- act.sa_handler = sig[j] == SIGTSTP ? stophandler : sighandler;
-- sigaction (sig[j], &act, NULL);
-- }
--#else
-- for (j = 0; j < nsigs; j++)
-- {
-- caught_sig[j] = (signal (sig[j], SIG_IGN) != SIG_IGN);
-- if (caught_sig[j])
-- {
-- signal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler);
-- siginterrupt (sig[j], 0);
-- }
-- }
--#endif
-- }
- }
-
- if (dereference == DEREF_UNDEFINED)
-@@ -1466,32 +1494,21 @@ main (int argc, char **argv)
- print_dir_name = true;
- }
-
-- if (print_with_color)
-+ if (print_with_color && used_color)
- {
- int j;
-
-- if (used_color)
-- {
-- /* Skip the restore when it would be a no-op, i.e.,
-- when left is "\033[" and right is "m". */
-- if (!(color_indicator[C_LEFT].len == 2
-- && memcmp (color_indicator[C_LEFT].string, "\033[", 2) == 0
-- && color_indicator[C_RIGHT].len == 1
-- && color_indicator[C_RIGHT].string[0] == 'm'))
-- restore_default_color ();
-- }
-+ /* Skip the restore when it would be a no-op, i.e.,
-+ when left is "\033[" and right is "m". */
-+ if (!(color_indicator[C_LEFT].len == 2
-+ && memcmp (color_indicator[C_LEFT].string, "\033[", 2) == 0
-+ && color_indicator[C_RIGHT].len == 1
-+ && color_indicator[C_RIGHT].string[0] == 'm'))
-+ restore_default_color ();
-+
- fflush (stdout);
-
-- /* Restore the default signal handling. */
--#if SA_NOCLDSTOP
-- for (j = 0; j < nsigs; j++)
-- if (sigismember (&caught_signals, sig[j]))
-- signal (sig[j], SIG_DFL);
--#else
-- for (j = 0; j < nsigs; j++)
-- if (caught_sig[j])
-- signal (sig[j], SIG_DFL);
--#endif
-+ signal_restore ();
-
- /* Act on any signals that arrived before the default was restored.
- This can process signals out of order, but there doesn't seem to
-@@ -4482,6 +4499,14 @@ put_indicator (const struct bin_str *ind)
- if (! used_color)
- {
- used_color = true;
-+
-+ /* If the standard output is a controlling terminal, watch out
-+ for signals, so that the colors can be restored to the
-+ default state if "ls" is suspended or interrupted. */
-+
-+ if (0 <= tcgetpgrp (STDOUT_FILENO))
-+ signal_init ();
-+
- prep_non_filename_text ();
- }
-
---
-2.7.4
-
diff --git a/coreutils-8.25-sort-thousands-sep.patch b/coreutils-8.25-sort-thousands-sep.patch
deleted file mode 100644
index b9d2b5c..0000000
--- a/coreutils-8.25-sort-thousands-sep.patch
+++ /dev/null
@@ -1,332 +0,0 @@
-From c479153d77b419a6cae4551b63d2b73096c1130e Mon Sep 17 00:00:00 2001
-From: Kamil Dudka
-Date: Mon, 18 Jul 2016 19:04:43 +0200
-Subject: [PATCH 1/3] maint: sort.c: deduplicate code for traversing numbers
-
-* src/sort.c (traverse_raw_number): New function for traversing numbers.
-(find_unit_order): Use traverse_raw_number() instead of open-coding it.
-(debug_key): Likewise.
----
- src/sort.c | 63 ++++++++++++++++++++++++++++++++++----------------------------
- 1 file changed, 35 insertions(+), 28 deletions(-)
-
-diff --git a/src/sort.c b/src/sort.c
-index 5b02343..e28bb6c 100644
---- a/src/sort.c
-+++ b/src/sort.c
-@@ -2231,18 +2231,16 @@ static char const unit_order[UCHAR_LIM] =
- #endif
- };
-
--/* Return an integer that represents the order of magnitude of the
-- unit following the number. The number may contain thousands
-- separators and a decimal point, but it may not contain leading blanks.
-- Negative numbers get negative orders; zero numbers have a zero order. */
--
--static int _GL_ATTRIBUTE_PURE
--find_unit_order (char const *number)
-+/* Traverse number given as *number consisting of digits, thousands_sep, and
-+ decimal_point chars only. Returns the highest digit found in the number,
-+ or '\0' if no digit has been found. Upon return *number points at the
-+ character that immediately follows after the given number. */
-+static unsigned char
-+traverse_raw_number (char const **number)
- {
-- bool minus_sign = (*number == '-');
-- char const *p = number + minus_sign;
-- int nonzero = 0;
-+ char const *p = *number;
- unsigned char ch;
-+ unsigned char max_digit = '\0';
-
- /* Scan to end of number.
- Decimals or separators not followed by digits stop the scan.
-@@ -2253,16 +2251,34 @@ find_unit_order (char const *number)
- do
- {
- while (ISDIGIT (ch = *p++))
-- nonzero |= ch - '0';
-+ if (max_digit < ch)
-+ max_digit = ch;
- }
- while (ch == thousands_sep);
-
- if (ch == decimal_point)
- while (ISDIGIT (ch = *p++))
-- nonzero |= ch - '0';
-+ if (max_digit < ch)
-+ max_digit = ch;
-+
-+ *number = p - 1;
-+ return max_digit;
-+}
-+
-+/* Return an integer that represents the order of magnitude of the
-+ unit following the number. The number may contain thousands
-+ separators and a decimal point, but it may not contain leading blanks.
-+ Negative numbers get negative orders; zero numbers have a zero order. */
-
-- if (nonzero)
-+static int _GL_ATTRIBUTE_PURE
-+find_unit_order (char const *number)
-+{
-+ bool minus_sign = (*number == '-');
-+ char const *p = number + minus_sign;
-+ unsigned char max_digit = traverse_raw_number (&p);
-+ if ('0' < max_digit)
- {
-+ unsigned char ch = *p;
- int order = unit_order[ch];
- return (minus_sign ? -order : order);
- }
-@@ -2655,23 +2671,14 @@ debug_key (struct line const *line, struct keyfield const *key)
- ignore_value (strtold (beg, &tighter_lim));
- else if (key->numeric || key->human_numeric)
- {
-- char *p = beg + (beg < lim && *beg == '-');
-- bool found_digit = false;
-- unsigned char ch;
--
-- do
-+ char const *p = beg + (beg < lim && *beg == '-');
-+ unsigned char max_digit = traverse_raw_number (&p);
-+ if ('0' <= max_digit)
- {
-- while (ISDIGIT (ch = *p++))
-- found_digit = true;
-+ unsigned char ch = *p;
-+ tighter_lim = (char *) p
-+ + (key->human_numeric && unit_order[ch]);
- }
-- while (ch == thousands_sep);
--
-- if (ch == decimal_point)
-- while (ISDIGIT (ch = *p++))
-- found_digit = true;
--
-- if (found_digit)
-- tighter_lim = p - ! (key->human_numeric && unit_order[ch]);
- }
- else
- tighter_lim = lim;
---
-2.5.5
-
-
-From 8c39465a5b0343ff7a21286dd69ed5430685d2f7 Mon Sep 17 00:00:00 2001
-From: Kamil Dudka
-Date: Mon, 18 Jul 2016 19:04:44 +0200
-Subject: [PATCH 2/3] sort: make -h work with -k and blank used as thousands
- separator
-
-* src/sort.c (traverse_raw_number): Allow to skip only one occurrence
-of thousands_sep to avoid finding the unit in the next column in case
-thousands_sep matches as blank and is used as column delimiter.
-* tests/misc/sort-h-thousands-sep.sh: Add regression test for this bug.
-* tests/local.mk: Reference the test.
-* NEWS: Mention the bug fix.
-Reported at https://bugzilla.redhat.com/1355780
-Fixes http://bugs.gnu.org/24015
----
- src/sort.c | 14 ++++++++----
- tests/local.mk | 1 +
- tests/misc/sort-h-thousands-sep.sh | 47 ++++++++++++++++++++++++++++++++++++++
- 3 files changed, 57 insertions(+), 5 deletions(-)
- create mode 100755 tests/misc/sort-h-thousands-sep.sh
-
-diff --git a/src/sort.c b/src/sort.c
-index e28bb6c..dd3ba58 100644
---- a/src/sort.c
-+++ b/src/sort.c
-@@ -2248,13 +2248,17 @@ traverse_raw_number (char const **number)
- to be lacking in units.
- FIXME: add support for multibyte thousands_sep and decimal_point. */
-
-- do
-+ while (ISDIGIT (ch = *p++))
- {
-- while (ISDIGIT (ch = *p++))
-- if (max_digit < ch)
-- max_digit = ch;
-+ if (max_digit < ch)
-+ max_digit = ch;
-+
-+ /* Allow to skip only one occurrence of thousands_sep to avoid finding
-+ the unit in the next column in case thousands_sep matches as blank
-+ and is used as column delimiter. */
-+ if (*p == thousands_sep)
-+ ++p;
- }
-- while (ch == thousands_sep);
-
- if (ch == decimal_point)
- while (ISDIGIT (ch = *p++))
-diff --git a/tests/local.mk b/tests/local.mk
-index 42d39f2..dccff8d 100644
---- a/tests/local.mk
-+++ b/tests/local.mk
-@@ -344,6 +344,7 @@ all_tests = \
- tests/misc/sort-discrim.sh \
- tests/misc/sort-files0-from.pl \
- tests/misc/sort-float.sh \
-+ tests/misc/sort-h-thousands-sep.sh \
- tests/misc/sort-mb-tests.sh \
- tests/i18n/sort.sh \
- tests/misc/sort-merge.pl \
-diff --git a/tests/misc/sort-h-thousands-sep.sh b/tests/misc/sort-h-thousands-sep.sh
-new file mode 100755
-index 0000000..17f1b6c
---- /dev/null
-+++ b/tests/misc/sort-h-thousands-sep.sh
-@@ -0,0 +1,47 @@
-+#!/bin/sh
-+# exercise 'sort -h' in locales where thousands separator is blank
-+
-+# Copyright (C) 2016 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 .
-+
-+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-+print_ver_ sort
-+test "$(LC_ALL=sv_SE locale thousands_sep)" = ' ' \
-+ || skip_ 'The Swedish locale with blank thousands separator is unavailable.'
-+
-+tee exp1 > in << _EOF_
-+1 1k 4 003 1M
-+2k 2M 4 002 2
-+3M 3 4 001 3k
-+_EOF_
-+
-+cat > exp2 << _EOF_
-+3M 3 4 001 3k
-+1 1k 4 003 1M
-+2k 2M 4 002 2
-+_EOF_
-+
-+cat > exp3 << _EOF_
-+3M 3 4 001 3k
-+2k 2M 4 002 2
-+1 1k 4 003 1M
-+_EOF_
-+
-+for i in 1 2 3; do
-+ LC_ALL="sv_SE.utf8" sort -h -k $i "in" > "out${i}" || fail=1
-+ compare "exp${i}" "out${i}" || fail=1
-+done
-+
-+Exit $fail
---
-2.5.5
-
-
-From 46ef53f558e7bc1c0bc0abd62a86b40b4141e058 Mon Sep 17 00:00:00 2001
-From: Kamil Dudka
-Date: Mon, 18 Jul 2016 19:04:45 +0200
-Subject: [PATCH 3/3] sort: with -h, disallow thousands separator between
- number and unit
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-* src/sort.c (traverse_raw_number): Accept thousands separator only
-if it is immediately followed by a digit.
-* tests/misc/sort-h-thousands-sep.sh: Cover the fix for this bug.
-
-Suggested by Pádraig Brady in http://bugs.gnu.org/24015
----
- src/sort.c | 11 ++++++++++-
- tests/misc/sort-h-thousands-sep.sh | 25 +++++++++++++------------
- 2 files changed, 23 insertions(+), 13 deletions(-)
-
-diff --git a/src/sort.c b/src/sort.c
-index dd3ba58..69ef75f 100644
---- a/src/sort.c
-+++ b/src/sort.c
-@@ -2241,6 +2241,7 @@ traverse_raw_number (char const **number)
- char const *p = *number;
- unsigned char ch;
- unsigned char max_digit = '\0';
-+ bool ends_with_thousands_sep = false;
-
- /* Scan to end of number.
- Decimals or separators not followed by digits stop the scan.
-@@ -2256,10 +2257,18 @@ traverse_raw_number (char const **number)
- /* Allow to skip only one occurrence of thousands_sep to avoid finding
- the unit in the next column in case thousands_sep matches as blank
- and is used as column delimiter. */
-- if (*p == thousands_sep)
-+ ends_with_thousands_sep = (*p == thousands_sep);
-+ if (ends_with_thousands_sep)
- ++p;
- }
-
-+ if (ends_with_thousands_sep)
-+ {
-+ /* thousands_sep not followed by digit is not allowed. */
-+ *number = p - 2;
-+ return max_digit;
-+ }
-+
- if (ch == decimal_point)
- while (ISDIGIT (ch = *p++))
- if (max_digit < ch)
-diff --git a/tests/misc/sort-h-thousands-sep.sh b/tests/misc/sort-h-thousands-sep.sh
-index 17f1b6c..3ffa89e 100755
---- a/tests/misc/sort-h-thousands-sep.sh
-+++ b/tests/misc/sort-h-thousands-sep.sh
-@@ -18,28 +18,29 @@
-
- . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
- print_ver_ sort
-+
- test "$(LC_ALL=sv_SE locale thousands_sep)" = ' ' \
- || skip_ 'The Swedish locale with blank thousands separator is unavailable.'
-
--tee exp1 > in << _EOF_
--1 1k 4 003 1M
--2k 2M 4 002 2
--3M 3 4 001 3k
-+tee exp1 exp3 > in << _EOF_
-+1 1k 1 M 4 003 1M
-+2k 2M 2 k 4 002 2
-+3M 3 3 G 4 001 3k
- _EOF_
-
- cat > exp2 << _EOF_
--3M 3 4 001 3k
--1 1k 4 003 1M
--2k 2M 4 002 2
-+3M 3 3 G 4 001 3k
-+1 1k 1 M 4 003 1M
-+2k 2M 2 k 4 002 2
- _EOF_
-
--cat > exp3 << _EOF_
--3M 3 4 001 3k
--2k 2M 4 002 2
--1 1k 4 003 1M
-+cat > exp5 << _EOF_
-+3M 3 3 G 4 001 3k
-+2k 2M 2 k 4 002 2
-+1 1k 1 M 4 003 1M
- _EOF_
-
--for i in 1 2 3; do
-+for i in 1 2 3 5; do
- LC_ALL="sv_SE.utf8" sort -h -k $i "in" > "out${i}" || fail=1
- compare "exp${i}" "out${i}" || fail=1
- done
---
-2.5.5
-
diff --git a/coreutils-8.25-sum-ignore-missing.patch b/coreutils-8.25-sum-ignore-missing.patch
deleted file mode 100644
index d27d176..0000000
--- a/coreutils-8.25-sum-ignore-missing.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-From 1e1a69da31b39e4d672ccb8a3ca0e5400d4720ee Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?P=C3=A1draig=20Brady?=
-Date: Wed, 26 Oct 2016 15:45:01 +0100
-Subject: [PATCH] md5sum,sha*sum: fix --ignore-missing with checksums starting
- with 00
-
-* NEWS: Mention the fix.
-* src/md5sum.c (digest_file): Add a new MISSING parameter to
-return whether the file was missing, separately from the digest.
-* tests/misc/md5sum.pl: Add a test case.
-Fixes http://bugs.gnu.org/24795
-
-Upstream-commit: d0ddfadfb27def2861f35b1a45190a4c1780b257
-Signed-off-by: Kamil Dudka
----
- src/md5sum.c | 20 ++++++++++++--------
- tests/misc/md5sum.pl | 7 +++++++
- 2 files changed, 19 insertions(+), 8 deletions(-)
-
-diff --git a/src/md5sum.c b/src/md5sum.c
-index 933ec99..fee28c7 100644
---- a/src/md5sum.c
-+++ b/src/md5sum.c
-@@ -465,15 +465,19 @@ print_filename (char const *file, bool escape)
- text because it was a terminal.
-
- Put the checksum in *BIN_RESULT, which must be properly aligned.
-+ Put true in *MISSING if the file can't be opened due to ENOENT.
- Return true if successful. */
-
- static bool
--digest_file (const char *filename, int *binary, unsigned char *bin_result)
-+digest_file (const char *filename, int *binary, unsigned char *bin_result,
-+ bool *missing)
- {
- FILE *fp;
- int err;
- bool is_stdin = STREQ (filename, "-");
-
-+ *missing = false;
-+
- if (is_stdin)
- {
- have_read_stdin = true;
-@@ -493,7 +497,7 @@ digest_file (const char *filename, int *binary, unsigned char *bin_result)
- {
- if (ignore_missing && errno == ENOENT)
- {
-- *bin_result = '\0';
-+ *missing = true;
- return true;
- }
- error (0, errno, "%s", quotef (filename));
-@@ -606,14 +610,14 @@ digest_check (const char *checkfile_name)
- '8', '9', 'a', 'b',
- 'c', 'd', 'e', 'f' };
- bool ok;
-+ bool missing;
- /* Only escape in the edge case producing multiple lines,
- to ease automatic processing of status output. */
- bool needs_escape = ! status_only && strchr (filename, '\n');
-
- properly_formatted_lines = true;
-
-- *bin_buffer = '\1'; /* flag set to 0 for ignored missing files. */
-- ok = digest_file (filename, &binary, bin_buffer);
-+ ok = digest_file (filename, &binary, bin_buffer, &missing);
-
- if (!ok)
- {
-@@ -626,10 +630,9 @@ digest_check (const char *checkfile_name)
- printf (": %s\n", _("FAILED open or read"));
- }
- }
-- else if (ignore_missing && ! *bin_buffer)
-+ else if (ignore_missing && missing)
- {
-- /* Treat an empty buffer as meaning a missing file,
-- which is ignored with --ignore-missing. */
-+ /* Ignore missing files with --ignore-missing. */
- ;
- }
- else
-@@ -879,8 +882,9 @@ main (int argc, char **argv)
- else
- {
- int file_is_binary = binary;
-+ bool missing;
-
-- if (! digest_file (file, &file_is_binary, bin_buffer))
-+ if (! digest_file (file, &file_is_binary, bin_buffer, &missing))
- ok = false;
- else
- {
-diff --git a/tests/misc/md5sum.pl b/tests/misc/md5sum.pl
-index 2eb6369..6ea7457 100755
---- a/tests/misc/md5sum.pl
-+++ b/tests/misc/md5sum.pl
-@@ -149,6 +149,13 @@ my @Tests =
- {ERR=>
- "md5sum: f.md5: no file was verified\n"},
- {EXIT=> 1}],
-+ # coreutils-8.25 with --ignore-missing treated checksums starting with 00
-+ # as if the file was not present
-+ ['check-ignore-missing-6', '--check', '--ignore-missing',
-+ {AUX=> {f=> '9t'}},
-+ {IN=> {'f.md5' =>
-+ "006999e6df389641adf1fa3a74801d9d f\n"}},
-+ {OUT=>"f: OK\n"}],
- ['bsd-segv', '--check', {IN=> {'z' => "MD5 ("}}, {EXIT=> 1},
- {ERR=> "$prog: z: no properly formatted MD5 checksum lines found\n"}],
-
---
-2.7.4
-
diff --git a/coreutils-8.26.tar.xz.sig b/coreutils-8.26.tar.xz.sig
new file mode 100644
index 0000000..fe1635d
--- /dev/null
+++ b/coreutils-8.26.tar.xz.sig
@@ -0,0 +1,17 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iQIcBAABAgAGBQJYPyRpAAoJEN9v2XEwYDfZ0I4P/3oaPYXMPEOKuDDpEcLumn26
+gYIMQc1jIMbBNQe120gQmNPkRr5dTKt5Bap9qYkCj0pI/6VxVIWDo0xrOLYZi7AN
+Xgr0kX2qLDFEH+EHkC1BpsAdpsgwfvLmVWPHS62CNKgVDgGiP1cRJZe8oVmlBCiR
+3ES7pUsBfDn3hbdKNTTmMDtro1rQMOxfHkVCZLAva+JjdzpE+KTvzZzKkVuZZfJ/
+Mi/ZySrXZXFvPBS7GXgop4x8EodyzQMeKO+nvpIUEBY1yLQgCvni5/CBI8w/EViD
+DSjj0zWsCQkEjx6HCohi8sBHUYZ+M3lB4rkFk7aevdioPZUGfLkW31LT/cUJC/VV
+MIQKWzQtZO/WCJuyEbWP2m25c4MtnnhTm5yoi29yT/CoTRlUWkIQpXm4oD1cJXHy
+PpHveu8qM0qRaAtVdXE3pmapIMYUV4g7vxSuCjZRrgiDLhp/K7Lzt5xBhl++kPU2
+U9uc202eah4Towo0pbHsuEJT0vk0GGLq8/17dCa/ss8wV+86ZLxl0kZYy4CNEnIW
+vsCN6CJ5AoAEVrMN1F7ZJYnH4hoJedvIczThnAkNTqYYE3wnN9stOe28Oy/a0/tg
+bt5/Mn0JbmQei890uU8zcEdUjidHqGV4hKk1E2UC4UCyHG/VcHv9gfr8OaD/xPDr
+SoauDCHpBU7J7FT/DX+k
+=vkKy
+-----END PGP SIGNATURE-----
diff --git a/coreutils-8.4-mkdir-modenote.patch b/coreutils-8.4-mkdir-modenote.patch
index 1f03c8d..51a129e 100644
--- a/coreutils-8.4-mkdir-modenote.patch
+++ b/coreutils-8.4-mkdir-modenote.patch
@@ -1,7 +1,8 @@
-diff -urNp coreutils-8.4-orig/doc/coreutils.texi coreutils-8.4/doc/coreutils.texi
---- coreutils-8.4-orig/doc/coreutils.texi 2011-01-07 15:01:18.575654333 +0100
-+++ coreutils-8.4/doc/coreutils.texi 2011-01-07 15:05:38.791655243 +0100
-@@ -9993,6 +9993,8 @@ incorrect. @xref{Directory Setuid and Setgid}, for how the
+diff --git a/doc/coreutils.texi b/doc/coreutils.texi
+index 400e135..47e4480 100644
+--- a/doc/coreutils.texi
++++ b/doc/coreutils.texi
+@@ -10074,6 +10074,8 @@ incorrect. @xref{Directory Setuid and Setgid}, for how the
set-user-ID and set-group-ID bits of directories are inherited unless
overridden in this way.
diff --git a/coreutils-df-direct.patch b/coreutils-df-direct.patch
index e69cd2b..a69d896 100644
--- a/coreutils-df-direct.patch
+++ b/coreutils-df-direct.patch
@@ -1,7 +1,8 @@
-diff -urNp coreutils-8.21-orig/doc/coreutils.texi coreutils-8.21/doc/coreutils.texi
---- coreutils-8.21-orig/doc/coreutils.texi 2013-02-11 10:37:28.000000000 +0100
-+++ coreutils-8.21/doc/coreutils.texi 2013-02-15 10:15:26.497593689 +0100
-@@ -11221,6 +11221,13 @@ some systems (notably SunOS), doing this yields more up to date results,
+diff --git a/doc/coreutils.texi b/doc/coreutils.texi
+index a507280..400e135 100644
+--- a/doc/coreutils.texi
++++ b/doc/coreutils.texi
+@@ -11303,6 +11303,13 @@ some systems (notably SunOS), doing this yields more up to date results,
but in general this option makes @command{df} much slower, especially when
there are many or very busy file systems.
@@ -15,10 +16,11 @@ diff -urNp coreutils-8.21-orig/doc/coreutils.texi coreutils-8.21/doc/coreutils.t
@item --total
@opindex --total
@cindex grand total of disk size, usage and available space
-diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
---- coreutils-8.21-orig/src/df.c 2013-02-05 00:40:31.000000000 +0100
-+++ coreutils-8.21/src/df.c 2013-02-15 10:26:41.158651782 +0100
-@@ -116,6 +116,9 @@ static bool print_type;
+diff --git a/src/df.c b/src/df.c
+index 8f760db..a7385fd 100644
+--- a/src/df.c
++++ b/src/df.c
+@@ -120,6 +120,9 @@ static bool print_type;
/* If true, print a grand total at the end. */
static bool print_grand_total;
@@ -28,7 +30,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
/* Grand total data. */
static struct fs_usage grand_fsu;
-@@ -243,13 +246,15 @@ enum
+@@ -247,13 +250,15 @@ enum
NO_SYNC_OPTION = CHAR_MAX + 1,
SYNC_OPTION,
TOTAL_OPTION,
@@ -45,7 +47,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
{"inodes", no_argument, NULL, 'i'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, NULL, 'H'},
-@@ -505,7 +510,10 @@ get_header (void)
+@@ -509,7 +514,10 @@ get_header (void)
for (col = 0; col < ncolumns; col++)
{
char *cell = NULL;
@@ -57,7 +59,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
if (columns[col]->field == SIZE_FIELD
&& (header_mode == DEFAULT_MODE
-@@ -1352,6 +1360,19 @@ get_point (const char *point, const struct stat *statp)
+@@ -1397,6 +1405,19 @@ get_point (const char *point, const struct stat *statp)
static void
get_entry (char const *name, struct stat const *statp)
{
@@ -77,7 +79,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
&& get_disk (name))
return;
-@@ -1422,6 +1443,7 @@ or all file systems by default.\n\
+@@ -1467,6 +1488,7 @@ or all file systems by default.\n\
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\
'-BM' prints sizes in units of 1,048,576 bytes;\n\
see SIZE format below\n\
@@ -85,7 +87,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\
-H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\
"), stdout);
-@@ -1512,6 +1534,9 @@ main (int argc, char **argv)
+@@ -1557,6 +1579,9 @@ main (int argc, char **argv)
xstrtol_fatal (e, oi, c, long_options, optarg);
}
break;
@@ -95,7 +97,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
case 'i':
if (header_mode == OUTPUT_MODE)
{
-@@ -1608,6 +1633,13 @@ main (int argc, char **argv)
+@@ -1653,6 +1678,13 @@ main (int argc, char **argv)
}
}
@@ -109,9 +111,11 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c
if (human_output_opts == -1)
{
if (posix_format)
-diff -urNp coreutils-8.21-orig/tests/df/direct.sh coreutils-8.21/tests/df/direct.sh
---- coreutils-8.21-orig/tests/df/direct.sh 1970-01-01 01:00:00.000000000 +0100
-+++ coreutils-8.21/tests/df/direct.sh 2013-02-15 10:15:26.503644446 +0100
+diff --git a/tests/df/direct.sh b/tests/df/direct.sh
+new file mode 100644
+index 0000000..8e4cfb8
+--- /dev/null
++++ b/tests/df/direct.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+# Ensure "df --direct" works as documented
diff --git a/coreutils-i18n-cut-old.patch b/coreutils-i18n-cut-old.patch
index 008cecb..7fcc8ff 100644
--- a/coreutils-i18n-cut-old.patch
+++ b/coreutils-i18n-cut-old.patch
@@ -1,6 +1,7 @@
-diff -urNp coreutils-8.25-orig/src/cut.c coreutils-8.25/src/cut.c
---- coreutils-8.25-orig/src/cut.c 2015-06-26 19:05:22.000000000 +0200
-+++ coreutils-8.25/src/cut.c 2015-07-05 09:04:33.028546950 +0200
+diff --git a/src/cut.c b/src/cut.c
+index 7ab6be4..022d0ad 100644
+--- a/src/cut.c
++++ b/src/cut.c
@@ -28,6 +28,11 @@
#include
#include
diff --git a/coreutils-i18n-expand-unexpand.patch b/coreutils-i18n-expand-unexpand.patch
index d23e0f0..b5f571f 100644
--- a/coreutils-i18n-expand-unexpand.patch
+++ b/coreutils-i18n-expand-unexpand.patch
@@ -1,4 +1,4 @@
-From 332e9adf944e4ea232a855b1bf75ea4ddfd7e794 Mon Sep 17 00:00:00 2001
+From e87ab5b991b08092a7e07af82b3ec822a8604151 Mon Sep 17 00:00:00 2001
From: Ondrej Oprala
Date: Wed, 5 Aug 2015 09:15:09 +0200
Subject: [PATCH] expand,unexpand: add multibyte support
@@ -9,13 +9,7 @@ Content-Transfer-Encoding: 8bit
* NEWS: Mention the changes.
* bootstrap.conf: Add mbfile to the list of modules.
* configure.ac: Properly initialize mbfile.
-* po/POTFILES.in: Add new source file.
-* src/expand-core.c: Move functions common to both expand and
-unexpand to this file.
-* src/expand-core.h: Add function prototypes from expand-core.c.
* src/expand.c (expand): Iterate over multibyte characters properly.
-* src/local.mk: Add expand-core.c to the lists of source codes for
-expand and unexpand
* src/unexpand.c (unexpand): Iterate over multibyte characters
properly.
* tests/local.mk: Add new tests.
@@ -28,29 +22,23 @@ Co-authored-by: Pádraig Brady
lib/mbfile.c | 3 +
lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++
m4/mbfile.m4 | 14 +++
- po/POTFILES.in | 1 +
- src/expand-core.c | 150 ++++++++++++++++++++++++++++++
- src/expand-core.h | 41 +++++++++
- src/expand.c | 186 ++++++++-----------------------------
- src/local.mk | 2 +
- src/unexpand.c | 195 ++++++++++-----------------------------
+ src/expand.c | 43 +++++----
+ src/unexpand.c | 54 +++++++----
tests/expand/mb.sh | 98 ++++++++++++++++++++
tests/local.mk | 2 +
tests/unexpand/mb.sh | 97 ++++++++++++++++++++
- 14 files changed, 750 insertions(+), 297 deletions(-)
+ 10 files changed, 535 insertions(+), 34 deletions(-)
create mode 100644 lib/mbfile.c
create mode 100644 lib/mbfile.h
create mode 100644 m4/mbfile.m4
- create mode 100644 src/expand-core.c
- create mode 100644 src/expand-core.h
create mode 100755 tests/expand/mb.sh
create mode 100755 tests/unexpand/mb.sh
diff --git a/bootstrap.conf b/bootstrap.conf
-index ef1c078..ea8cebc 100644
+index 8a0ff31..a1c78b2 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
-@@ -151,6 +151,7 @@ gnulib_modules="
+@@ -152,6 +152,7 @@ gnulib_modules="
maintainer-makefile
malloc-gnu
manywarnings
@@ -59,10 +47,10 @@ index ef1c078..ea8cebc 100644
mbrtowc
mbsalign
diff --git a/configure.ac b/configure.ac
-index 8dc2192..b8b5114 100644
+index 1e74b36..24c9725 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -425,6 +425,8 @@ fi
+@@ -427,6 +427,8 @@ fi
# I'm leaving it here for now. This whole thing needs to be modernized...
gl_WINSIZE_IN_PTEM
@@ -71,1126 +59,6 @@ index 8dc2192..b8b5114 100644
gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
-diff --git a/po/POTFILES.in b/po/POTFILES.in
-index b3fe668..c594d20 100644
---- a/po/POTFILES.in
-+++ b/po/POTFILES.in
-@@ -57,6 +57,7 @@ src/dirname.c
- src/du.c
- src/echo.c
- src/env.c
-+src/expand-core.c
- src/expand.c
- src/expr.c
- src/factor.c
-diff --git a/src/expand-core.c b/src/expand-core.c
-new file mode 100644
-index 0000000..c8445db
---- /dev/null
-+++ b/src/expand-core.c
-@@ -0,0 +1,150 @@
-+/* expand-core.c - elementary functions for the expand and unexpand utilities
-+ Copyright (C) 1989-2015 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 . */
-+
-+#include
-+
-+#include
-+#include
-+
-+#include "system.h"
-+#include "error.h"
-+#include "fadvise.h"
-+#include "quote.h"
-+#include "xstrndup.h"
-+
-+#include "expand-core.h"
-+
-+/* Add the comma or blank separated list of tab stops STOPS
-+ to the list of tab stops. */
-+
-+extern void
-+parse_tab_stops (char const *stops, void (*add_tab_stop)(uintmax_t))
-+{
-+ bool have_tabval = false;
-+ uintmax_t tabval IF_LINT ( = 0);
-+ char const *num_start IF_LINT ( = NULL);
-+ bool ok = true;
-+
-+ for (; *stops; stops++)
-+ {
-+ if (*stops == ',' || isblank (to_uchar (*stops)))
-+ {
-+ if (have_tabval)
-+ add_tab_stop (tabval);
-+ have_tabval = false;
-+ }
-+ else if (ISDIGIT (*stops))
-+ {
-+ if (!have_tabval)
-+ {
-+ tabval = 0;
-+ have_tabval = true;
-+ num_start = stops;
-+ }
-+
-+ /* Detect overflow. */
-+ if (!DECIMAL_DIGIT_ACCUMULATE (tabval, *stops - '0', uintmax_t))
-+ {
-+ size_t len = strspn (num_start, "0123456789");
-+ char *bad_num = xstrndup (num_start, len);
-+ error (0, 0, _("tab stop is too large %s"), quote (bad_num));
-+ free (bad_num);
-+ ok = false;
-+ stops = num_start + len - 1;
-+ }
-+ }
-+ else
-+ {
-+ error (0, 0, _("tab size contains invalid character(s): %s"),
-+ quote (stops));
-+ ok = false;
-+ break;
-+ }
-+ }
-+
-+ if (!ok)
-+ exit (EXIT_FAILURE);
-+
-+ if (have_tabval)
-+ add_tab_stop (tabval);
-+}
-+
-+/* Check that the list of tab stops TABS, with ENTRIES entries,
-+ contains only nonzero, ascending values. */
-+
-+extern void
-+validate_tab_stops (uintmax_t const *tabs, size_t entries)
-+{
-+ uintmax_t prev_tab = 0;
-+ size_t i;
-+
-+ for (i = 0; i < entries; i++)
-+ {
-+ if (tabs[i] == 0)
-+ error (EXIT_FAILURE, 0, _("tab size cannot be 0"));
-+ if (tabs[i] <= prev_tab)
-+ error (EXIT_FAILURE, 0, _("tab sizes must be ascending"));
-+ prev_tab = tabs[i];
-+ }
-+}
-+
-+/* Close the old stream pointer FP if it is non-NULL,
-+ and return a new one opened to read the next input file.
-+ Open a filename of '-' as the standard input.
-+ Return NULL if there are no more input files. */
-+
-+extern FILE *
-+next_file (FILE *fp)
-+{
-+ static char *prev_file;
-+ char *file;
-+
-+ if (fp)
-+ {
-+ if (ferror (fp))
-+ {
-+ error (0, errno, "%s", prev_file);
-+ exit_status = EXIT_FAILURE;
-+ }
-+ if (STREQ (prev_file, "-"))
-+ clearerr (fp); /* Also clear EOF. */
-+ else if (fclose (fp) != 0)
-+ {
-+ error (0, errno, "%s", prev_file);
-+ exit_status = EXIT_FAILURE;
-+ }
-+ }
-+
-+ while ((file = *file_list++) != NULL)
-+ {
-+ if (STREQ (file, "-"))
-+ {
-+ have_read_stdin = true;
-+ fp = stdin;
-+ }
-+ else
-+ fp = fopen (file, "r");
-+ if (fp)
-+ {
-+ prev_file = file;
-+ fadvise (fp, FADVISE_SEQUENTIAL);
-+ return fp;
-+ }
-+ error (0, errno, "%s", file);
-+ exit_status = EXIT_FAILURE;
-+ }
-+ return NULL;
-+}
-diff --git a/src/expand-core.h b/src/expand-core.h
-new file mode 100644
-index 0000000..2419407
---- /dev/null
-+++ b/src/expand-core.h
-@@ -0,0 +1,41 @@
-+/* expand-core.h - function prototypes for the expand and unexpand utilities
-+ Copyright (C) 1989-2015 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 . */
-+
-+#ifndef EXPAND_CORE_H_
-+# define EXPAND_CORE_H_
-+
-+extern size_t first_free_tab;
-+
-+extern size_t n_tabs_allocated;
-+
-+extern uintmax_t *tab_list;
-+
-+extern int exit_status;
-+
-+extern char **file_list;
-+
-+extern bool have_read_stdin;
-+
-+void
-+parse_tab_stops (char const *stops, void (*add_tab_stop)(uintmax_t));
-+
-+void
-+validate_tab_stops (uintmax_t const *tabs, size_t entries);
-+
-+FILE *
-+next_file (FILE *fp);
-+
-+#endif /* EXPAND_CORE_H_ */
-diff --git a/src/expand.c b/src/expand.c
-index 0a40a1a..ed97fd4 100644
---- a/src/expand.c
-+++ b/src/expand.c
-@@ -37,12 +37,16 @@
- #include
- #include
- #include
-+
-+#include
-+
- #include "system.h"
- #include "error.h"
- #include "fadvise.h"
--#include "quote.h"
- #include "xstrndup.h"
-
-+#include "expand-core.h"
-+
- /* The official name of this program (e.g., no 'g' prefix). */
- #define PROGRAM_NAME "expand"
-
-@@ -58,17 +62,17 @@ static uintmax_t tab_size;
- /* Array of the explicit column numbers of the tab stops;
- after 'tab_list' is exhausted, each additional tab is replaced
- by a space. The first column is column 0. */
--static uintmax_t *tab_list;
-+uintmax_t *tab_list;
-
- /* The number of allocated entries in 'tab_list'. */
--static size_t n_tabs_allocated;
-+size_t n_tabs_allocated;
-
- /* The index of the first invalid element of 'tab_list',
- where the next element can be added. */
--static size_t first_free_tab;
-+size_t first_free_tab;
-
- /* Null-terminated array of input filenames. */
--static char **file_list;
-+char **file_list;
-
- /* Default for 'file_list' if no files are given on the command line. */
- static char *stdin_argv[] =
-@@ -77,10 +81,10 @@ static char *stdin_argv[] =
- };
-
- /* True if we have ever read standard input. */
--static bool have_read_stdin;
-+bool have_read_stdin;
-
- /* The desired exit status. */
--static int exit_status;
-+int exit_status;
-
- static char const shortopts[] = "it:0::1::2::3::4::5::6::7::8::9::";
-
-@@ -135,128 +139,6 @@ add_tab_stop (uintmax_t tabval)
- tab_list[first_free_tab++] = tabval;
- }
-
--/* Add the comma or blank separated list of tab stops STOPS
-- to the list of tab stops. */
--
--static void
--parse_tab_stops (char const *stops)
--{
-- bool have_tabval = false;
-- uintmax_t tabval IF_LINT ( = 0);
-- char const *num_start IF_LINT ( = NULL);
-- bool ok = true;
--
-- for (; *stops; stops++)
-- {
-- if (*stops == ',' || isblank (to_uchar (*stops)))
-- {
-- if (have_tabval)
-- add_tab_stop (tabval);
-- have_tabval = false;
-- }
-- else if (ISDIGIT (*stops))
-- {
-- if (!have_tabval)
-- {
-- tabval = 0;
-- have_tabval = true;
-- num_start = stops;
-- }
--
-- /* Detect overflow. */
-- if (!DECIMAL_DIGIT_ACCUMULATE (tabval, *stops - '0', uintmax_t))
-- {
-- size_t len = strspn (num_start, "0123456789");
-- char *bad_num = xstrndup (num_start, len);
-- error (0, 0, _("tab stop is too large %s"), quote (bad_num));
-- free (bad_num);
-- ok = false;
-- stops = num_start + len - 1;
-- }
-- }
-- else
-- {
-- error (0, 0, _("tab size contains invalid character(s): %s"),
-- quote (stops));
-- ok = false;
-- break;
-- }
-- }
--
-- if (!ok)
-- exit (EXIT_FAILURE);
--
-- if (have_tabval)
-- add_tab_stop (tabval);
--}
--
--/* Check that the list of tab stops TABS, with ENTRIES entries,
-- contains only nonzero, ascending values. */
--
--static void
--validate_tab_stops (uintmax_t const *tabs, size_t entries)
--{
-- uintmax_t prev_tab = 0;
-- size_t i;
--
-- for (i = 0; i < entries; i++)
-- {
-- if (tabs[i] == 0)
-- error (EXIT_FAILURE, 0, _("tab size cannot be 0"));
-- if (tabs[i] <= prev_tab)
-- error (EXIT_FAILURE, 0, _("tab sizes must be ascending"));
-- prev_tab = tabs[i];
-- }
--}
--
--/* Close the old stream pointer FP if it is non-NULL,
-- and return a new one opened to read the next input file.
-- Open a filename of '-' as the standard input.
-- Return NULL if there are no more input files. */
--
--static FILE *
--next_file (FILE *fp)
--{
-- static char *prev_file;
-- char *file;
--
-- if (fp)
-- {
-- if (ferror (fp))
-- {
-- error (0, errno, "%s", quotef (prev_file));
-- exit_status = EXIT_FAILURE;
-- }
-- if (STREQ (prev_file, "-"))
-- clearerr (fp); /* Also clear EOF. */
-- else if (fclose (fp) != 0)
-- {
-- error (0, errno, "%s", quotef (prev_file));
-- exit_status = EXIT_FAILURE;
-- }
-- }
--
-- while ((file = *file_list++) != NULL)
-- {
-- if (STREQ (file, "-"))
-- {
-- have_read_stdin = true;
-- fp = stdin;
-- }
-- else
-- fp = fopen (file, "r");
-- if (fp)
-- {
-- prev_file = file;
-- fadvise (fp, FADVISE_SEQUENTIAL);
-- return fp;
-- }
-- error (0, errno, "%s", quotef (file));
-- exit_status = EXIT_FAILURE;
-- }
-- return NULL;
--}
--
- /* Change tabs to spaces, writing to stdout.
- Read each file in 'file_list', in order. */
-
-@@ -265,19 +147,19 @@ expand (void)
- {
- /* Input stream. */
- FILE *fp = next_file (NULL);
-+ mb_file_t mbf;
-+ mbf_char_t c;
-
- if (!fp)
- return;
-
-+ mbf_init (mbf, fp);
-+
- while (true)
- {
-- /* Input character, or EOF. */
-- int c;
--
- /* If true, perform translations. */
- bool convert = true;
-
--
- /* The following variables have valid values only when CONVERT
- is true: */
-
-@@ -287,17 +169,23 @@ expand (void)
- /* Index in TAB_LIST of next tab stop to examine. */
- size_t tab_index = 0;
-
--
- /* Convert a line of text. */
-
- do
- {
-- while ((c = getc (fp)) < 0 && (fp = next_file (fp)))
-- continue;
-+ do {
-+ mbf_getc (c, mbf);
-+ if (mb_iseof (c))
-+ {
-+ mbf_init (mbf, fp = next_file (fp));
-+ continue;
-+ }
-+ }
-+ while (false);
-
- if (convert)
- {
-- if (c == '\t')
-+ if (mb_iseq (c, '\t'))
- {
- /* Column the next input tab stop is on. */
- uintmax_t next_tab_column;
-@@ -328,32 +216,34 @@ expand (void)
- if (putchar (' ') < 0)
- error (EXIT_FAILURE, errno, _("write error"));
-
-- c = ' ';
-+ mb_setascii (&c, ' ');
- }
-- else if (c == '\b')
-+ else if (mb_iseq (c, '\b'))
- {
- /* Go back one column, and force recalculation of the
- next tab stop. */
- column -= !!column;
- tab_index -= !!tab_index;
- }
-- else
-+ /* A leading control character could make us trip over. */
-+ else if (!mb_iscntrl (c))
- {
-- column++;
-+ column += mb_width (c);
- if (!column)
- error (EXIT_FAILURE, 0, _("input line is too long"));
- }
-
-- convert &= convert_entire_line || !! isblank (c);
-+ convert &= convert_entire_line || mb_isblank (c);
- }
-
-- if (c < 0)
-+ if (mb_iseof (c))
- return;
-
-- if (putchar (c) < 0)
-+ mb_putc (c, stdout);
-+ if (ferror (stdout))
- error (EXIT_FAILURE, errno, _("write error"));
- }
-- while (c != '\n');
-+ while (!mb_iseq (c, '\n'));
- }
- }
-
-@@ -385,19 +275,19 @@ main (int argc, char **argv)
- break;
-
- case 't':
-- parse_tab_stops (optarg);
-+ parse_tab_stops (optarg, add_tab_stop);
- break;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- if (optarg)
-- parse_tab_stops (optarg - 1);
-+ parse_tab_stops (optarg - 1, add_tab_stop);
- else
- {
- char tab_stop[2];
- tab_stop[0] = c;
- tab_stop[1] = '\0';
-- parse_tab_stops (tab_stop);
-+ parse_tab_stops (tab_stop, add_tab_stop);
- }
- break;
-
-diff --git a/src/local.mk b/src/local.mk
-index 536b7cc..bfede88 100644
---- a/src/local.mk
-+++ b/src/local.mk
-@@ -361,6 +361,8 @@ src_coreutils_SOURCES = src/coreutils.c
-
- src_cp_SOURCES = src/cp.c $(copy_sources) $(selinux_sources)
- src_dir_SOURCES = src/ls.c src/ls-dir.c
-+src_expand_SOURCES = src/expand.c src/expand-core.c
-+src_unexpand_SOURCES = src/unexpand.c src/expand-core.c
- src_vdir_SOURCES = src/ls.c src/ls-vdir.c
- src_id_SOURCES = src/id.c src/group-list.c
- src_groups_SOURCES = src/groups.c src/group-list.c
-diff --git a/src/unexpand.c b/src/unexpand.c
-index e0f7c22..48fbb32 100644
---- a/src/unexpand.c
-+++ b/src/unexpand.c
-@@ -38,12 +38,16 @@
- #include
- #include
- #include
-+
-+#include
-+
- #include "system.h"
- #include "error.h"
- #include "fadvise.h"
--#include "quote.h"
- #include "xstrndup.h"
-
-+#include "expand-core.h"
-+
- /* The official name of this program (e.g., no 'g' prefix). */
- #define PROGRAM_NAME "unexpand"
-
-@@ -62,17 +66,17 @@ static size_t max_column_width;
- /* Array of the explicit column numbers of the tab stops;
- after 'tab_list' is exhausted, the rest of the line is printed
- unchanged. The first column is column 0. */
--static uintmax_t *tab_list;
-+uintmax_t *tab_list;
-
- /* The number of allocated entries in 'tab_list'. */
--static size_t n_tabs_allocated;
-+size_t n_tabs_allocated;
-
- /* The index of the first invalid element of 'tab_list',
- where the next element can be added. */
--static size_t first_free_tab;
-+size_t first_free_tab;
-
- /* Null-terminated array of input filenames. */
--static char **file_list;
-+char **file_list;
-
- /* Default for 'file_list' if no files are given on the command line. */
- static char *stdin_argv[] =
-@@ -81,10 +85,10 @@ static char *stdin_argv[] =
- };
-
- /* True if we have ever read standard input. */
--static bool have_read_stdin;
-+bool have_read_stdin;
-
- /* The desired exit status. */
--static int exit_status;
-+int exit_status;
-
- /* For long options that have no equivalent short option, use a
- non-character as a pseudo short option, starting with CHAR_MAX + 1. */
-@@ -154,128 +158,6 @@ add_tab_stop (uintmax_t tabval)
- }
- }
-
--/* Add the comma or blank separated list of tab stops STOPS
-- to the list of tab stops. */
--
--static void
--parse_tab_stops (char const *stops)
--{
-- bool have_tabval = false;
-- uintmax_t tabval IF_LINT ( = 0);
-- char const *num_start IF_LINT ( = NULL);
-- bool ok = true;
--
-- for (; *stops; stops++)
-- {
-- if (*stops == ',' || isblank (to_uchar (*stops)))
-- {
-- if (have_tabval)
-- add_tab_stop (tabval);
-- have_tabval = false;
-- }
-- else if (ISDIGIT (*stops))
-- {
-- if (!have_tabval)
-- {
-- tabval = 0;
-- have_tabval = true;
-- num_start = stops;
-- }
--
-- /* Detect overflow. */
-- if (!DECIMAL_DIGIT_ACCUMULATE (tabval, *stops - '0', uintmax_t))
-- {
-- size_t len = strspn (num_start, "0123456789");
-- char *bad_num = xstrndup (num_start, len);
-- error (0, 0, _("tab stop is too large %s"), quote (bad_num));
-- free (bad_num);
-- ok = false;
-- stops = num_start + len - 1;
-- }
-- }
-- else
-- {
-- error (0, 0, _("tab size contains invalid character(s): %s"),
-- quote (stops));
-- ok = false;
-- break;
-- }
-- }
--
-- if (!ok)
-- exit (EXIT_FAILURE);
--
-- if (have_tabval)
-- add_tab_stop (tabval);
--}
--
--/* Check that the list of tab stops TABS, with ENTRIES entries,
-- contains only nonzero, ascending values. */
--
--static void
--validate_tab_stops (uintmax_t const *tabs, size_t entries)
--{
-- uintmax_t prev_tab = 0;
-- size_t i;
--
-- for (i = 0; i < entries; i++)
-- {
-- if (tabs[i] == 0)
-- error (EXIT_FAILURE, 0, _("tab size cannot be 0"));
-- if (tabs[i] <= prev_tab)
-- error (EXIT_FAILURE, 0, _("tab sizes must be ascending"));
-- prev_tab = tabs[i];
-- }
--}
--
--/* Close the old stream pointer FP if it is non-NULL,
-- and return a new one opened to read the next input file.
-- Open a filename of '-' as the standard input.
-- Return NULL if there are no more input files. */
--
--static FILE *
--next_file (FILE *fp)
--{
-- static char *prev_file;
-- char *file;
--
-- if (fp)
-- {
-- if (ferror (fp))
-- {
-- error (0, errno, "%s", quotef (prev_file));
-- exit_status = EXIT_FAILURE;
-- }
-- if (STREQ (prev_file, "-"))
-- clearerr (fp); /* Also clear EOF. */
-- else if (fclose (fp) != 0)
-- {
-- error (0, errno, "%s", quotef (prev_file));
-- exit_status = EXIT_FAILURE;
-- }
-- }
--
-- while ((file = *file_list++) != NULL)
-- {
-- if (STREQ (file, "-"))
-- {
-- have_read_stdin = true;
-- fp = stdin;
-- }
-- else
-- fp = fopen (file, "r");
-- if (fp)
-- {
-- prev_file = file;
-- fadvise (fp, FADVISE_SEQUENTIAL);
-- return fp;
-- }
-- error (0, errno, "%s", quotef (file));
-- exit_status = EXIT_FAILURE;
-- }
-- return NULL;
--}
--
- /* Change blanks to tabs, writing to stdout.
- Read each file in 'file_list', in order. */
-
-@@ -284,11 +166,12 @@ unexpand (void)
- {
- /* Input stream. */
- FILE *fp = next_file (NULL);
-+ mb_file_t mbf;
-
- /* The array of pending blanks. In non-POSIX locales, blanks can
- include characters other than spaces, so the blanks must be
- stored, not merely counted. */
-- char *pending_blank;
-+ mbf_char_t *pending_blank;
-
- if (!fp)
- return;
-@@ -296,12 +179,14 @@ unexpand (void)
- /* The worst case is a non-blank character, then one blank, then a
- tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
- allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
-- pending_blank = xmalloc (max_column_width);
-+ pending_blank = xmalloc (max_column_width * sizeof (mbf_char_t));
-+
-+ mbf_init (mbf, fp);
-
- while (true)
- {
- /* Input character, or EOF. */
-- int c;
-+ mbf_char_t c;
-
- /* If true, perform translations. */
- bool convert = true;
-@@ -335,12 +220,19 @@ unexpand (void)
-
- do
- {
-- while ((c = getc (fp)) < 0 && (fp = next_file (fp)))
-- continue;
-+ do {
-+ mbf_getc (c, mbf);
-+ if (mb_iseof (c))
-+ {
-+ mbf_init (mbf, fp = next_file (fp));
-+ continue;
-+ }
-+ }
-+ while (false);
-
- if (convert)
- {
-- bool blank = !! isblank (c);
-+ bool blank = mb_isblank (c);
-
- if (blank)
- {
-@@ -372,16 +264,16 @@ unexpand (void)
- if (next_tab_column < column)
- error (EXIT_FAILURE, 0, _("input line is too long"));
-
-- if (c == '\t')
-+ if (mb_iseq (c, '\t'))
- {
- column = next_tab_column;
-
- if (pending)
-- pending_blank[0] = '\t';
-+ mb_setascii (&pending_blank[0], '\t');
- }
- else
- {
-- column++;
-+ column += mb_width (c);
-
- if (! (prev_blank && column == next_tab_column))
- {
-@@ -389,13 +281,14 @@ unexpand (void)
- will be replaced by tabs. */
- if (column == next_tab_column)
- one_blank_before_tab_stop = true;
-- pending_blank[pending++] = c;
-+ mb_copy (&pending_blank[pending++], &c);
- prev_blank = true;
- continue;
- }
-
- /* Replace the pending blanks by a tab or two. */
-- pending_blank[0] = c = '\t';
-+ mb_setascii (&c, '\t');
-+ mb_setascii (&pending_blank[0], '\t');
- }
-
- /* Discard pending blanks, unless it was a single
-@@ -403,7 +296,7 @@ unexpand (void)
- pending = one_blank_before_tab_stop;
- }
- }
-- else if (c == '\b')
-+ else if (mb_iseq (c, '\b'))
- {
- /* Go back one column, and force recalculation of the
- next tab stop. */
-@@ -413,7 +306,7 @@ unexpand (void)
- }
- else
- {
-- column++;
-+ column += mb_width (c);
- if (!column)
- error (EXIT_FAILURE, 0, _("input line is too long"));
- }
-@@ -421,9 +314,13 @@ unexpand (void)
- if (pending)
- {
- if (pending > 1 && one_blank_before_tab_stop)
-- pending_blank[0] = '\t';
-- if (fwrite (pending_blank, 1, pending, stdout) != pending)
-+ mb_setascii (&pending_blank[0], '\t');
-+
-+ for (int n = 0; n < pending; ++n)
-+ mb_putc (pending_blank[n], stdout);
-+ if (ferror (stdout))
- error (EXIT_FAILURE, errno, _("write error"));
-+
- pending = 0;
- one_blank_before_tab_stop = false;
- }
-@@ -432,16 +329,16 @@ unexpand (void)
- convert &= convert_entire_line || blank;
- }
-
-- if (c < 0)
-+ if (mb_iseof (c))
- {
- free (pending_blank);
- return;
- }
--
-- if (putchar (c) < 0)
-+ mb_putc (c, stdout);
-+ if (ferror (stdout))
- error (EXIT_FAILURE, errno, _("write error"));
- }
-- while (c != '\n');
-+ while (!mb_iseq (c, '\n'));
- }
- }
-
-@@ -482,7 +379,7 @@ main (int argc, char **argv)
- break;
- case 't':
- convert_entire_line = true;
-- parse_tab_stops (optarg);
-+ parse_tab_stops (optarg, add_tab_stop);
- break;
- case CONVERT_FIRST_ONLY_OPTION:
- convert_first_only = true;
-diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
-new file mode 100755
-index 0000000..7971e18
---- /dev/null
-+++ b/tests/expand/mb.sh
-@@ -0,0 +1,98 @@
-+#!/bin/sh
-+
-+# Copyright (C) 2012-2015 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 .
-+
-+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-+print_ver_ expand
-+
-+export LC_ALL=en_US.UTF-8
-+
-+#input containing multibyte characters
-+cat <<\EOF > in || framework_failure_
-+1234567812345678123456781
-+. . . .
-+a b c d
-+. . . .
-+ä ö ü ß
-+. . . .
-+EOF
-+env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_
-+
-+cat <<\EOF > exp || framework_failure_
-+1234567812345678123456781
-+. . . .
-+a b c d
-+. . . .
-+ä ö ü ß
-+. . . .
-+ äöü . öüä. ä xx
-+EOF
-+
-+expand < in > out || fail=1
-+compare exp out > /dev/null 2>&1 || fail=1
-+
-+#test characters with display widths != 1
-+env printf '12345678
-+e\t|ascii(1)
-+\u00E9\t|composed(1)
-+e\u0301\t|decomposed(1)
-+\u3000\t|ideo-space(2)
-+\uFF0D\t|full-hypen(2)
-+' > in || framework_failure_
-+
-+env printf '12345678
-+e |ascii(1)
-+\u00E9 |composed(1)
-+e\u0301 |decomposed(1)
-+\u3000 |ideo-space(2)
-+\uFF0D |full-hypen(2)
-+' > exp || framework_failure_
-+
-+expand < in > out || fail=1
-+compare exp out > /dev/null 2>&1 || fail=1
-+
-+#shouldn't fail with "input line too long"
-+#when a line starts with a control character
-+env printf '\n' > in || framework_failure_
-+
-+expand < in > out || fail=1
-+compare in out > /dev/null 2>&1 || fail=1
-+
-+#non-Unicode characters interspersed between Unicode ones
-+env printf '12345678
-+\t\xFF|
-+\xFF\t|
-+\t\xFFä|
-+ä\xFF\t|
-+\tä\xFF|
-+\xFF\tä|
-+äbcdef\xFF\t|
-+' > in || framework_failure_
-+
-+env printf '12345678
-+ \xFF|
-+\xFF |
-+ \xFFä|
-+ä\xFF |
-+ ä\xFF|
-+\xFF ä|
-+äbcdef\xFF |
-+' > exp || framework_failure_
-+
-+expand < in > out || fail=1
-+compare exp out > /dev/null 2>&1 || fail=1
-+
-+exit $fail
-diff --git a/tests/local.mk b/tests/local.mk
-index 7df04da..d3462be 100644
---- a/tests/local.mk
-+++ b/tests/local.mk
-@@ -536,6 +536,7 @@ all_tests = \
- tests/du/threshold.sh \
- tests/du/trailing-slash.sh \
- tests/du/two-args.sh \
-+ tests/expand/mb.sh \
- tests/id/gnu-zero-uids.sh \
- tests/id/no-context.sh \
- tests/id/context.sh \
-@@ -674,6 +675,7 @@ all_tests = \
- tests/touch/read-only.sh \
- tests/touch/relative.sh \
- tests/touch/trailing-slash.sh \
-+ tests/unexpand/mb.sh \
- $(all_root_tests)
-
- # See tests/factor/create-test.sh.
-diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
-new file mode 100755
-index 0000000..60d4c1a
---- /dev/null
-+++ b/tests/unexpand/mb.sh
-@@ -0,0 +1,97 @@
-+#!/bin/sh
-+
-+# Copyright (C) 2012-2015 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 .
-+
-+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-+print_ver_ unexpand
-+
-+export LC_ALL=en_US.UTF-8
-+
-+#input containing multibyte characters
-+cat > in <<\EOF
-+1234567812345678123456781
-+. . . .
-+a b c d
-+. . . .
-+ä ö ü ß
-+. . . .
-+ äöü . öüä. ä xx
-+EOF
-+
-+cat > exp <<\EOF
-+1234567812345678123456781
-+. . . .
-+a b c d
-+. . . .
-+ä ö ü ß
-+. . . .
-+ äöü . öüä. ä xx
-+EOF
-+
-+unexpand -a < in > out || fail=1
-+compare exp out > /dev/null 2>&1 || fail=1
-+
-+#test characters with a display width larger than 1
-+
-+env printf '12345678
-+e |ascii(1)
-+\u00E9 |composed(1)
-+e\u0301 |decomposed(1)
-+\u3000 |ideo-space(2)
-+\uFF0D |full-hypen(2)
-+' > in || framework_failure_
-+
-+env printf '12345678
-+e\t|ascii(1)
-+\u00E9\t|composed(1)
-+e\u0301\t|decomposed(1)
-+\u3000\t|ideo-space(2)
-+\uFF0D\t|full-hypen(2)
-+' > exp || framework_failure_
-+
-+unexpand -a < in > out || fail=1
-+compare exp out > /dev/null 2>&1 || fail=1
-+
-+#test input where a blank of width > 1 is not being substituted
-+in="$(LC_ALL=en_US.UTF-8 printf ' \u3000 ö ü ß')"
-+exp=' ö ü ß'
-+
-+unexpand -a < in > out || fail=1
-+compare exp out > /dev/null 2>&1 || fail=1
-+
-+#non-Unicode characters interspersed between Unicode ones
-+env printf '12345678
-+ \xFF|
-+\xFF |
-+ \xFFä|
-+ä\xFF |
-+ ä\xFF|
-+\xFF ä|
-+äbcdef\xFF |
-+' > in || framework_failure_
-+
-+env printf '12345678
-+\t\xFF|
-+\xFF\t|
-+\t\xFFä|
-+ä\xFF\t|
-+\tä\xFF|
-+\xFF\tä|
-+äbcdef\xFF\t|
-+' > exp || framework_failure_
-+
-+unexpand -a < in > out || fail=1
-+compare exp out > /dev/null 2>&1 || fail=1
-diff --git a/m4/mbfile.m4 b/m4/mbfile.m4
-new file mode 100644
-index 0000000..8589902
---- /dev/null
-+++ b/m4/mbfile.m4
-@@ -0,0 +1,14 @@
-+# mbfile.m4 serial 7
-+dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc.
-+dnl This file is free software; the Free Software Foundation
-+dnl gives unlimited permission to copy and/or distribute it,
-+dnl with or without modifications, as long as this notice is preserved.
-+
-+dnl autoconf tests required for use of mbfile.h
-+dnl From Bruno Haible.
-+
-+AC_DEFUN([gl_MBFILE],
-+[
-+ AC_REQUIRE([AC_TYPE_MBSTATE_T])
-+ :
-+])
diff --git a/lib/mbfile.c b/lib/mbfile.c
new file mode 100644
index 0000000..b0a468e
@@ -1461,6 +329,520 @@ index 0000000..11f1b12
+_GL_INLINE_HEADER_BEGIN
+
+#endif /* _MBFILE_H */
+diff --git a/m4/mbfile.m4 b/m4/mbfile.m4
+new file mode 100644
+index 0000000..8589902
+--- /dev/null
++++ b/m4/mbfile.m4
+@@ -0,0 +1,14 @@
++# mbfile.m4 serial 7
++dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc.
++dnl This file is free software; the Free Software Foundation
++dnl gives unlimited permission to copy and/or distribute it,
++dnl with or without modifications, as long as this notice is preserved.
++
++dnl autoconf tests required for use of mbfile.h
++dnl From Bruno Haible.
++
++AC_DEFUN([gl_MBFILE],
++[
++ AC_REQUIRE([AC_TYPE_MBSTATE_T])
++ :
++])
+diff --git a/src/expand.c b/src/expand.c
+index 9fa2e10..380e020 100644
+--- a/src/expand.c
++++ b/src/expand.c
+@@ -37,6 +37,9 @@
+ #include
+ #include
+ #include
++
++#include
++
+ #include "system.h"
+ #include "die.h"
+ #include "xstrndup.h"
+@@ -100,19 +103,19 @@ expand (void)
+ {
+ /* Input stream. */
+ FILE *fp = next_file (NULL);
++ mb_file_t mbf;
++ mbf_char_t c;
+
+ if (!fp)
+ return;
+
++ mbf_init (mbf, fp);
++
+ while (true)
+ {
+- /* Input character, or EOF. */
+- int c;
+-
+ /* If true, perform translations. */
+ bool convert = true;
+
+-
+ /* The following variables have valid values only when CONVERT
+ is true: */
+
+@@ -122,17 +125,23 @@ expand (void)
+ /* Index in TAB_LIST of next tab stop to examine. */
+ size_t tab_index = 0;
+
+-
+ /* Convert a line of text. */
+
+ do
+ {
+- while ((c = getc (fp)) < 0 && (fp = next_file (fp)))
+- continue;
++ do {
++ mbf_getc (c, mbf);
++ if (mb_iseof (c))
++ {
++ mbf_init (mbf, fp = next_file (fp));
++ continue;
++ }
++ }
++ while (false);
+
+ if (convert)
+ {
+- if (c == '\t')
++ if (mb_iseq (c, '\t'))
+ {
+ /* Column the next input tab stop is on. */
+ uintmax_t next_tab_column;
+@@ -151,32 +160,34 @@ expand (void)
+ if (putchar (' ') < 0)
+ die (EXIT_FAILURE, errno, _("write error"));
+
+- c = ' ';
++ mb_setascii (&c, ' ');
+ }
+- else if (c == '\b')
++ else if (mb_iseq (c, '\b'))
+ {
+ /* Go back one column, and force recalculation of the
+ next tab stop. */
+ column -= !!column;
+ tab_index -= !!tab_index;
+ }
+- else
++ /* A leading control character could make us trip over. */
++ else if (!mb_iscntrl (c))
+ {
+- column++;
++ column += mb_width (c);
+ if (!column)
+ die (EXIT_FAILURE, 0, _("input line is too long"));
+ }
+
+- convert &= convert_entire_line || !! isblank (c);
++ convert &= convert_entire_line || mb_isblank (c);
+ }
+
+- if (c < 0)
++ if (mb_iseof (c))
+ return;
+
+- if (putchar (c) < 0)
++ mb_putc (c, stdout);
++ if (ferror (stdout))
+ die (EXIT_FAILURE, errno, _("write error"));
+ }
+- while (c != '\n');
++ while (!mb_iseq (c, '\n'));
+ }
+ }
+
+diff --git a/src/unexpand.c b/src/unexpand.c
+index 7801274..569a7ee 100644
+--- a/src/unexpand.c
++++ b/src/unexpand.c
+@@ -38,6 +38,9 @@
+ #include
+ #include
+ #include
++
++#include
++
+ #include "system.h"
+ #include "die.h"
+ #include "xstrndup.h"
+@@ -107,11 +110,12 @@ unexpand (void)
+ {
+ /* Input stream. */
+ FILE *fp = next_file (NULL);
++ mb_file_t mbf;
+
+ /* The array of pending blanks. In non-POSIX locales, blanks can
+ include characters other than spaces, so the blanks must be
+ stored, not merely counted. */
+- char *pending_blank;
++ mbf_char_t *pending_blank;
+
+ if (!fp)
+ return;
+@@ -119,12 +123,14 @@ unexpand (void)
+ /* The worst case is a non-blank character, then one blank, then a
+ tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
+ allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
+- pending_blank = xmalloc (max_column_width);
++ pending_blank = xmalloc (max_column_width * sizeof (mbf_char_t));
++
++ mbf_init (mbf, fp);
+
+ while (true)
+ {
+ /* Input character, or EOF. */
+- int c;
++ mbf_char_t c;
+
+ /* If true, perform translations. */
+ bool convert = true;
+@@ -158,12 +164,19 @@ unexpand (void)
+
+ do
+ {
+- while ((c = getc (fp)) < 0 && (fp = next_file (fp)))
+- continue;
++ do {
++ mbf_getc (c, mbf);
++ if (mb_iseof (c))
++ {
++ mbf_init (mbf, fp = next_file (fp));
++ continue;
++ }
++ }
++ while (false);
+
+ if (convert)
+ {
+- bool blank = !! isblank (c);
++ bool blank = mb_isblank (c);
+
+ if (blank)
+ {
+@@ -180,16 +193,16 @@ unexpand (void)
+ if (next_tab_column < column)
+ die (EXIT_FAILURE, 0, _("input line is too long"));
+
+- if (c == '\t')
++ if (mb_iseq (c, '\t'))
+ {
+ column = next_tab_column;
+
+ if (pending)
+- pending_blank[0] = '\t';
++ mb_setascii (&pending_blank[0], '\t');
+ }
+ else
+ {
+- column++;
++ column += mb_width (c);
+
+ if (! (prev_blank && column == next_tab_column))
+ {
+@@ -197,13 +210,14 @@ unexpand (void)
+ will be replaced by tabs. */
+ if (column == next_tab_column)
+ one_blank_before_tab_stop = true;
+- pending_blank[pending++] = c;
++ mb_copy (&pending_blank[pending++], &c);
+ prev_blank = true;
+ continue;
+ }
+
+ /* Replace the pending blanks by a tab or two. */
+- pending_blank[0] = c = '\t';
++ mb_setascii (&c, '\t');
++ mb_setascii (&pending_blank[0], '\t');
+ }
+
+ /* Discard pending blanks, unless it was a single
+@@ -211,7 +225,7 @@ unexpand (void)
+ pending = one_blank_before_tab_stop;
+ }
+ }
+- else if (c == '\b')
++ else if (mb_iseq (c, '\b'))
+ {
+ /* Go back one column, and force recalculation of the
+ next tab stop. */
+@@ -221,7 +235,7 @@ unexpand (void)
+ }
+ else
+ {
+- column++;
++ column += mb_width (c);
+ if (!column)
+ die (EXIT_FAILURE, 0, _("input line is too long"));
+ }
+@@ -229,8 +243,11 @@ unexpand (void)
+ if (pending)
+ {
+ if (pending > 1 && one_blank_before_tab_stop)
+- pending_blank[0] = '\t';
+- if (fwrite (pending_blank, 1, pending, stdout) != pending)
++ mb_setascii (&pending_blank[0], '\t');
++
++ for (int n = 0; n < pending; ++n)
++ mb_putc (pending_blank[n], stdout);
++ if (ferror (stdout))
+ die (EXIT_FAILURE, errno, _("write error"));
+ pending = 0;
+ one_blank_before_tab_stop = false;
+@@ -240,16 +257,17 @@ unexpand (void)
+ convert &= convert_entire_line || blank;
+ }
+
+- if (c < 0)
++ if (mb_iseof (c))
+ {
+ free (pending_blank);
+ return;
+ }
+
+- if (putchar (c) < 0)
++ mb_putc (c, stdout);
++ if (ferror (stdout))
+ die (EXIT_FAILURE, errno, _("write error"));
+ }
+- while (c != '\n');
++ while (!mb_iseq (c, '\n'));
+ }
+ }
+
+diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
+new file mode 100755
+index 0000000..7971e18
+--- /dev/null
++++ b/tests/expand/mb.sh
+@@ -0,0 +1,98 @@
++#!/bin/sh
++
++# Copyright (C) 2012-2015 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 .
++
++. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++print_ver_ expand
++
++export LC_ALL=en_US.UTF-8
++
++#input containing multibyte characters
++cat <<\EOF > in || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++EOF
++env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_
++
++cat <<\EOF > exp || framework_failure_
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++expand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++#test characters with display widths != 1
++env printf '12345678
++e\t|ascii(1)
++\u00E9\t|composed(1)
++e\u0301\t|decomposed(1)
++\u3000\t|ideo-space(2)
++\uFF0D\t|full-hypen(2)
++' > in || framework_failure_
++
++env printf '12345678
++e |ascii(1)
++\u00E9 |composed(1)
++e\u0301 |decomposed(1)
++\u3000 |ideo-space(2)
++\uFF0D |full-hypen(2)
++' > exp || framework_failure_
++
++expand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++#shouldn't fail with "input line too long"
++#when a line starts with a control character
++env printf '\n' > in || framework_failure_
++
++expand < in > out || fail=1
++compare in out > /dev/null 2>&1 || fail=1
++
++#non-Unicode characters interspersed between Unicode ones
++env printf '12345678
++\t\xFF|
++\xFF\t|
++\t\xFFä|
++ä\xFF\t|
++\tä\xFF|
++\xFF\tä|
++äbcdef\xFF\t|
++' > in || framework_failure_
++
++env printf '12345678
++ \xFF|
++\xFF |
++ \xFFä|
++ä\xFF |
++ ä\xFF|
++\xFF ä|
++äbcdef\xFF |
++' > exp || framework_failure_
++
++expand < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++exit $fail
+diff --git a/tests/local.mk b/tests/local.mk
+index 192f776..8053397 100644
+--- a/tests/local.mk
++++ b/tests/local.mk
+@@ -544,6 +544,7 @@ all_tests = \
+ tests/du/threshold.sh \
+ tests/du/trailing-slash.sh \
+ tests/du/two-args.sh \
++ tests/expand/mb.sh \
+ tests/id/gnu-zero-uids.sh \
+ tests/id/no-context.sh \
+ tests/id/context.sh \
+@@ -684,6 +685,7 @@ all_tests = \
+ tests/touch/read-only.sh \
+ tests/touch/relative.sh \
+ tests/touch/trailing-slash.sh \
++ tests/unexpand/mb.sh \
+ $(all_root_tests)
+
+ # See tests/factor/create-test.sh.
+diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
+new file mode 100755
+index 0000000..60d4c1a
+--- /dev/null
++++ b/tests/unexpand/mb.sh
+@@ -0,0 +1,97 @@
++#!/bin/sh
++
++# Copyright (C) 2012-2015 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 .
++
++. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++print_ver_ unexpand
++
++export LC_ALL=en_US.UTF-8
++
++#input containing multibyte characters
++cat > in <<\EOF
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++cat > exp <<\EOF
++1234567812345678123456781
++. . . .
++a b c d
++. . . .
++ä ö ü ß
++. . . .
++ äöü . öüä. ä xx
++EOF
++
++unexpand -a < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++#test characters with a display width larger than 1
++
++env printf '12345678
++e |ascii(1)
++\u00E9 |composed(1)
++e\u0301 |decomposed(1)
++\u3000 |ideo-space(2)
++\uFF0D |full-hypen(2)
++' > in || framework_failure_
++
++env printf '12345678
++e\t|ascii(1)
++\u00E9\t|composed(1)
++e\u0301\t|decomposed(1)
++\u3000\t|ideo-space(2)
++\uFF0D\t|full-hypen(2)
++' > exp || framework_failure_
++
++unexpand -a < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++#test input where a blank of width > 1 is not being substituted
++in="$(LC_ALL=en_US.UTF-8 printf ' \u3000 ö ü ß')"
++exp=' ö ü ß'
++
++unexpand -a < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
++
++#non-Unicode characters interspersed between Unicode ones
++env printf '12345678
++ \xFF|
++\xFF |
++ \xFFä|
++ä\xFF |
++ ä\xFF|
++\xFF ä|
++äbcdef\xFF |
++' > in || framework_failure_
++
++env printf '12345678
++\t\xFF|
++\xFF\t|
++\t\xFFä|
++ä\xFF\t|
++\tä\xFF|
++\xFF\tä|
++äbcdef\xFF\t|
++' > exp || framework_failure_
++
++unexpand -a < in > out || fail=1
++compare exp out > /dev/null 2>&1 || fail=1
--
-2.5.5
+2.7.4
diff --git a/coreutils-i18n-fix-unexpand.patch b/coreutils-i18n-fix-unexpand.patch
index c7ca839..f0c347c 100644
--- a/coreutils-i18n-fix-unexpand.patch
+++ b/coreutils-i18n-fix-unexpand.patch
@@ -1,60 +1,28 @@
-From lkundrak@v3.sk Thu Jan 28 20:57:48 2016
-Return-Path: lkundrak@v3.sk
-Received: from zimbra.v3.sk (LHLO zimbra.v3.sk) (10.13.37.31) by
- zimbra.v3.sk with LMTP; Thu, 28 Jan 2016 20:57:48 +0100 (CET)
-Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix)
- with ESMTP id D4DD260F92 for ; Thu, 28 Jan 2016 20:57:47
- +0100 (CET)
-X-Spam-Flag: NO
-X-Spam-Score: -2.9
-X-Spam-Level:
-X-Spam-Status: No, score=-2.9 tagged_above=-10 required=3
- tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=ham autolearn_force=no
-Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk
- [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id HB5H5ynfOcyL; Thu, 28
- Jan 2016 20:57:45 +0100 (CET)
-Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix)
- with ESMTP id 3FEF160F90; Thu, 28 Jan 2016 20:57:45 +0100 (CET)
-X-Virus-Scanned: amavisd-new at zimbra.v3.sk
-Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk
- [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id TUF9p5l6r9SN; Thu, 28
- Jan 2016 20:57:44 +0100 (CET)
-Received: from odvarok.localdomain (s559633cb.adsl.online.nl
- [85.150.51.203]) by zimbra.v3.sk (Postfix) with ESMTPSA id 6763560F8F; Thu,
- 28 Jan 2016 20:57:44 +0100 (CET)
+From 02424bfcd719bbaa695f4e1c3ef17ad91b0d23c0 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel
-To: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= , Ondrej
- Oprala
-Cc: Lubomir Rintel
-Subject: [PATCH] unexpand: fix blank line handling
Date: Thu, 28 Jan 2016 20:57:22 +0100
-Message-Id: <1454011042-30492-1-git-send-email-lkundrak@v3.sk>
-X-Mailer: git-send-email 2.5.0
-X-Evolution-Source: 1409576065.5421.4@dhcp-24-163.brq.redhat.com
-Content-Transfer-Encoding: 8bit
-Mime-Version: 1.0
+Subject: [PATCH] unexpand: fix blank line handling
- echo '' |./src/unexpand -a
-
-Really?
----
- src/unexpand.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/unexpand.c b/src/unexpand.c
-index d6ff662..762c56b 100644
---- a/src/unexpand.c
-+++ b/src/unexpand.c
-@@ -304,7 +304,7 @@ unexpand (void)
- next_tab_column = column;
- tab_index -= !!tab_index;
- }
-- else
-+ else if (!mb_iseq (c, '\n'))
- {
- column += mb_width (c);
- if (!column)
---
-2.5.0
-
+ echo '' |./src/unexpand -a
+
+Really?
+---
+ src/unexpand.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/unexpand.c b/src/unexpand.c
+index 569a7ee..3bbbd66 100644
+--- a/src/unexpand.c
++++ b/src/unexpand.c
+@@ -233,7 +233,7 @@ unexpand (void)
+ next_tab_column = column;
+ tab_index -= !!tab_index;
+ }
+- else
++ else if (!mb_iseq (c, '\n'))
+ {
+ column += mb_width (c);
+ if (!column)
+--
+2.7.4
diff --git a/coreutils-i18n-fix2-expand-unexpand.patch b/coreutils-i18n-fix2-expand-unexpand.patch
index 1f02c5e..1a63012 100644
--- a/coreutils-i18n-fix2-expand-unexpand.patch
+++ b/coreutils-i18n-fix2-expand-unexpand.patch
@@ -1,7 +1,8 @@
-diff -up ./src/expand.c.orig ./src/expand.c
---- ./src/expand.c.orig 2016-06-01 12:42:49.330373488 +0200
-+++ ./src/expand.c 2016-06-07 14:35:16.011142041 +0200
-@@ -173,15 +173,19 @@ expand (void)
+diff --git a/src/expand.c b/src/expand.c
+index 380e020..310b349 100644
+--- a/src/expand.c
++++ b/src/expand.c
+@@ -129,15 +129,19 @@ expand (void)
do
{
@@ -25,10 +26,11 @@ diff -up ./src/expand.c.orig ./src/expand.c
if (convert)
{
-diff -up ./src/unexpand.c.orig ./src/unexpand.c
---- ./src/unexpand.c.orig 2016-06-07 14:26:57.380746446 +0200
-+++ ./src/unexpand.c 2016-06-07 14:34:54.059256698 +0200
-@@ -220,15 +220,19 @@ unexpand (void)
+diff --git a/src/unexpand.c b/src/unexpand.c
+index 3bbbd66..863a90a 100644
+--- a/src/unexpand.c
++++ b/src/unexpand.c
+@@ -164,15 +164,19 @@ unexpand (void)
do
{
@@ -52,9 +54,10 @@ diff -up ./src/unexpand.c.orig ./src/unexpand.c
if (convert)
{
-diff -up ./tests/expand/mb.sh.orig ./tests/expand/mb.sh
---- ./tests/expand/mb.sh.orig 2016-05-11 14:13:53.095289000 +0200
-+++ ./tests/expand/mb.sh 2016-06-07 14:38:48.259033445 +0200
+diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
+index 7971e18..031be7a 100755
+--- a/tests/expand/mb.sh
++++ b/tests/expand/mb.sh
@@ -44,6 +44,20 @@ EOF
expand < in > out || fail=1
compare exp out > /dev/null 2>&1 || fail=1
@@ -76,9 +79,10 @@ diff -up ./tests/expand/mb.sh.orig ./tests/expand/mb.sh
#test characters with display widths != 1
env printf '12345678
e\t|ascii(1)
-diff -up ./tests/unexpand/mb.sh.orig ./tests/unexpand/mb.sh
---- ./tests/unexpand/mb.sh.orig 2016-06-07 14:41:44.210106466 +0200
-+++ ./tests/unexpand/mb.sh 2016-06-07 14:52:28.848639772 +0200
+diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
+index 60d4c1a..8d75652 100755
+--- a/tests/unexpand/mb.sh
++++ b/tests/unexpand/mb.sh
@@ -44,6 +44,22 @@ EOF
unexpand -a < in > out || fail=1
compare exp out > /dev/null 2>&1 || fail=1
diff --git a/coreutils-i18n-sort-human.patch b/coreutils-i18n-sort-human.patch
index 2469189..6752493 100644
--- a/coreutils-i18n-sort-human.patch
+++ b/coreutils-i18n-sort-human.patch
@@ -14,7 +14,7 @@ diff --git a/src/sort.c b/src/sort.c
index 9e07ad8..e47b039 100644
--- a/src/sort.c
+++ b/src/sort.c
-@@ -2274,12 +2274,10 @@ find_unit_order (char const *number)
+@@ -2304,12 +2304,10 @@ find_unit_order (char const *number)
< K/k < M < G < T < P < E < Z < Y */
static int
diff --git a/coreutils-i18n-un-expand-BOM.patch b/coreutils-i18n-un-expand-BOM.patch
index 44769c6..56e7fa5 100644
--- a/coreutils-i18n-un-expand-BOM.patch
+++ b/coreutils-i18n-un-expand-BOM.patch
@@ -1,19 +1,20 @@
-diff -up ./src/expand-core.c.orig ./src/expand-core.c
---- ./src/expand-core.c.orig 2016-06-28 14:44:18.281619000 +0200
-+++ ./src/expand-core.c 2016-06-30 11:46:50.025109755 +0200
+diff --git a/src/expand-common.c b/src/expand-common.c
+index 4657e46..97cbb09 100644
+--- a/src/expand-common.c
++++ b/src/expand-common.c
@@ -18,6 +18,7 @@
#include
#include
+#include
-
#include "system.h"
+ #include "die.h"
#include "error.h"
-@@ -27,6 +28,119 @@
+@@ -85,6 +86,119 @@ add_tab_stop (uintmax_t tabval)
+ }
+ }
- #include "expand-core.h"
-
-+extern inline int
++extern int
+set_utf_locale (void)
+{
+ /*try using some predefined locale */
@@ -118,7 +119,7 @@ diff -up ./src/expand-core.c.orig ./src/expand-core.c
+ return false;
+}
+
-+extern inline void
++extern void
+print_bom(void)
+{
+ putc (0xEF, stdout);
@@ -128,42 +129,35 @@ diff -up ./src/expand-core.c.orig ./src/expand-core.c
+
/* Add the comma or blank separated list of tab stops STOPS
to the list of tab stops. */
+ extern void
+diff --git a/src/expand-common.h b/src/expand-common.h
+index 8cb2079..763bfda 100644
+--- a/src/expand-common.h
++++ b/src/expand-common.h
+@@ -34,6 +34,18 @@ extern size_t max_column_width;
+ /* The desired exit status. */
+ extern int exit_status;
-diff -up ./src/expand-core.h.orig ./src/expand-core.h
---- ./src/expand-core.h.orig 2016-06-28 14:44:18.281619000 +0200
-+++ ./src/expand-core.h 2016-06-30 11:47:18.929437205 +0200
-@@ -15,7 +15,7 @@
- along with this program. If not, see . */
-
- #ifndef EXPAND_CORE_H_
--# define EXPAND_CORE_H_
-+#define EXPAND_CORE_H_
-
- extern size_t first_free_tab;
-
-@@ -29,6 +29,18 @@ extern char **file_list;
-
- extern bool have_read_stdin;
-
-+inline int
++extern int
+set_utf_locale (void);
+
-+bool
++extern bool
+check_utf_locale(void);
+
-+bool
++extern bool
+check_bom(FILE* fp, mb_file_t *mbf);
+
-+inline void
++extern void
+print_bom(void);
+
- void
- parse_tab_stops (char const *stops, void (*add_tab_stop)(uintmax_t));
-
-diff -up ./src/expand.c.orig ./src/expand.c
---- ./src/expand.c.orig 2016-06-28 14:44:18.286619000 +0200
-+++ ./src/expand.c 2016-06-30 11:50:15.077312947 +0200
-@@ -149,11 +149,33 @@ expand (void)
+ /* Add tab stop TABVAL to the end of 'tab_list'. */
+ extern void
+ add_tab_stop (uintmax_t tabval);
+diff --git a/src/expand.c b/src/expand.c
+index 310b349..4136824 100644
+--- a/src/expand.c
++++ b/src/expand.c
+@@ -105,11 +105,33 @@ expand (void)
FILE *fp = next_file (NULL);
mb_file_t mbf;
mbf_char_t c;
@@ -199,7 +193,7 @@ diff -up ./src/expand.c.orig ./src/expand.c
while (true)
{
-@@ -178,6 +200,27 @@ expand (void)
+@@ -134,6 +156,27 @@ expand (void)
if ((mb_iseof (c)) && (fp = next_file (fp)))
{
mbf_init (mbf, fp);
@@ -227,10 +221,11 @@ diff -up ./src/expand.c.orig ./src/expand.c
continue;
}
else
-diff -up ./src/unexpand.c.orig ./src/unexpand.c
---- ./src/unexpand.c.orig 2016-06-28 17:39:22.894259000 +0200
-+++ ./src/unexpand.c 2016-07-07 09:48:07.659924755 +0200
-@@ -172,16 +172,36 @@ unexpand (void)
+diff --git a/src/unexpand.c b/src/unexpand.c
+index 863a90a..5681b58 100644
+--- a/src/unexpand.c
++++ b/src/unexpand.c
+@@ -116,16 +116,36 @@ unexpand (void)
include characters other than spaces, so the blanks must be
stored, not merely counted. */
mbf_char_t *pending_blank;
@@ -268,7 +263,7 @@ diff -up ./src/unexpand.c.orig ./src/unexpand.c
while (true)
{
-@@ -225,6 +245,27 @@ unexpand (void)
+@@ -169,6 +189,27 @@ unexpand (void)
if ((mb_iseof (c)) && (fp = next_file (fp)))
{
mbf_init (mbf, fp);
@@ -296,10 +291,11 @@ diff -up ./src/unexpand.c.orig ./src/unexpand.c
continue;
}
else
-diff -up ./tests/expand/mb.sh.orig ./tests/expand/mb.sh
---- ./tests/expand/mb.sh.orig 2016-06-28 14:44:18.287619000 +0200
-+++ ./tests/expand/mb.sh 2016-06-30 11:57:10.038407216 +0200
-@@ -109,4 +109,75 @@ äbcdef\xFF |
+diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
+index 031be7a..1621c84 100755
+--- a/tests/expand/mb.sh
++++ b/tests/expand/mb.sh
+@@ -109,4 +109,75 @@ env printf '12345678
expand < in > out || fail=1
compare exp out > /dev/null 2>&1 || fail=1
@@ -375,10 +371,11 @@ diff -up ./tests/expand/mb.sh.orig ./tests/expand/mb.sh
+compare exp out > /dev/null 2>&1 || fail=1
+
exit $fail
-diff -up ./tests/unexpand/mb.sh.orig ./tests/unexpand/mb.sh
---- ./tests/unexpand/mb.sh.orig 2016-06-28 17:39:22.895259000 +0200
-+++ ./tests/unexpand/mb.sh 2016-07-07 09:55:00.098281917 +0200
-@@ -111,3 +111,62 @@ äbcdef\xFF\t|
+diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
+index 8d75652..9d4ee3e 100755
+--- a/tests/unexpand/mb.sh
++++ b/tests/unexpand/mb.sh
+@@ -111,3 +111,62 @@ env printf '12345678
unexpand -a < in > out || fail=1
compare exp out > /dev/null 2>&1 || fail=1
diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch
index bcce9ff..d7cf59c 100644
--- a/coreutils-i18n.patch
+++ b/coreutils-i18n.patch
@@ -1,6 +1,36 @@
-diff -urNp coreutils-8.24-orig/lib/linebuffer.h coreutils-8.24/lib/linebuffer.h
---- coreutils-8.24-orig/lib/linebuffer.h 2015-06-16 07:00:37.000000000 +0200
-+++ coreutils-8.24/lib/linebuffer.h 2015-07-05 09:04:33.027546943 +0200
+From 29117b2d07af00f4d4b87cf778e4294588ab1a83 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Thu, 1 Dec 2016 15:10:04 +0100
+Subject: [PATCH] coreutils-i18n.patch
+
+TODO: merge upstream
+---
+ lib/linebuffer.h | 8 +
+ src/fold.c | 308 ++++++++++++++++--
+ src/join.c | 359 ++++++++++++++++++---
+ src/pr.c | 443 ++++++++++++++++++++++---
+ src/sort.c | 764 +++++++++++++++++++++++++++++++++++++++++---
+ src/uniq.c | 265 ++++++++++++++-
+ tests/i18n/sort.sh | 29 ++
+ tests/local.mk | 2 +
+ tests/misc/cut.pl | 7 +-
+ tests/misc/expand.pl | 42 +++
+ tests/misc/fold.pl | 50 ++-
+ tests/misc/join.pl | 50 +++
+ tests/misc/sort-mb-tests.sh | 45 +++
+ tests/misc/sort-merge.pl | 42 +++
+ tests/misc/sort.pl | 40 ++-
+ tests/misc/unexpand.pl | 39 +++
+ tests/misc/uniq.pl | 55 ++++
+ tests/pr/pr-tests.pl | 49 +++
+ 18 files changed, 2435 insertions(+), 162 deletions(-)
+ create mode 100644 tests/i18n/sort.sh
+ create mode 100644 tests/misc/sort-mb-tests.sh
+
+diff --git a/lib/linebuffer.h b/lib/linebuffer.h
+index 64181af..9b8fe5a 100644
+--- a/lib/linebuffer.h
++++ b/lib/linebuffer.h
@@ -21,6 +21,11 @@
# include
@@ -23,10 +53,11 @@ diff -urNp coreutils-8.24-orig/lib/linebuffer.h coreutils-8.24/lib/linebuffer.h
};
/* Initialize linebuffer LINEBUFFER for use. */
-diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
---- coreutils-8.24-orig/src/fold.c 2015-06-26 19:05:22.000000000 +0200
-+++ coreutils-8.24/src/fold.c 2015-07-05 09:04:33.029546958 +0200
-@@ -22,11 +22,33 @@
+diff --git a/src/fold.c b/src/fold.c
+index 8cd0d6b..d23edd5 100644
+--- a/src/fold.c
++++ b/src/fold.c
+@@ -22,12 +22,34 @@
#include
#include
@@ -41,6 +72,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
+#endif
+
#include "system.h"
+ #include "die.h"
#include "error.h"
#include "fadvise.h"
#include "xdectoint.h"
@@ -60,7 +92,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
#define TAB_WIDTH 8
/* The official name of this program (e.g., no 'g' prefix). */
-@@ -34,20 +56,41 @@
+@@ -35,20 +57,41 @@
#define AUTHORS proper_name ("David MacKenzie")
@@ -106,7 +138,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
{"spaces", no_argument, NULL, 's'},
{"width", required_argument, NULL, 'w'},
{GETOPT_HELP_OPTION_DECL},
-@@ -75,6 +118,7 @@ Wrap input lines in each FILE, writing to standard output.\n\
+@@ -76,6 +119,7 @@ Wrap input lines in each FILE, writing to standard output.\n\
fputs (_("\
-b, --bytes count bytes rather than columns\n\
@@ -114,7 +146,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
-s, --spaces break at spaces\n\
-w, --width=WIDTH use WIDTH columns instead of 80\n\
"), stdout);
-@@ -92,7 +136,7 @@ Wrap input lines in each FILE, writing to standard output.\n\
+@@ -93,7 +137,7 @@ Wrap input lines in each FILE, writing to standard output.\n\
static size_t
adjust_column (size_t column, char c)
{
@@ -123,7 +155,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
{
if (c == '\b')
{
-@@ -115,30 +159,14 @@ adjust_column (size_t column, char c)
+@@ -116,30 +160,14 @@ adjust_column (size_t column, char c)
to stdout, with maximum line length WIDTH.
Return true if successful. */
@@ -156,7 +188,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
fadvise (istream, FADVISE_SEQUENTIAL);
-@@ -168,6 +196,15 @@ fold_file (char const *filename, size_t width)
+@@ -169,6 +197,15 @@ fold_file (char const *filename, size_t width)
bool found_blank = false;
size_t logical_end = offset_out;
@@ -172,7 +204,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
/* Look for the last blank. */
while (logical_end)
{
-@@ -214,11 +251,221 @@ fold_file (char const *filename, size_t width)
+@@ -215,11 +252,221 @@ fold_file (char const *filename, size_t width)
line_out[offset_out++] = c;
}
@@ -395,7 +427,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
if (ferror (istream))
{
error (0, saved_errno, "%s", quotef (filename));
-@@ -251,7 +498,8 @@ main (int argc, char **argv)
+@@ -252,7 +499,8 @@ main (int argc, char **argv)
atexit (close_stdout);
@@ -405,7 +437,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
{
-@@ -260,7 +508,15 @@ main (int argc, char **argv)
+@@ -261,7 +509,15 @@ main (int argc, char **argv)
switch (optc)
{
case 'b': /* Count bytes rather than columns. */
@@ -422,10 +454,11 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c
break;
case 's': /* Break at word boundaries. */
-diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
---- coreutils-8.24-orig/src/join.c 2015-06-26 19:05:22.000000000 +0200
-+++ coreutils-8.24/src/join.c 2015-07-05 09:04:33.029546958 +0200
-@@ -22,18 +22,32 @@
+diff --git a/src/join.c b/src/join.c
+index 98b461c..9990f38 100644
+--- a/src/join.c
++++ b/src/join.c
+@@ -22,19 +22,33 @@
#include
#include
@@ -440,6 +473,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
+#endif
+
#include "system.h"
+ #include "die.h"
#include "error.h"
#include "fadvise.h"
#include "hard-locale.h"
@@ -459,7 +493,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "join"
-@@ -135,10 +149,12 @@ static struct outlist outlist_head;
+@@ -136,10 +150,12 @@ static struct outlist outlist_head;
/* Last element in 'outlist', where a new element can be added. */
static struct outlist *outlist_end = &outlist_head;
@@ -476,7 +510,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
/* If nonzero, check that the input is correctly ordered. */
static enum
-@@ -275,13 +291,14 @@ xfields (struct line *line)
+@@ -276,13 +292,14 @@ xfields (struct line *line)
if (ptr == lim)
return;
@@ -494,7 +528,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
{
/* Skip leading blanks before the first field. */
while (field_sep (*ptr))
-@@ -305,6 +322,147 @@ xfields (struct line *line)
+@@ -306,6 +323,147 @@ xfields (struct line *line)
extract_field (line, ptr, lim - ptr);
}
@@ -642,7 +676,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
static void
freeline (struct line *line)
{
-@@ -326,56 +484,133 @@ keycmp (struct line const *line1, struct line const *line2,
+@@ -327,56 +485,133 @@ keycmp (struct line const *line1, struct line const *line2,
size_t jf_1, size_t jf_2)
{
/* Start of field to compare in each file. */
@@ -799,7 +833,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
}
/* Check that successive input lines PREV and CURRENT from input file
-@@ -467,6 +702,11 @@ get_line (FILE *fp, struct line **linep, int which)
+@@ -468,6 +703,11 @@ get_line (FILE *fp, struct line **linep, int which)
}
++line_no[which - 1];
@@ -811,7 +845,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
xfields (line);
if (prevline[which - 1])
-@@ -566,21 +806,28 @@ prfield (size_t n, struct line const *line)
+@@ -567,21 +807,28 @@ prfield (size_t n, struct line const *line)
/* Output all the fields in line, other than the join field. */
@@ -843,7 +877,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
prfield (i, line);
}
}
-@@ -591,7 +838,6 @@ static void
+@@ -592,7 +839,6 @@ static void
prjoin (struct line const *line1, struct line const *line2)
{
const struct outlist *outlist;
@@ -851,7 +885,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
size_t field;
struct line const *line;
-@@ -625,7 +871,7 @@ prjoin (struct line const *line1, struct line const *line2)
+@@ -626,7 +872,7 @@ prjoin (struct line const *line1, struct line const *line2)
o = o->next;
if (o == NULL)
break;
@@ -860,7 +894,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
}
putchar (eolchar);
}
-@@ -1103,21 +1349,46 @@ main (int argc, char **argv)
+@@ -1104,20 +1350,43 @@ main (int argc, char **argv)
case 't':
{
@@ -887,16 +921,14 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
+ newtablen = 1;
if (! newtab)
- newtab = '\n'; /* '' => process the whole line. */
-+ {
+ newtab = (char*)"\n"; /* '' => process the whole line. */
-+ }
else if (optarg[1])
{
- if (STREQ (optarg, "\\0"))
- newtab = '\0';
- else
-- error (EXIT_FAILURE, 0, _("multi-character tab %s"),
-- quote (optarg));
+- die (EXIT_FAILURE, 0, _("multi-character tab %s"),
+- quote (optarg));
+ if (newtablen == 1 && newtab[1])
+ {
+ if (STREQ (newtab, "\\0"))
@@ -906,20 +938,19 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c
+ if (tab != NULL && strcmp (tab, newtab))
+ {
+ free (newtab);
-+ error (EXIT_FAILURE, 0, _("incompatible tabs"));
++ die (EXIT_FAILURE, 0, _("incompatible tabs"));
}
- if (0 <= tab && tab != newtab)
-- error (EXIT_FAILURE, 0, _("incompatible tabs"));
+- die (EXIT_FAILURE, 0, _("incompatible tabs"));
tab = newtab;
-- }
+ tablen = newtablen;
-+ }
+ }
break;
- case 'z':
-diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
---- coreutils-8.24-orig/src/pr.c 2015-06-26 19:05:22.000000000 +0200
-+++ coreutils-8.24/src/pr.c 2015-07-05 09:04:33.030546965 +0200
+diff --git a/src/pr.c b/src/pr.c
+index 26f221f..633f50e 100644
+--- a/src/pr.c
++++ b/src/pr.c
@@ -311,6 +311,24 @@
#include
@@ -943,9 +974,9 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
+#endif
+
#include "system.h"
+ #include "die.h"
#include "error.h"
- #include "fadvise.h"
-@@ -323,6 +341,18 @@
+@@ -324,6 +342,18 @@
#include "xstrtol.h"
#include "xdectoint.h"
@@ -964,7 +995,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "pr"
-@@ -415,7 +445,20 @@ struct COLUMN
+@@ -416,7 +446,20 @@ struct COLUMN
typedef struct COLUMN COLUMN;
@@ -986,7 +1017,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
static bool read_line (COLUMN *p);
static bool print_page (void);
static bool print_stored (COLUMN *p);
-@@ -427,6 +470,7 @@ static void add_line_number (COLUMN *p);
+@@ -428,6 +471,7 @@ static void add_line_number (COLUMN *p);
static void getoptnum (const char *n_str, int min, int *num,
const char *errfmt);
static void getoptarg (char *arg, char switch_char, char *character,
@@ -994,7 +1025,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
int *number);
static void print_files (int number_of_files, char **av);
static void init_parameters (int number_of_files);
-@@ -440,7 +484,6 @@ static void store_char (char c);
+@@ -441,7 +485,6 @@ static void store_char (char c);
static void pad_down (unsigned int lines);
static void read_rest_of_line (COLUMN *p);
static void skip_read (COLUMN *p, int column_number);
@@ -1002,7 +1033,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
static void cleanup (void);
static void print_sep_string (void);
static void separator_string (const char *optarg_S);
-@@ -452,7 +495,7 @@ static COLUMN *column_vector;
+@@ -453,7 +496,7 @@ static COLUMN *column_vector;
we store the leftmost columns contiguously in buff.
To print a line from buff, get the index of the first character
from line_vector[i], and print up to line_vector[i + 1]. */
@@ -1011,7 +1042,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* Index of the position in buff where the next character
will be stored. */
-@@ -556,7 +599,7 @@ static int chars_per_column;
+@@ -557,7 +600,7 @@ static int chars_per_column;
static bool untabify_input = false;
/* (-e) The input tab character. */
@@ -1020,7 +1051,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ...
where the leftmost column is 1. */
-@@ -566,7 +609,10 @@ static int chars_per_input_tab = 8;
+@@ -567,7 +610,10 @@ static int chars_per_input_tab = 8;
static bool tabify_output = false;
/* (-i) The output tab character. */
@@ -1032,7 +1063,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* (-i) The width of the output tab. */
static int chars_per_output_tab = 8;
-@@ -636,7 +682,13 @@ static int line_number;
+@@ -637,7 +683,13 @@ static int line_number;
static bool numbered_lines = false;
/* (-n) Character which follows each line number. */
@@ -1047,18 +1078,18 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* (-n) line counting starts with 1st line of input file (not with 1st
line of 1st page printed). */
-@@ -689,6 +741,7 @@ static bool use_col_separator = false;
+@@ -690,6 +742,7 @@ static bool use_col_separator = false;
-a|COLUMN|-m is a 'space' and with the -J option a 'tab'. */
- static char *col_sep_string = (char *) "";
+ static char const *col_sep_string = "";
static int col_sep_length = 0;
+static int col_sep_width = 0;
static char *column_separator = (char *) " ";
static char *line_separator = (char *) "\t";
-@@ -839,6 +892,13 @@ separator_string (const char *optarg_S)
- col_sep_length = (int) strlen (optarg_S);
- col_sep_string = xmalloc (col_sep_length + 1);
- strcpy (col_sep_string, optarg_S);
+@@ -851,6 +904,13 @@ separator_string (const char *optarg_S)
+ integer_overflow ();
+ col_sep_length = len;
+ col_sep_string = optarg_S;
+
+#if HAVE_MBRTOWC
+ if (MB_CUR_MAX > 1)
@@ -1069,7 +1100,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
}
int
-@@ -863,6 +923,21 @@ main (int argc, char **argv)
+@@ -875,6 +935,21 @@ main (int argc, char **argv)
atexit (close_stdout);
@@ -1090,8 +1121,8 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
+
n_files = 0;
file_names = (argc > 1
- ? xmalloc ((argc - 1) * sizeof (char *))
-@@ -939,8 +1014,12 @@ main (int argc, char **argv)
+ ? xnmalloc (argc - 1, sizeof (char *))
+@@ -951,8 +1026,12 @@ main (int argc, char **argv)
break;
case 'e':
if (optarg)
@@ -1106,7 +1137,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* Could check tab width > 0. */
untabify_input = true;
break;
-@@ -953,8 +1032,12 @@ main (int argc, char **argv)
+@@ -965,8 +1044,12 @@ main (int argc, char **argv)
break;
case 'i':
if (optarg)
@@ -1121,7 +1152,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* Could check tab width > 0. */
tabify_output = true;
break;
-@@ -972,8 +1055,8 @@ main (int argc, char **argv)
+@@ -984,8 +1067,8 @@ main (int argc, char **argv)
case 'n':
numbered_lines = true;
if (optarg)
@@ -1132,16 +1163,15 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
break;
case 'N':
skip_count = false;
-@@ -997,7 +1080,7 @@ main (int argc, char **argv)
- old_s = false;
+@@ -1010,6 +1093,7 @@ main (int argc, char **argv)
/* Reset an additional input of -s, -S dominates -s */
- col_sep_string = bad_cast ("");
-- col_sep_length = 0;
-+ col_sep_length = col_sep_width = 0;
+ col_sep_string = "";
+ col_sep_length = 0;
++ col_sep_width = 0;
use_col_separator = true;
if (optarg)
separator_string (optarg);
-@@ -1152,10 +1235,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err)
+@@ -1166,10 +1250,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err)
a number. */
static void
@@ -1189,7 +1219,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
if (*arg)
{
long int tmp_long;
-@@ -1177,6 +1295,11 @@ static void
+@@ -1191,6 +1310,11 @@ static void
init_parameters (int number_of_files)
{
int chars_used_by_number = 0;
@@ -1201,7 +1231,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
lines_per_body = lines_per_page - lines_per_header - lines_per_footer;
if (lines_per_body <= 0)
-@@ -1214,7 +1337,7 @@ init_parameters (int number_of_files)
+@@ -1228,7 +1352,7 @@ init_parameters (int number_of_files)
else
col_sep_string = column_separator;
@@ -1210,7 +1240,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
use_col_separator = true;
}
/* It's rather pointless to define a TAB separator with column
-@@ -1244,11 +1367,11 @@ init_parameters (int number_of_files)
+@@ -1258,11 +1382,11 @@ init_parameters (int number_of_files)
+ TAB_WIDTH (chars_per_input_tab, chars_per_number); */
/* Estimate chars_per_text without any margin and keep it constant. */
@@ -1224,16 +1254,16 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* The number is part of the column width unless we are
printing files in parallel. */
-@@ -1257,7 +1380,7 @@ init_parameters (int number_of_files)
+@@ -1271,7 +1395,7 @@ init_parameters (int number_of_files)
}
- chars_per_column = (chars_per_line - chars_used_by_number
-- - (columns - 1) * col_sep_length) / columns;
-+ - (columns - 1) * col_sep_width) / columns;
-
- if (chars_per_column < 1)
- error (EXIT_FAILURE, 0, _("page width too narrow"));
-@@ -1275,7 +1398,7 @@ init_parameters (int number_of_files)
+ int sep_chars, useful_chars;
+- if (INT_MULTIPLY_WRAPV (columns - 1, col_sep_length, &sep_chars))
++ if (INT_MULTIPLY_WRAPV (columns - 1, col_sep_width, &sep_chars))
+ sep_chars = INT_MAX;
+ if (INT_SUBTRACT_WRAPV (chars_per_line - chars_used_by_number, sep_chars,
+ &useful_chars))
+@@ -1294,7 +1418,7 @@ init_parameters (int number_of_files)
We've to use 8 as the lower limit, if we use chars_per_default_tab = 8
to expand a tab which is not an input_tab-char. */
free (clump_buff);
@@ -1242,7 +1272,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
}
/* Open the necessary files,
-@@ -1383,7 +1506,7 @@ init_funcs (void)
+@@ -1402,7 +1526,7 @@ init_funcs (void)
/* Enlarge p->start_position of first column to use the same form of
padding_not_printed with all columns. */
@@ -1251,7 +1281,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* This loop takes care of all but the rightmost column. */
-@@ -1417,7 +1540,7 @@ init_funcs (void)
+@@ -1436,7 +1560,7 @@ init_funcs (void)
}
else
{
@@ -1260,19 +1290,19 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
h_next = h + chars_per_column;
}
}
-@@ -1708,9 +1831,9 @@ static void
+@@ -1727,9 +1851,9 @@ static void
align_column (COLUMN *p)
{
padding_not_printed = p->start_position;
-- if (padding_not_printed - col_sep_length > 0)
-+ if (padding_not_printed - col_sep_width > 0)
+- if (col_sep_length < padding_not_printed)
++ if (col_sep_width < padding_not_printed)
{
- pad_across_to (padding_not_printed - col_sep_length);
+ pad_across_to (padding_not_printed - col_sep_width);
padding_not_printed = ANYWHERE;
}
-@@ -1981,13 +2104,13 @@ store_char (char c)
+@@ -2004,13 +2128,13 @@ store_char (char c)
/* May be too generous. */
buff = X2REALLOC (buff, &buff_allocated);
}
@@ -1288,7 +1318,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
char *s;
int num_width;
-@@ -2004,22 +2127,24 @@ add_line_number (COLUMN *p)
+@@ -2027,22 +2151,24 @@ add_line_number (COLUMN *p)
/* Tabification is assumed for multiple columns, also for n-separators,
but 'default n-separator = TAB' hasn't been given priority over
equal column_width also specified by POSIX. */
@@ -1317,7 +1347,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
output_position = POS_AFTER_TAB (chars_per_output_tab,
output_position);
}
-@@ -2180,7 +2305,7 @@ print_white_space (void)
+@@ -2203,7 +2329,7 @@ print_white_space (void)
while (goal - h_old > 1
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
{
@@ -1326,15 +1356,15 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
h_old = h_new;
}
while (++h_old <= goal)
-@@ -2200,6 +2325,7 @@ print_sep_string (void)
+@@ -2223,6 +2349,7 @@ print_sep_string (void)
{
- char *s;
+ char const *s = col_sep_string;
int l = col_sep_length;
+ int not_space_flag;
- s = col_sep_string;
-
-@@ -2213,6 +2339,7 @@ print_sep_string (void)
+ if (separators_not_printed <= 0)
+ {
+@@ -2234,6 +2361,7 @@ print_sep_string (void)
{
for (; separators_not_printed > 0; --separators_not_printed)
{
@@ -1342,7 +1372,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
while (l-- > 0)
{
/* 3 types of sep_strings: spaces only, spaces and chars,
-@@ -2226,12 +2353,15 @@ print_sep_string (void)
+@@ -2247,12 +2375,15 @@ print_sep_string (void)
}
else
{
@@ -1359,7 +1389,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* sep_string ends with some spaces */
if (spaces_not_printed > 0)
print_white_space ();
-@@ -2259,7 +2389,7 @@ print_clump (COLUMN *p, int n, char *clump)
+@@ -2280,7 +2411,7 @@ print_clump (COLUMN *p, int n, char *clump)
required number of tabs and spaces. */
static void
@@ -1368,7 +1398,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
{
if (tabify_output)
{
-@@ -2283,6 +2413,74 @@ print_char (char c)
+@@ -2304,6 +2435,74 @@ print_char (char c)
putchar (c);
}
@@ -1443,19 +1473,19 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* Skip to page PAGE before printing.
PAGE may be larger than total number of pages. */
-@@ -2462,9 +2660,9 @@ read_line (COLUMN *p)
+@@ -2483,9 +2682,9 @@ read_line (COLUMN *p)
align_empty_cols = false;
}
-- if (padding_not_printed - col_sep_length > 0)
-+ if (padding_not_printed - col_sep_width > 0)
+- if (col_sep_length < padding_not_printed)
++ if (col_sep_width < padding_not_printed)
{
- pad_across_to (padding_not_printed - col_sep_length);
+ pad_across_to (padding_not_printed - col_sep_width);
padding_not_printed = ANYWHERE;
}
-@@ -2534,7 +2732,7 @@ print_stored (COLUMN *p)
+@@ -2555,7 +2754,7 @@ print_stored (COLUMN *p)
int i;
int line = p->current_line++;
@@ -1464,7 +1494,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
/* FIXME
UMR: Uninitialized memory read:
* This is occurring while in:
-@@ -2546,7 +2744,7 @@ print_stored (COLUMN *p)
+@@ -2567,7 +2766,7 @@ print_stored (COLUMN *p)
xmalloc [xmalloc.c:94]
init_store_cols [pr.c:1648]
*/
@@ -1473,19 +1503,19 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
pad_vertically = true;
-@@ -2565,9 +2763,9 @@ print_stored (COLUMN *p)
+@@ -2586,9 +2785,9 @@ print_stored (COLUMN *p)
}
}
-- if (padding_not_printed - col_sep_length > 0)
-+ if (padding_not_printed - col_sep_width > 0)
+- if (col_sep_length < padding_not_printed)
++ if (col_sep_width < padding_not_printed)
{
- pad_across_to (padding_not_printed - col_sep_length);
+ pad_across_to (padding_not_printed - col_sep_width);
padding_not_printed = ANYWHERE;
}
-@@ -2580,8 +2778,8 @@ print_stored (COLUMN *p)
+@@ -2601,8 +2800,8 @@ print_stored (COLUMN *p)
if (spaces_not_printed == 0)
{
output_position = p->start_position + end_vector[line];
@@ -1496,7 +1526,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
}
return true;
-@@ -2600,7 +2798,7 @@ print_stored (COLUMN *p)
+@@ -2621,7 +2820,7 @@ print_stored (COLUMN *p)
number of characters is 1.) */
static int
@@ -1505,7 +1535,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
{
unsigned char uc = c;
char *s = clump_buff;
-@@ -2610,10 +2808,10 @@ char_to_clump (char c)
+@@ -2631,10 +2830,10 @@ char_to_clump (char c)
int chars;
int chars_per_c = 8;
@@ -1518,7 +1548,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c
{
width = TAB_WIDTH (chars_per_c, input_position);
-@@ -2694,6 +2892,164 @@ char_to_clump (char c)
+@@ -2715,6 +2914,164 @@ char_to_clump (char c)
return chars;
}
@@ -1683,9 +1713,10 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/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.24-orig/src/sort.c coreutils-8.24/src/sort.c
---- coreutils-8.24-orig/src/sort.c 2015-06-26 19:05:22.000000000 +0200
-+++ coreutils-8.24/src/sort.c 2015-07-05 09:04:33.032546980 +0200
+diff --git a/src/sort.c b/src/sort.c
+index 6d2eec5..f189a0d 100644
+--- a/src/sort.c
++++ b/src/sort.c
@@ -29,6 +29,14 @@
#include
#include
@@ -1700,8 +1731,8 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
+
#include "system.h"
#include "argmatch.h"
- #include "error.h"
-@@ -163,14 +171,39 @@ static int decimal_point;
+ #include "die.h"
+@@ -165,14 +173,39 @@ static int decimal_point;
/* Thousands separator; if -1, then there isn't one. */
static int thousands_sep;
@@ -1742,7 +1773,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
/* The kind of blanks for '-b' to skip in various options. */
enum blanktype { bl_start, bl_end, bl_both };
-@@ -344,13 +377,11 @@ static bool reverse;
+@@ -346,13 +379,11 @@ static bool reverse;
they were read if all keys compare equal. */
static bool stable;
@@ -1759,7 +1790,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
/* Flag to remove consecutive duplicate lines from the output.
Only the last of a sequence of equal lines will be output. */
-@@ -810,6 +841,46 @@ reap_all (void)
+@@ -811,6 +842,46 @@ reap_all (void)
reap (-1);
}
@@ -1806,7 +1837,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
/* Clean up any remaining temporary files. */
static void
-@@ -1254,7 +1325,7 @@ zaptemp (char const *name)
+@@ -1255,7 +1326,7 @@ zaptemp (char const *name)
free (node);
}
@@ -1815,7 +1846,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
static int
struct_month_cmp (void const *m1, void const *m2)
-@@ -1269,7 +1340,7 @@ struct_month_cmp (void const *m1, void const *m2)
+@@ -1270,7 +1341,7 @@ struct_month_cmp (void const *m1, void const *m2)
/* Initialize the character class tables. */
static void
@@ -1824,7 +1855,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
size_t i;
-@@ -1281,7 +1352,7 @@ inittables (void)
+@@ -1282,7 +1353,7 @@ inittables (void)
fold_toupper[i] = toupper (i);
}
@@ -1833,7 +1864,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
/* If we're not in the "C" locale, read different names for months. */
if (hard_LC_TIME)
{
-@@ -1363,6 +1434,84 @@ specify_nmerge (int oi, char c, char const *s)
+@@ -1364,6 +1435,84 @@ specify_nmerge (int oi, char c, char const *s)
xstrtol_fatal (e, oi, c, long_options, s);
}
@@ -1918,7 +1949,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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)
-@@ -1596,7 +1745,7 @@ buffer_linelim (struct buffer const *buf)
+@@ -1597,7 +1746,7 @@ buffer_linelim (struct buffer const *buf)
by KEY in LINE. */
static char *
@@ -1927,7 +1958,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t sword = key->sword;
-@@ -1605,10 +1754,10 @@ begfield (struct line const *line, struct keyfield const *key)
+@@ -1606,10 +1755,10 @@ begfield (struct line const *line, struct keyfield const *key)
/* The leading field separator itself is included in a field when -t
is absent. */
@@ -1940,7 +1971,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
++ptr;
if (ptr < lim)
++ptr;
-@@ -1634,11 +1783,70 @@ begfield (struct line const *line, struct keyfield const *key)
+@@ -1635,11 +1784,70 @@ begfield (struct line const *line, struct keyfield const *key)
return ptr;
}
@@ -2012,7 +2043,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar;
-@@ -1653,10 +1861,10 @@ limfield (struct line const *line, struct keyfield const *key)
+@@ -1654,10 +1862,10 @@ limfield (struct line const *line, struct keyfield const *key)
'beginning' is the first character following the delimiting TAB.
Otherwise, leave PTR pointing at the first 'blank' character after
the preceding field. */
@@ -2025,7 +2056,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
++ptr;
if (ptr < lim && (eword || echar))
++ptr;
-@@ -1702,10 +1910,10 @@ limfield (struct line const *line, struct keyfield const *key)
+@@ -1703,10 +1911,10 @@ limfield (struct line const *line, struct keyfield const *key)
*/
/* Make LIM point to the end of (one byte past) the current field. */
@@ -2038,7 +2069,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
if (newlim)
lim = newlim;
}
-@@ -1736,6 +1944,130 @@ limfield (struct line const *line, struct keyfield const *key)
+@@ -1737,6 +1945,130 @@ limfield (struct line const *line, struct keyfield const *key)
return ptr;
}
@@ -2169,7 +2200,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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
-@@ -1822,8 +2154,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
+@@ -1823,8 +2155,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
else
{
if (key->skipsblanks)
@@ -2194,7 +2225,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
line->keybeg = line_start;
}
}
-@@ -1944,7 +2290,7 @@ human_numcompare (char const *a, char const *b)
+@@ -1974,7 +2320,7 @@ human_numcompare (char const *a, char const *b)
hideously fast. */
static int
@@ -2203,7 +2234,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
while (blanks[to_uchar (*a)])
a++;
-@@ -1954,6 +2300,25 @@ numcompare (char const *a, char const *b)
+@@ -1984,6 +2330,25 @@ numcompare (char const *a, char const *b)
return strnumcmp (a, b, decimal_point, thousands_sep);
}
@@ -2229,7 +2260,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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
-@@ -2004,7 +2369,7 @@ general_numcompare (char const *sa, char const *sb)
+@@ -2034,7 +2399,7 @@ general_numcompare (char const *sa, char const *sb)
Return 0 if the name in S is not recognized. */
static int
@@ -2238,7 +2269,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
size_t lo = 0;
size_t hi = MONTHS_PER_YEAR;
-@@ -2280,15 +2645,14 @@ debug_key (struct line const *line, struct keyfield const *key)
+@@ -2310,15 +2675,14 @@ debug_key (struct line const *line, struct keyfield const *key)
char saved = *lim;
*lim = '\0';
@@ -2256,16 +2287,16 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
else if (key->general_numeric)
ignore_value (strtold (beg, &tighter_lim));
else if (key->numeric || key->human_numeric)
-@@ -2432,7 +2796,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
- bool maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key)
- && !(key->schar || key->echar);
+@@ -2452,7 +2816,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
+ /* Warn about significant leading blanks. */
+ bool implicit_skip = key_numeric (key) || key->month;
bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */
-- if (!gkey_only && tab == TAB_DEFAULT && !line_offset
-+ if (!gkey_only && !tab_length && !line_offset
- && ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned))
+- if (!zero_width && !gkey_only && tab == TAB_DEFAULT && !line_offset
++ if (!zero_width && !gkey_only && !tab_length && !line_offset
+ && ((!key->skipsblanks && !implicit_skip)
|| (!key->skipsblanks && key->schar)
|| (!key->skipeblanks && key->echar)))
-@@ -2490,11 +2854,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
+@@ -2510,11 +2874,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
error (0, 0, _("option '-r' only applies to last-resort comparison"));
}
@@ -2354,7 +2385,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
struct keyfield *key = keylist;
-@@ -2579,7 +3019,7 @@ keycompare (struct line const *a, struct line const *b)
+@@ -2599,7 +3039,7 @@ keycompare (struct line const *a, struct line const *b)
else if (key->human_numeric)
diff = human_numcompare (ta, tb);
else if (key->month)
@@ -2363,7 +2394,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
else if (key->random)
diff = compare_random (ta, tlena, tb, tlenb);
else if (key->version)
-@@ -2695,6 +3135,211 @@ keycompare (struct line const *a, struct line const *b)
+@@ -2715,6 +3155,211 @@ keycompare (struct line const *a, struct line const *b)
return key->reverse ? -diff : diff;
}
@@ -2575,7 +2606,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/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. */
-@@ -2722,7 +3367,7 @@ compare (struct line const *a, struct line const *b)
+@@ -2742,7 +3387,7 @@ compare (struct line const *a, struct line const *b)
diff = - NONZERO (blen);
else if (blen == 0)
diff = 1;
@@ -2584,7 +2615,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
{
/* Note xmemcoll0 is a performance enhancement as
it will not unconditionally write '\0' after the
-@@ -4121,6 +4766,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
+@@ -4139,6 +4784,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
break;
case 'f':
key->translate = fold_toupper;
@@ -2592,7 +2623,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
break;
case 'g':
key->general_numeric = true;
-@@ -4199,7 +4845,7 @@ main (int argc, char **argv)
+@@ -4218,7 +4864,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE);
@@ -2601,7 +2632,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
hard_LC_TIME = hard_locale (LC_TIME);
#endif
-@@ -4220,6 +4866,29 @@ main (int argc, char **argv)
+@@ -4239,6 +4885,29 @@ main (int argc, char **argv)
thousands_sep = -1;
}
@@ -2631,7 +2662,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
have_read_stdin = false;
inittables ();
-@@ -4494,13 +5163,34 @@ main (int argc, char **argv)
+@@ -4513,13 +5182,34 @@ main (int argc, char **argv)
case 't':
{
@@ -2641,7 +2672,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
+ size_t newtab_length = 1;
+ strncpy (newtab, optarg, MB_LEN_MAX);
+ if (! newtab[0])
- error (SORT_FAILURE, 0, _("empty tab"));
+ die (SORT_FAILURE, 0, _("empty tab"));
- if (optarg[1])
+#if HAVE_MBRTOWC
+ if (MB_CUR_MAX > 1)
@@ -2670,22 +2701,21 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
else
{
/* Provoke with 'sort -txx'. Complain about
-@@ -4511,9 +5201,12 @@ main (int argc, char **argv)
- quote (optarg));
+@@ -4530,9 +5220,11 @@ main (int argc, char **argv)
+ quote (optarg));
}
}
- if (tab != TAB_DEFAULT && tab != newtab)
-+ if (tab_length
-+ && (tab_length != newtab_length
-+ || memcmp (tab, newtab, tab_length) != 0))
- error (SORT_FAILURE, 0, _("incompatible tabs"));
++ if (tab_length && (tab_length != newtab_length
++ || memcmp (tab, newtab, tab_length) != 0))
+ die (SORT_FAILURE, 0, _("incompatible tabs"));
- tab = newtab;
+ memcpy (tab, newtab, newtab_length);
+ tab_length = newtab_length;
}
break;
-@@ -4751,12 +5444,10 @@ main (int argc, char **argv)
+@@ -4770,12 +5462,10 @@ main (int argc, char **argv)
sort (files, nfiles, outfile, nthreads);
}
@@ -2697,10 +2727,11 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c
-#endif
if (have_read_stdin && fclose (stdin) == EOF)
- die (_("close failed"), "-");
-diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
---- coreutils-8.24-orig/src/uniq.c 2015-06-26 19:04:19.000000000 +0200
-+++ coreutils-8.24/src/uniq.c 2015-07-05 09:04:33.032546980 +0200
+ sort_die (_("close failed"), "-");
+diff --git a/src/uniq.c b/src/uniq.c
+index 87a0c93..9f755d9 100644
+--- a/src/uniq.c
++++ b/src/uniq.c
@@ -21,6 +21,17 @@
#include
#include
@@ -2719,7 +2750,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
#include "system.h"
#include "argmatch.h"
#include "linebuffer.h"
-@@ -31,9 +42,21 @@
+@@ -32,9 +43,21 @@
#include "stdio--.h"
#include "xmemcoll.h"
#include "xstrtol.h"
@@ -2742,7 +2773,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "uniq"
-@@ -143,6 +166,10 @@ enum
+@@ -144,6 +167,10 @@ enum
GROUP_OPTION = CHAR_MAX + 1
};
@@ -2753,7 +2784,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
static struct option const longopts[] =
{
{"count", no_argument, NULL, 'c'},
-@@ -252,7 +279,7 @@ size_opt (char const *opt, char const *msgid)
+@@ -260,7 +287,7 @@ size_opt (char const *opt, char const *msgid)
return a pointer to the beginning of the line's field to be compared. */
static char * _GL_ATTRIBUTE_PURE
@@ -2762,7 +2793,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
{
size_t count;
char const *lp = line->buffer;
-@@ -272,6 +299,83 @@ find_field (struct linebuffer const *line)
+@@ -280,6 +307,83 @@ find_field (struct linebuffer const *line)
return line->buffer + i;
}
@@ -2846,7 +2877,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
/* Return false if two strings OLD and NEW match, true if not.
OLD and NEW point not to the beginnings of the lines
but rather to the beginnings of the fields to compare.
-@@ -280,6 +384,8 @@ find_field (struct linebuffer const *line)
+@@ -288,6 +392,8 @@ find_field (struct linebuffer const *line)
static bool
different (char *old, char *new, size_t oldlen, size_t newlen)
{
@@ -2855,7 +2886,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
if (check_chars < oldlen)
oldlen = check_chars;
if (check_chars < newlen)
-@@ -287,14 +393,103 @@ different (char *old, char *new, size_t oldlen, size_t newlen)
+@@ -295,14 +401,103 @@ different (char *old, char *new, size_t oldlen, size_t newlen)
if (ignore_case)
{
@@ -2964,7 +2995,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
/* Output the line in linebuffer LINE to standard output
provided that the switches say it should be output.
-@@ -359,19 +554,38 @@ check_file (const char *infile, const char *outfile, char delimiter)
+@@ -367,19 +562,38 @@ check_file (const char *infile, const char *outfile, char delimiter)
char *prevfield IF_LINT ( = NULL);
size_t prevlen IF_LINT ( = 0);
bool first_group_printed = false;
@@ -3003,7 +3034,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
new_group = (prevline->length == 0
|| different (thisfield, prevfield, thislen, prevlen));
-@@ -389,6 +603,10 @@ check_file (const char *infile, const char *outfile, char delimiter)
+@@ -397,6 +611,10 @@ check_file (const char *infile, const char *outfile, char delimiter)
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
@@ -3014,7 +3045,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
first_group_printed = true;
}
}
-@@ -401,17 +619,26 @@ check_file (const char *infile, const char *outfile, char delimiter)
+@@ -409,17 +627,26 @@ check_file (const char *infile, const char *outfile, char delimiter)
size_t prevlen;
uintmax_t match_count = 0;
bool first_delimiter = true;
@@ -3041,7 +3072,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
{
if (ferror (stdin))
-@@ -420,6 +647,14 @@ check_file (const char *infile, const char *outfile, char delimiter)
+@@ -428,6 +655,14 @@ check_file (const char *infile, const char *outfile, char delimiter)
}
thisfield = find_field (thisline);
thislen = thisline->length - 1 - (thisfield - thisline->buffer);
@@ -3056,7 +3087,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
match = !different (thisfield, prevfield, thislen, prevlen);
match_count += match;
-@@ -452,6 +687,9 @@ check_file (const char *infile, const char *outfile, char delimiter)
+@@ -460,6 +695,9 @@ check_file (const char *infile, const char *outfile, char delimiter)
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
@@ -3066,7 +3097,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
if (!match)
match_count = 0;
}
-@@ -498,6 +736,19 @@ main (int argc, char **argv)
+@@ -506,6 +744,19 @@ main (int argc, char **argv)
atexit (close_stdout);
@@ -3086,9 +3117,11 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c
skip_chars = 0;
skip_fields = 0;
check_chars = SIZE_MAX;
-diff -urNp coreutils-8.24-orig/tests/i18n/sort.sh coreutils-8.24/tests/i18n/sort.sh
---- coreutils-8.24-orig/tests/i18n/sort.sh 1970-01-01 01:00:00.000000000 +0100
-+++ coreutils-8.24/tests/i18n/sort.sh 2015-07-05 09:04:33.032546980 +0200
+diff --git a/tests/i18n/sort.sh b/tests/i18n/sort.sh
+new file mode 100644
+index 0000000..26c95de
+--- /dev/null
++++ b/tests/i18n/sort.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Verify sort's multi-byte support.
@@ -3119,21 +3152,23 @@ diff -urNp coreutils-8.24-orig/tests/i18n/sort.sh coreutils-8.24/tests/i18n/sort
+
+
+Exit $fail
-diff -urNp coreutils-8.24-orig/tests/local.mk coreutils-8.24/tests/local.mk
---- coreutils-8.24-orig/tests/local.mk 2015-07-05 09:00:46.526859558 +0200
-+++ coreutils-8.24/tests/local.mk 2015-07-05 09:04:33.033546987 +0200
-@@ -344,6 +344,8 @@ all_tests = \
+diff --git a/tests/local.mk b/tests/local.mk
+index 568944e..192f776 100644
+--- a/tests/local.mk
++++ b/tests/local.mk
+@@ -350,6 +350,8 @@ all_tests = \
tests/misc/sort-discrim.sh \
tests/misc/sort-files0-from.pl \
tests/misc/sort-float.sh \
+ tests/misc/sort-mb-tests.sh \
+ tests/i18n/sort.sh \
+ tests/misc/sort-h-thousands-sep.sh \
tests/misc/sort-merge.pl \
tests/misc/sort-merge-fdlimit.sh \
- tests/misc/sort-month.sh \
-diff -urNp coreutils-8.24-orig/tests/misc/cut.pl coreutils-8.24/tests/misc/cut.pl
---- coreutils-8.24-orig/tests/misc/cut.pl 2015-06-26 19:04:19.000000000 +0200
-+++ coreutils-8.24/tests/misc/cut.pl 2015-07-05 09:04:33.033546987 +0200
+diff --git a/tests/misc/cut.pl b/tests/misc/cut.pl
+index f6f8a56..b426a80 100755
+--- a/tests/misc/cut.pl
++++ b/tests/misc/cut.pl
@@ -23,9 +23,11 @@ use strict;
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
@@ -3156,10 +3191,11 @@ diff -urNp coreutils-8.24-orig/tests/misc/cut.pl coreutils-8.24/tests/misc/cut.p
push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
}
push @Tests, @new;
-diff -urNp coreutils-8.24-orig/tests/misc/expand.pl coreutils-8.24/tests/misc/expand.pl
---- coreutils-8.24-orig/tests/misc/expand.pl 2015-06-26 19:04:19.000000000 +0200
-+++ coreutils-8.24/tests/misc/expand.pl 2015-07-05 09:04:33.033546987 +0200
-@@ -23,6 +23,15 @@ use strict;
+diff --git a/tests/misc/expand.pl b/tests/misc/expand.pl
+index 8a9cad1..9293e39 100755
+--- a/tests/misc/expand.pl
++++ b/tests/misc/expand.pl
+@@ -27,6 +27,15 @@ my $prog = 'expand';
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
@@ -3175,8 +3211,17 @@ diff -urNp coreutils-8.24-orig/tests/misc/expand.pl coreutils-8.24/tests/misc/ex
my @Tests =
(
['t1', '--tabs=3', {IN=>"a\tb"}, {OUT=>"a b"}],
-@@ -31,6 +40,37 @@ my @Tests =
- ['i2', '--tabs=3 -i', {IN=>" \ta\tb"}, {OUT=>" a\tb"}],
+@@ -140,6 +149,8 @@ my @Tests =
+
+
+ # Test errors
++ # FIXME: The following tests contain ‘quoting’ specific to LC_MESSAGES
++ # So we force LC_MESSAGES=C to make them pass.
+ ['e1', '--tabs="a"', {IN=>''}, {OUT=>''}, {EXIT=>1},
+ {ERR => "$prog: tab size contains invalid character(s): 'a'\n"}],
+ ['e2', "-t $UINTMAX_OFLOW", {IN=>''}, {OUT=>''}, {EXIT=>1},
+@@ -150,6 +161,37 @@ my @Tests =
+ {ERR => "$prog: tab sizes must be ascending\n"}],
);
+if ($mb_locale ne 'C')
@@ -3202,7 +3247,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/expand.pl coreutils-8.24/tests/misc/ex
+ push @new_t, $sub;
+ push @$t, $sub;
+ }
-+ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
++ push @new, ["$test_name-mb", @new_t, {ENV => "LANG=$mb_locale LC_MESSAGES=C"}];
+ }
+ push @Tests, @new;
+ }
@@ -3213,9 +3258,10 @@ diff -urNp coreutils-8.24-orig/tests/misc/expand.pl coreutils-8.24/tests/misc/ex
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-diff -urNp coreutils-8.24-orig/tests/misc/fold.pl coreutils-8.24/tests/misc/fold.pl
---- coreutils-8.24-orig/tests/misc/fold.pl 2015-06-26 19:04:19.000000000 +0200
-+++ coreutils-8.24/tests/misc/fold.pl 2015-07-05 09:04:33.033546987 +0200
+diff --git a/tests/misc/fold.pl b/tests/misc/fold.pl
+index 7b192b4..76f073f 100755
+--- a/tests/misc/fold.pl
++++ b/tests/misc/fold.pl
@@ -20,9 +20,18 @@ use strict;
(my $program_name = $0) =~ s|.*/||;
@@ -3285,9 +3331,10 @@ diff -urNp coreutils-8.24-orig/tests/misc/fold.pl coreutils-8.24/tests/misc/fold
-my $prog = 'fold';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
-diff -urNp coreutils-8.24-orig/tests/misc/join.pl coreutils-8.24/tests/misc/join.pl
---- coreutils-8.24-orig/tests/misc/join.pl 2015-06-26 19:04:19.000000000 +0200
-+++ coreutils-8.24/tests/misc/join.pl 2015-07-05 09:04:33.033546987 +0200
+diff --git a/tests/misc/join.pl b/tests/misc/join.pl
+index 4d399d8..07f2823 100755
+--- a/tests/misc/join.pl
++++ b/tests/misc/join.pl
@@ -25,6 +25,15 @@ my $limits = getlimits ();
my $prog = 'join';
@@ -3354,9 +3401,11 @@ diff -urNp coreutils-8.24-orig/tests/misc/join.pl coreutils-8.24/tests/misc/join
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-diff -urNp coreutils-8.24-orig/tests/misc/sort-mb-tests.sh coreutils-8.24/tests/misc/sort-mb-tests.sh
---- coreutils-8.24-orig/tests/misc/sort-mb-tests.sh 1970-01-01 01:00:00.000000000 +0100
-+++ coreutils-8.24/tests/misc/sort-mb-tests.sh 2015-07-05 09:04:33.034546995 +0200
+diff --git a/tests/misc/sort-mb-tests.sh b/tests/misc/sort-mb-tests.sh
+new file mode 100644
+index 0000000..11836ba
+--- /dev/null
++++ b/tests/misc/sort-mb-tests.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Verify sort's multi-byte support.
@@ -3403,9 +3452,10 @@ diff -urNp coreutils-8.24-orig/tests/misc/sort-mb-tests.sh coreutils-8.24/tests/
+compare exp out || { fail=1; cat out; }
+
+Exit $fail
-diff -urNp coreutils-8.24-orig/tests/misc/sort-merge.pl coreutils-8.24/tests/misc/sort-merge.pl
---- coreutils-8.24-orig/tests/misc/sort-merge.pl 2015-06-26 19:04:19.000000000 +0200
-+++ coreutils-8.24/tests/misc/sort-merge.pl 2015-07-05 09:04:33.034546995 +0200
+diff --git a/tests/misc/sort-merge.pl b/tests/misc/sort-merge.pl
+index 23f6ed2..402a987 100755
+--- a/tests/misc/sort-merge.pl
++++ b/tests/misc/sort-merge.pl
@@ -26,6 +26,15 @@ my $prog = 'sort';
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
@@ -3462,9 +3512,10 @@ diff -urNp coreutils-8.24-orig/tests/misc/sort-merge.pl coreutils-8.24/tests/mis
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-diff -urNp coreutils-8.24-orig/tests/misc/sort.pl coreutils-8.24/tests/misc/sort.pl
---- coreutils-8.24-orig/tests/misc/sort.pl 2015-06-26 19:04:19.000000000 +0200
-+++ coreutils-8.24/tests/misc/sort.pl 2015-07-05 09:04:33.034546995 +0200
+diff --git a/tests/misc/sort.pl b/tests/misc/sort.pl
+index c3e7f8e..6ecd3ff 100755
+--- a/tests/misc/sort.pl
++++ b/tests/misc/sort.pl
@@ -24,10 +24,15 @@ my $prog = 'sort';
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
@@ -3529,9 +3580,10 @@ diff -urNp coreutils-8.24-orig/tests/misc/sort.pl coreutils-8.24/tests/misc/sort
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-diff -urNp coreutils-8.24-orig/tests/misc/unexpand.pl coreutils-8.24/tests/misc/unexpand.pl
---- coreutils-8.24-orig/tests/misc/unexpand.pl 2015-06-26 19:04:19.000000000 +0200
-+++ coreutils-8.24/tests/misc/unexpand.pl 2015-07-05 09:04:33.034546995 +0200
+diff --git a/tests/misc/unexpand.pl b/tests/misc/unexpand.pl
+index 6ba6d40..de86723 100755
+--- a/tests/misc/unexpand.pl
++++ b/tests/misc/unexpand.pl
@@ -27,6 +27,14 @@ my $limits = getlimits ();
my $prog = 'unexpand';
@@ -3547,8 +3599,8 @@ diff -urNp coreutils-8.24-orig/tests/misc/unexpand.pl coreutils-8.24/tests/misc/
my @Tests =
(
['a1', {IN=> ' 'x 1 ."y\n"}, {OUT=> ' 'x 1 ."y\n"}],
-@@ -92,6 +100,37 @@ my @Tests =
- {EXIT => 1}, {ERR => "$prog: tab stop value is too large\n"}],
+@@ -128,6 +136,37 @@ my @Tests =
+ ['ts2', '-t5,8', {IN=>"x\t \t y\n"}, {OUT=>"x\t\t y\n"}],
);
+if ($mb_locale ne 'C')
@@ -3585,9 +3637,10 @@ diff -urNp coreutils-8.24-orig/tests/misc/unexpand.pl coreutils-8.24/tests/misc/
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-diff -urNp coreutils-8.24-orig/tests/misc/uniq.pl coreutils-8.24/tests/misc/uniq.pl
---- coreutils-8.24-orig/tests/misc/uniq.pl 2015-06-26 19:04:19.000000000 +0200
-+++ coreutils-8.24/tests/misc/uniq.pl 2015-07-05 09:04:33.035547002 +0200
+diff --git a/tests/misc/uniq.pl b/tests/misc/uniq.pl
+index f028036..8eaf59a 100755
+--- a/tests/misc/uniq.pl
++++ b/tests/misc/uniq.pl
@@ -23,9 +23,17 @@ my $limits = getlimits ();
my $prog = 'uniq';
my $try = "Try '$prog --help' for more information.\n";
@@ -3660,9 +3713,10 @@ diff -urNp coreutils-8.24-orig/tests/misc/uniq.pl coreutils-8.24/tests/misc/uniq
@Tests = add_z_variants \@Tests;
@Tests = triple_test \@Tests;
-diff -urNp coreutils-8.24-orig/tests/pr/pr-tests.pl coreutils-8.24/tests/pr/pr-tests.pl
---- coreutils-8.24-orig/tests/pr/pr-tests.pl 2015-06-26 19:04:19.000000000 +0200
-+++ coreutils-8.24/tests/pr/pr-tests.pl 2015-07-05 09:04:33.035547002 +0200
+diff --git a/tests/pr/pr-tests.pl b/tests/pr/pr-tests.pl
+index ec3980a..136657d 100755
+--- a/tests/pr/pr-tests.pl
++++ b/tests/pr/pr-tests.pl
@@ -24,6 +24,15 @@ use strict;
my $prog = 'pr';
my $normalize_strerror = "s/': .*/'/";
@@ -3679,9 +3733,9 @@ diff -urNp coreutils-8.24-orig/tests/pr/pr-tests.pl coreutils-8.24/tests/pr/pr-t
my @tv = (
# -b option is no longer an official option. But it's still working to
-@@ -467,8 +476,48 @@ push @Tests,
- {IN=>{3=>"x\ty\tz\n"}},
- {OUT=>join("\t", qw(a b c m n o x y z)) . "\n"} ];
+@@ -474,8 +483,48 @@ push @Tests,
+ {IN=>{2=>"a\n"}},
+ {OUT=>"a\t\t\t\t \t\t\ta\n"} ];
+# Add _POSIX2_VERSION=199209 to the environment of each test
+# that uses an old-style option like +1.
@@ -3709,7 +3763,7 @@ diff -urNp coreutils-8.24-orig/tests/pr/pr-tests.pl coreutils-8.24/tests/pr/pr-t
+ push @$t, $sub;
+ }
+ #temporarily skip some failing tests
-+ next if ($test_name =~ "col-0" or $test_name =~ "col-inval");
++ next if ($test_name =~ "col-0" or $test_name =~ "col-inval" or $test_name =~ "asan1");
+ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
+ }
+ push @Tests, @new;
@@ -3728,3 +3782,6 @@ diff -urNp coreutils-8.24-orig/tests/pr/pr-tests.pl coreutils-8.24/tests/pr/pr-t
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
+--
+2.7.4
+
diff --git a/coreutils-overflow.patch b/coreutils-overflow.patch
index 06059a9..d62b19a 100644
--- a/coreutils-overflow.patch
+++ b/coreutils-overflow.patch
@@ -1,6 +1,8 @@
---- coreutils-5.2.1/src/who.c.overflow 2005-05-25 09:59:06.000000000 +0100
-+++ coreutils-5.2.1/src/who.c 2005-05-25 10:00:31.000000000 +0100
-@@ -79,7 +79,7 @@
+diff --git a/src/who.c b/src/who.c
+index 55733b4..3ad4774 100644
+--- a/src/who.c
++++ b/src/who.c
+@@ -81,7 +81,7 @@
# define UT_TYPE_NEW_TIME(U) false
#endif
diff --git a/coreutils-selinux.patch b/coreutils-selinux.patch
index 9f45177..9f780cc 100644
--- a/coreutils-selinux.patch
+++ b/coreutils-selinux.patch
@@ -1,15 +1,17 @@
-diff -urNp coreutils-8.21-orig/man/chcon.x coreutils-8.21/man/chcon.x
---- coreutils-8.21-orig/man/chcon.x 2011-08-23 15:44:01.000000000 +0200
-+++ coreutils-8.21/man/chcon.x 2013-02-15 14:31:58.937482694 +0100
+diff --git a/man/chcon.x b/man/chcon.x
+index 8c1ff6f..c84fb96 100644
+--- a/man/chcon.x
++++ b/man/chcon.x
@@ -1,4 +1,4 @@
[NAME]
-chcon \- change file security context
+chcon \- change file SELinux security context
[DESCRIPTION]
.\" Add any additional description here
-diff -urNp coreutils-8.21-orig/man/runcon.x coreutils-8.21/man/runcon.x
---- coreutils-8.21-orig/man/runcon.x 2011-08-23 15:44:01.000000000 +0200
-+++ coreutils-8.21/man/runcon.x 2013-02-15 14:31:58.938486496 +0100
+diff --git a/man/runcon.x b/man/runcon.x
+index d2df13e..5c5f5d8 100644
+--- a/man/runcon.x
++++ b/man/runcon.x
@@ -1,5 +1,5 @@
[NAME]
-runcon \- run command with specified security context
@@ -17,10 +19,11 @@ diff -urNp coreutils-8.21-orig/man/runcon.x coreutils-8.21/man/runcon.x
[DESCRIPTION]
Run COMMAND with completely-specified CONTEXT, or with current or
transitioned security context modified by one or more of LEVEL,
-diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
---- coreutils-8.21-orig/src/cp.c 2013-02-07 10:37:05.000000000 +0100
-+++ coreutils-8.21/src/cp.c 2013-02-15 14:31:58.945468929 +0100
-@@ -202,6 +202,9 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
+diff --git a/src/cp.c b/src/cp.c
+index 1b528c6..25dbb88 100644
+--- a/src/cp.c
++++ b/src/cp.c
+@@ -203,6 +203,9 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
all\n\
"), stdout);
fputs (_("\
@@ -30,16 +33,16 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
--no-preserve=ATTR_LIST don't preserve the specified attributes\n\
--parents use full source file name under DIRECTORY\n\
"), stdout);
-@@ -943,7 +946,7 @@ main (int argc, char **argv)
- we'll actually use backup_suffix_string. */
- backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
+@@ -929,7 +932,7 @@ main (int argc, char **argv)
+ selinux_enabled = (0 < is_selinux_enabled ());
+ cp_option_init (&x);
- while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:TZ",
+ while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ",
long_opts, NULL))
!= -1)
{
-@@ -991,6 +994,17 @@ main (int argc, char **argv)
+@@ -977,6 +980,17 @@ main (int argc, char **argv)
copy_contents = true;
break;
@@ -57,10 +60,11 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
case 'd':
x.preserve_links = true;
x.dereference = DEREF_NEVER;
-diff -urNp coreutils-8.21-orig/src/id.c coreutils-8.21/src/id.c
---- coreutils-8.21-orig/src/id.c 2013-01-31 01:46:24.000000000 +0100
-+++ coreutils-8.21/src/id.c 2013-02-15 14:31:58.946469154 +0100
-@@ -113,7 +113,7 @@ int
+diff --git a/src/id.c b/src/id.c
+index 05d98a5..d6eb002 100644
+--- a/src/id.c
++++ b/src/id.c
+@@ -114,7 +114,7 @@ int
main (int argc, char **argv)
{
int optc;
@@ -69,28 +73,29 @@ diff -urNp coreutils-8.21-orig/src/id.c coreutils-8.21/src/id.c
bool smack_enabled = is_smack_enabled ();
bool opt_zero = false;
char *pw_name = NULL;
-diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c
---- coreutils-8.21-orig/src/install.c 2013-02-07 10:37:05.000000000 +0100
-+++ coreutils-8.21/src/install.c 2013-02-15 14:31:58.948469440 +0100
-@@ -649,7 +649,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\
+diff --git a/src/install.c b/src/install.c
+index d79d597..437889a 100644
+--- a/src/install.c
++++ b/src/install.c
+@@ -673,7 +673,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\
-v, --verbose print the name of each directory as it is created\n\
"), stdout);
fputs (_("\
- --preserve-context preserve SELinux security context\n\
+ -P, --preserve-context preserve SELinux security context (-P deprecated)\n\
-Z set SELinux security context of destination\n\
- file to default type\n\
+ file and each created directory to default type\n\
--context[=CTX] like -Z, or if CTX is specified then set the\n\
-@@ -817,7 +817,7 @@ main (int argc, char **argv)
- we'll actually use backup_suffix_string. */
- backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
+@@ -824,7 +824,7 @@ main (int argc, char **argv)
+ dir_arg = false;
+ umask (0);
- while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z", long_options,
+ while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pPt:TvS:Z", long_options,
NULL)) != -1)
{
switch (optc)
-@@ -878,6 +878,8 @@ main (int argc, char **argv)
+@@ -885,6 +885,8 @@ main (int argc, char **argv)
no_target_directory = true;
break;
@@ -99,7 +104,7 @@ diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c
case PRESERVE_CONTEXT_OPTION:
if (! selinux_enabled)
{
-@@ -885,6 +887,10 @@ main (int argc, char **argv)
+@@ -892,6 +894,10 @@ main (int argc, char **argv)
"this kernel is not SELinux-enabled"));
break;
}
diff --git a/coreutils-selinuxmanpages.patch b/coreutils-selinuxmanpages.patch
index 1540613..c3eb1a8 100644
--- a/coreutils-selinuxmanpages.patch
+++ b/coreutils-selinuxmanpages.patch
@@ -1,7 +1,8 @@
-diff -urNp coreutils-6.10-orig/doc/coreutils.texi coreutils-6.10/doc/coreutils.texi
---- coreutils-6.10-orig/doc/coreutils.texi 2008-04-07 17:52:11.000000000 +0200
-+++ coreutils-6.10/doc/coreutils.texi 2008-04-07 18:01:43.000000000 +0200
-@@ -8002,6 +8002,11 @@ done
+diff --git a/doc/coreutils.texi b/doc/coreutils.texi
+index 47e4480..cff2ead 100644
+--- a/doc/coreutils.texi
++++ b/doc/coreutils.texi
+@@ -8083,6 +8083,11 @@ done
exit $fail
@end example
diff --git a/coreutils.spec b/coreutils.spec
index c5a835a..fd58008 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,12 +1,11 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
-Version: 8.25
-Release: 17%{?dist}
+Version: 8.26
+Release: 1%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
-Source2: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig
Source50: supported_utils
Source105: coreutils-colorls.sh
Source106: coreutils-colorls.csh
@@ -17,15 +16,6 @@ Source10: coreutils-find-requires.sh
%global __find_provides %{_rpmconfigdir}/find-provides
%global __find_requires %{SOURCE10} %{_rpmconfigdir}/find-requires
-# From upstream
-Patch952: coreutils-8.25-intall-Z-selinux.patch
-# fix 'sort -h -k' in locales that use blank as thousands separator (#1355780)
-Patch953: coreutils-8.25-sort-thousands-sep.patch
-# ls: allow interruption when reading slow directories (#1365933)
-Patch954: coreutils-8.25-ls-signal.patch
-# md5sum,sha*sum: fix --ignore-missing with checksums starting with 00
-Patch955: coreutils-8.25-sum-ignore-missing.patch
-
# Our patches
#general patch to workaround koji build system issues
Patch100: coreutils-6.10-configuration.patch
@@ -213,12 +203,6 @@ tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null
#SELinux
%patch950 -p1 -b .selinux
%patch951 -p1 -b .selinuxman
-%patch952 -p1
-
-# upstream patches
-%patch953 -p1
-%patch954 -p1
-%patch955 -p1
chmod a+x \
tests/df/direct.sh \
@@ -348,6 +332,9 @@ fi
%license COPYING
%changelog
+* Thu Dec 01 2016 Kamil Dudka - 8.26-1
+- new upstream release 8.26
+
* Mon Oct 31 2016 Kamil Dudka - 8.25-17
- md5sum,sha*sum: fix --ignore-missing with checksums starting with 00
diff --git a/sources b/sources
index 52af064..becdeb6 100644
--- a/sources
+++ b/sources
@@ -1,2 +1 @@
-070e43ba7f618d747414ef56ab248a48 coreutils-8.25.tar.xz
-eb5694f81fd88ccf16b68ed80935b10f coreutils-8.25.tar.xz.sig
+d5aa2072f662d4118b9f4c63b94601a6 coreutils-8.26.tar.xz
diff --git a/supported_utils b/supported_utils
index c2aed28..8105ccf 100644
--- a/supported_utils
+++ b/supported_utils
@@ -1,4 +1,5 @@
%{_bindir}/arch
+%{_bindir}/b2sum
%{_bindir}/basename
%{_bindir}/cat
%{_bindir}/chgrp
From 8d346246a75ec5d65859d546f28dc66235b2ea77 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Fri, 2 Dec 2016 11:08:45 +0100
Subject: [PATCH 036/232] disable the test-lock gnulib test prone to deadlock
See https://lists.gnu.org/archive/html/bug-gnulib/2015-07/msg00033.html
and https://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=25fb4c6 for
some context.
---
coreutils-8.26-test-lock.patch | 35 ++++++++++++++++++++++++++++++++++
coreutils.spec | 5 ++++-
2 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 coreutils-8.26-test-lock.patch
diff --git a/coreutils-8.26-test-lock.patch b/coreutils-8.26-test-lock.patch
new file mode 100644
index 0000000..3f2603e
--- /dev/null
+++ b/coreutils-8.26-test-lock.patch
@@ -0,0 +1,35 @@
+From 812480a9fb21b26f2e705b992ce75810f36d08c9 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Fri, 2 Dec 2016 10:12:09 +0100
+Subject: [PATCH] disable the test-lock gnulib test prone to deadlock
+
+See https://lists.gnu.org/archive/html/bug-gnulib/2015-07/msg00033.html
+and https://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=25fb4c6 for
+some context.
+---
+ gnulib-tests/gnulib.mk | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/gnulib-tests/gnulib.mk b/gnulib-tests/gnulib.mk
+index 8f32431..c9943d8 100644
+--- a/gnulib-tests/gnulib.mk
++++ b/gnulib-tests/gnulib.mk
+@@ -1207,15 +1207,6 @@ EXTRA_DIST += test-localename.c macros.h
+
+ ## end gnulib module localename-tests
+
+-## begin gnulib module lock-tests
+-
+-TESTS += test-lock
+-check_PROGRAMS += test-lock
+-test_lock_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@
+-EXTRA_DIST += test-lock.c
+-
+-## end gnulib module lock-tests
+-
+ ## begin gnulib module lseek-tests
+
+ TESTS += test-lseek.sh
+--
+2.7.4
+
diff --git a/coreutils.spec b/coreutils.spec
index fd58008..e5e7f26 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -16,7 +16,9 @@ Source10: coreutils-find-requires.sh
%global __find_provides %{_rpmconfigdir}/find-provides
%global __find_requires %{SOURCE10} %{_rpmconfigdir}/find-requires
-# Our patches
+# disable the test-lock gnulib test prone to deadlock
+Patch1: coreutils-8.26-test-lock.patch
+
#general patch to workaround koji build system issues
Patch100: coreutils-6.10-configuration.patch
#add note about no difference between binary/text mode on Linux - md5sum manpage
@@ -174,6 +176,7 @@ including documentation and translations.
tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null
# Our patches
+%patch1 -p1
%patch100 -p1 -b .configure
%patch101 -p1 -b .manpages
%patch102 -p1
From 59a39fa268d977a7dab581ab51c5465ccc0ebe2e Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Fri, 2 Dec 2016 13:27:35 +0100
Subject: [PATCH 037/232] apply patches automatically to ease maintenance
---
coreutils-i18n-cut.patch | 2 ++
coreutils.spec | 51 ++++++++--------------------------------
2 files changed, 12 insertions(+), 41 deletions(-)
diff --git a/coreutils-i18n-cut.patch b/coreutils-i18n-cut.patch
index f680df6..f4015d1 100644
--- a/coreutils-i18n-cut.patch
+++ b/coreutils-i18n-cut.patch
@@ -1,3 +1,5 @@
+(sb) lin18nux/lsb compliance - cut - not stable enough, not applied
+
--- coreutils-8.24/src/cut.c 2015-06-26 19:05:22.000000000 +0200
+++ cut.c 2016-01-15 10:15:04.863804121 +0100
@@ -28,6 +28,11 @@
diff --git a/coreutils.spec b/coreutils.spec
index e5e7f26..bf783b9 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.26
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -41,8 +41,6 @@ Patch713: coreutils-4.5.3-langinfo.patch
Patch800: coreutils-i18n.patch
# (sb) lin18nux/lsb compliance - expand/unexpand
Patch801: coreutils-i18n-expand-unexpand.patch
-# (sb) lin18nux/lsb compliance - cut - not stable enough, not applied
-Patch802: coreutils-i18n-cut.patch
# i18n patch for cut - old version - used
Patch804: coreutils-i18n-cut-old.patch
# The unexpand patch above is not correct. Sent to the patch authors
@@ -170,49 +168,17 @@ Optional though recommended components,
including documentation and translations.
%prep
-%setup -q
+%autosetup -N
# will be modified by coreutils-8.25-DIR_COLORS.patch
tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null
-# Our patches
-%patch1 -p1
-%patch100 -p1 -b .configure
-%patch101 -p1 -b .manpages
-%patch102 -p1
-%patch103 -p1 -b .sysinfo
-%patch104 -p1 -b .dfdirect
-%patch107 -p1 -b .mkdirmode
+# apply all patches
+%autopatch -p1
-# sh-utils
-%patch703 -p1 -b .dateman
-%patch713 -p1 -b .langinfo
-
-# li18nux/lsb
-%patch800 -p1 -b .i18n
-%patch801 -p1 -b .i18n-expand
-#%%patch802 -p1 -b .i18n-cut
-%patch803 -p1 -b .i18n-fix-expand
-%patch804 -p1 -b .i18n-cutold
-%patch805 -p1 -b .i18n-fix2-expand-unexpand
-%patch806 -p1 -b .i18n-BOM-expand-unexpand
-%patch807 -p1
-
-# Coreutils
-%patch908 -p1 -b .getgrouplist
-%patch912 -p1 -b .overflow
-%patch913 -p1 -b .testoff
-
-#SELinux
-%patch950 -p1 -b .selinux
-%patch951 -p1 -b .selinuxman
-
-chmod a+x \
- tests/df/direct.sh \
- tests/install/install-Z-selinux.sh \
- tests/misc/sort-h-thousands-sep.sh \
- tests/misc/sort-mb-tests.sh \
- || :
+(echo ">>> Fixing permissions on tests") 2>/dev/null
+find tests -name '*.sh' -perm 0644 -print -exec chmod 0755 '{}' '+'
+(echo "<<< done") 2>/dev/null
#fix typos/mistakes in localized documentation(#439410, #440056)
find ./po/ -name "*.p*" | xargs \
@@ -335,6 +301,9 @@ fi
%license COPYING
%changelog
+* Fri Dec 02 2016 Kamil Dudka - 8.26-2
+- apply patches automatically to ease maintenance
+
* Thu Dec 01 2016 Kamil Dudka - 8.26-1
- new upstream release 8.26
From a4f03c6bc0685f084801cc49cdd8be2715f06632 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Thu, 15 Dec 2016 10:38:07 +0100
Subject: [PATCH 038/232] drop build fixes no longer needed
---
coreutils-6.10-configuration.patch | 218 --------------------------
coreutils-8.22-temporarytestoff.patch | 13 --
coreutils.spec | 9 +-
3 files changed, 4 insertions(+), 236 deletions(-)
delete mode 100644 coreutils-6.10-configuration.patch
delete mode 100644 coreutils-8.22-temporarytestoff.patch
diff --git a/coreutils-6.10-configuration.patch b/coreutils-6.10-configuration.patch
deleted file mode 100644
index c34fd99..0000000
--- a/coreutils-6.10-configuration.patch
+++ /dev/null
@@ -1,218 +0,0 @@
-From 54ef056964da3d0987afd9f1e96b9419db0d653a Mon Sep 17 00:00:00 2001
-From: Kamil Dudka
-Date: Thu, 1 Dec 2016 14:32:46 +0100
-Subject: [PATCH] coreutils-6.10-configuration.patch
-
-TODO: check whether still necessary
----
- gnulib-tests/gnulib.mk | 60 +++++++++++++++++++++----------------------
- man/local.mk | 2 +-
- tests/df/skip-duplicates.sh | 3 +++
- tests/local.mk | 2 +-
- tests/misc/nohup.sh | 2 ++
- tests/touch/no-dereference.sh | 2 ++
- 6 files changed, 39 insertions(+), 32 deletions(-)
-
-diff --git a/gnulib-tests/gnulib.mk b/gnulib-tests/gnulib.mk
-index fee978f..8f32431 100644
---- a/gnulib-tests/gnulib.mk
-+++ b/gnulib-tests/gnulib.mk
-@@ -279,9 +279,9 @@ EXTRA_DIST += nap.h test-chown.h test-chown.c signature.h macros.h
-
- ## begin gnulib module cloexec-tests
-
--TESTS += test-cloexec
--check_PROGRAMS += test-cloexec
--EXTRA_DIST += test-cloexec.c macros.h
-+#TESTS += test-cloexec
-+#check_PROGRAMS += test-cloexec
-+#EXTRA_DIST += test-cloexec.c macros.h
-
- ## end gnulib module cloexec-tests
-
-@@ -392,9 +392,9 @@ EXTRA_DIST += test-dup.c signature.h macros.h
-
- ## begin gnulib module dup2-tests
-
--TESTS += test-dup2
--check_PROGRAMS += test-dup2
--EXTRA_DIST += test-dup2.c signature.h macros.h
-+#TESTS += test-dup2
-+#check_PROGRAMS += test-dup2
-+#EXTRA_DIST += test-dup2.c signature.h macros.h
-
- ## end gnulib module dup2-tests
-
-@@ -453,10 +453,10 @@ EXTRA_DIST += test-fadvise.c
-
- ## begin gnulib module fchdir-tests
-
--TESTS += test-fchdir
--check_PROGRAMS += test-fchdir
--test_fchdir_LDADD = $(LDADD) $(LIBINTL)
--EXTRA_DIST += test-fchdir.c signature.h macros.h
-+#TESTS += test-fchdir
-+#check_PROGRAMS += test-fchdir
-+#test_fchdir_LDADD = $(LDADD) $(LIBINTL)
-+#EXTRA_DIST += test-fchdir.c signature.h macros.h
-
- ## end gnulib module fchdir-tests
-
-@@ -900,9 +900,9 @@ EXTRA_DIST += test-getloadavg.c signature.h
-
- ## begin gnulib module getlogin-tests
-
--TESTS += test-getlogin
--check_PROGRAMS += test-getlogin
--EXTRA_DIST += test-getlogin.c signature.h macros.h
-+#TESTS += test-getlogin
-+#check_PROGRAMS += test-getlogin
-+#EXTRA_DIST += test-getlogin.c signature.h macros.h
-
- ## end gnulib module getlogin-tests
-
-@@ -1148,10 +1148,10 @@ EXTRA_DIST += test-link.h test-link.c signature.h macros.h
-
- ## begin gnulib module linkat-tests
-
--TESTS += test-linkat
--check_PROGRAMS += test-linkat
--test_linkat_LDADD = $(LDADD) @LIBINTL@
--EXTRA_DIST += test-link.h test-linkat.c signature.h macros.h
-+#TESTS += test-linkat
-+#check_PROGRAMS += test-linkat
-+#test_linkat_LDADD = $(LDADD) @LIBINTL@
-+#EXTRA_DIST += test-link.h test-linkat.c signature.h macros.h
-
- ## end gnulib module linkat-tests
-
-@@ -1360,9 +1360,9 @@ EXTRA_DIST += test-memcoll.c macros.h
-
- ## begin gnulib module memrchr-tests
-
--TESTS += test-memrchr
--check_PROGRAMS += test-memrchr
--EXTRA_DIST += test-memrchr.c zerosize-ptr.h signature.h macros.h
-+#TESTS += test-memrchr
-+#check_PROGRAMS += test-memrchr
-+#EXTRA_DIST += test-memrchr.c zerosize-ptr.h signature.h macros.h
-
- ## end gnulib module memrchr-tests
-
-@@ -1913,9 +1913,9 @@ EXTRA_DIST += test-statat.c
-
- ## begin gnulib module stdalign-tests
-
--TESTS += test-stdalign
--check_PROGRAMS += test-stdalign
--EXTRA_DIST += test-stdalign.c macros.h
-+#TESTS += test-stdalign
-+#check_PROGRAMS += test-stdalign
-+#EXTRA_DIST += test-stdalign.c macros.h
-
- ## end gnulib module stdalign-tests
-
-@@ -2270,9 +2270,9 @@ EXTRA_DIST += test-uname.c signature.h macros.h
-
- ## begin gnulib module unistd-safer-tests
-
--TESTS += test-dup-safer
--check_PROGRAMS += test-dup-safer
--EXTRA_DIST += test-dup-safer.c macros.h
-+#TESTS += test-dup-safer
-+#check_PROGRAMS += test-dup-safer
-+#EXTRA_DIST += test-dup-safer.c macros.h
-
- ## end gnulib module unistd-safer-tests
-
-@@ -2368,10 +2368,10 @@ EXTRA_DIST += test-userspec.c
-
- ## begin gnulib module utimens-tests
-
--TESTS += test-utimens
--check_PROGRAMS += test-utimens
--test_utimens_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_NANOSLEEP) @LIBINTL@
--EXTRA_DIST += nap.h test-futimens.h test-lutimens.h test-utimens.h test-utimens-common.h test-utimens.c macros.h
-+#TESTS += test-utimens
-+#check_PROGRAMS += test-utimens
-+#test_utimens_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_NANOSLEEP) @LIBINTL@
-+#EXTRA_DIST += nap.h test-futimens.h test-lutimens.h test-utimens.h test-utimens-common.h test-utimens.c macros.h
-
- ## end gnulib module utimens-tests
-
-diff --git a/man/local.mk b/man/local.mk
-index a39bb65..535690c 100644
---- a/man/local.mk
-+++ b/man/local.mk
-@@ -41,7 +41,7 @@ distclean-local:
- test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS)
-
- # Dependencies common to all man pages. Updated below.
--mandeps =
-+mandeps = $(PROGRAMS)
-
- # Depend on this to get version number changes.
- mandeps += .version
-diff --git a/tests/df/skip-duplicates.sh b/tests/df/skip-duplicates.sh
-index f349263..9854f8d 100755
---- a/tests/df/skip-duplicates.sh
-+++ b/tests/df/skip-duplicates.sh
-@@ -26,6 +26,9 @@ require_gcc_shared_
- df --local --output=target >LOCAL_FS || skip_ 'df fails'
- grep '^/$' LOCAL_FS || skip_ 'no root file system found'
-
-+# mark it expensive, to temporarily skip the test in koji
-+expensive_
-+
- # Get real targets to substitute for /NONROOT and /REMOTE below.
- export CU_NONROOT_FS=$(grep /. LOCAL_FS | head -n1)
- export CU_REMOTE_FS=$(grep /. LOCAL_FS | tail -n+2 | head -n1)
-diff --git a/tests/local.mk b/tests/local.mk
-index 3335002..568944e 100644
---- a/tests/local.mk
-+++ b/tests/local.mk
-@@ -134,6 +134,7 @@ all_root_tests = \
- tests/rm/no-give-up.sh \
- tests/rm/one-file-system.sh \
- tests/rm/read-only.sh \
-+ tests/tail-2/inotify-hash-abuse.sh \
- tests/tail-2/append-only.sh \
- tests/touch/now-owned-by-other.sh
-
-@@ -168,7 +169,6 @@ all_tests = \
- tests/cp/link-heap.sh \
- tests/cp/no-ctx.sh \
- tests/misc/tty-eof.pl \
-- tests/tail-2/inotify-hash-abuse.sh \
- tests/tail-2/inotify-hash-abuse2.sh \
- tests/tail-2/F-vs-missing.sh \
- tests/tail-2/F-vs-rename.sh \
-diff --git a/tests/misc/nohup.sh b/tests/misc/nohup.sh
-index 1b43b60..3fd29e7 100755
---- a/tests/misc/nohup.sh
-+++ b/tests/misc/nohup.sh
-@@ -19,6 +19,8 @@
- . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
- print_ver_ nohup
-
-+#mark it expensive, to temporarily skip the test in koji
-+expensive_
-
- nohup sh -c 'echo stdout; echo stderr 1>&2' 2>err || fail=1
-
-diff --git a/tests/touch/no-dereference.sh b/tests/touch/no-dereference.sh
-index 7994638..72b2222 100755
---- a/tests/touch/no-dereference.sh
-+++ b/tests/touch/no-dereference.sh
-@@ -42,6 +42,8 @@ test -f nowhere && fail=1
- grep '^#define HAVE_UTIMENSAT 1' "$CONFIG_HEADER" > /dev/null ||
- grep '^#define HAVE_LUTIMES 1' "$CONFIG_HEADER" > /dev/null ||
- skip_ 'this system lacks the utimensat function'
-+grep '^#define HAVE_WORKINGKOJI 1' "$CONFIG_HEADER" > /dev/null ||
-+ skip_ 'rest of the test disabled due to koji lack of utimensat function'
-
- # Changing time of dangling symlink is okay.
- # Skip the test if this fails, but the error text corresponds to
---
-2.7.4
-
diff --git a/coreutils-8.22-temporarytestoff.patch b/coreutils-8.22-temporarytestoff.patch
deleted file mode 100644
index c95343b..0000000
--- a/coreutils-8.22-temporarytestoff.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff -urNp coreutils-8.22-orig/tests/df/df-symlink.sh coreutils-8.22/tests/df/df-symlink.sh
---- coreutils-8.22-orig/tests/df/df-symlink.sh 2013-12-04 15:48:30.000000000 +0100
-+++ coreutils-8.22/tests/df/df-symlink.sh 2013-12-14 18:20:15.822594995 +0100
-@@ -18,6 +18,9 @@
-
- . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
- print_ver_ df
-+#df doesn't work correctly on symlinks when on LVM/LUKS filesystem, therefore
-+#marking expensive_ to disable by default
-+expensive_
-
- disk=$(df --out=source '.' | tail -n1) ||
- skip_ "cannot determine '.' file system"
diff --git a/coreutils.spec b/coreutils.spec
index bf783b9..21de5eb 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.26
-Release: 2%{?dist}
+Release: 3%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -19,8 +19,6 @@ Source10: coreutils-find-requires.sh
# disable the test-lock gnulib test prone to deadlock
Patch1: coreutils-8.26-test-lock.patch
-#general patch to workaround koji build system issues
-Patch100: coreutils-6.10-configuration.patch
#add note about no difference between binary/text mode on Linux - md5sum manpage
Patch101: coreutils-6.10-manpages.patch
# downstream changes to default DIR_COLORS
@@ -56,8 +54,6 @@ Patch807: coreutils-i18n-sort-human.patch
Patch908: coreutils-getgrouplist.patch
#Prevent buffer overflow in who(1) (bug #158405).
Patch912: coreutils-overflow.patch
-#Temporarily disable df symlink test, failing
-Patch913: coreutils-8.22-temporarytestoff.patch
#SELINUX Patch - implements Redhat changes
#(upstream did some SELinux implementation unlike with RedHat patch)
@@ -301,6 +297,9 @@ fi
%license COPYING
%changelog
+* Thu Dec 15 2016 Kamil Dudka - 8.26-3
+- drop build fixes no longer needed
+
* Fri Dec 02 2016 Kamil Dudka - 8.26-2
- apply patches automatically to ease maintenance
From c168f3b3431ee8e57653d93c9c09e50935e4beb0 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Thu, 15 Dec 2016 10:45:14 +0100
Subject: [PATCH 039/232] merge coreutils-selinuxmanpages.patch into
coreutils-selinux.patch
It does not make any sense to apply them separately.
---
coreutils-selinux.patch | 29 ++++++++++++++++-------------
coreutils-selinuxmanpages.patch | 16 ----------------
coreutils.spec | 1 -
3 files changed, 16 insertions(+), 30 deletions(-)
delete mode 100644 coreutils-selinuxmanpages.patch
diff --git a/coreutils-selinux.patch b/coreutils-selinux.patch
index 9f780cc..cee4f7c 100644
--- a/coreutils-selinux.patch
+++ b/coreutils-selinux.patch
@@ -60,19 +60,22 @@ index 1b528c6..25dbb88 100644
case 'd':
x.preserve_links = true;
x.dereference = DEREF_NEVER;
-diff --git a/src/id.c b/src/id.c
-index 05d98a5..d6eb002 100644
---- a/src/id.c
-+++ b/src/id.c
-@@ -114,7 +114,7 @@ int
- main (int argc, char **argv)
- {
- int optc;
-- int selinux_enabled = (is_selinux_enabled () > 0);
-+ bool selinux_enabled = (is_selinux_enabled () > 0);
- bool smack_enabled = is_smack_enabled ();
- bool opt_zero = false;
- char *pw_name = NULL;
+diff --git a/doc/coreutils.texi b/doc/coreutils.texi
+index 47e4480..cff2ead 100644
+--- a/doc/coreutils.texi
++++ b/doc/coreutils.texi
+@@ -8083,6 +8083,11 @@ done
+ exit $fail
+ @end example
+
++@item -c
++@cindex SELinux security context information, preserving
++Preserve SELinux security context of the original files if possible.
++Some file systems don't support storing of SELinux security context.
++
+ @item --copy-contents
+ @cindex directories, copying recursively
+ @cindex copying directories recursively
diff --git a/src/install.c b/src/install.c
index d79d597..437889a 100644
--- a/src/install.c
diff --git a/coreutils-selinuxmanpages.patch b/coreutils-selinuxmanpages.patch
deleted file mode 100644
index c3eb1a8..0000000
--- a/coreutils-selinuxmanpages.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff --git a/doc/coreutils.texi b/doc/coreutils.texi
-index 47e4480..cff2ead 100644
---- a/doc/coreutils.texi
-+++ b/doc/coreutils.texi
-@@ -8083,6 +8083,11 @@ done
- exit $fail
- @end example
-
-+@item -c
-+@cindex SELinux security context information, preserving
-+Preserve SELinux security context of the original files if possible.
-+Some file systems don't support storing of SELinux security context.
-+
- @item --copy-contents
- @cindex directories, copying recursively
- @cindex copying directories recursively
diff --git a/coreutils.spec b/coreutils.spec
index 21de5eb..860a5cd 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -58,7 +58,6 @@ Patch912: coreutils-overflow.patch
#SELINUX Patch - implements Redhat changes
#(upstream did some SELinux implementation unlike with RedHat patch)
Patch950: coreutils-selinux.patch
-Patch951: coreutils-selinuxmanpages.patch
Conflicts: filesystem < 3
# To avoid clobbering installs
From b3b3da0cdf2777c6b06f95b5f267ffe65d97a32a Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 2 Jan 2017 09:58:50 +0100
Subject: [PATCH 040/232] use upstream patch for gnulib's test-lock
... instead of disabling it
---
coreutils-8.26-test-lock.patch | 219 +++++++++++++++++++++++++++++----
coreutils.spec | 5 +-
2 files changed, 197 insertions(+), 27 deletions(-)
diff --git a/coreutils-8.26-test-lock.patch b/coreutils-8.26-test-lock.patch
index 3f2603e..43e477e 100644
--- a/coreutils-8.26-test-lock.patch
+++ b/coreutils-8.26-test-lock.patch
@@ -1,35 +1,202 @@
-From 812480a9fb21b26f2e705b992ce75810f36d08c9 Mon Sep 17 00:00:00 2001
-From: Kamil Dudka
-Date: Fri, 2 Dec 2016 10:12:09 +0100
-Subject: [PATCH] disable the test-lock gnulib test prone to deadlock
+From 4f6cb65ce4d643aca0c6bf7db2e8b32c0d08eb89 Mon Sep 17 00:00:00 2001
+From: Bruno Haible
+Date: Sat, 24 Dec 2016 18:21:59 +0100
+Subject: [PATCH] lock test: Fix performance problem on multi-core machines.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
-See https://lists.gnu.org/archive/html/bug-gnulib/2015-07/msg00033.html
-and https://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=25fb4c6 for
-some context.
+* tests/test-lock.c (USE_VOLATILE): New macro.
+(struct atomic_int): New type.
+(init_atomic_int, get_atomic_int_value, set_atomic_int_value): New
+functions.
+(lock_checker_done, rwlock_checker_done, reclock_checker_done): Define
+as 'struct atomic_int'.
+(lock_checker_thread, test_lock, rwlock_checker_thread, test_rwlock,
+reclock_checker_thread, test_recursive_lock): Use the new functions.
+Reported by Eric Blake in
+https://www.redhat.com/archives/libvir-list/2012-March/msg00854.html
+and by Pádraig Brady in
+http://lists.gnu.org/archive/html/bug-gnulib/2016-12/msg00117.html.
+
+Upstream-commit: 480d374e596a0ee3fed168ab42cd84c313ad3c89
+Signed-off-by: Kamil Dudka
---
- gnulib-tests/gnulib.mk | 9 ---------
- 1 file changed, 9 deletions(-)
+ gnulib-tests/test-lock.c | 79 ++++++++++++++++++++++++++++++++++++++++--------
+ 1 file changed, 67 insertions(+), 12 deletions(-)
-diff --git a/gnulib-tests/gnulib.mk b/gnulib-tests/gnulib.mk
-index 8f32431..c9943d8 100644
---- a/gnulib-tests/gnulib.mk
-+++ b/gnulib-tests/gnulib.mk
-@@ -1207,15 +1207,6 @@ EXTRA_DIST += test-localename.c macros.h
+diff --git a/gnulib-tests/test-lock.c b/gnulib-tests/test-lock.c
+index cb734b4..aa6de27 100644
+--- a/gnulib-tests/test-lock.c
++++ b/gnulib-tests/test-lock.c
+@@ -50,6 +50,13 @@
+ Uncomment this to see if the operating system has a fair scheduler. */
+ #define EXPLICIT_YIELD 1
- ## end gnulib module localename-tests
++/* Whether to use 'volatile' on some variables that communicate information
++ between threads. If set to 0, a lock is used to protect these variables.
++ If set to 1, 'volatile' is used; this is theoretically equivalent but can
++ lead to much slower execution (e.g. 30x slower total run time on a 40-core
++ machine. */
++#define USE_VOLATILE 0
++
+ /* Whether to print debugging messages. */
+ #define ENABLE_DEBUGGING 0
--## begin gnulib module lock-tests
--
--TESTS += test-lock
--check_PROGRAMS += test-lock
--test_lock_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@
--EXTRA_DIST += test-lock.c
--
--## end gnulib module lock-tests
--
- ## begin gnulib module lseek-tests
+@@ -103,6 +110,51 @@
+ # define yield()
+ #endif
- TESTS += test-lseek.sh
++#if USE_VOLATILE
++struct atomic_int {
++ volatile int value;
++};
++static void
++init_atomic_int (struct atomic_int *ai)
++{
++}
++static int
++get_atomic_int_value (struct atomic_int *ai)
++{
++ return ai->value;
++}
++static void
++set_atomic_int_value (struct atomic_int *ai, int new_value)
++{
++ ai->value = new_value;
++}
++#else
++struct atomic_int {
++ gl_lock_define (, lock)
++ int value;
++};
++static void
++init_atomic_int (struct atomic_int *ai)
++{
++ gl_lock_init (ai->lock);
++}
++static int
++get_atomic_int_value (struct atomic_int *ai)
++{
++ gl_lock_lock (ai->lock);
++ int ret = ai->value;
++ gl_lock_unlock (ai->lock);
++ return ret;
++}
++static void
++set_atomic_int_value (struct atomic_int *ai, int new_value)
++{
++ gl_lock_lock (ai->lock);
++ ai->value = new_value;
++ gl_lock_unlock (ai->lock);
++}
++#endif
++
+ #define ACCOUNT_COUNT 4
+
+ static int account[ACCOUNT_COUNT];
+@@ -170,12 +222,12 @@ lock_mutator_thread (void *arg)
+ return NULL;
+ }
+
+-static volatile int lock_checker_done;
++static struct atomic_int lock_checker_done;
+
+ static void *
+ lock_checker_thread (void *arg)
+ {
+- while (!lock_checker_done)
++ while (get_atomic_int_value (&lock_checker_done) == 0)
+ {
+ dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ());
+ gl_lock_lock (my_lock);
+@@ -200,7 +252,8 @@ test_lock (void)
+ /* Initialization. */
+ for (i = 0; i < ACCOUNT_COUNT; i++)
+ account[i] = 1000;
+- lock_checker_done = 0;
++ init_atomic_int (&lock_checker_done);
++ set_atomic_int_value (&lock_checker_done, 0);
+
+ /* Spawn the threads. */
+ checkerthread = gl_thread_create (lock_checker_thread, NULL);
+@@ -210,7 +263,7 @@ test_lock (void)
+ /* Wait for the threads to terminate. */
+ for (i = 0; i < THREAD_COUNT; i++)
+ gl_thread_join (threads[i], NULL);
+- lock_checker_done = 1;
++ set_atomic_int_value (&lock_checker_done, 1);
+ gl_thread_join (checkerthread, NULL);
+ check_accounts ();
+ }
+@@ -254,12 +307,12 @@ rwlock_mutator_thread (void *arg)
+ return NULL;
+ }
+
+-static volatile int rwlock_checker_done;
++static struct atomic_int rwlock_checker_done;
+
+ static void *
+ rwlock_checker_thread (void *arg)
+ {
+- while (!rwlock_checker_done)
++ while (get_atomic_int_value (&rwlock_checker_done) == 0)
+ {
+ dbgprintf ("Checker %p before check rdlock\n", gl_thread_self_pointer ());
+ gl_rwlock_rdlock (my_rwlock);
+@@ -284,7 +337,8 @@ test_rwlock (void)
+ /* Initialization. */
+ for (i = 0; i < ACCOUNT_COUNT; i++)
+ account[i] = 1000;
+- rwlock_checker_done = 0;
++ init_atomic_int (&rwlock_checker_done);
++ set_atomic_int_value (&rwlock_checker_done, 0);
+
+ /* Spawn the threads. */
+ for (i = 0; i < THREAD_COUNT; i++)
+@@ -295,7 +349,7 @@ test_rwlock (void)
+ /* Wait for the threads to terminate. */
+ for (i = 0; i < THREAD_COUNT; i++)
+ gl_thread_join (threads[i], NULL);
+- rwlock_checker_done = 1;
++ set_atomic_int_value (&rwlock_checker_done, 1);
+ for (i = 0; i < THREAD_COUNT; i++)
+ gl_thread_join (checkerthreads[i], NULL);
+ check_accounts ();
+@@ -356,12 +410,12 @@ reclock_mutator_thread (void *arg)
+ return NULL;
+ }
+
+-static volatile int reclock_checker_done;
++static struct atomic_int reclock_checker_done;
+
+ static void *
+ reclock_checker_thread (void *arg)
+ {
+- while (!reclock_checker_done)
++ while (get_atomic_int_value (&reclock_checker_done) == 0)
+ {
+ dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ());
+ gl_recursive_lock_lock (my_reclock);
+@@ -386,7 +440,8 @@ test_recursive_lock (void)
+ /* Initialization. */
+ for (i = 0; i < ACCOUNT_COUNT; i++)
+ account[i] = 1000;
+- reclock_checker_done = 0;
++ init_atomic_int (&reclock_checker_done);
++ set_atomic_int_value (&reclock_checker_done, 0);
+
+ /* Spawn the threads. */
+ checkerthread = gl_thread_create (reclock_checker_thread, NULL);
+@@ -396,7 +451,7 @@ test_recursive_lock (void)
+ /* Wait for the threads to terminate. */
+ for (i = 0; i < THREAD_COUNT; i++)
+ gl_thread_join (threads[i], NULL);
+- reclock_checker_done = 1;
++ set_atomic_int_value (&reclock_checker_done, 1);
+ gl_thread_join (checkerthread, NULL);
+ check_accounts ();
+ }
--
2.7.4
diff --git a/coreutils.spec b/coreutils.spec
index 860a5cd..c683fa7 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.26
-Release: 3%{?dist}
+Release: 4%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -296,6 +296,9 @@ fi
%license COPYING
%changelog
+* Mon Jan 02 2017 Kamil Dudka - 8.26-4
+- use upstream patch for gnulib's test-lock (instead of disabling it)
+
* Thu Dec 15 2016 Kamil Dudka - 8.26-3
- drop build fixes no longer needed
From e12860338133a2a90558751f5daaa1e754135349 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 23 Jan 2017 10:24:10 +0100
Subject: [PATCH 041/232] =?UTF-8?q?date:=20fix=20fix=20TZ=3D=20regression?=
=?UTF-8?q?=20(patch=20by=20P=C3=A1draig=20Brady)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851934#10
---
coreutils-8.26-date-fix-tz-regre.patch | 82 ++++++++++++++++++++++++++
coreutils.spec | 8 ++-
2 files changed, 89 insertions(+), 1 deletion(-)
create mode 100644 coreutils-8.26-date-fix-tz-regre.patch
diff --git a/coreutils-8.26-date-fix-tz-regre.patch b/coreutils-8.26-date-fix-tz-regre.patch
new file mode 100644
index 0000000..158c80a
--- /dev/null
+++ b/coreutils-8.26-date-fix-tz-regre.patch
@@ -0,0 +1,82 @@
+From 12284825dcc5d9485ebaa78aedd93f450bad7b73 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?=
+Date: Fri, 20 Jan 2017 12:40:35 +0000
+Subject: [PATCH 1/2] date: fix TZ= regression
+
+On 17/03/16 17:38, Paul Eggert wrote:
+> On 03/16/2016 08:51 PM, Assaf Gordon wrote:
+>> I suspect it has something to do with this commit:
+>> commit 037e3b9847feb46cf6b58d99ce960d3987faaf52
+>
+> You're right, and thanks for that detailed bug report. I installed the
+> attached patch, which fixed the bug for me.
+
+This introduced a bug unfortunately due to the side effects of
+parse_datetime().
+parse_datetime resets the TZ env variable but doesn't call tzset().
+Hence using the wrong timezone for output.
+Previously localtime() called tzset() implicitly.
+Perhaps we should call tzset() in parse_datetime() if needed?
+I'm not sure as to whether this undoes the fix for bug 23035?
+
+Anyway this avoids the issue on GNU/Linux.
+
+Signed-off-by: Kamil Dudka
+---
+ src/date.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/date.c b/src/date.c
+index 619a72b..2b3d890 100644
+--- a/src/date.c
++++ b/src/date.c
+@@ -571,6 +571,8 @@ show_date (const char *format, struct timespec when, timezone_t tz)
+ {
+ struct tm tm;
+
++ tzset ();
++
+ if (localtime_rz (tz, &when.tv_sec, &tm))
+ {
+ if (format == rfc_2822_format)
+--
+2.7.4
+
+
+From 3c082157634bd4fbc79c26e9c56abb4da79e9a2d Mon Sep 17 00:00:00 2001
+From: Paul Eggert
+Date: Fri, 20 Jan 2017 18:24:02 -0800
+Subject: [PATCH 2/2] date: test for TZ= regression
+
+Problem reported by Paul Wise for Debian, in:
+https://bugs.debian.org/851934
+This is fallout from the fix for GNU Bug#23035.
+* tests/misc/date.pl: Test the fix.
+
+Upstream-commit: b14be5085cd1aefd473a000456b21270e6070711
+Signed-off-by: Kamil Dudka
+---
+ tests/misc/date-debug.sh | 4 ++--
+ tests/misc/date.pl | 6 ++++++
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/tests/misc/date.pl b/tests/misc/date.pl
+index 7e45e98..be8b39e 100755
+--- a/tests/misc/date.pl
++++ b/tests/misc/date.pl
+@@ -291,6 +291,12 @@ my @Tests =
+ {ERR => "date: invalid date 'TZ=\"\"\"'\n"},
+ {EXIT => 1},
+ ],
++
++ # https://bugs.debian.org/851934#10
++ ['cross-TZ-mishandled', "-d 'TZ=\"EST5\" 1970-01-01 00:00'",
++ {ENV => 'TZ=PST8'},
++ {OUT => 'Wed Dec 31 21:00:00 PST 1969'},
++ ],
+ );
+
+ # Repeat the cross-dst test, using Jan 1, 2005 and every interval from 1..364.
+--
+2.7.4
+
diff --git a/coreutils.spec b/coreutils.spec
index c683fa7..43e0e6f 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.26
-Release: 4%{?dist}
+Release: 5%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -19,6 +19,9 @@ Source10: coreutils-find-requires.sh
# disable the test-lock gnulib test prone to deadlock
Patch1: coreutils-8.26-test-lock.patch
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851934#10
+Patch2: coreutils-8.26-date-fix-tz-regre.patch
+
#add note about no difference between binary/text mode on Linux - md5sum manpage
Patch101: coreutils-6.10-manpages.patch
# downstream changes to default DIR_COLORS
@@ -296,6 +299,9 @@ fi
%license COPYING
%changelog
+* Mon Jan 23 2017 Kamil Dudka - 8.26-5
+- date: fix fix TZ= regression (patch by Pádraig Brady)
+
* Mon Jan 02 2017 Kamil Dudka - 8.26-4
- use upstream patch for gnulib's test-lock (instead of disabling it)
From 5e261ae9b91a3ff67dea0c98e57c17b52b12fe97 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 23 Jan 2017 10:46:15 +0100
Subject: [PATCH 042/232] changelog: fix a duplicated word in the last entry
---
coreutils.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/coreutils.spec b/coreutils.spec
index 43e0e6f..a3874b4 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -300,7 +300,7 @@ fi
%changelog
* Mon Jan 23 2017 Kamil Dudka - 8.26-5
-- date: fix fix TZ= regression (patch by Pádraig Brady)
+- date: fix TZ= regression (patch by Pádraig Brady)
* Mon Jan 02 2017 Kamil Dudka - 8.26-4
- use upstream patch for gnulib's test-lock (instead of disabling it)
From 5e77c9c1c9d1cd3284e7d94b1d2a2cae9d48aa1b Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 23 Jan 2017 12:47:06 +0100
Subject: [PATCH 043/232] test-lock: disable the rwlock test
---
coreutils-8.26-test-lock.patch | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/coreutils-8.26-test-lock.patch b/coreutils-8.26-test-lock.patch
index 43e477e..786aa33 100644
--- a/coreutils-8.26-test-lock.patch
+++ b/coreutils-8.26-test-lock.patch
@@ -1,7 +1,8 @@
From 4f6cb65ce4d643aca0c6bf7db2e8b32c0d08eb89 Mon Sep 17 00:00:00 2001
From: Bruno Haible
Date: Sat, 24 Dec 2016 18:21:59 +0100
-Subject: [PATCH] lock test: Fix performance problem on multi-core machines.
+Subject: [PATCH 1/2] lock test: Fix performance problem on multi-core
+ machines.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -200,3 +201,33 @@ index cb734b4..aa6de27 100644
--
2.7.4
+
+From 0d04ee8ddedb2bf33d64f148f246a3b7ec4fef21 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Mon, 23 Jan 2017 12:35:41 +0100
+Subject: [PATCH 2/2] test-lock: disable the rwlock test
+
+It hangs indefinitely if the system rwlock implementation does not
+prevent writer starvation (and glibc does not implement it).
+
+Bug: http://www.mail-archive.com/bug-gnulib@gnu.org/msg33017.html
+---
+ gnulib-tests/test-lock.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gnulib-tests/test-lock.c b/gnulib-tests/test-lock.c
+index aa6de27..5af0a6c 100644
+--- a/gnulib-tests/test-lock.c
++++ b/gnulib-tests/test-lock.c
+@@ -42,7 +42,7 @@
+ Uncomment some of these, to verify that all tests crash if no locking
+ is enabled. */
+ #define DO_TEST_LOCK 1
+-#define DO_TEST_RWLOCK 1
++#define DO_TEST_RWLOCK 0
+ #define DO_TEST_RECURSIVE_LOCK 1
+ #define DO_TEST_ONCE 1
+
+--
+2.7.4
+
From f1a024cc0933e93fd37fd2cda8fc584d4ba87008 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Fri, 3 Feb 2017 12:35:13 +0100
Subject: [PATCH 044/232] Resolves: #1418505 - fold: preserve new-lines in
mutlibyte text
---
coreutils-i18n-fold-newline.patch | 83 +++++++++++++++++++++++++++++++
coreutils.spec | 7 ++-
2 files changed, 89 insertions(+), 1 deletion(-)
create mode 100644 coreutils-i18n-fold-newline.patch
diff --git a/coreutils-i18n-fold-newline.patch b/coreutils-i18n-fold-newline.patch
new file mode 100644
index 0000000..79d1a09
--- /dev/null
+++ b/coreutils-i18n-fold-newline.patch
@@ -0,0 +1,83 @@
+From ff424639fe863cbd6963add1a79b97290c1606c6 Mon Sep 17 00:00:00 2001
+From: rpm-build
+Date: Fri, 3 Feb 2017 12:26:53 +0100
+Subject: [PATCH] fold.c: preserve new-lines in mutlibyte text
+
+---
+ src/fold.c | 55 +++++++++++++++++++++++++++----------------------------
+ 1 file changed, 27 insertions(+), 28 deletions(-)
+
+diff --git a/src/fold.c b/src/fold.c
+index d23edd5..8c232a7 100644
+--- a/src/fold.c
++++ b/src/fold.c
+@@ -342,39 +342,38 @@ fold_multibyte_text (FILE *istream, size_t width, int *saved_errno)
+ }
+
+ rescan:
+- if (operating_mode == byte_mode) /* byte mode */
++ if (convfail)
++ increment = 1;
++ else if (wc == L'\n')
++ {
++ /* preserve newline */
++ fwrite (line_out, sizeof(char), offset_out, stdout);
++ START_NEW_LINE;
++ continue;
++ }
++ else if (operating_mode == byte_mode) /* byte mode */
+ increment = mblength;
+ else if (operating_mode == character_mode) /* character mode */
+ increment = 1;
+- else /* column mode */
++ else /* column mode */
+ {
+- if (convfail)
+- increment = 1;
+- else
++ switch (wc)
+ {
+- switch (wc)
+- {
+- case L'\n':
+- fwrite (line_out, sizeof(char), offset_out, stdout);
+- START_NEW_LINE;
+- continue;
+-
+- case L'\b':
+- increment = (column > 0) ? -1 : 0;
+- break;
+-
+- case L'\r':
+- increment = -1 * column;
+- break;
+-
+- case L'\t':
+- increment = 8 - column % 8;
+- break;
+-
+- default:
+- increment = wcwidth (wc);
+- increment = (increment < 0) ? 0 : increment;
+- }
++ case L'\b':
++ increment = (column > 0) ? -1 : 0;
++ break;
++
++ case L'\r':
++ increment = -1 * column;
++ break;
++
++ case L'\t':
++ increment = 8 - column % 8;
++ break;
++
++ default:
++ increment = wcwidth (wc);
++ increment = (increment < 0) ? 0 : increment;
+ }
+ }
+
+--
+2.7.4
+
diff --git a/coreutils.spec b/coreutils.spec
index a3874b4..ae10648 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.26
-Release: 5%{?dist}
+Release: 6%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -52,6 +52,8 @@ Patch805: coreutils-i18n-fix2-expand-unexpand.patch
Patch806: coreutils-i18n-un-expand-BOM.patch
# make 'sort -h' work for arbitrary column even when using UTF-8 locales
Patch807: coreutils-i18n-sort-human.patch
+# fold: preserve new-lines in mutlibyte text (#1418505)
+Patch808: coreutils-i18n-fold-newline.patch
#getgrouplist() patch from Ulrich Drepper.
Patch908: coreutils-getgrouplist.patch
@@ -299,6 +301,9 @@ fi
%license COPYING
%changelog
+* Fri Feb 03 2017 Kamil Dudka - 8.26-6
+- fold: preserve new-lines in mutlibyte text (#1418505)
+
* Mon Jan 23 2017 Kamil Dudka - 8.26-5
- date: fix TZ= regression (patch by Pádraig Brady)
From bc257082406e008d63ca9271390a5bdb65689c3d Mon Sep 17 00:00:00 2001
From: Fedora Release Engineering
Date: Fri, 10 Feb 2017 07:54:30 +0000
Subject: [PATCH 045/232] - Rebuilt for
https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
---
coreutils.spec | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/coreutils.spec b/coreutils.spec
index ae10648..a2899d7 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.26
-Release: 6%{?dist}
+Release: 7%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -301,6 +301,9 @@ fi
%license COPYING
%changelog
+* Fri Feb 10 2017 Fedora Release Engineering - 8.26-7
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
+
* Fri Feb 03 2017 Kamil Dudka - 8.26-6
- fold: preserve new-lines in mutlibyte text (#1418505)
From fbd36190723741b022f693d1fe30bcc700fa7d25 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Thu, 2 Mar 2017 10:25:23 +0100
Subject: [PATCH 046/232] Resolves: #1398913 - install,mkdir: fix handling of
-DZ and -pZ, respectively
---
coreutils-8.25-mkdir-p-selinux.patch | 52 ++++++++++++++++++++++++++++
coreutils.spec | 8 ++++-
2 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 coreutils-8.25-mkdir-p-selinux.patch
diff --git a/coreutils-8.25-mkdir-p-selinux.patch b/coreutils-8.25-mkdir-p-selinux.patch
new file mode 100644
index 0000000..a321e6d
--- /dev/null
+++ b/coreutils-8.25-mkdir-p-selinux.patch
@@ -0,0 +1,52 @@
+From 8b89985a3904e0267750c430e01684edf008051b Mon Sep 17 00:00:00 2001
+From: Kamil Dudka
+Date: Mon, 28 Nov 2016 16:21:42 +0100
+Subject: [PATCH] install,mkdir: fix handling of -DZ and -pZ, respectively
+
+... in the case where two or more directories nested in each other are
+created and each of them defaults to a different SELinux context.
+
+* src/install.c (make_ancestor): When calling defaultcon(), give it the
+same path that is given to mkdir(). The other path is not always valid
+wrt. current working directory.
+* src/mkdir.c (make_ancestor): Likewise.
+* NEWS: Mention the bug fix.
+
+Reported at https://bugzilla.redhat.com/1398913
+
+Upstream-commit: d8104265f229ababd5a68a46eeccbccc07e72cdc
+Signed-off-by: Kamil Dudka
+---
+ src/install.c | 2 +-
+ src/mkdir.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/install.c b/src/install.c
+index 1b7a209..cae0a53 100644
+--- a/src/install.c
++++ b/src/install.c
+@@ -425,7 +425,7 @@ static int
+ make_ancestor (char const *dir, char const *component, void *options)
+ {
+ struct cp_options const *x = options;
+- if (x->set_security_context && defaultcon (dir, S_IFDIR) < 0
++ if (x->set_security_context && defaultcon (component, S_IFDIR) < 0
+ && ! ignorable_ctx_err (errno))
+ error (0, errno, _("failed to set default creation context for %s"),
+ quoteaf (dir));
+diff --git a/src/mkdir.c b/src/mkdir.c
+index 60fc08a..77af857 100644
+--- a/src/mkdir.c
++++ b/src/mkdir.c
+@@ -122,7 +122,7 @@ make_ancestor (char const *dir, char const *component, void *options)
+ {
+ struct mkdir_options const *o = options;
+
+- if (o->set_security_context && defaultcon (dir, S_IFDIR) < 0
++ if (o->set_security_context && defaultcon (component, S_IFDIR) < 0
+ && ! ignorable_ctx_err (errno))
+ error (0, errno, _("failed to set default creation context for %s"),
+ quoteaf (dir));
+--
+2.9.3
+
diff --git a/coreutils.spec b/coreutils.spec
index 0e06eea..c81744b 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.25
-Release: 7%{?dist}
+Release: 8%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -28,6 +28,8 @@ Patch953: coreutils-8.25-sort-thousands-sep.patch
Patch954: coreutils-8.25-ls-signal.patch
# md5sum,sha*sum: fix --ignore-missing with checksums starting with 00
Patch955: coreutils-8.25-sum-ignore-missing.patch
+# install,mkdir: fix handling of -DZ and -pZ, respectively (#1398913)
+Patch956: coreutils-8.25-mkdir-p-selinux.patch
# Our patches
#general patch to workaround koji build system issues
@@ -212,6 +214,7 @@ including documentation and translations.
%patch953 -p1
%patch954 -p1
%patch955 -p1
+%patch956 -p1
chmod a+x \
tests/df/direct.sh \
@@ -379,6 +382,9 @@ fi
%license COPYING
%changelog
+* Thu Mar 02 2017 Kamil Dudka - 8.25-8
+- install,mkdir: fix handling of -DZ and -pZ, respectively (#1398913)
+
* Mon Oct 31 2016 Kamil Dudka - 8.25-7
- md5sum,sha*sum: fix --ignore-missing with checksums starting with 00
- ls: allow interruption when reading slow directories (#1365933)
From 7a7c1a231c01c2f817bb9a808e89c17e558f8be6 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Thu, 9 Mar 2017 09:57:09 +0100
Subject: [PATCH 047/232] new upstream release 8.27
---
coreutils-8.25-DIR_COLORS.patch | 119 +++++++------
coreutils-8.26-date-fix-tz-regre.patch | 82 ---------
coreutils-8.26-test-lock.patch | 206 +---------------------
coreutils-8.26.tar.xz.sig | 17 --
coreutils-8.27.tar.xz.sig | 16 ++
coreutils-getgrouplist.patch | 2 +-
coreutils-i18n-fix2-expand-unexpand.patch | 4 +-
coreutils-i18n-fold-newline.patch | 31 ++--
coreutils-i18n-un-expand-BOM.patch | 50 ++++--
coreutils-i18n.patch | 31 ++--
coreutils-selinux.patch | 2 +-
coreutils.spec | 16 +-
sources | 2 +-
13 files changed, 163 insertions(+), 415 deletions(-)
delete mode 100644 coreutils-8.26-date-fix-tz-regre.patch
delete mode 100644 coreutils-8.26.tar.xz.sig
create mode 100644 coreutils-8.27.tar.xz.sig
diff --git a/coreutils-8.25-DIR_COLORS.patch b/coreutils-8.25-DIR_COLORS.patch
index a8a2d1a..94923b0 100644
--- a/coreutils-8.25-DIR_COLORS.patch
+++ b/coreutils-8.25-DIR_COLORS.patch
@@ -4,16 +4,16 @@ Date: Fri, 17 Jun 2016 16:58:18 +0200
Subject: [PATCH] downstream changes to default DIR_COLORS
---
- DIR_COLORS | 44 ++++----
- DIR_COLORS.256color | 294 +++++++++++++++++++++++-------------------------
- DIR_COLORS.lightbgcolor | 207 +++++++++++++++++-----------------
- 3 files changed, 271 insertions(+), 274 deletions(-)
+ DIR_COLORS | 41 ++++---
+ DIR_COLORS.256color | 302 ++++++++++++++++++++++++------------------------
+ DIR_COLORS.lightbgcolor | 215 +++++++++++++++++-----------------
+ 3 files changed, 286 insertions(+), 272 deletions(-)
diff --git a/DIR_COLORS b/DIR_COLORS
index d2ea453..27af9d7 100644
--- a/DIR_COLORS
+++ b/DIR_COLORS
-@@ -1,12 +1,18 @@
+@@ -1,6 +1,10 @@
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
@@ -21,20 +21,20 @@ index d2ea453..27af9d7 100644
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
+
- # Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ # Copyright (C) 1996-2017 Free Software Foundation, Inc.
# Copying and distribution of this file, with or without modification,
# are permitted provided the copyright notice and this notice are preserved.
+@@ -8,6 +12,9 @@
+ # The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
+ # slackware version of dircolors) are recognized but ignored.
--# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
--# slackware version of dircolors) are recognized but ignored.
-+# The keywords OPTIONS and EIGHTBIT (honored by the slackware version of
-+# dircolors) are recognized but ignored. For compatibility reasons, the
-+# pattern "^COLOR.*none" is recognized as a way to disable colorization.
-+# See https://bugzilla.redhat.com/1349579 for details.
-
++# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
++# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
++
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
-@@ -56,7 +62,7 @@ DOOR 01;35 # door
+ TERM Eterm
+@@ -56,7 +63,7 @@ DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
@@ -43,7 +43,7 @@ index d2ea453..27af9d7 100644
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
-@@ -181,21 +187,21 @@ EXEC 01;32
+@@ -185,21 +192,21 @@ EXEC 01;32
.ogx 01;35
# audio formats
@@ -72,7 +72,7 @@ index d2ea453..27af9d7 100644
+.ra 01;36
+.wav 01;36
- # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+ # https://wiki.xiph.org/MIME_Types_and_File_Extensions
-.oga 00;36
-.opus 00;36
-.spx 00;36
@@ -85,26 +85,23 @@ diff --git a/DIR_COLORS.256color b/DIR_COLORS.256color
index d2ea453..74c34ba 100644
--- a/DIR_COLORS.256color
+++ b/DIR_COLORS.256color
-@@ -1,39 +1,22 @@
--# Configuration file for dircolors, a utility to help you set the
--# LS_COLORS environment variable used by GNU ls with the --color option.
+@@ -1,3 +1,9 @@
+# Configuration file for the 256color ls utility
+
+# This file goes in the /etc directory, and must be world readable.
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
++
+ # Configuration file for dircolors, a utility to help you set the
+ # LS_COLORS environment variable used by GNU ls with the --color option.
- # Copyright (C) 1996-2016 Free Software Foundation, Inc.
- # Copying and distribution of this file, with or without modification,
- # are permitted provided the copyright notice and this notice are preserved.
-
--# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
--# slackware version of dircolors) are recognized but ignored.
-+# The keywords OPTIONS and EIGHTBIT (honored by the slackware version of
-+# dircolors) are recognized but ignored. For compatibility reasons, the
-+# pattern "^COLOR.*none" is recognized as a way to disable colorization.
-+# See https://bugzilla.redhat.com/1349579 for details.
+@@ -8,32 +14,13 @@
+ # The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
+ # slackware version of dircolors) are recognized but ignored.
++# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
++# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
++
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
-TERM Eterm
@@ -136,7 +133,7 @@ index d2ea453..74c34ba 100644
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
-@@ -43,29 +26,40 @@ TERM xterm*
+@@ -43,29 +30,40 @@ TERM xterm*
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
@@ -193,7 +190,7 @@ index d2ea453..74c34ba 100644
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
-@@ -83,119 +77,115 @@ EXEC 01;32
+@@ -83,123 +81,123 @@ EXEC 01;32
#.csh 01;32
# archives or compressed (bright red)
@@ -240,6 +237,10 @@ index d2ea453..74c34ba 100644
-.7z 01;31
-.rz 01;31
-.cab 01;31
+-.wim 01;31
+-.swm 01;31
+-.dwm 01;31
+-.esd 01;31
+.tar 38;5;9
+.tgz 38;5;9
+.arc 38;5;9
@@ -262,6 +263,8 @@ index d2ea453..74c34ba 100644
+.lz 38;5;9
+.lzo 38;5;9
+.xz 38;5;9
++.zst 38;5;9
++.tzst 38;5;9
+.bz2 38;5;9
+.bz 38;5;9
+.tbz 38;5;9
@@ -281,6 +284,10 @@ index d2ea453..74c34ba 100644
+.7z 38;5;9
+.rz 38;5;9
+.cab 38;5;9
++.wim 38;5;9
++.swm 38;5;9
++.dwm 38;5;9
++.esd 38;5;9
# image formats
-.jpg 01;35
@@ -332,6 +339,8 @@ index d2ea453..74c34ba 100644
-.emf 01;35
+.jpg 38;5;13
+.jpeg 38;5;13
++.mjpg 38;5;13
++.mjpeg 38;5;13
+.gif 38;5;13
+.bmp 38;5;13
+.pbm 38;5;13
@@ -376,7 +385,7 @@ index d2ea453..74c34ba 100644
+.cgm 38;5;13
+.emf 38;5;13
- # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+ # https://wiki.xiph.org/MIME_Types_and_File_Extensions
-.ogv 01;35
-.ogx 01;35
+.ogv 38;5;13
@@ -408,7 +417,7 @@ index d2ea453..74c34ba 100644
+.ra 38;5;45
+.wav 38;5;45
- # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+ # https://wiki.xiph.org/MIME_Types_and_File_Extensions
-.oga 00;36
-.opus 00;36
-.spx 00;36
@@ -421,29 +430,27 @@ diff --git a/DIR_COLORS.lightbgcolor b/DIR_COLORS.lightbgcolor
index d2ea453..95d6879 100644
--- a/DIR_COLORS.lightbgcolor
+++ b/DIR_COLORS.lightbgcolor
-@@ -1,12 +1,17 @@
--# Configuration file for dircolors, a utility to help you set the
--# LS_COLORS environment variable used by GNU ls with the --color option.
+@@ -1,3 +1,9 @@
+# Configuration file for the color ls utility - modified for lighter backgrounds
+
+# This file goes in the /etc directory, and must be world readable.
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
++
+ # Configuration file for dircolors, a utility to help you set the
+ # LS_COLORS environment variable used by GNU ls with the --color option.
- # Copyright (C) 1996-2016 Free Software Foundation, Inc.
- # Copying and distribution of this file, with or without modification,
- # are permitted provided the copyright notice and this notice are preserved.
-
--# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
--# slackware version of dircolors) are recognized but ignored.
-+# The keywords OPTIONS and EIGHTBIT (honored by the slackware version of
-+# dircolors) are recognized but ignored. For compatibility reasons, the
-+# pattern "^COLOR.*none" is recognized as a way to disable colorization.
-+# See https://bugzilla.redhat.com/1349579 for details.
+@@ -8,6 +14,9 @@
+ # The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
+ # slackware version of dircolors) are recognized but ignored.
++# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
++# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
++
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
-@@ -46,17 +51,17 @@ TERM xterm*
+ TERM Eterm
+@@ -46,17 +55,17 @@ TERM xterm*
#NORMAL 00 # no color code at all
#FILE 00 # regular file: use no color at all
RESET 0 # reset to "normal" color
@@ -466,7 +473,7 @@ index d2ea453..95d6879 100644
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
-@@ -65,7 +70,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
+@@ -65,7 +74,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
@@ -475,7 +482,7 @@ index d2ea453..95d6879 100644
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
-@@ -82,103 +87,99 @@ EXEC 01;32
+@@ -82,107 +91,107 @@ EXEC 01;32
#.sh 01;32
#.csh 01;32
@@ -523,6 +530,10 @@ index d2ea453..95d6879 100644
-.7z 01;31
-.rz 01;31
-.cab 01;31
+-.wim 01;31
+-.swm 01;31
+-.dwm 01;31
+-.esd 01;31
+# archives or compressed (red)
+.tar 00;31
+.tgz 00;31
@@ -546,6 +557,8 @@ index d2ea453..95d6879 100644
+.lz 00;31
+.lzo 00;31
+.xz 00;31
++.zst 00;31
++.tzst 00;31
+.bz2 00;31
+.bz 00;31
+.tbz 00;31
@@ -565,6 +578,10 @@ index d2ea453..95d6879 100644
+.7z 00;31
+.rz 00;31
+.cab 00;31
++.wim 00;31
++.swm 00;31
++.dwm 00;31
++.esd 00;31
# image formats
-.jpg 01;35
@@ -616,6 +633,8 @@ index d2ea453..95d6879 100644
-.emf 01;35
+.jpg 00;35
+.jpeg 00;35
++.mjpg 00;35
++.mjpeg 00;35
+.gif 00;35
+.bmp 00;35
+.pbm 00;35
@@ -660,7 +679,7 @@ index d2ea453..95d6879 100644
+.cgm 00;35
+.emf 00;35
- # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+ # https://wiki.xiph.org/MIME_Types_and_File_Extensions
-.ogv 01;35
-.ogx 01;35
+.ogv 00;35
diff --git a/coreutils-8.26-date-fix-tz-regre.patch b/coreutils-8.26-date-fix-tz-regre.patch
deleted file mode 100644
index 158c80a..0000000
--- a/coreutils-8.26-date-fix-tz-regre.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From 12284825dcc5d9485ebaa78aedd93f450bad7b73 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?P=C3=A1draig=20Brady?=
-Date: Fri, 20 Jan 2017 12:40:35 +0000
-Subject: [PATCH 1/2] date: fix TZ= regression
-
-On 17/03/16 17:38, Paul Eggert wrote:
-> On 03/16/2016 08:51 PM, Assaf Gordon wrote:
->> I suspect it has something to do with this commit:
->> commit 037e3b9847feb46cf6b58d99ce960d3987faaf52
->
-> You're right, and thanks for that detailed bug report. I installed the
-> attached patch, which fixed the bug for me.
-
-This introduced a bug unfortunately due to the side effects of
-parse_datetime().
-parse_datetime resets the TZ env variable but doesn't call tzset().
-Hence using the wrong timezone for output.
-Previously localtime() called tzset() implicitly.
-Perhaps we should call tzset() in parse_datetime() if needed?
-I'm not sure as to whether this undoes the fix for bug 23035?
-
-Anyway this avoids the issue on GNU/Linux.
-
-Signed-off-by: Kamil Dudka
----
- src/date.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/date.c b/src/date.c
-index 619a72b..2b3d890 100644
---- a/src/date.c
-+++ b/src/date.c
-@@ -571,6 +571,8 @@ show_date (const char *format, struct timespec when, timezone_t tz)
- {
- struct tm tm;
-
-+ tzset ();
-+
- if (localtime_rz (tz, &when.tv_sec, &tm))
- {
- if (format == rfc_2822_format)
---
-2.7.4
-
-
-From 3c082157634bd4fbc79c26e9c56abb4da79e9a2d Mon Sep 17 00:00:00 2001
-From: Paul Eggert
-Date: Fri, 20 Jan 2017 18:24:02 -0800
-Subject: [PATCH 2/2] date: test for TZ= regression
-
-Problem reported by Paul Wise for Debian, in:
-https://bugs.debian.org/851934
-This is fallout from the fix for GNU Bug#23035.
-* tests/misc/date.pl: Test the fix.
-
-Upstream-commit: b14be5085cd1aefd473a000456b21270e6070711
-Signed-off-by: Kamil Dudka
----
- tests/misc/date-debug.sh | 4 ++--
- tests/misc/date.pl | 6 ++++++
- 2 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/tests/misc/date.pl b/tests/misc/date.pl
-index 7e45e98..be8b39e 100755
---- a/tests/misc/date.pl
-+++ b/tests/misc/date.pl
-@@ -291,6 +291,12 @@ my @Tests =
- {ERR => "date: invalid date 'TZ=\"\"\"'\n"},
- {EXIT => 1},
- ],
-+
-+ # https://bugs.debian.org/851934#10
-+ ['cross-TZ-mishandled', "-d 'TZ=\"EST5\" 1970-01-01 00:00'",
-+ {ENV => 'TZ=PST8'},
-+ {OUT => 'Wed Dec 31 21:00:00 PST 1969'},
-+ ],
- );
-
- # Repeat the cross-dst test, using Jan 1, 2005 and every interval from 1..364.
---
-2.7.4
-
diff --git a/coreutils-8.26-test-lock.patch b/coreutils-8.26-test-lock.patch
index 786aa33..d66928c 100644
--- a/coreutils-8.26-test-lock.patch
+++ b/coreutils-8.26-test-lock.patch
@@ -1,211 +1,7 @@
-From 4f6cb65ce4d643aca0c6bf7db2e8b32c0d08eb89 Mon Sep 17 00:00:00 2001
-From: Bruno Haible
-Date: Sat, 24 Dec 2016 18:21:59 +0100
-Subject: [PATCH 1/2] lock test: Fix performance problem on multi-core
- machines.
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-* tests/test-lock.c (USE_VOLATILE): New macro.
-(struct atomic_int): New type.
-(init_atomic_int, get_atomic_int_value, set_atomic_int_value): New
-functions.
-(lock_checker_done, rwlock_checker_done, reclock_checker_done): Define
-as 'struct atomic_int'.
-(lock_checker_thread, test_lock, rwlock_checker_thread, test_rwlock,
-reclock_checker_thread, test_recursive_lock): Use the new functions.
-Reported by Eric Blake in
-https://www.redhat.com/archives/libvir-list/2012-March/msg00854.html
-and by Pádraig Brady in
-http://lists.gnu.org/archive/html/bug-gnulib/2016-12/msg00117.html.
-
-Upstream-commit: 480d374e596a0ee3fed168ab42cd84c313ad3c89
-Signed-off-by: Kamil Dudka
----
- gnulib-tests/test-lock.c | 79 ++++++++++++++++++++++++++++++++++++++++--------
- 1 file changed, 67 insertions(+), 12 deletions(-)
-
-diff --git a/gnulib-tests/test-lock.c b/gnulib-tests/test-lock.c
-index cb734b4..aa6de27 100644
---- a/gnulib-tests/test-lock.c
-+++ b/gnulib-tests/test-lock.c
-@@ -50,6 +50,13 @@
- Uncomment this to see if the operating system has a fair scheduler. */
- #define EXPLICIT_YIELD 1
-
-+/* Whether to use 'volatile' on some variables that communicate information
-+ between threads. If set to 0, a lock is used to protect these variables.
-+ If set to 1, 'volatile' is used; this is theoretically equivalent but can
-+ lead to much slower execution (e.g. 30x slower total run time on a 40-core
-+ machine. */
-+#define USE_VOLATILE 0
-+
- /* Whether to print debugging messages. */
- #define ENABLE_DEBUGGING 0
-
-@@ -103,6 +110,51 @@
- # define yield()
- #endif
-
-+#if USE_VOLATILE
-+struct atomic_int {
-+ volatile int value;
-+};
-+static void
-+init_atomic_int (struct atomic_int *ai)
-+{
-+}
-+static int
-+get_atomic_int_value (struct atomic_int *ai)
-+{
-+ return ai->value;
-+}
-+static void
-+set_atomic_int_value (struct atomic_int *ai, int new_value)
-+{
-+ ai->value = new_value;
-+}
-+#else
-+struct atomic_int {
-+ gl_lock_define (, lock)
-+ int value;
-+};
-+static void
-+init_atomic_int (struct atomic_int *ai)
-+{
-+ gl_lock_init (ai->lock);
-+}
-+static int
-+get_atomic_int_value (struct atomic_int *ai)
-+{
-+ gl_lock_lock (ai->lock);
-+ int ret = ai->value;
-+ gl_lock_unlock (ai->lock);
-+ return ret;
-+}
-+static void
-+set_atomic_int_value (struct atomic_int *ai, int new_value)
-+{
-+ gl_lock_lock (ai->lock);
-+ ai->value = new_value;
-+ gl_lock_unlock (ai->lock);
-+}
-+#endif
-+
- #define ACCOUNT_COUNT 4
-
- static int account[ACCOUNT_COUNT];
-@@ -170,12 +222,12 @@ lock_mutator_thread (void *arg)
- return NULL;
- }
-
--static volatile int lock_checker_done;
-+static struct atomic_int lock_checker_done;
-
- static void *
- lock_checker_thread (void *arg)
- {
-- while (!lock_checker_done)
-+ while (get_atomic_int_value (&lock_checker_done) == 0)
- {
- dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ());
- gl_lock_lock (my_lock);
-@@ -200,7 +252,8 @@ test_lock (void)
- /* Initialization. */
- for (i = 0; i < ACCOUNT_COUNT; i++)
- account[i] = 1000;
-- lock_checker_done = 0;
-+ init_atomic_int (&lock_checker_done);
-+ set_atomic_int_value (&lock_checker_done, 0);
-
- /* Spawn the threads. */
- checkerthread = gl_thread_create (lock_checker_thread, NULL);
-@@ -210,7 +263,7 @@ test_lock (void)
- /* Wait for the threads to terminate. */
- for (i = 0; i < THREAD_COUNT; i++)
- gl_thread_join (threads[i], NULL);
-- lock_checker_done = 1;
-+ set_atomic_int_value (&lock_checker_done, 1);
- gl_thread_join (checkerthread, NULL);
- check_accounts ();
- }
-@@ -254,12 +307,12 @@ rwlock_mutator_thread (void *arg)
- return NULL;
- }
-
--static volatile int rwlock_checker_done;
-+static struct atomic_int rwlock_checker_done;
-
- static void *
- rwlock_checker_thread (void *arg)
- {
-- while (!rwlock_checker_done)
-+ while (get_atomic_int_value (&rwlock_checker_done) == 0)
- {
- dbgprintf ("Checker %p before check rdlock\n", gl_thread_self_pointer ());
- gl_rwlock_rdlock (my_rwlock);
-@@ -284,7 +337,8 @@ test_rwlock (void)
- /* Initialization. */
- for (i = 0; i < ACCOUNT_COUNT; i++)
- account[i] = 1000;
-- rwlock_checker_done = 0;
-+ init_atomic_int (&rwlock_checker_done);
-+ set_atomic_int_value (&rwlock_checker_done, 0);
-
- /* Spawn the threads. */
- for (i = 0; i < THREAD_COUNT; i++)
-@@ -295,7 +349,7 @@ test_rwlock (void)
- /* Wait for the threads to terminate. */
- for (i = 0; i < THREAD_COUNT; i++)
- gl_thread_join (threads[i], NULL);
-- rwlock_checker_done = 1;
-+ set_atomic_int_value (&rwlock_checker_done, 1);
- for (i = 0; i < THREAD_COUNT; i++)
- gl_thread_join (checkerthreads[i], NULL);
- check_accounts ();
-@@ -356,12 +410,12 @@ reclock_mutator_thread (void *arg)
- return NULL;
- }
-
--static volatile int reclock_checker_done;
-+static struct atomic_int reclock_checker_done;
-
- static void *
- reclock_checker_thread (void *arg)
- {
-- while (!reclock_checker_done)
-+ while (get_atomic_int_value (&reclock_checker_done) == 0)
- {
- dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ());
- gl_recursive_lock_lock (my_reclock);
-@@ -386,7 +440,8 @@ test_recursive_lock (void)
- /* Initialization. */
- for (i = 0; i < ACCOUNT_COUNT; i++)
- account[i] = 1000;
-- reclock_checker_done = 0;
-+ init_atomic_int (&reclock_checker_done);
-+ set_atomic_int_value (&reclock_checker_done, 0);
-
- /* Spawn the threads. */
- checkerthread = gl_thread_create (reclock_checker_thread, NULL);
-@@ -396,7 +451,7 @@ test_recursive_lock (void)
- /* Wait for the threads to terminate. */
- for (i = 0; i < THREAD_COUNT; i++)
- gl_thread_join (threads[i], NULL);
-- reclock_checker_done = 1;
-+ set_atomic_int_value (&reclock_checker_done, 1);
- gl_thread_join (checkerthread, NULL);
- check_accounts ();
- }
---
-2.7.4
-
-
From 0d04ee8ddedb2bf33d64f148f246a3b7ec4fef21 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 23 Jan 2017 12:35:41 +0100
-Subject: [PATCH 2/2] test-lock: disable the rwlock test
+Subject: [PATCH] test-lock: disable the rwlock test
It hangs indefinitely if the system rwlock implementation does not
prevent writer starvation (and glibc does not implement it).
diff --git a/coreutils-8.26.tar.xz.sig b/coreutils-8.26.tar.xz.sig
deleted file mode 100644
index fe1635d..0000000
--- a/coreutils-8.26.tar.xz.sig
+++ /dev/null
@@ -1,17 +0,0 @@
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iQIcBAABAgAGBQJYPyRpAAoJEN9v2XEwYDfZ0I4P/3oaPYXMPEOKuDDpEcLumn26
-gYIMQc1jIMbBNQe120gQmNPkRr5dTKt5Bap9qYkCj0pI/6VxVIWDo0xrOLYZi7AN
-Xgr0kX2qLDFEH+EHkC1BpsAdpsgwfvLmVWPHS62CNKgVDgGiP1cRJZe8oVmlBCiR
-3ES7pUsBfDn3hbdKNTTmMDtro1rQMOxfHkVCZLAva+JjdzpE+KTvzZzKkVuZZfJ/
-Mi/ZySrXZXFvPBS7GXgop4x8EodyzQMeKO+nvpIUEBY1yLQgCvni5/CBI8w/EViD
-DSjj0zWsCQkEjx6HCohi8sBHUYZ+M3lB4rkFk7aevdioPZUGfLkW31LT/cUJC/VV
-MIQKWzQtZO/WCJuyEbWP2m25c4MtnnhTm5yoi29yT/CoTRlUWkIQpXm4oD1cJXHy
-PpHveu8qM0qRaAtVdXE3pmapIMYUV4g7vxSuCjZRrgiDLhp/K7Lzt5xBhl++kPU2
-U9uc202eah4Towo0pbHsuEJT0vk0GGLq8/17dCa/ss8wV+86ZLxl0kZYy4CNEnIW
-vsCN6CJ5AoAEVrMN1F7ZJYnH4hoJedvIczThnAkNTqYYE3wnN9stOe28Oy/a0/tg
-bt5/Mn0JbmQei890uU8zcEdUjidHqGV4hKk1E2UC4UCyHG/VcHv9gfr8OaD/xPDr
-SoauDCHpBU7J7FT/DX+k
-=vkKy
------END PGP SIGNATURE-----
diff --git a/coreutils-8.27.tar.xz.sig b/coreutils-8.27.tar.xz.sig
new file mode 100644
index 0000000..7555c00
--- /dev/null
+++ b/coreutils-8.27.tar.xz.sig
@@ -0,0 +1,16 @@
+-----BEGIN PGP SIGNATURE-----
+
+iQIcBAABAgAGBQJYwOwaAAoJEN9v2XEwYDfZQrUP/RdXj/ug35e+u+VD1ts9/b8n
+7JihJmxngEZQAJECNTMbJ7mNj6DhpMY0Jg/Hwg7zJT28T6QDeS1Iuk3Id4uM5eFa
+CgHKAZumntSMTkQdNvnCEFEIqu+L8BtBYGcOaw66wAFNFw3jdJUUs2sOST2r46jR
+N7aY9oARKJuHfgTZ2BI2zL0Q+poXM1O0k/U+BScE6c139zJsbg+1uM9kGVtJWPkM
+EPLFWkbTgjYnt+qEFrDlWL0YFOS42sgR7P1sVfBC1nAu5lwgzPy62OtGv9WCEBhm
+3+PRNZ0KLW8CKp06llG/0bG4QwssWs6p/vPwrRGeAg6pKsRNN1ni27AnDThiPgvz
+YbBLgU+EZj1HuibvYArHXNKY2+O5ZC3nYU6bdAffl3TAtrGFA1ncZXGiFD5UgOQ2
+V9Q38S41FUEwKGtf9tWGCRTxrb4FQ1CDzJglV9vHKetn4mgH/HpEG/q07k4RNW5d
+ikfrS0xFxbqtLjlY3UqvtkrFyVQFY093ozsP7fKsq53JAtEWc3YvXR8UCbliU+gV
+5qug0REBQafe9EAyH+oq0dzD2BZ3KtFcjtKI/2UzAf3idcyygsHgcEPQObqI8BfD
+NscEMjdFY7+Zh5w2shQlyq4xr2aI2nXCX3+AMcS/6Yfg6W6fBvgIjtmXBrQsbWpV
+DBcx50TVDa/ERBX1+FI1
+=skPR
+-----END PGP SIGNATURE-----
diff --git a/coreutils-getgrouplist.patch b/coreutils-getgrouplist.patch
index 7defd19..5b35f42 100644
--- a/coreutils-getgrouplist.patch
+++ b/coreutils-getgrouplist.patch
@@ -30,7 +30,7 @@ index 76474c2..0a9d221 100644
- : getgroups (0, NULL));
+ if (!username)
+ max_n_groups = getgroups(0, NULL);
-+ else
++ else
+ {
+#ifdef HAVE_GETGROUPLIST
+ max_n_groups = 0;
diff --git a/coreutils-i18n-fix2-expand-unexpand.patch b/coreutils-i18n-fix2-expand-unexpand.patch
index 1a63012..b34d7b7 100644
--- a/coreutils-i18n-fix2-expand-unexpand.patch
+++ b/coreutils-i18n-fix2-expand-unexpand.patch
@@ -22,7 +22,7 @@ index 380e020..310b349 100644
+ }
}
- while (false);
-+
++
if (convert)
{
@@ -50,7 +50,7 @@ index 3bbbd66..863a90a 100644
+ }
}
- while (false);
-+
++
if (convert)
{
diff --git a/coreutils-i18n-fold-newline.patch b/coreutils-i18n-fold-newline.patch
index 79d1a09..f7286ef 100644
--- a/coreutils-i18n-fold-newline.patch
+++ b/coreutils-i18n-fold-newline.patch
@@ -4,8 +4,8 @@ Date: Fri, 3 Feb 2017 12:26:53 +0100
Subject: [PATCH] fold.c: preserve new-lines in mutlibyte text
---
- src/fold.c | 55 +++++++++++++++++++++++++++----------------------------
- 1 file changed, 27 insertions(+), 28 deletions(-)
+ src/fold.c | 49 ++++++++++++++++++++++++-------------------------
+ 1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/src/fold.c b/src/fold.c
index d23edd5..8c232a7 100644
@@ -43,15 +43,24 @@ index d23edd5..8c232a7 100644
- fwrite (line_out, sizeof(char), offset_out, stdout);
- START_NEW_LINE;
- continue;
--
++ case L'\b':
++ increment = (column > 0) ? -1 : 0;
++ break;
+
- case L'\b':
- increment = (column > 0) ? -1 : 0;
- break;
--
++ case L'\r':
++ increment = -1 * column;
++ break;
+
- case L'\r':
- increment = -1 * column;
- break;
--
++ case L'\t':
++ increment = 8 - column % 8;
++ break;
+
- case L'\t':
- increment = 8 - column % 8;
- break;
@@ -60,18 +69,6 @@ index d23edd5..8c232a7 100644
- increment = wcwidth (wc);
- increment = (increment < 0) ? 0 : increment;
- }
-+ case L'\b':
-+ increment = (column > 0) ? -1 : 0;
-+ break;
-+
-+ case L'\r':
-+ increment = -1 * column;
-+ break;
-+
-+ case L'\t':
-+ increment = 8 - column % 8;
-+ break;
-+
+ default:
+ increment = wcwidth (wc);
+ increment = (increment < 0) ? 0 : increment;
diff --git a/coreutils-i18n-un-expand-BOM.patch b/coreutils-i18n-un-expand-BOM.patch
index 56e7fa5..2ccdcca 100644
--- a/coreutils-i18n-un-expand-BOM.patch
+++ b/coreutils-i18n-un-expand-BOM.patch
@@ -1,3 +1,17 @@
+From 7a7c776a4e228d180e74614fd8c8afcad5d4bdf7 Mon Sep 17 00:00:00 2001
+From: Jakub Martisko
+Date: Thu, 7 Jul 2016 12:53:26 +0200
+Subject: [PATCH] coreutils-i18n-un-expand-BOM.patch
+
+---
+ src/expand-common.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ src/expand-common.h | 12 ++++++
+ src/expand.c | 45 +++++++++++++++++++-
+ src/unexpand.c | 43 ++++++++++++++++++-
+ tests/expand/mb.sh | 71 ++++++++++++++++++++++++++++++++
+ tests/unexpand/mb.sh | 59 ++++++++++++++++++++++++++
+ 6 files changed, 342 insertions(+), 2 deletions(-)
+
diff --git a/src/expand-common.c b/src/expand-common.c
index 4657e46..97cbb09 100644
--- a/src/expand-common.c
@@ -10,8 +24,8 @@ index 4657e46..97cbb09 100644
#include "system.h"
#include "die.h"
#include "error.h"
-@@ -85,6 +86,119 @@ add_tab_stop (uintmax_t tabval)
- }
+@@ -105,6 +106,119 @@ set_extend_size (uintmax_t tabval)
+ return ok;
}
+extern int
@@ -40,12 +54,12 @@ index 4657e46..97cbb09 100644
+check_utf_locale(void)
+{
+ char* locale = setlocale (LC_CTYPE , NULL);
-+ if (locale == NULL)
++ if (locale == NULL)
+ {
+ return false;
+ }
+ else if (strcasestr(locale, "utf8") == NULL && strcasestr(locale, "utf-8") == NULL)
-+ {
++ {
+ return false;
+ }
+ return true;
@@ -147,7 +161,7 @@ index 8cb2079..763bfda 100644
+extern bool
+check_bom(FILE* fp, mb_file_t *mbf);
+
-+extern void
++extern void
+print_bom(void);
+
/* Add tab stop TABVAL to the end of 'tab_list'. */
@@ -161,14 +175,13 @@ index 310b349..4136824 100644
FILE *fp = next_file (NULL);
mb_file_t mbf;
mbf_char_t c;
--
+ /* True if the starting locale is utf8. */
+ bool using_utf_locale;
-+
++
+ /* True if the first file contains BOM header. */
+ bool found_bom;
+ using_utf_locale=check_utf_locale();
-+
+
if (!fp)
return;
-
@@ -178,13 +191,13 @@ index 310b349..4136824 100644
+ if (using_utf_locale == false && found_bom == true)
+ {
+ /*try using some predefined locale */
-+
++
+ if (set_utf_locale () != 0)
+ {
+ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale"));
+ }
+ }
-+
++
+
+ if (found_bom == true)
+ {
@@ -212,7 +225,7 @@ index 310b349..4136824 100644
+ {
+ if(using_utf_locale==false && found_bom==true)
+ {
-+ /*First file conatined BOM header - locale was switched to UTF
++ /*First file conatined BOM header - locale was switched to UTF
+ /*all subsequent files should contain BOM. */
+ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
+ }
@@ -231,7 +244,7 @@ index 863a90a..5681b58 100644
mbf_char_t *pending_blank;
+ /* True if the starting locale is utf8. */
+ bool using_utf_locale;
-+
++
+ /* True if the first file contains BOM header. */
+ bool found_bom;
+ using_utf_locale=check_utf_locale();
@@ -240,11 +253,11 @@ index 863a90a..5681b58 100644
return;
+ mbf_init (mbf, fp);
+ found_bom=check_bom(fp,&mbf);
-
++
+ if (using_utf_locale == false && found_bom == true)
+ {
+ /*try using some predefined locale */
-+
+
+ if (set_utf_locale () != 0)
+ {
+ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale"));
@@ -282,7 +295,7 @@ index 863a90a..5681b58 100644
+ {
+ if(using_utf_locale==false && found_bom==true)
+ {
-+ /*First file conatined BOM header - locale was switched to UTF
++ /*First file conatined BOM header - locale was switched to UTF
+ /*all subsequent files should contain BOM. */
+ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
+ }
@@ -301,7 +314,7 @@ index 031be7a..1621c84 100755
+
+
-+#BOM header test 1
++#BOM header test 1
+printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_
+1234567812345678123456781
+. . . .
@@ -380,7 +393,7 @@ index 8d75652..9d4ee3e 100755
unexpand -a < in > out || fail=1
compare exp out > /dev/null 2>&1 || fail=1
+
-+#BOM header test 1
++#BOM header test 1
+printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_
+1234567812345678123456781
+. . . .
@@ -438,3 +451,6 @@ index 8d75652..9d4ee3e 100755
+
+LC_ALL=C unexpand in in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+--
+2.9.3
+
diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch
index d7cf59c..ab5d8dc 100644
--- a/coreutils-i18n.patch
+++ b/coreutils-i18n.patch
@@ -315,7 +315,7 @@ index 8cd0d6b..d23edd5 100644
+ fwrite (line_out, sizeof(char), offset_out, stdout);
+ START_NEW_LINE;
+ continue;
-+
++
+ case L'\b':
+ increment = (column > 0) ? -1 : 0;
+ break;
@@ -672,7 +672,7 @@ index 98b461c..9990f38 100644
+ extract_field (line, ptr, lim - ptr);
+}
+#endif
-+
++
static void
freeline (struct line *line)
{
@@ -2843,7 +2843,7 @@ index 87a0c93..9f755d9 100644
+ while (pos < size)
+ {
+ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail);
-+
++
+ if (convfail || !(iswblank (wc) || wc == '\n'))
+ {
+ pos += mblength;
@@ -2886,7 +2886,7 @@ index 87a0c93..9f755d9 100644
if (check_chars < oldlen)
oldlen = check_chars;
if (check_chars < newlen)
-@@ -295,14 +401,103 @@ different (char *old, char *new, size_t oldlen, size_t newlen)
+@@ -295,15 +401,104 @@ different (char *old, char *new, size_t oldlen, size_t newlen)
if (ignore_case)
{
@@ -2918,8 +2918,8 @@ index 87a0c93..9f755d9 100644
+
+ return xmemcoll (copy_old, oldlen, copy_new, newlen);
+
-+}
-+
+ }
+
+#if HAVE_MBRTOWC
+static int
+different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate)
@@ -2990,11 +2990,12 @@ index 87a0c93..9f755d9 100644
+ free (copy[1]);
+ return rc;
+
- }
++}
+#endif
-
++
/* Output the line in linebuffer LINE to standard output
provided that the switches say it should be output.
+ MATCH is true if the line matches the previous line.
@@ -367,19 +562,38 @@ check_file (const char *infile, const char *outfile, char delimiter)
char *prevfield IF_LINT ( = NULL);
size_t prevlen IF_LINT ( = 0);
@@ -3156,7 +3157,7 @@ diff --git a/tests/local.mk b/tests/local.mk
index 568944e..192f776 100644
--- a/tests/local.mk
+++ b/tests/local.mk
-@@ -350,6 +350,8 @@ all_tests = \
+@@ -352,6 +352,8 @@ all_tests = \
tests/misc/sort-discrim.sh \
tests/misc/sort-files0-from.pl \
tests/misc/sort-float.sh \
@@ -3211,8 +3212,8 @@ index 8a9cad1..9293e39 100755
my @Tests =
(
['t1', '--tabs=3', {IN=>"a\tb"}, {OUT=>"a b"}],
-@@ -140,6 +149,8 @@ my @Tests =
-
+@@ -152,6 +161,8 @@ my @Tests =
+ ['trail9', '--tab=1,2 -t/5',{IN=>"\ta\tb\tc"}, {OUT=>" a b c"}],
# Test errors
+ # FIXME: The following tests contain ‘quoting’ specific to LC_MESSAGES
@@ -3220,8 +3221,8 @@ index 8a9cad1..9293e39 100755
['e1', '--tabs="a"', {IN=>''}, {OUT=>''}, {EXIT=>1},
{ERR => "$prog: tab size contains invalid character(s): 'a'\n"}],
['e2', "-t $UINTMAX_OFLOW", {IN=>''}, {OUT=>''}, {EXIT=>1},
-@@ -150,6 +161,37 @@ my @Tests =
- {ERR => "$prog: tab sizes must be ascending\n"}],
+@@ -168,6 +179,37 @@ my @Tests =
+ {ERR => "$prog: '/' specifier not at start of number: '/'\n"}],
);
+if ($mb_locale ne 'C')
@@ -3533,7 +3534,7 @@ index c3e7f8e..6ecd3ff 100755
# Since each test is run with a file name and with redirected stdin,
# the name in the diagnostic is either the file name or "-".
# Normalize each diagnostic to use '-'.
-@@ -424,6 +429,38 @@ foreach my $t (@Tests)
+@@ -423,6 +428,38 @@ foreach my $t (@Tests)
}
}
@@ -3572,7 +3573,7 @@ index c3e7f8e..6ecd3ff 100755
@Tests = triple_test \@Tests;
# Remember that triple_test creates from each test with exactly one "IN"
-@@ -433,6 +470,7 @@ foreach my $t (@Tests)
+@@ -432,6 +469,7 @@ foreach my $t (@Tests)
# Remove the IN_PIPE version of the "output-is-input" test above.
# The others aren't susceptible because they have three inputs each.
@Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests;
diff --git a/coreutils-selinux.patch b/coreutils-selinux.patch
index cee4f7c..8274a23 100644
--- a/coreutils-selinux.patch
+++ b/coreutils-selinux.patch
@@ -48,7 +48,7 @@ index 1b528c6..25dbb88 100644
+ case 'c':
+ fprintf (stderr, "%s: warning: option '-c' is deprecated, please use '--preserve=context' instead\n", argv[0]);
-+ if ( x.set_security_context ) {
++ if ( x.set_security_context ) {
+ (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]);
+ exit( 1 );
+ }
diff --git a/coreutils.spec b/coreutils.spec
index a2899d7..0af685d 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,11 +1,11 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
-Version: 8.26
-Release: 7%{?dist}
+Version: 8.27
+Release: 1%{?dist}
License: GPLv3+
Group: System Environment/Base
-Url: http://www.gnu.org/software/coreutils/
-Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
+Url: https://www.gnu.org/software/coreutils/
+Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
Source50: supported_utils
Source105: coreutils-colorls.sh
Source106: coreutils-colorls.csh
@@ -19,9 +19,6 @@ Source10: coreutils-find-requires.sh
# disable the test-lock gnulib test prone to deadlock
Patch1: coreutils-8.26-test-lock.patch
-# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851934#10
-Patch2: coreutils-8.26-date-fix-tz-regre.patch
-
#add note about no difference between binary/text mode on Linux - md5sum manpage
Patch101: coreutils-6.10-manpages.patch
# downstream changes to default DIR_COLORS
@@ -172,6 +169,8 @@ including documentation and translations.
# will be modified by coreutils-8.25-DIR_COLORS.patch
tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null
+# git add DIR_COLORS{,.256color,.lightbgcolor}
+# git commit -m "clone DIR_COLORS before patching"
# apply all patches
%autopatch -p1
@@ -301,6 +300,9 @@ fi
%license COPYING
%changelog
+* Thu Mar 09 2017 Kamil Dudka - 8.27-1
+- new upstream release 8.27
+
* Fri Feb 10 2017 Fedora Release Engineering - 8.26-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
diff --git a/sources b/sources
index becdeb6..2566cf4 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-d5aa2072f662d4118b9f4c63b94601a6 coreutils-8.26.tar.xz
+SHA512 (coreutils-8.27.tar.xz) = abf3280aaa54e9bd5851df0eda2af1de1017ca174633e52d1e592455d46ea0e99812dda46d2f320e979553cef271485d8818c595bba6ed31264511a511c93679
From 4ceb7222e4ce09a1b0816de5fe1f1f5925269ba5 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Wed, 15 Mar 2017 10:16:30 +0100
Subject: [PATCH 048/232] fix spurious build failure caused by the
misc/date-debug test
---
coreutils-8.27-date-debug-test.patch | 50 ++++++++++++++++++++++++++++
coreutils.spec | 10 ++++--
2 files changed, 58 insertions(+), 2 deletions(-)
create mode 100644 coreutils-8.27-date-debug-test.patch
diff --git a/coreutils-8.27-date-debug-test.patch b/coreutils-8.27-date-debug-test.patch
new file mode 100644
index 0000000..a8def7b
--- /dev/null
+++ b/coreutils-8.27-date-debug-test.patch
@@ -0,0 +1,50 @@
+From ee2017f191f1ad177405fbd8816df0a55127804a Mon Sep 17 00:00:00 2001
+From: Paul Eggert
+Date: Thu, 9 Mar 2017 23:59:05 -0800
+Subject: [PATCH] tests: port to tzdb-2017a
+
+Problem reported by Bernhard Voelker in:
+http://lists.gnu.org/archive/html/coreutils/2017-03/msg00026.html
+* tests/misc/date-debug.sh: Port test to tzdb 2017a,
+and future-proof the America/Belize test.
+
+Upstream-commit: 612086660bab9bf981894da146550e9101224b17
+Signed-off-by: Kamil Dudka
+---
+ tests/misc/date-debug.sh | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/tests/misc/date-debug.sh b/tests/misc/date-debug.sh
+index 48f4605..8e0b2af 100755
+--- a/tests/misc/date-debug.sh
++++ b/tests/misc/date-debug.sh
+@@ -52,10 +52,11 @@ date: output timezone: +09:00 (set from TZ="Asia/Tokyo" environment value)
+ date: final: 661095000.000000000 (epoch-seconds)
+ date: final: (Y-M-D) 1990-12-13 13:30:00 (UTC0)
+ date: final: (Y-M-D) 1990-12-13 22:30:00 (output timezone TZ=+09:00)
+-Thu Dec 13 07:30:00 CST 1990
++Thu Dec 13 07:30:00 -0600 1990
+ EOF
+
+-TZ=America/Belize date --debug -d "$in1" >out1 2>&1 || fail=1
++TZ=America/Belize date --debug -d "$in1" +'%a %b %e %T %z %Y' >out1 2>&1 ||
++ fail=1
+
+ compare exp1 out1 || fail=1
+
+@@ -94,10 +95,10 @@ date: output timezone: -05:00 (set from TZ="America/Lima" environment value)
+ date: final: 1.000000000 (epoch-seconds)
+ date: final: (Y-M-D) 1970-01-01 00:00:01 (UTC0)
+ date: final: (Y-M-D) 1969-12-31 19:00:01 (output timezone TZ=-05:00)
+-Wed Dec 31 19:00:01 PET 1969
++Wed Dec 31 19:00:01 -0500 1969
+ EOF
+
+-TZ=America/Lima date --debug -d "$in3" >out3 2>&1 || fail=1
++TZ=America/Lima date --debug -d "$in3" +'%a %b %e %T %z %Y' >out3 2>&1 || fail=1
+ compare exp3 out3 || fail=1
+
+ ##
+--
+2.9.3
+
diff --git a/coreutils.spec b/coreutils.spec
index 0af685d..4744830 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.27
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: https://www.gnu.org/software/coreutils/
@@ -16,8 +16,11 @@ Source10: coreutils-find-requires.sh
%global __find_provides %{_rpmconfigdir}/find-provides
%global __find_requires %{SOURCE10} %{_rpmconfigdir}/find-requires
+# upstream patches
+Patch1: coreutils-8.27-date-debug-test.patch
+
# disable the test-lock gnulib test prone to deadlock
-Patch1: coreutils-8.26-test-lock.patch
+Patch100: coreutils-8.26-test-lock.patch
#add note about no difference between binary/text mode on Linux - md5sum manpage
Patch101: coreutils-6.10-manpages.patch
@@ -300,6 +303,9 @@ fi
%license COPYING
%changelog
+* Wed Mar 15 2017 Kamil Dudka - 8.27-2
+- fix spurious build failure caused by the misc/date-debug test
+
* Thu Mar 09 2017 Kamil Dudka - 8.27-1
- new upstream release 8.27
From 3d65658099fc016b2a0c90f0a2ebc7403bfcd00c Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Tue, 25 Apr 2017 13:43:39 +0200
Subject: [PATCH 049/232] Resolves: #1444802 - do not obsolete
coreutils-single, so it can be installed by DNF2
This reverts commit c553cab787c2499ffaa36748a2de7c0e08fe31d5.
---
coreutils.spec | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/coreutils.spec b/coreutils.spec
index 4744830..5e9e46b 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.27
-Release: 2%{?dist}
+Release: 3%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: https://www.gnu.org/software/coreutils/
@@ -67,8 +67,6 @@ Patch950: coreutils-selinux.patch
Conflicts: filesystem < 3
# To avoid clobbering installs
Conflicts: coreutils-single
-# To give priority to this package
-Obsoletes: coreutils-single
Provides: /bin/basename
Provides: /bin/cat
Provides: /bin/chgrp
@@ -303,6 +301,9 @@ fi
%license COPYING
%changelog
+* Tue Apr 25 2017 Kamil Dudka - 8.27-3
+- do not obsolete coreutils-single, so it can be installed by DNF2 (#1444802)
+
* Wed Mar 15 2017 Kamil Dudka - 8.27-2
- fix spurious build failure caused by the misc/date-debug test
From e0567d54a78f817b054755885bb5f97a2ef690ee Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Thu, 27 Apr 2017 09:51:08 +0200
Subject: [PATCH 050/232] Resolves: CVE-2017-7476 - date, touch: fix
out-of-bounds write via large TZ variable
---
coreutils-8.27-CVE-2017-7476.patch | 189 +++++++++++++++++++++++++++++
coreutils.spec | 8 +-
2 files changed, 196 insertions(+), 1 deletion(-)
create mode 100644 coreutils-8.27-CVE-2017-7476.patch
diff --git a/coreutils-8.27-CVE-2017-7476.patch b/coreutils-8.27-CVE-2017-7476.patch
new file mode 100644
index 0000000..23fdb3f
--- /dev/null
+++ b/coreutils-8.27-CVE-2017-7476.patch
@@ -0,0 +1,189 @@
+From fc286e2b3af5b2ed9aec44b520265bb0968f1660 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?=
+Date: Mon, 24 Apr 2017 01:43:36 -0700
+Subject: [PATCH 1/2] time_rz: fix heap buffer overflow vulnerability
+
+This issue has been assigned CVE-2017-7476 and was
+detected with American Fuzzy Lop 2.41b run on the
+coreutils date(1) program with ASAN enabled.
+
+ ERROR: AddressSanitizer: heap-buffer-overflow on address 0x...
+ WRITE of size 8 at 0x60d00000cff8 thread T0
+ #1 0x443020 in extend_abbrs lib/time_rz.c:88
+ #2 0x443356 in save_abbr lib/time_rz.c:155
+ #3 0x44393f in localtime_rz lib/time_rz.c:290
+ #4 0x41e4fe in parse_datetime2 lib/parse-datetime.y:1798
+
+A minimized reproducer is the following 120 byte TZ value,
+which goes beyond the value of ABBR_SIZE_MIN (119) on x86_64.
+Extend the aa...b portion to overwrite more of the heap.
+
+ date -d $(printf 'TZ="aaa%020daaaaaab%089d"')
+
+localtime_rz and mktime_z were affected since commit 4bc76593.
+parse_datetime was affected since commit 4e6e16b3f.
+
+* lib/time_rz.c (save_abbr): Rearrange the calculation determining
+whether there is enough buffer space available. The rearrangement
+ensures we're only dealing with positive numbers, thus avoiding
+the problematic promotion of signed to unsigned causing an invalid
+comparison when zone_copy is more than ABBR_SIZE_MIN bytes beyond
+the start of the buffer.
+* tests/test-parse-datetime.c (main): Add a test case written by
+Paul Eggert, which overwrites enough of the heap so that
+standard glibc will fail with "free(): invalid pointer"
+without the patch applied.
+Reported and analyzed at https://bugzilla.redhat.com/1444774
+
+Upstream-commit: 94e01571507835ff59dd8ce2a0b56a4b566965a4
+Signed-off-by: Kamil Dudka
+---
+ gnulib-tests/test-parse-datetime.c | 16 ++++++++++++++++
+ lib/time_rz.c | 15 +++++++++++++--
+ 2 files changed, 29 insertions(+), 2 deletions(-)
+
+diff --git a/gnulib-tests/test-parse-datetime.c b/gnulib-tests/test-parse-datetime.c
+index b42a51c..b6fe457 100644
+--- a/gnulib-tests/test-parse-datetime.c
++++ b/gnulib-tests/test-parse-datetime.c
+@@ -432,5 +432,21 @@ main (int argc _GL_UNUSED, char **argv)
+ ASSERT ( parse_datetime (&result, "TZ=\"\\\\\"", &now));
+ ASSERT ( parse_datetime (&result, "TZ=\"\\\"\"", &now));
+
++ /* Outlandishly-long time zone abbreviations should not cause problems. */
++ {
++ static char const bufprefix[] = "TZ=\"";
++ enum { tzname_len = 2000 };
++ static char const bufsuffix[] = "0\" 1970-01-01 01:02:03.123456789";
++ enum { bufsize = sizeof bufprefix - 1 + tzname_len + sizeof bufsuffix };
++ char buf[bufsize];
++ memcpy (buf, bufprefix, sizeof bufprefix - 1);
++ memset (buf + sizeof bufprefix - 1, 'X', tzname_len);
++ strcpy (buf + bufsize - sizeof bufsuffix, bufsuffix);
++ ASSERT (parse_datetime (&result, buf, &now));
++ LOG (buf, now, result);
++ ASSERT (result.tv_sec == 1 * 60 * 60 + 2 * 60 + 3
++ && result.tv_nsec == 123456789);
++ }
++
+ return 0;
+ }
+diff --git a/lib/time_rz.c b/lib/time_rz.c
+index adb9c1c..c41a8ef 100644
+--- a/lib/time_rz.c
++++ b/lib/time_rz.c
+@@ -27,6 +27,7 @@
+ #include