This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 3.x development tree".
The branch, master has been updated via 2f875d48377bed73e2f198b2f3f26d07f844666b (commit) via f2f0d669613632138aef186c6ec8d2be11efc41b (commit) via 9cbb2d8059fbdca4d90199684cc6bfc005ae99b4 (commit) via cbaab2907d4fba0e6221f88fc6625b033e35404a (commit) via cefc1a9b6602e7c9b505ddd6cd090b6616f8f32d (commit) via e8da1929e042ff98bf281f0ea10c6ff985e5e03f (commit) via 6d9201b0baf043238b9767093f5a48e0caefe205 (commit) via cb0c82aaa565dc134014aec898c706ea6ad2410a (commit) from 65e52362543425464bab0e1fd695e4a3cb0e89ac (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 2f875d48377bed73e2f198b2f3f26d07f844666b Author: Stefan Schantl stefan.schantl@ipfire.org Date: Sat Jun 22 12:19:49 2019 +0200
curl: Update to 7.65.1
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Michael Tremer michael.tremer@ipfire.org
commit f2f0d669613632138aef186c6ec8d2be11efc41b Author: Arne Fitzenreiter arne_f@ipfire.org Date: Sat Jun 22 11:16:52 2019 +0100
intel-microcode: add new package
Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org Signed-off-by: Michael Tremer michael.tremer@ipfire.org
commit 9cbb2d8059fbdca4d90199684cc6bfc005ae99b4 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Sat Jun 22 12:20:22 2019 +0200
openssh: Update to 8.0p1
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Michael Tremer michael.tremer@ipfire.org
commit cbaab2907d4fba0e6221f88fc6625b033e35404a Author: Stefan Schantl stefan.schantl@ipfire.org Date: Fri Jun 21 23:11:32 2019 +0200
systemd: Enable libseccomp support
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Michael Tremer michael.tremer@ipfire.org
commit cefc1a9b6602e7c9b505ddd6cd090b6616f8f32d Author: Stefan Schantl stefan.schantl@ipfire.org Date: Fri Jun 21 23:11:31 2019 +0200
systemd: Drop systemd-units package.
* Rework build process to use meson and ninja macros.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Michael Tremer michael.tremer@ipfire.org
commit e8da1929e042ff98bf281f0ea10c6ff985e5e03f Author: Stefan Schantl stefan.schantl@ipfire.org Date: Fri Jun 21 23:02:42 2019 +0200
coreutils: Update to 8.31
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Michael Tremer michael.tremer@ipfire.org
commit 6d9201b0baf043238b9767093f5a48e0caefe205 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Fri Jun 21 23:01:58 2019 +0200
bash: Update to 5.0
This is a major update to the latest version of bash.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Michael Tremer michael.tremer@ipfire.org
commit cb0c82aaa565dc134014aec898c706ea6ad2410a Author: Stefan Schantl stefan.schantl@ipfire.org Date: Fri Jun 21 23:01:05 2019 +0200
bash-completion: Remove file for rfkill.
This is now shipped by util-linux.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Michael Tremer michael.tremer@ipfire.org
-----------------------------------------------------------------------
Summary of changes: bash-completion/bash-completion.nm | 6 +- bash/bash.nm | 2 +- bash/patches/bash-2.05b-xcc.patch | 19 - bash/patches/bash-4.3-noecho.patch | 31 +- bash/patches/bash-5.0-patch-1.patch | 150 ++++ bash/patches/bash-5.0-patch-2.patch | 96 +++ bash/patches/bash-5.0-patch-3.patch | 202 +++++ bash/patches/bash-5.0-patch-4.patch | 42 + bash/patches/bash-5.0-patch-5.patch | 102 +++ bash/patches/bash-5.0-patch-6.patch | 39 + bash/patches/bash-5.0-patch-7.patch | 51 ++ bash/patches/bash-requires.patch | 155 ++-- bash/patches/bash-tty-tests.patch | 41 +- coreutils/coreutils.nm | 8 +- coreutils/patches/coreutils-i18n-cut-old.patch | 565 ++++++++++++++ .../patches/coreutils-i18n-expand-unexpand.patch | 848 +++++++++++++++++++++ .../patches/coreutils-i18n-fix-unexpand.patch | 28 + .../coreutils-i18n-fix2-expand-unexpand.patch | 108 +++ .../patches/coreutils-i18n-fold-newline.patch | 80 ++ coreutils/patches/coreutils-i18n-sort-human.patch | 35 + .../patches/coreutils-i18n-un-expand-BOM.patch | 456 +++++++++++ coreutils/patches/coreutils-i18n.patch | 190 ++--- curl/curl.nm | 2 +- .../intel-microcode.nm | 25 +- openssh/openssh.nm | 2 +- systemd/systemd.nm | 62 +- 26 files changed, 3035 insertions(+), 310 deletions(-) delete mode 100644 bash/patches/bash-2.05b-xcc.patch create mode 100644 bash/patches/bash-5.0-patch-1.patch create mode 100644 bash/patches/bash-5.0-patch-2.patch create mode 100644 bash/patches/bash-5.0-patch-3.patch create mode 100644 bash/patches/bash-5.0-patch-4.patch create mode 100644 bash/patches/bash-5.0-patch-5.patch create mode 100644 bash/patches/bash-5.0-patch-6.patch create mode 100644 bash/patches/bash-5.0-patch-7.patch create mode 100644 coreutils/patches/coreutils-i18n-cut-old.patch create mode 100644 coreutils/patches/coreutils-i18n-expand-unexpand.patch create mode 100644 coreutils/patches/coreutils-i18n-fix-unexpand.patch create mode 100644 coreutils/patches/coreutils-i18n-fix2-expand-unexpand.patch create mode 100644 coreutils/patches/coreutils-i18n-fold-newline.patch create mode 100644 coreutils/patches/coreutils-i18n-sort-human.patch create mode 100644 coreutils/patches/coreutils-i18n-un-expand-BOM.patch copy linux-firmware/linux-firmware.nm => intel-microcode/intel-microcode.nm (50%)
Difference in files: diff --git a/bash-completion/bash-completion.nm b/bash-completion/bash-completion.nm index 867cbe669..f0c3f51f8 100644 --- a/bash-completion/bash-completion.nm +++ b/bash-completion/bash-completion.nm @@ -5,7 +5,7 @@
name = bash-completion version = 2.4 -release = 2 +release = 3 arch = noarch
groups = Development/Languages @@ -25,8 +25,8 @@ build install_cmds rm -rvf %{BUILDROOT}%{datadir}/bash-completion/completions/{cawsay,cowthink}
- # Drop files which are provided by util-linux >= 2.28 - rm -rvf %{BUILDROOT}%{datadir}/bash-completion/completions/{mount,umount} + # Drop files which are provided by util-linux >= 2.28 and 2.34 + rm -rvf %{BUILDROOT}%{datadir}/bash-completion/completions/{mount,umount,rfkill}
install -Dpm 644 %{DIR_SOURCE}/bash-completion-1.99-redefine_filedir.bash \ %{BUILDROOT}%{sysconfdir}/bash_completion.d/redefine_filedir diff --git a/bash/bash.nm b/bash/bash.nm index 0ca9d1560..4179d3add 100644 --- a/bash/bash.nm +++ b/bash/bash.nm @@ -4,7 +4,7 @@ ###############################################################################
name = bash -version = 4.4 +version = 5.0 release = 1
groups = System/Tools diff --git a/bash/patches/bash-2.05b-xcc.patch b/bash/patches/bash-2.05b-xcc.patch deleted file mode 100644 index ad4283260..000000000 --- a/bash/patches/bash-2.05b-xcc.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- bash-3.1/Makefile.in.xcc 2005-10-25 19:37:52.000000000 +0100 -+++ bash-3.1/Makefile.in 2005-12-23 16:11:09.000000000 +0000 -@@ -68,6 +68,7 @@ - ARFLAGS = @ARFLAGS@ - RANLIB = @RANLIB@ - SIZE = @SIZE@ -+STRIP = strip - - INSTALL = @INSTALL@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ -@@ -535,7 +536,7 @@ - @chmod a+rx bashbug - - strip: $(Program) .made -- strip $(Program) -+ $(STRIP) $(Program) - ls -l $(Program) - -$(SIZE) $(Program) - diff --git a/bash/patches/bash-4.3-noecho.patch b/bash/patches/bash-4.3-noecho.patch index 8a2842ac5..8adf36d93 100644 --- a/bash/patches/bash-4.3-noecho.patch +++ b/bash/patches/bash-4.3-noecho.patch @@ -1,25 +1,29 @@ ---- bash-4.3/parse.y 2014-05-29 14:46:09.545543384 +0200 -+++ bash-4.3/parse.y 2014-05-29 14:48:40.758626213 +0200 -@@ -3858,6 +3858,8 @@ xparse_dolparen (base, string, indp, fla +diff --git a/parse.y b/parse.y +index 07e6e3e..4cd373f 100644 +--- a/parse.y ++++ b/parse.y +@@ -4410,6 +4410,8 @@ xparse_dolparen (base, string, indp, flags) save_parser_state (&ps); save_input_line_state (&ls); orig_eof_token = shell_eof_token; + /* avoid echoing every substitution again */ + echo_input_at_read = 0; - - /*(*/ - parser_state |= PST_CMDSUBST|PST_EOFTOKEN; /* allow instant ')' */ /*(*/ ---- bash-4.3/subst.c 2014-05-29 16:04:35.802784549 +0200 -+++ bash-4.3/subst.c 2014-05-29 16:08:25.021942676 +0200 -@@ -7103,6 +7103,7 @@ param_expand (string, sindex, quoted, ex + #if defined (ALIAS) || defined (DPAREN_ARITHMETIC) + saved_pushed_strings = pushed_string_list; /* separate parsing context */ + pushed_string_list = (STRING_SAVER *)NULL; +diff --git a/subst.c b/subst.c +index 9559187..0c2caa6 100644 +--- a/subst.c ++++ b/subst.c +@@ -9145,6 +9145,7 @@ param_expand (string, sindex, quoted, expanded_something, WORD_LIST *list; WORD_DESC *tdesc, *ret; int tflag; + int old_echo_input;
+ /*itrace("param_expand: `%s' pflags = %d", string+*sindex, pflags);*/ zindex = *sindex; - c = string[++zindex]; -@@ -7401,6 +7402,9 @@ arithsub: +@@ -9514,6 +9515,9 @@ arithsub: }
comsub: @@ -29,7 +33,7 @@ if (pflags & PF_NOCOMSUB) /* we need zindex+1 because string[zindex] == RPAREN */ temp1 = substring (string, *sindex, zindex+1); -@@ -7413,6 +7417,7 @@ comsub: +@@ -9526,6 +9530,7 @@ comsub: } FREE (temp); temp = temp1; @@ -37,3 +41,6 @@ break;
/* Do POSIX.2d9-style arithmetic substitution. This will probably go +-- +2.17.2 + diff --git a/bash/patches/bash-5.0-patch-1.patch b/bash/patches/bash-5.0-patch-1.patch new file mode 100644 index 000000000..254fd9ee0 --- /dev/null +++ b/bash/patches/bash-5.0-patch-1.patch @@ -0,0 +1,150 @@ +From 4d2e315490b778707b3a3afdfc514d5083a97a11 Mon Sep 17 00:00:00 2001 +From: Chet Ramey chet.ramey@case.edu +Date: Fri, 18 Jan 2019 15:12:37 -0500 +Subject: [PATCH] Bash-5.0 patch 1: fix pathname expansion of directory names + containing backslashes + +--- + bashline.c | 62 +++++++++++++++++++++++++++++++++++++++++--- + lib/glob/glob_loop.c | 6 ----- + patchlevel.h | 2 +- + 3 files changed, 60 insertions(+), 10 deletions(-) + +diff --git a/bashline.c b/bashline.c +index 2846aabf..75e79f1a 100644 +--- a/bashline.c ++++ b/bashline.c +@@ -231,6 +231,7 @@ static int bash_possible_variable_completions __P((int, int)); + static int bash_complete_command __P((int, int)); + static int bash_possible_command_completions __P((int, int)); + ++static int completion_glob_pattern __P((char *)); + static char *glob_complete_word __P((const char *, int)); + static int bash_glob_completion_internal __P((int)); + static int bash_glob_complete_word __P((int, int)); +@@ -1741,7 +1742,7 @@ bash_default_completion (text, start, end, qc, compflags) + + /* This could be a globbing pattern, so try to expand it using pathname + expansion. */ +- if (!matches && glob_pattern_p (text)) ++ if (!matches && completion_glob_pattern ((char *)text)) + { + matches = rl_completion_matches (text, glob_complete_word); + /* A glob expression that matches more than one filename is problematic. +@@ -1850,7 +1851,7 @@ command_word_completion_function (hint_text, state) + glob_matches = (char **)NULL; + } + +- globpat = glob_pattern_p (hint_text); ++ globpat = completion_glob_pattern ((char *)hint_text); + + /* If this is an absolute program name, do not check it against + aliases, reserved words, functions or builtins. We must check +@@ -3713,6 +3714,61 @@ bash_complete_command_internal (what_to_do) + return bash_specific_completion (what_to_do, command_word_completion_function); + } + ++static int ++completion_glob_pattern (string) ++ char *string; ++{ ++ register int c; ++ char *send; ++ int open; ++ ++ DECLARE_MBSTATE; ++ ++ open = 0; ++ send = string + strlen (string); ++ ++ while (c = *string++) ++ { ++ switch (c) ++ { ++ case '?': ++ case '*': ++ return (1); ++ ++ case '[': ++ open++; ++ continue; ++ ++ case ']': ++ if (open) ++ return (1); ++ continue; ++ ++ case '+': ++ case '@': ++ case '!': ++ if (*string == '(') /*)*/ ++ return (1); ++ continue; ++ ++ case '\': ++ if (*string == 0) ++ return (0); ++ } ++ ++ /* Advance one fewer byte than an entire multibyte character to ++ account for the auto-increment in the loop above. */ ++#ifdef HANDLE_MULTIBYTE ++ string--; ++ ADVANCE_CHAR_P (string, send - string); ++ string++; ++#else ++ ADVANCE_CHAR_P (string, send - string); ++#endif ++ } ++ return (0); ++} ++ + static char *globtext; + static char *globorig; + +@@ -3877,7 +3933,7 @@ bash_vi_complete (count, key) + t = substring (rl_line_buffer, p, rl_point); + } + +- if (t && glob_pattern_p (t) == 0) ++ if (t && completion_glob_pattern (t) == 0) + rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */ + FREE (t); + +diff --git a/lib/glob/glob_loop.c b/lib/glob/glob_loop.c +index 5f319cc2..7d6ae211 100644 +--- a/lib/glob/glob_loop.c ++++ b/lib/glob/glob_loop.c +@@ -54,17 +54,11 @@ INTERNAL_GLOB_PATTERN_P (pattern) + continue; + + case L('\'): +-#if 0 + /* Don't let the pattern end in a backslash (GMATCH returns no match + if the pattern ends in a backslash anyway), but otherwise return 1, + since the matching engine uses backslash as an escape character + and it can be removed. */ + return (*p != L('\0')); +-#else +- /* The pattern may not end with a backslash. */ +- if (*p++ == L('\0')) +- return 0; +-#endif + } + + return 0; +diff --git a/patchlevel.h b/patchlevel.h +index 1cd7c96c..40db1a32 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 0 ++#define PATCHLEVEL 1 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.17.2 + diff --git a/bash/patches/bash-5.0-patch-2.patch b/bash/patches/bash-5.0-patch-2.patch new file mode 100644 index 000000000..b9858ae18 --- /dev/null +++ b/bash/patches/bash-5.0-patch-2.patch @@ -0,0 +1,96 @@ +From ddf3f643cb9b9a2ca8e6d996c605e4332204874c Mon Sep 17 00:00:00 2001 +From: Chet Ramey chet.ramey@case.edu +Date: Fri, 18 Jan 2019 15:13:57 -0500 +Subject: [PATCH] Bash-5.0 patch 2: fix expansion of aliases whose value ends + with an unquoted tab + +--- + parse.y | 5 ++++- + parser.h | 1 + + patchlevel.h | 2 +- + y.tab.c | 5 ++++- + 4 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/parse.y b/parse.y +index 3ff87bcc..07e6e3e4 100644 +--- a/parse.y ++++ b/parse.y +@@ -2557,12 +2557,14 @@ next_alias_char: + if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE && + pushed_string_list->flags != PSH_DPAREN && + (parser_state & PST_COMMENT) == 0 && ++ (parser_state & PST_ENDALIAS) == 0 && /* only once */ + shell_input_line_index > 0 && +- shell_input_line[shell_input_line_index-1] != ' ' && ++ shellblank (shell_input_line[shell_input_line_index-1]) == 0 && + shell_input_line[shell_input_line_index-1] != '\n' && + shellmeta (shell_input_line[shell_input_line_index-1]) == 0 && + (current_delimiter (dstack) != ''' && current_delimiter (dstack) != '"')) + { ++ parser_state |= PST_ENDALIAS; + return ' '; /* END_ALIAS */ + } + #endif +@@ -2571,6 +2573,7 @@ pop_alias: + /* This case works for PSH_DPAREN as well */ + if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE) + { ++ parser_state &= ~PST_ENDALIAS; + pop_string (); + uc = shell_input_line[shell_input_line_index]; + if (uc) +diff --git a/parser.h b/parser.h +index 54dd2c88..6d08915d 100644 +--- a/parser.h ++++ b/parser.h +@@ -47,6 +47,7 @@ + #define PST_REPARSE 0x040000 /* re-parsing in parse_string_to_word_list */ + #define PST_REDIRLIST 0x080000 /* parsing a list of redirections preceding a simple command name */ + #define PST_COMMENT 0x100000 /* parsing a shell comment; used by aliases */ ++#define PST_ENDALIAS 0x200000 /* just finished expanding and consuming an alias */ + + /* Definition of the delimiter stack. Needed by parse.y and bashhist.c. */ + struct dstack { +diff --git a/patchlevel.h b/patchlevel.h +index 40db1a32..a988d852 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 1 ++#define PATCHLEVEL 2 + + #endif /* _PATCHLEVEL_H_ */ +diff --git a/y.tab.c b/y.tab.c +index 1abe2c50..7efce3c8 100644 +--- a/y.tab.c ++++ b/y.tab.c +@@ -4873,12 +4873,14 @@ next_alias_char: + if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE && + pushed_string_list->flags != PSH_DPAREN && + (parser_state & PST_COMMENT) == 0 && ++ (parser_state & PST_ENDALIAS) == 0 && /* only once */ + shell_input_line_index > 0 && +- shell_input_line[shell_input_line_index-1] != ' ' && ++ shellblank (shell_input_line[shell_input_line_index-1]) == 0 && + shell_input_line[shell_input_line_index-1] != '\n' && + shellmeta (shell_input_line[shell_input_line_index-1]) == 0 && + (current_delimiter (dstack) != ''' && current_delimiter (dstack) != '"')) + { ++ parser_state |= PST_ENDALIAS; + return ' '; /* END_ALIAS */ + } + #endif +@@ -4887,6 +4889,7 @@ pop_alias: + /* This case works for PSH_DPAREN as well */ + if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE) + { ++ parser_state &= ~PST_ENDALIAS; + pop_string (); + uc = shell_input_line[shell_input_line_index]; + if (uc) +-- +2.17.2 + diff --git a/bash/patches/bash-5.0-patch-3.patch b/bash/patches/bash-5.0-patch-3.patch new file mode 100644 index 000000000..509f52efb --- /dev/null +++ b/bash/patches/bash-5.0-patch-3.patch @@ -0,0 +1,202 @@ +From fcf6ae7d069a64741e9484cf219d7fe95de9e796 Mon Sep 17 00:00:00 2001 +From: Chet Ramey chet.ramey@case.edu +Date: Tue, 19 Mar 2019 10:05:39 -0400 +Subject: [PATCH] Bash-5.0 patch 3: improvements when globbing directory names + containing backslashes + +--- + bashline.c | 2 +- + lib/glob/glob.c | 25 +++++++++++++++++++++---- + lib/glob/glob.h | 1 + + lib/glob/glob_loop.c | 23 ++++++++++++++++------- + patchlevel.h | 2 +- + pathexp.c | 16 ++++++++++++---- + 6 files changed, 52 insertions(+), 17 deletions(-) + +diff --git a/bashline.c b/bashline.c +index 75e79f1a..824ea9d9 100644 +--- a/bashline.c ++++ b/bashline.c +@@ -3752,7 +3752,7 @@ completion_glob_pattern (string) + continue; + + case '\': +- if (*string == 0) ++ if (*string++ == 0) + return (0); + } + +diff --git a/lib/glob/glob.c b/lib/glob/glob.c +index 22d90a5c..398253b5 100644 +--- a/lib/glob/glob.c ++++ b/lib/glob/glob.c +@@ -1061,7 +1061,7 @@ glob_filename (pathname, flags) + char *directory_name, *filename, *dname, *fn; + unsigned int directory_len; + int free_dirname; /* flag */ +- int dflags; ++ int dflags, hasglob; + + result = (char **) malloc (sizeof (char *)); + result_size = 1; +@@ -1110,9 +1110,12 @@ glob_filename (pathname, flags) + free_dirname = 1; + } + ++ hasglob = 0; + /* If directory_name contains globbing characters, then we +- have to expand the previous levels. Just recurse. */ +- if (directory_len > 0 && glob_pattern_p (directory_name)) ++ have to expand the previous levels. Just recurse. ++ If glob_pattern_p returns != [0,1] we have a pattern that has backslash ++ quotes but no unquoted glob pattern characters. We dequote it below. */ ++ if (directory_len > 0 && (hasglob = glob_pattern_p (directory_name)) == 1) + { + char **directories, *d, *p; + register unsigned int i; +@@ -1175,7 +1178,7 @@ glob_filename (pathname, flags) + if (d[directory_len - 1] == '/') + d[directory_len - 1] = '\0'; + +- directories = glob_filename (d, dflags); ++ directories = glob_filename (d, dflags|GX_RECURSE); + + if (free_dirname) + { +@@ -1332,6 +1335,20 @@ only_filename: + free (directory_name); + return (NULL); + } ++ /* If we have a directory name with quoted characters, and we are ++ being called recursively to glob the directory portion of a pathname, ++ we need to dequote the directory name before returning it so the ++ caller can read the directory */ ++ if (directory_len > 0 && hasglob == 2 && (flags & GX_RECURSE) != 0) ++ { ++ dequote_pathname (directory_name); ++ directory_len = strlen (directory_name); ++ } ++ ++ /* We could check whether or not the dequoted directory_name is a ++ directory and return it here, returning the original directory_name ++ if not, but we don't do that yet. I'm not sure it matters. */ ++ + /* Handle GX_MARKDIRS here. */ + result[0] = (char *) malloc (directory_len + 1); + if (result[0] == NULL) +diff --git a/lib/glob/glob.h b/lib/glob/glob.h +index b9462333..56ac08ba 100644 +--- a/lib/glob/glob.h ++++ b/lib/glob/glob.h +@@ -30,6 +30,7 @@ + #define GX_NULLDIR 0x100 /* internal -- no directory preceding pattern */ + #define GX_ADDCURDIR 0x200 /* internal -- add passed directory name */ + #define GX_GLOBSTAR 0x400 /* turn on special handling of ** */ ++#define GX_RECURSE 0x800 /* internal -- glob_filename called recursively */ + + extern int glob_pattern_p __P((const char *)); + extern char **glob_vector __P((char *, char *, int)); +diff --git a/lib/glob/glob_loop.c b/lib/glob/glob_loop.c +index 7d6ae211..3a4f4f1e 100644 +--- a/lib/glob/glob_loop.c ++++ b/lib/glob/glob_loop.c +@@ -26,10 +26,10 @@ INTERNAL_GLOB_PATTERN_P (pattern) + { + register const GCHAR *p; + register GCHAR c; +- int bopen; ++ int bopen, bsquote; + + p = pattern; +- bopen = 0; ++ bopen = bsquote = 0; + + while ((c = *p++) != L('\0')) + switch (c) +@@ -55,13 +55,22 @@ INTERNAL_GLOB_PATTERN_P (pattern) + + case L('\'): + /* Don't let the pattern end in a backslash (GMATCH returns no match +- if the pattern ends in a backslash anyway), but otherwise return 1, +- since the matching engine uses backslash as an escape character +- and it can be removed. */ +- return (*p != L('\0')); ++ if the pattern ends in a backslash anyway), but otherwise note that ++ we have seen this, since the matching engine uses backslash as an ++ escape character and it can be removed. We return 2 later if we ++ have seen only backslash-escaped characters, so interested callers ++ know they can shortcut and just dequote the pathname. */ ++ if (*p != L('\0')) ++ { ++ p++; ++ bsquote = 1; ++ continue; ++ } ++ else /* (*p == L('\0')) */ ++ return 0; + } + +- return 0; ++ return bsquote ? 2 : 0; + } + + #undef INTERNAL_GLOB_PATTERN_P +diff --git a/patchlevel.h b/patchlevel.h +index a988d852..e7e960c1 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 2 ++#define PATCHLEVEL 3 + + #endif /* _PATCHLEVEL_H_ */ +diff --git a/pathexp.c b/pathexp.c +index b51729a7..c1bf2d89 100644 +--- a/pathexp.c ++++ b/pathexp.c +@@ -65,11 +65,11 @@ unquoted_glob_pattern_p (string) + { + register int c; + char *send; +- int open; ++ int open, bsquote; + + DECLARE_MBSTATE; + +- open = 0; ++ open = bsquote = 0; + send = string + strlen (string); + + while (c = *string++) +@@ -100,7 +100,14 @@ unquoted_glob_pattern_p (string) + can be removed by the matching engine, so we have to run it through + globbing. */ + case '\': +- return (*string != 0); ++ if (*string != '\0' && *string != '/') ++ { ++ bsquote = 1; ++ string++; ++ continue; ++ } ++ else if (*string == 0) ++ return (0); + + case CTLESC: + if (*string++ == '\0') +@@ -117,7 +124,8 @@ unquoted_glob_pattern_p (string) + ADVANCE_CHAR_P (string, send - string); + #endif + } +- return (0); ++ ++ return (bsquote ? 2 : 0); + } + + /* Return 1 if C is a character that is `special' in a POSIX ERE and needs to +-- +2.17.2 + diff --git a/bash/patches/bash-5.0-patch-4.patch b/bash/patches/bash-5.0-patch-4.patch new file mode 100644 index 000000000..899383312 --- /dev/null +++ b/bash/patches/bash-5.0-patch-4.patch @@ -0,0 +1,42 @@ +From 16c907aa3bb427618733e5a6f2f4e2fc5a3488d3 Mon Sep 17 00:00:00 2001 +From: Chet Ramey chet.ramey@case.edu +Date: Sat, 20 Apr 2019 14:24:28 -0400 +Subject: [PATCH] Bash-5.0 patch 4: the wait builtin without arguments only + waits for known children the shell started + +--- + jobs.c | 4 +--- + patchlevel.h | 2 +- + 2 files changed, 2 insertions(+), 4 deletions(-) + +diff --git a/jobs.c b/jobs.c +index ce2bdf24..ae3c54c6 100644 +--- a/jobs.c ++++ b/jobs.c +@@ -2488,10 +2488,8 @@ wait_for_background_pids () + r = wait_for (last_procsub_child->pid); + wait_procsubs (); + reap_procsubs (); +-#if 1 ++#if 0 + /* We don't want to wait indefinitely if we have stopped children. */ +- /* XXX - should add a loop that goes through the list of process +- substitutions and waits for each proc in turn before this code. */ + if (any_stopped == 0) + { + /* Check whether or not we have any unreaped children. */ +diff --git a/patchlevel.h b/patchlevel.h +index e7e960c1..c059f0bd 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 3 ++#define PATCHLEVEL 4 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.17.2 + diff --git a/bash/patches/bash-5.0-patch-5.patch b/bash/patches/bash-5.0-patch-5.patch new file mode 100644 index 000000000..1fb4fafaf --- /dev/null +++ b/bash/patches/bash-5.0-patch-5.patch @@ -0,0 +1,102 @@ +From 41f5420db7a911fb0833be693205f4db41f05434 Mon Sep 17 00:00:00 2001 +From: Chet Ramey chet.ramey@case.edu +Date: Sat, 20 Apr 2019 14:25:52 -0400 +Subject: [PATCH] Bash-5.0 patch 5: prevent optimizing forks away too + aggressively + +--- + builtins/evalstring.c | 26 +++++++++++++++++++++++--- + command.h | 1 + + execute_cmd.c | 2 ++ + patchlevel.h | 2 +- + 4 files changed, 27 insertions(+), 4 deletions(-) + +diff --git a/builtins/evalstring.c b/builtins/evalstring.c +index 1496eeec..cadc9bc0 100644 +--- a/builtins/evalstring.c ++++ b/builtins/evalstring.c +@@ -100,12 +100,22 @@ should_suppress_fork (command) + ((command->flags & CMD_INVERT_RETURN) == 0)); + } + ++int ++can_optimize_connection (command) ++ COMMAND *command; ++{ ++ return (*bash_input.location.string == '\0' && ++ (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') && ++ command->value.Connection->second->type == cm_simple); ++} ++ + void + optimize_fork (command) + COMMAND *command; + { + if (command->type == cm_connection && +- (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR) && ++ (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') && ++ (command->value.Connection->second->flags & CMD_TRY_OPTIMIZING) && + should_suppress_fork (command->value.Connection->second)) + { + command->value.Connection->second->flags |= CMD_NO_FORK; +@@ -412,8 +422,18 @@ parse_and_execute (string, from_file, flags) + command->flags |= CMD_NO_FORK; + command->value.Simple->flags |= CMD_NO_FORK; + } +- else if (command->type == cm_connection) +- optimize_fork (command); ++ ++ /* Can't optimize forks out here execept for simple commands. ++ This knows that the parser sets up commands as left-side heavy ++ (&& and || are left-associative) and after the single parse, ++ if we are at the end of the command string, the last in a ++ series of connection commands is ++ command->value.Connection->second. */ ++ else if (command->type == cm_connection && can_optimize_connection (command)) ++ { ++ command->value.Connection->second->flags |= CMD_TRY_OPTIMIZING; ++ command->value.Connection->second->value.Simple->flags |= CMD_TRY_OPTIMIZING; ++ } + #endif /* ONESHOT */ + + /* See if this is a candidate for $( <file ). */ +diff --git a/command.h b/command.h +index 32495162..b9e9b669 100644 +--- a/command.h ++++ b/command.h +@@ -186,6 +186,7 @@ typedef struct element { + #define CMD_COPROC_SUBSHELL 0x1000 + #define CMD_LASTPIPE 0x2000 + #define CMD_STDPATH 0x4000 /* use standard path for command lookup */ ++#define CMD_TRY_OPTIMIZING 0x8000 /* try to optimize this simple command */ + + /* What a command looks like. */ + typedef struct command { +diff --git a/execute_cmd.c b/execute_cmd.c +index 8b3c83aa..f1d74bfe 100644 +--- a/execute_cmd.c ++++ b/execute_cmd.c +@@ -2767,6 +2767,8 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close) + ((command->value.Connection->connector == OR_OR) && + (exec_result != EXECUTION_SUCCESS))) + { ++ optimize_fork (command); ++ + second = command->value.Connection->second; + if (ignore_return && second) + second->flags |= CMD_IGNORE_RETURN; +diff --git a/patchlevel.h b/patchlevel.h +index c059f0bd..1bc098b8 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 4 ++#define PATCHLEVEL 5 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.17.2 + diff --git a/bash/patches/bash-5.0-patch-6.patch b/bash/patches/bash-5.0-patch-6.patch new file mode 100644 index 000000000..bfd84603b --- /dev/null +++ b/bash/patches/bash-5.0-patch-6.patch @@ -0,0 +1,39 @@ +From dfd2cc6ac5558e252af0a7cb829a9629bf782e17 Mon Sep 17 00:00:00 2001 +From: Chet Ramey chet.ramey@case.edu +Date: Sat, 20 Apr 2019 14:27:00 -0400 +Subject: [PATCH] Bash-5.0 patch 6: allow building with SYSLOG_HISTORY defined + without defining SYSLOG_SHOPT + +--- + builtins/shopt.def | 2 +- + patchlevel.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/builtins/shopt.def b/builtins/shopt.def +index f6dc6f97..1c485361 100644 +--- a/builtins/shopt.def ++++ b/builtins/shopt.def +@@ -122,7 +122,7 @@ extern int assoc_expand_once; + extern int array_expand_once; + #endif + +-#if defined (SYSLOG_HISTORY) && defined (SYSLOG_SHOPT) ++#if defined (SYSLOG_HISTORY) + extern int syslog_history; + #endif + +diff --git a/patchlevel.h b/patchlevel.h +index 1bc098b8..14bff9fc 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 5 ++#define PATCHLEVEL 6 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.17.2 + diff --git a/bash/patches/bash-5.0-patch-7.patch b/bash/patches/bash-5.0-patch-7.patch new file mode 100644 index 000000000..2a4315e71 --- /dev/null +++ b/bash/patches/bash-5.0-patch-7.patch @@ -0,0 +1,51 @@ +From 3ba697465bc74fab513a26dea700cc82e9f4724e Mon Sep 17 00:00:00 2001 +From: Chet Ramey chet.ramey@case.edu +Date: Sat, 20 Apr 2019 14:27:56 -0400 +Subject: [PATCH] Bash-5.0 patch 7: fix exec builtin leaving the terminal in + the wrong process group + +--- + jobs.c | 12 +++++------- + patchlevel.h | 2 +- + 2 files changed, 6 insertions(+), 8 deletions(-) + +diff --git a/jobs.c b/jobs.c +index ae3c54c6..6bc31dca 100644 +--- a/jobs.c ++++ b/jobs.c +@@ -4837,15 +4837,13 @@ void + end_job_control () + { + if (job_control) +- { +- terminate_stopped_jobs (); ++ terminate_stopped_jobs (); + +- if (original_pgrp >= 0) +- give_terminal_to (original_pgrp, 1); +- } ++ if (original_pgrp >= 0 && terminal_pgrp != original_pgrp) ++ give_terminal_to (original_pgrp, 1); + +- if (original_pgrp >= 0) +- setpgid (0, original_pgrp); ++ if (original_pgrp >= 0 && setpgid (0, original_pgrp) == 0) ++ shell_pgrp = original_pgrp; + } + + /* Restart job control by closing shell tty and reinitializing. This is +diff --git a/patchlevel.h b/patchlevel.h +index 14bff9fc..deb9c5b7 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 6 ++#define PATCHLEVEL 7 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.17.2 + diff --git a/bash/patches/bash-requires.patch b/bash/patches/bash-requires.patch index 888de173c..35670bd55 100644 --- a/bash/patches/bash-requires.patch +++ b/bash/patches/bash-requires.patch @@ -1,40 +1,32 @@ -commit efb0da0c0fee3e3ca21b21cd72f63cdfd7766d45 -Author: Michael Tremer michael.tremer@ipfire.org -Date: Sun Sep 18 14:12:44 2016 +0100 - - Implement --rpm-requires - - Signed-off-by: Michael Tremer michael.tremer@ipfire.org - diff --git a/builtins.h b/builtins.h -index 0cfea18..c0c6acc 100644 +index dac95fd..5b7e811 100644 --- a/builtins.h +++ b/builtins.h -@@ -42,6 +42,7 @@ +@@ -45,6 +45,7 @@ #define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */ #define POSIX_BUILTIN 0x20 /* This builtins is special in the Posix command search order. */ #define LOCALVAR_BUILTIN 0x40 /* This builtin creates local variables */ -+#define REQUIRES_BUILTIN 0x80 /* This builtin requires other files. */ ++#define REQUIRES_BUILTIN 0x80 /* This builtin requires other files. */
#define BASE_INDENT 4
diff --git a/builtins/mkbuiltins.c b/builtins/mkbuiltins.c -index 4f51201..69707ec 100644 +index 4f51201..91c25db 100644 --- a/builtins/mkbuiltins.c +++ b/builtins/mkbuiltins.c @@ -69,10 +69,15 @@ extern char *strcpy (); #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
/* Flag values that builtins can have. */ -+/* These flags are for the C code generator, ++/* These flags are for the C code generator, + the C which is produced (./builtin.c) -+ includes the flags definitions found ++ includes the flags definitions found + in ../builtins.h */ #define BUILTIN_FLAG_SPECIAL 0x01 #define BUILTIN_FLAG_ASSIGNMENT 0x02 #define BUILTIN_FLAG_LOCALVAR 0x04 #define BUILTIN_FLAG_POSIX_BUILTIN 0x08 -+#define BUILTIN_FLAG_REQUIRES 0x16 ++#define BUILTIN_FLAG_REQUIRES 0x10
#define BASE_INDENT 4
@@ -58,17 +50,16 @@ index 4f51201..69707ec 100644
#if !defined (HAVE_RENAME) static int rename (); -@@ -831,6 +844,9 @@ builtin_handler (self, defs, arg) +@@ -831,6 +844,8 @@ builtin_handler (self, defs, arg) new->flags |= BUILTIN_FLAG_LOCALVAR; if (is_posix_builtin (name)) new->flags |= BUILTIN_FLAG_POSIX_BUILTIN; + if (is_requires_builtin (name)) + new->flags |= BUILTIN_FLAG_REQUIRES; -+
array_add ((char *)new, defs->builtins); building_builtin = 1; -@@ -1250,12 +1266,13 @@ write_builtins (defs, structfile, externfile) +@@ -1250,12 +1265,13 @@ write_builtins (defs, structfile, externfile) else fprintf (structfile, "(sh_builtin_func_t *)0x0, ");
@@ -83,7 +74,7 @@ index 4f51201..69707ec 100644 document_name (builtin));
/* Don't translate short document summaries that are identical -@@ -1645,6 +1662,13 @@ is_posix_builtin (name) +@@ -1645,6 +1661,13 @@ is_posix_builtin (name) return (_find_in_table (name, posix_builtins)); }
@@ -98,15 +89,15 @@ index 4f51201..69707ec 100644 static int rename (from, to) diff --git a/doc/bash.1 b/doc/bash.1 -index 9a7a384..1c738bb 100644 +index d91f1fd..111a66d 100644 --- a/doc/bash.1 +++ b/doc/bash.1 -@@ -238,6 +238,14 @@ The shell becomes restricted (see +@@ -239,6 +239,14 @@ The shell becomes restricted (see .B "RESTRICTED SHELL" below). .TP +.B --rpm-requires -+Produce the list of files that are required for the ++Produce the list of files that are required for the +shell script to run. This implies '-n' and is subject +to the same limitations as compile time error checking checking; +Command substitutions, Conditional expressions and @@ -117,15 +108,15 @@ index 9a7a384..1c738bb 100644 Equivalent to \fB-v\fP. .TP diff --git a/doc/bashref.texi b/doc/bashref.texi -index c0f4a2f..8e30d4f 100644 +index d33cd57..6fc4d18 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi -@@ -6243,6 +6243,13 @@ standard. @xref{Bash POSIX Mode}, for a description of the Bash +@@ -6453,6 +6453,13 @@ standard. @xref{Bash POSIX Mode}, for a description of the Bash @item --restricted Make the shell a restricted shell (@pxref{The Restricted Shell}).
+@item --rpm-requires -+Produce the list of files that are required for the ++Produce the list of files that are required for the +shell script to run. This implies '-n' and is subject +to the same limitations as compile time error checking checking; +Command substitutions, Conditional expressions and @command{eval} @@ -135,31 +126,24 @@ index c0f4a2f..8e30d4f 100644 Equivalent to @option{-v}. Print shell input lines as they're read.
diff --git a/eval.c b/eval.c -index db863e7..5a5af32 100644 +index f02d6e4..76c1e8d 100644 --- a/eval.c +++ b/eval.c -@@ -56,6 +56,7 @@ extern int need_here_doc; - extern int current_command_number, current_command_line_count, line_number; - extern int expand_aliases; - extern char *ps0_prompt; -+extern int rpm_requires; - - #if defined (HAVE_POSIX_SIGNALS) - extern sigset_t top_level_mask; -@@ -148,7 +149,7 @@ reader_loop () +@@ -142,7 +142,8 @@ reader_loop ()
if (read_command () == 0) { - if (interactive_shell == 0 && read_but_dont_execute) ++ + if (interactive_shell == 0 && (read_but_dont_execute && !rpm_requires)) { last_command_exit_value = EXECUTION_SUCCESS; dispose_command (global_command); diff --git a/execute_cmd.c b/execute_cmd.c -index 2a3df6d..2e3fb0c 100644 +index 8b3c83a..4eae19c 100644 --- a/execute_cmd.c +++ b/execute_cmd.c -@@ -529,6 +529,8 @@ async_redirect_stdin () +@@ -538,6 +538,8 @@ async_redirect_stdin ()
#define DESCRIBE_PID(pid) do { if (interactive) describe_pid (pid); } while (0)
@@ -168,7 +152,7 @@ index 2a3df6d..2e3fb0c 100644 /* Execute the command passed in COMMAND, perhaps doing it asynchronously. COMMAND is exactly what read_command () places into GLOBAL_COMMAND. ASYNCHROUNOUS, if non-zero, says to do this command in the background. -@@ -561,7 +563,13 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, +@@ -569,7 +571,13 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
if (breaking || continuing) return (last_command_exit_value); @@ -178,14 +162,14 @@ index 2a3df6d..2e3fb0c 100644 + if (rpm_requires && command->type == cm_function_def) + return last_command_exit_value = + execute_intern_function (command->value.Function_def->name, -+ command->value.Function_def->command); ++ command->value.Function_def); + if (read_but_dont_execute) return (EXECUTION_SUCCESS);
QUIT; -@@ -5609,7 +5617,7 @@ execute_intern_function (name, funcdef) - - if (check_identifier (name, posixly_correct) == 0) +@@ -2813,7 +2821,7 @@ execute_for_command (for_command) + save_line_number = line_number; + if (check_identifier (for_command->name, 1) == 0) { - if (posixly_correct && interactive_shell == 0) + if (posixly_correct && interactive_shell == 0 && rpm_requires == 0) @@ -193,53 +177,24 @@ index 2a3df6d..2e3fb0c 100644 last_command_exit_value = EX_BADUSAGE; jump_to_top_level (ERREXIT); diff --git a/execute_cmd.h b/execute_cmd.h -index 62bec82..d42dc85 100644 +index dc2f15e..506fff4 100644 --- a/execute_cmd.h +++ b/execute_cmd.h -@@ -22,6 +22,8 @@ +@@ -22,6 +22,9 @@ #define _EXECUTE_CMD_H_
#include "stdc.h" +#include "variables.h" +#include "command.h" ++
#if defined (ARRAY_VARS) struct func_array_state diff --git a/make_cmd.c b/make_cmd.c -index b42e9ff..95ec723 100644 +index ecbbfd6..3d8bfa4 100644 --- a/make_cmd.c +++ b/make_cmd.c -@@ -42,11 +42,15 @@ - #include "flags.h" - #include "make_cmd.h" - #include "dispose_cmd.h" -+#include "execute_cmd.h" - #include "variables.h" - #include "subst.h" - #include "input.h" - #include "ocache.h" - #include "externs.h" -+#include "builtins.h" -+ -+#include "builtins/common.h" - - #if defined (JOB_CONTROL) - #include "jobs.h" -@@ -57,9 +61,13 @@ - extern int line_number, current_command_line_count, parser_state; - extern int last_command_exit_value; - extern int shell_initialized; -+extern int rpm_requires; - - int here_doc_first_line = 0; - -+static char *alphabet_set = "abcdefghijklmnopqrstuvwxyz" -+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -+ - /* Object caching */ - sh_obj_cache_t wdcache = {0, 0, 0}; - sh_obj_cache_t wlcache = {0, 0, 0}; -@@ -839,6 +847,27 @@ make_coproc_command (name, command) +@@ -828,6 +828,27 @@ make_coproc_command (name, command) return (make_command (cm_coproc, (SIMPLE_COM *)temp)); }
@@ -251,9 +206,9 @@ index b42e9ff..95ec723 100644 + if (strchr(filename, '$') || (filename[0] != '/' && strchr(filename, '/'))) + return; + -+ /* ++ /* + if the executable is called via variable substitution we can -+ not dermine what it is at compile time. ++ not dermine what it is at compile time. + + if the executable consists only of characters not in the + alphabet we do not consider it a dependency just an artifact @@ -267,7 +222,7 @@ index b42e9ff..95ec723 100644 /* Reverse the word list and redirection list in the simple command has just been parsed. It seems simpler to do this here the one time then by any other method that I can think of. */ -@@ -856,6 +885,27 @@ clean_simple_command (command) +@@ -845,6 +866,28 @@ clean_simple_command (command) REVERSE_LIST (command->value.Simple->redirects, REDIRECT *); }
@@ -291,15 +246,16 @@ index b42e9ff..95ec723 100644 + output_requirement (find_function(cmd0) ? "function" : "executable", cmd0); + } + } /*rpm_requires*/ ++ + parser_state &= ~PST_REDIRLIST; return (command); } diff --git a/shell.c b/shell.c -index 45b77f9..b43de50 100644 +index a2b2a55..c5d99b3 100644 --- a/shell.c +++ b/shell.c -@@ -201,6 +201,9 @@ int have_devfd = 0; +@@ -193,6 +193,9 @@ int have_devfd = 0; /* The name of the .(shell)rc file. */ static char *bashrc_file = DEFAULT_BASHRC;
@@ -309,7 +265,7 @@ index 45b77f9..b43de50 100644 /* Non-zero means to act more like the Bourne shell on startup. */ static int act_like_sh;
-@@ -264,6 +267,7 @@ static const struct { +@@ -259,6 +262,7 @@ static const struct { { "protected", Int, &protected_mode, (char **)0x0 }, #endif { "rcfile", Charp, (int *)0x0, &bashrc_file }, @@ -317,7 +273,7 @@ index 45b77f9..b43de50 100644 #if defined (RESTRICTED_SHELL) { "restricted", Int, &restricted, (char **)0x0 }, #endif -@@ -500,6 +504,12 @@ main (argc, argv, env) +@@ -496,6 +500,12 @@ main (argc, argv, env) if (dump_translatable_strings) read_but_dont_execute = 1;
@@ -330,3 +286,36 @@ index 45b77f9..b43de50 100644 if (running_setuid && privileged_mode == 0) disable_priv_mode ();
+diff --git a/shell.h b/shell.h +index 8072605..6c4149d 100644 +--- a/shell.h ++++ b/shell.h +@@ -34,12 +34,15 @@ + #include "maxpath.h" + #include "unwind_prot.h" + #include "dispose_cmd.h" ++#include "execute_cmd.h" + #include "make_cmd.h" + #include "ocache.h" + #include "subst.h" + #include "sig.h" + #include "pathnames.h" + #include "externs.h" ++#include "builtins.h" ++#include "builtins/common.h" + + extern int EOF_Reached; + +@@ -99,6 +102,9 @@ extern int interactive, interactive_shell; + extern int startup_state; + extern int reading_shell_script; + extern int shell_initialized; ++extern int rpm_requires; ++static char *alphabet_set = "abcdefghijklmnopqrstuvwxyz" ++ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + extern int bash_argv_initialized; + extern int subshell_environment; + extern int current_command_number; +-- +2.17.2 + diff --git a/bash/patches/bash-tty-tests.patch b/bash/patches/bash-tty-tests.patch index 984f1b40d..f9b653245 100644 --- a/bash/patches/bash-tty-tests.patch +++ b/bash/patches/bash-tty-tests.patch @@ -1,7 +1,8 @@ -diff -up bash-4.2-rc2/tests/exec.right.tty_tests bash-4.2-rc2/tests/exec.right ---- bash-4.2-rc2/tests/exec.right.tty_tests 2011-02-09 10:42:48.000000000 +0100 -+++ bash-4.2-rc2/tests/exec.right 2011-02-09 10:42:59.000000000 +0100 -@@ -50,7 +50,6 @@ this is ohio-state +diff --git a/tests/exec.right b/tests/exec.right +index 6075cc8..0b3f02c 100644 +--- a/tests/exec.right ++++ b/tests/exec.right +@@ -51,7 +51,6 @@ this is ohio-state 0 1 testb @@ -9,21 +10,23 @@ diff -up bash-4.2-rc2/tests/exec.right.tty_tests bash-4.2-rc2/tests/exec.right 1 1 1 -diff -up bash-4.2-rc2/tests/execscript.tty_tests bash-4.2-rc2/tests/execscript ---- bash-4.2-rc2/tests/execscript.tty_tests 2010-12-27 22:01:02.000000000 +0100 -+++ bash-4.2-rc2/tests/execscript 2011-02-09 10:42:34.000000000 +0100 -@@ -107,8 +107,6 @@ ${THIS_SH} ./exec6.sub +diff --git a/tests/execscript b/tests/execscript +index c1819de..9227a4a 100644 +--- a/tests/execscript ++++ b/tests/execscript +@@ -108,8 +108,6 @@ ${THIS_SH} ./exec6.sub # checks for properly deciding what constitutes an executable file ${THIS_SH} ./exec7.sub
--${THIS_SH} -i ./exec8.sub +-${THIS_SH} -i ${PWD}/exec8.sub - ${THIS_SH} ./exec9.sub
- true | `echo true` & -diff -up bash-4.2-rc2/tests/read.right.tty_tests bash-4.2-rc2/tests/read.right ---- bash-4.2-rc2/tests/read.right.tty_tests 2010-12-21 16:49:00.000000000 +0100 -+++ bash-4.2-rc2/tests/read.right 2011-02-09 10:42:34.000000000 +0100 + ${THIS_SH} ./exec10.sub +diff --git a/tests/read.right b/tests/read.right +index 73cb704..a92fe7f 100644 +--- a/tests/read.right ++++ b/tests/read.right @@ -33,14 +33,6 @@ a = abcdefg a = xyz a = -xyz 123- @@ -39,10 +42,11 @@ diff -up bash-4.2-rc2/tests/read.right.tty_tests bash-4.2-rc2/tests/read.right ./read3.sub: line 4: read: -1: invalid number abc ab -diff -up bash-4.2-rc2/tests/read.tests.tty_tests bash-4.2-rc2/tests/read.tests ---- bash-4.2-rc2/tests/read.tests.tty_tests 2008-09-06 19:09:11.000000000 +0200 -+++ bash-4.2-rc2/tests/read.tests 2011-02-09 10:42:34.000000000 +0100 -@@ -82,9 +82,6 @@ echo " foo" | { IFS=$':' ; read line; re +diff --git a/tests/read.tests b/tests/read.tests +index f67cd00..083f4a4 100644 +--- a/tests/read.tests ++++ b/tests/read.tests +@@ -82,9 +82,6 @@ echo " foo" | { IFS=$':' ; read line; recho "$line"; } # test read -d delim behavior ${THIS_SH} ./read1.sub
@@ -52,3 +56,6 @@ diff -up bash-4.2-rc2/tests/read.tests.tty_tests bash-4.2-rc2/tests/read.tests # test read -n nchars behavior ${THIS_SH} ./read3.sub
+-- +2.17.2 + diff --git a/coreutils/coreutils.nm b/coreutils/coreutils.nm index a85b6a872..026bc14da 100644 --- a/coreutils/coreutils.nm +++ b/coreutils/coreutils.nm @@ -4,7 +4,7 @@ ###############################################################################
name = coreutils -version = 8.30 +version = 8.31 release = 1
groups = System/Base @@ -23,7 +23,7 @@ sources = %{thisapp}.tar.xz build requires autoconf - automake + automake >= 1.15 e2fsprogs-devel gettext-devel gmp-devel @@ -43,6 +43,10 @@ build --enable-no-install-program=hostname,kill,uptime \ --with-tty-group
+ prepare_cmds + autoreconf -vfi + end + test make check RUN_VERY_EXPENSIVE_TESTS=yes || true end diff --git a/coreutils/patches/coreutils-i18n-cut-old.patch b/coreutils/patches/coreutils-i18n-cut-old.patch new file mode 100644 index 000000000..757ee0fbb --- /dev/null +++ b/coreutils/patches/coreutils-i18n-cut-old.patch @@ -0,0 +1,565 @@ +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 <assert.h> + #include <getopt.h> + #include <sys/types.h> ++ ++/* Get mbstate_t, mbrtowc(). */ ++#if HAVE_WCHAR_H ++# include <wchar.h> ++#endif + #include "system.h" + + #include "error.h" +@@ -38,6 +43,18 @@ + + #include "set-fields.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 ++# undef MB_LEN_MAX ++# define MB_LEN_MAX 16 ++#endif ++ ++/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ ++#if HAVE_MBRTOWC && defined mbstate_t ++# 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 "cut" + +@@ -54,6 +71,52 @@ + } \ + while (0) + ++/* Refill the buffer BUF to get a multibyte character. */ ++#define REFILL_BUFFER(BUF, BUFPOS, BUFLEN, STREAM) \ ++ do \ ++ { \ ++ if (BUFLEN < MB_LEN_MAX && !feof (STREAM) && !ferror (STREAM)) \ ++ { \ ++ memmove (BUF, BUFPOS, BUFLEN); \ ++ BUFLEN += fread (BUF + BUFLEN, sizeof(char), BUFSIZ, STREAM); \ ++ BUFPOS = BUF; \ ++ } \ ++ } \ ++ while (0) ++ ++/* Get wide character on BUFPOS. BUFPOS is not included after that. ++ If byte sequence is not valid as a character, CONVFAIL is true. Otherwise false. */ ++#define GET_NEXT_WC_FROM_BUFFER(WC, BUFPOS, BUFLEN, MBLENGTH, STATE, CONVFAIL) \ ++ do \ ++ { \ ++ mbstate_t state_bak; \ ++ \ ++ if (BUFLEN < 1) \ ++ { \ ++ WC = WEOF; \ ++ break; \ ++ } \ ++ \ ++ /* Get a wide character. */ \ ++ CONVFAIL = false; \ ++ state_bak = STATE; \ ++ MBLENGTH = mbrtowc ((wchar_t *)&WC, BUFPOS, BUFLEN, &STATE); \ ++ \ ++ switch (MBLENGTH) \ ++ { \ ++ case (size_t)-1: \ ++ case (size_t)-2: \ ++ CONVFAIL = true; \ ++ STATE = state_bak; \ ++ /* Fall througn. */ \ ++ \ ++ case 0: \ ++ MBLENGTH = 1; \ ++ break; \ ++ } \ ++ } \ ++ while (0) ++ + + /* Pointer inside RP. When checking if a byte or field is selected + by a finite range, we check if it is between CURRENT_RP.LO +@@ -61,6 +124,9 @@ + CURRENT_RP.HI then we make CURRENT_RP to point to the next range pair. */ + static struct field_range_pair *current_rp; + ++/* Length of the delimiter given as argument to -d. */ ++size_t delimlen; ++ + /* This buffer is used to support the semantics of the -s option + (or lack of same) when the specified field list includes (does + not include) the first field. In both of those cases, the entire +@@ -77,15 +143,25 @@ enum operating_mode + { + undefined_mode, + +- /* Output characters that are in the given bytes. */ ++ /* Output bytes that are at the given positions. */ + byte_mode, + ++ /* Output characters that are at the given positions. */ ++ character_mode, ++ + /* Output the given delimiter-separated fields. */ + field_mode + }; + + static enum operating_mode operating_mode; + ++/* If nonzero, when in byte mode, don't split multibyte characters. */ ++static int byte_mode_character_aware; ++ ++/* If nonzero, the function for single byte locale is work ++ if this program runs on multibyte locale. */ ++static int force_singlebyte_mode; ++ + /* If true do not output lines containing no delimiter characters. + Otherwise, all such lines are printed. This option is valid only + with field mode. */ +@@ -97,6 +173,9 @@ static bool complement; + + /* The delimiter character for field mode. */ + static unsigned char delim; ++#if HAVE_WCHAR_H ++static wchar_t wcdelim; ++#endif + + /* The delimiter for each line/record. */ + static unsigned char line_delim = '\n'; +@@ -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\ +- -n (ignored)\n\ ++ -n with -b: don't split multibyte characters\n\ + "), stdout); + fputs (_("\ + --complement complement the set of selected bytes, characters\n\ +@@ -280,6 +359,82 @@ cut_bytes (FILE *stream) + } + } + ++#if HAVE_MBRTOWC ++/* This function is in use for the following case. ++ ++ 1. Read from the stream STREAM, printing to standard output any selected ++ characters. ++ ++ 2. Read from stream STREAM, printing to standard output any selected bytes, ++ without splitting multibyte characters. */ ++ ++static void ++cut_characters_or_cut_bytes_no_split (FILE *stream) ++{ ++ uintmax_t idx; /* number of bytes or characters in the line so far. */ ++ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */ ++ char *bufpos; /* Next read position of BUF. */ ++ size_t buflen; /* The length of the byte sequence in buf. */ ++ wint_t wc; /* A gotten wide character. */ ++ size_t mblength; /* The byte size of a multibyte character which shows ++ as same character as WC. */ ++ mbstate_t state; /* State of the stream. */ ++ bool convfail = false; /* true, when conversion failed. Otherwise false. */ ++ /* Whether to begin printing delimiters between ranges for the current line. ++ Set after we've begun printing data corresponding to the first range. */ ++ bool print_delimiter = false; ++ ++ idx = 0; ++ buflen = 0; ++ bufpos = buf; ++ memset (&state, '\0', sizeof(mbstate_t)); ++ ++ current_rp = frp; ++ ++ while (1) ++ { ++ REFILL_BUFFER (buf, bufpos, buflen, stream); ++ ++ GET_NEXT_WC_FROM_BUFFER (wc, bufpos, buflen, mblength, state, convfail); ++ (void) convfail; /* ignore unused */ ++ ++ if (wc == WEOF) ++ { ++ if (idx > 0) ++ putchar (line_delim); ++ break; ++ } ++ else if (wc == line_delim) ++ { ++ putchar (line_delim); ++ idx = 0; ++ print_delimiter = false; ++ current_rp = frp; ++ } ++ else ++ { ++ next_item (&idx); ++ if (print_kth (idx)) ++ { ++ if (output_delimiter_specified) ++ { ++ if (print_delimiter && is_range_start_index (idx)) ++ { ++ fwrite (output_delimiter_string, sizeof (char), ++ output_delimiter_length, stdout); ++ } ++ print_delimiter = true; ++ } ++ fwrite (bufpos, mblength, sizeof(char), stdout); ++ } ++ } ++ ++ buflen -= mblength; ++ bufpos += mblength; ++ } ++} ++#endif ++ + /* Read from stream STREAM, printing to standard output any selected fields. */ + + static void +@@ -425,13 +580,211 @@ cut_fields (FILE *stream) + } + } + ++#if HAVE_MBRTOWC ++static void ++cut_fields_mb (FILE *stream) ++{ ++ int c; ++ uintmax_t field_idx; ++ int found_any_selected_field; ++ int buffer_first_field; ++ int empty_input; ++ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */ ++ char *bufpos; /* Next read position of BUF. */ ++ size_t buflen; /* The length of the byte sequence in buf. */ ++ wint_t wc = 0; /* A gotten wide character. */ ++ size_t mblength; /* The byte size of a multibyte character which shows ++ as same character as WC. */ ++ mbstate_t state; /* State of the stream. */ ++ bool convfail = false; /* true, when conversion failed. Otherwise false. */ ++ ++ current_rp = frp; ++ ++ found_any_selected_field = 0; ++ field_idx = 1; ++ bufpos = buf; ++ buflen = 0; ++ memset (&state, '\0', sizeof(mbstate_t)); ++ ++ c = getc (stream); ++ empty_input = (c == EOF); ++ if (c != EOF) ++ { ++ ungetc (c, stream); ++ wc = 0; ++ } ++ else ++ wc = WEOF; ++ ++ /* To support the semantics of the -s flag, we may have to buffer ++ all of the first field to determine whether it is `delimited.' ++ But that is unnecessary if all non-delimited lines must be printed ++ and the first field has been selected, or if non-delimited lines ++ must be suppressed and the first field has *not* been selected. ++ That is because a non-delimited line has exactly one field. */ ++ buffer_first_field = (suppress_non_delimited ^ !print_kth (1)); ++ ++ while (1) ++ { ++ if (field_idx == 1 && buffer_first_field) ++ { ++ int len = 0; ++ ++ while (1) ++ { ++ REFILL_BUFFER (buf, bufpos, buflen, stream); ++ ++ GET_NEXT_WC_FROM_BUFFER ++ (wc, bufpos, buflen, mblength, state, convfail); ++ ++ if (wc == WEOF) ++ break; ++ ++ field_1_buffer = xrealloc (field_1_buffer, len + mblength); ++ memcpy (field_1_buffer + len, bufpos, mblength); ++ len += mblength; ++ buflen -= mblength; ++ bufpos += mblength; ++ ++ if (!convfail && (wc == line_delim || wc == wcdelim)) ++ break; ++ } ++ ++ if (len <= 0 && wc == WEOF) ++ break; ++ ++ /* If the first field extends to the end of line (it is not ++ delimited) and we are printing all non-delimited lines, ++ print this one. */ ++ if (convfail || (!convfail && wc != wcdelim)) ++ { ++ if (suppress_non_delimited) ++ { ++ /* Empty. */ ++ } ++ else ++ { ++ fwrite (field_1_buffer, sizeof (char), len, stdout); ++ /* Make sure the output line is newline terminated. */ ++ if (convfail || (!convfail && wc != line_delim)) ++ putchar (line_delim); ++ } ++ continue; ++ } ++ ++ if (print_kth (1)) ++ { ++ /* Print the field, but not the trailing delimiter. */ ++ fwrite (field_1_buffer, sizeof (char), len - 1, stdout); ++ found_any_selected_field = 1; ++ } ++ next_item (&field_idx); ++ } ++ ++ if (wc != WEOF) ++ { ++ if (print_kth (field_idx)) ++ { ++ if (found_any_selected_field) ++ { ++ fwrite (output_delimiter_string, sizeof (char), ++ output_delimiter_length, stdout); ++ } ++ found_any_selected_field = 1; ++ } ++ ++ while (1) ++ { ++ REFILL_BUFFER (buf, bufpos, buflen, stream); ++ ++ GET_NEXT_WC_FROM_BUFFER ++ (wc, bufpos, buflen, mblength, state, convfail); ++ ++ if (wc == WEOF) ++ break; ++ else if (!convfail && (wc == wcdelim || wc == line_delim)) ++ { ++ buflen -= mblength; ++ bufpos += mblength; ++ break; ++ } ++ ++ if (print_kth (field_idx)) ++ fwrite (bufpos, mblength, sizeof(char), stdout); ++ ++ buflen -= mblength; ++ bufpos += mblength; ++ } ++ } ++ ++ if ((!convfail || wc == line_delim) && buflen < 1) ++ wc = WEOF; ++ ++ if (!convfail && wc == wcdelim) ++ next_item (&field_idx); ++ else if (wc == WEOF || (!convfail && wc == line_delim)) ++ { ++ if (found_any_selected_field ++ || (!empty_input && !(suppress_non_delimited && field_idx == 1))) ++ putchar (line_delim); ++ if (wc == WEOF) ++ break; ++ field_idx = 1; ++ current_rp = frp; ++ found_any_selected_field = 0; ++ } ++ } ++} ++#endif ++ + static void + cut_stream (FILE *stream) + { +- if (operating_mode == byte_mode) +- cut_bytes (stream); ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1 && !force_singlebyte_mode) ++ { ++ switch (operating_mode) ++ { ++ case byte_mode: ++ if (byte_mode_character_aware) ++ cut_characters_or_cut_bytes_no_split (stream); ++ else ++ cut_bytes (stream); ++ break; ++ ++ case character_mode: ++ cut_characters_or_cut_bytes_no_split (stream); ++ break; ++ ++ case field_mode: ++ if (delimlen == 1) ++ { ++ /* Check if we have utf8 multibyte locale, so we can use this ++ optimization because of uniqueness of characters, which is ++ not true for e.g. SJIS */ ++ char * loc = setlocale(LC_CTYPE, NULL); ++ if (loc && (strstr (loc, "UTF-8") || strstr (loc, "utf-8") || ++ strstr (loc, "UTF8") || strstr (loc, "utf8"))) ++ { ++ cut_fields (stream); ++ break; ++ } ++ } ++ cut_fields_mb (stream); ++ break; ++ ++ default: ++ abort (); ++ } ++ } + else +- cut_fields (stream); ++#endif ++ { ++ if (operating_mode == field_mode) ++ cut_fields (stream); ++ else ++ cut_bytes (stream); ++ } + } + + /* Process file FILE to standard output. +@@ -483,6 +836,7 @@ main (int argc, char **argv) + bool ok; + bool delim_specified = false; + char *spec_list_string IF_LINT ( = NULL); ++ char mbdelim[MB_LEN_MAX + 1]; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -505,7 +859,6 @@ main (int argc, char **argv) + switch (optc) + { + case 'b': +- case 'c': + /* Build the byte list. */ + if (operating_mode != undefined_mode) + FATAL_ERROR (_("only one type of list may be specified")); +@@ -513,6 +866,14 @@ main (int argc, char **argv) + spec_list_string = optarg; + break; + ++ case 'c': ++ /* Build the character list. */ ++ if (operating_mode != undefined_mode) ++ FATAL_ERROR (_("only one type of list may be specified")); ++ operating_mode = character_mode; ++ spec_list_string = optarg; ++ break; ++ + case 'f': + /* Build the field list. */ + if (operating_mode != undefined_mode) +@@ -524,10 +885,38 @@ main (int argc, char **argv) + case 'd': + /* New delimiter. */ + /* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */ +- if (optarg[0] != '\0' && optarg[1] != '\0') +- FATAL_ERROR (_("the delimiter must be a single character")); +- delim = optarg[0]; +- delim_specified = true; ++ { ++#if HAVE_MBRTOWC ++ if(MB_CUR_MAX > 1) ++ { ++ mbstate_t state; ++ ++ memset (&state, '\0', sizeof(mbstate_t)); ++ delimlen = mbrtowc (&wcdelim, optarg, strnlen(optarg, MB_LEN_MAX), &state); ++ ++ if (delimlen == (size_t)-1 || delimlen == (size_t)-2) ++ ++force_singlebyte_mode; ++ else ++ { ++ delimlen = (delimlen < 1) ? 1 : delimlen; ++ if (wcdelim != L'\0' && *(optarg + delimlen) != '\0') ++ FATAL_ERROR (_("the delimiter must be a single character")); ++ memcpy (mbdelim, optarg, delimlen); ++ mbdelim[delimlen] = '\0'; ++ if (delimlen == 1) ++ delim = *optarg; ++ } ++ } ++ ++ if (MB_CUR_MAX <= 1 || force_singlebyte_mode) ++#endif ++ { ++ if (optarg[0] != '\0' && optarg[1] != '\0') ++ FATAL_ERROR (_("the delimiter must be a single character")); ++ delim = (unsigned char) optarg[0]; ++ } ++ delim_specified = true; ++ } + break; + + case OUTPUT_DELIMITER_OPTION: +@@ -540,6 +929,7 @@ main (int argc, char **argv) + break; + + case 'n': ++ byte_mode_character_aware = 1; + break; + + case 's': +@@ -579,15 +969,34 @@ main (int argc, char **argv) + | (complement ? SETFLD_COMPLEMENT : 0) ); + + if (!delim_specified) +- delim = '\t'; ++ { ++ delim = '\t'; ++#ifdef HAVE_MBRTOWC ++ wcdelim = L'\t'; ++ mbdelim[0] = '\t'; ++ mbdelim[1] = '\0'; ++ delimlen = 1; ++#endif ++ } + + if (output_delimiter_string == NULL) + { +- static char dummy[2]; +- dummy[0] = delim; +- dummy[1] = '\0'; +- output_delimiter_string = dummy; +- output_delimiter_length = 1; ++#ifdef HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1 && !force_singlebyte_mode) ++ { ++ output_delimiter_string = xstrdup(mbdelim); ++ output_delimiter_length = delimlen; ++ } ++ ++ if (MB_CUR_MAX <= 1 || force_singlebyte_mode) ++#endif ++ { ++ static char dummy[2]; ++ dummy[0] = delim; ++ dummy[1] = '\0'; ++ output_delimiter_string = dummy; ++ output_delimiter_length = 1; ++ } + } + + if (optind == argc) diff --git a/coreutils/patches/coreutils-i18n-expand-unexpand.patch b/coreutils/patches/coreutils-i18n-expand-unexpand.patch new file mode 100644 index 000000000..b5f571f5f --- /dev/null +++ b/coreutils/patches/coreutils-i18n-expand-unexpand.patch @@ -0,0 +1,848 @@ +From e87ab5b991b08092a7e07af82b3ec822a8604151 Mon Sep 17 00:00:00 2001 +From: Ondrej Oprala ooprala@redhat.com +Date: Wed, 5 Aug 2015 09:15:09 +0200 +Subject: [PATCH] expand,unexpand: add multibyte support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* NEWS: Mention the changes. +* bootstrap.conf: Add mbfile to the list of modules. +* configure.ac: Properly initialize mbfile. +* src/expand.c (expand): Iterate over multibyte characters properly. +* src/unexpand.c (unexpand): Iterate over multibyte characters +properly. +* tests/local.mk: Add new tests. +* tests/{expand,unexpand}/mb.sh: New tests. + +Co-authored-by: Pádraig Brady pbrady@redhat.com +--- + bootstrap.conf | 1 + + configure.ac | 2 + + lib/mbfile.c | 3 + + lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++ + m4/mbfile.m4 | 14 +++ + src/expand.c | 43 +++++---- + src/unexpand.c | 54 +++++++---- + tests/expand/mb.sh | 98 ++++++++++++++++++++ + tests/local.mk | 2 + + tests/unexpand/mb.sh | 97 ++++++++++++++++++++ + 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 100755 tests/expand/mb.sh + create mode 100755 tests/unexpand/mb.sh + +diff --git a/bootstrap.conf b/bootstrap.conf +index 8a0ff31..a1c78b2 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -152,6 +152,7 @@ gnulib_modules=" + maintainer-makefile + malloc-gnu + manywarnings ++ mbfile + mbrlen + mbrtowc + mbsalign +diff --git a/configure.ac b/configure.ac +index 1e74b36..24c9725 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -427,6 +427,8 @@ fi + # I'm leaving it here for now. This whole thing needs to be modernized... + gl_WINSIZE_IN_PTEM + ++gl_MBFILE ++ + gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H + + if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \ +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 <config.h> ++#define MBFILE_INLINE _GL_EXTERN_INLINE ++#include "mbfile.h" +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. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see http://www.gnu.org/licenses/. */ ++ ++/* Written by Mitsuru Chinen mchinen@yamato.ibm.com ++ and Bruno Haible bruno@clisp.org. */ ++ ++/* The macros in this file implement multi-byte character input from a ++ stream. ++ ++ mb_file_t ++ is the type for multibyte character input stream, usable for variable ++ declarations. ++ ++ mbf_char_t ++ is the type for multibyte character or EOF, usable for variable ++ declarations. ++ ++ mbf_init (mbf, stream) ++ initializes the MB_FILE for reading from stream. ++ ++ mbf_getc (mbc, mbf) ++ reads the next multibyte character from mbf and stores it in mbc. ++ ++ mb_iseof (mbc) ++ returns true if mbc represents the EOF value. ++ ++ Here are the function prototypes of the macros. ++ ++ extern void mbf_init (mb_file_t mbf, FILE *stream); ++ extern void mbf_getc (mbf_char_t mbc, mb_file_t mbf); ++ extern bool mb_iseof (const mbf_char_t mbc); ++ */ ++ ++#ifndef _MBFILE_H ++#define _MBFILE_H 1 ++ ++#include <assert.h> ++#include <stdbool.h> ++#include <stdio.h> ++#include <string.h> ++ ++/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before ++ <wchar.h>. ++ BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before ++ <wchar.h>. */ ++#include <stdio.h> ++#include <time.h> ++#include <wchar.h> ++ ++#include "mbchar.h" ++ ++#ifndef _GL_INLINE_HEADER_BEGIN ++ #error "Please include config.h first." ++#endif ++_GL_INLINE_HEADER_BEGIN ++#ifndef MBFILE_INLINE ++# define MBFILE_INLINE _GL_INLINE ++#endif ++ ++struct mbfile_multi { ++ FILE *fp; ++ bool eof_seen; ++ bool have_pushback; ++ mbstate_t state; ++ unsigned int bufcount; ++ char buf[MBCHAR_BUF_SIZE]; ++ struct mbchar pushback; ++}; ++ ++MBFILE_INLINE void ++mbfile_multi_getc (struct mbchar *mbc, struct mbfile_multi *mbf) ++{ ++ size_t bytes; ++ ++ /* If EOF has already been seen, don't use getc. This matters if ++ mbf->fp is connected to an interactive tty. */ ++ if (mbf->eof_seen) ++ goto eof; ++ ++ /* Return character pushed back, if there is one. */ ++ if (mbf->have_pushback) ++ { ++ mb_copy (mbc, &mbf->pushback); ++ mbf->have_pushback = false; ++ return; ++ } ++ ++ /* Before using mbrtowc, we need at least one byte. */ ++ if (mbf->bufcount == 0) ++ { ++ int c = getc (mbf->fp); ++ if (c == EOF) ++ { ++ mbf->eof_seen = true; ++ goto eof; ++ } ++ mbf->buf[0] = (unsigned char) c; ++ mbf->bufcount++; ++ } ++ ++ /* Handle most ASCII characters quickly, without calling mbrtowc(). */ ++ if (mbf->bufcount == 1 && mbsinit (&mbf->state) && is_basic (mbf->buf[0])) ++ { ++ /* These characters are part of the basic character set. ISO C 99 ++ guarantees that their wide character code is identical to their ++ char code. */ ++ mbc->wc = mbc->buf[0] = mbf->buf[0]; ++ mbc->wc_valid = true; ++ mbc->ptr = &mbc->buf[0]; ++ mbc->bytes = 1; ++ mbf->bufcount = 0; ++ return; ++ } ++ ++ /* Use mbrtowc on an increasing number of bytes. Read only as many bytes ++ from mbf->fp as needed. This is needed to give reasonable interactive ++ behaviour when mbf->fp is connected to an interactive tty. */ ++ for (;;) ++ { ++ /* We don't know whether the 'mbrtowc' function updates the state when ++ it returns -2, - this is the ISO C 99 and glibc-2.2 behaviour - or ++ not - amended ANSI C, glibc-2.1 and Solaris 2.7 behaviour. We ++ don't have an autoconf test for this, yet. ++ The new behaviour would allow us to feed the bytes one by one into ++ mbrtowc. But the old behaviour forces us to feed all bytes since ++ the end of the last character into mbrtowc. Since we want to retry ++ with more bytes when mbrtowc returns -2, we must backup the state ++ before calling mbrtowc, because implementations with the new ++ behaviour will clobber it. */ ++ mbstate_t backup_state = mbf->state; ++ ++ bytes = mbrtowc (&mbc->wc, &mbf->buf[0], mbf->bufcount, &mbf->state); ++ ++ if (bytes == (size_t) -1) ++ { ++ /* An invalid multibyte sequence was encountered. */ ++ /* Return a single byte. */ ++ bytes = 1; ++ mbc->wc_valid = false; ++ break; ++ } ++ else if (bytes == (size_t) -2) ++ { ++ /* An incomplete multibyte character. */ ++ mbf->state = backup_state; ++ if (mbf->bufcount == MBCHAR_BUF_SIZE) ++ { ++ /* An overlong incomplete multibyte sequence was encountered. */ ++ /* Return a single byte. */ ++ bytes = 1; ++ mbc->wc_valid = false; ++ break; ++ } ++ else ++ { ++ /* Read one more byte and retry mbrtowc. */ ++ int c = getc (mbf->fp); ++ if (c == EOF) ++ { ++ /* An incomplete multibyte character at the end. */ ++ mbf->eof_seen = true; ++ bytes = mbf->bufcount; ++ mbc->wc_valid = false; ++ break; ++ } ++ mbf->buf[mbf->bufcount] = (unsigned char) c; ++ mbf->bufcount++; ++ } ++ } ++ else ++ { ++ if (bytes == 0) ++ { ++ /* A null wide character was encountered. */ ++ bytes = 1; ++ assert (mbf->buf[0] == '\0'); ++ assert (mbc->wc == 0); ++ } ++ mbc->wc_valid = true; ++ break; ++ } ++ } ++ ++ /* Return the multibyte sequence mbf->buf[0..bytes-1]. */ ++ mbc->ptr = &mbc->buf[0]; ++ memcpy (&mbc->buf[0], &mbf->buf[0], bytes); ++ mbc->bytes = bytes; ++ ++ mbf->bufcount -= bytes; ++ if (mbf->bufcount > 0) ++ { ++ /* It's not worth calling memmove() for so few bytes. */ ++ unsigned int count = mbf->bufcount; ++ char *p = &mbf->buf[0]; ++ ++ do ++ { ++ *p = *(p + bytes); ++ p++; ++ } ++ while (--count > 0); ++ } ++ return; ++ ++eof: ++ /* An mbchar_t with bytes == 0 is used to indicate EOF. */ ++ mbc->ptr = NULL; ++ mbc->bytes = 0; ++ mbc->wc_valid = false; ++ return; ++} ++ ++MBFILE_INLINE void ++mbfile_multi_ungetc (const struct mbchar *mbc, struct mbfile_multi *mbf) ++{ ++ mb_copy (&mbf->pushback, mbc); ++ mbf->have_pushback = true; ++} ++ ++typedef struct mbfile_multi mb_file_t; ++ ++typedef mbchar_t mbf_char_t; ++ ++#define mbf_init(mbf, stream) \ ++ ((mbf).fp = (stream), \ ++ (mbf).eof_seen = false, \ ++ (mbf).have_pushback = false, \ ++ memset (&(mbf).state, '\0', sizeof (mbstate_t)), \ ++ (mbf).bufcount = 0) ++ ++#define mbf_getc(mbc, mbf) mbfile_multi_getc (&(mbc), &(mbf)) ++ ++#define mbf_ungetc(mbc, mbf) mbfile_multi_ungetc (&(mbc), &(mbf)) ++ ++#define mb_iseof(mbc) ((mbc).bytes == 0) ++ ++#ifndef _GL_INLINE_HEADER_BEGIN ++ #error "Please include config.h first." ++#endif ++_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 <stdio.h> + #include <getopt.h> + #include <sys/types.h> ++ ++#include <mbfile.h> ++ + #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 <stdio.h> + #include <getopt.h> + #include <sys/types.h> ++ ++#include <mbfile.h> ++ + #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 http://www.gnu.org/licenses/. ++ ++. "${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 http://www.gnu.org/licenses/. ++ ++. "${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.7.4 + diff --git a/coreutils/patches/coreutils-i18n-fix-unexpand.patch b/coreutils/patches/coreutils-i18n-fix-unexpand.patch new file mode 100644 index 000000000..f0c347cd2 --- /dev/null +++ b/coreutils/patches/coreutils-i18n-fix-unexpand.patch @@ -0,0 +1,28 @@ +From 02424bfcd719bbaa695f4e1c3ef17ad91b0d23c0 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel lkundrak@v3.sk +Date: Thu, 28 Jan 2016 20:57:22 +0100 +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 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/patches/coreutils-i18n-fix2-expand-unexpand.patch b/coreutils/patches/coreutils-i18n-fix2-expand-unexpand.patch new file mode 100644 index 000000000..b34d7b74f --- /dev/null +++ b/coreutils/patches/coreutils-i18n-fix2-expand-unexpand.patch @@ -0,0 +1,108 @@ +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 + { +- 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 --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 + { +- 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 --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 + ++#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 --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 + ++ ++#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/patches/coreutils-i18n-fold-newline.patch b/coreutils/patches/coreutils-i18n-fold-newline.patch new file mode 100644 index 000000000..f7286efe0 --- /dev/null +++ b/coreutils/patches/coreutils-i18n-fold-newline.patch @@ -0,0 +1,80 @@ +From ff424639fe863cbd6963add1a79b97290c1606c6 Mon Sep 17 00:00:00 2001 +From: rpm-build <rpm-build> +Date: Fri, 3 Feb 2017 12:26:53 +0100 +Subject: [PATCH] fold.c: preserve new-lines in mutlibyte text + +--- + 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 +--- 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'\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; +- +- default: +- increment = wcwidth (wc); +- increment = (increment < 0) ? 0 : increment; +- } ++ default: ++ increment = wcwidth (wc); ++ increment = (increment < 0) ? 0 : increment; + } + } + +-- +2.7.4 + diff --git a/coreutils/patches/coreutils-i18n-sort-human.patch b/coreutils/patches/coreutils-i18n-sort-human.patch new file mode 100644 index 000000000..675249315 --- /dev/null +++ b/coreutils/patches/coreutils-i18n-sort-human.patch @@ -0,0 +1,35 @@ +From 3976ef5a20369d8b490907ab2cba2d617305a5e0 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka kdudka@redhat.com +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 +@@ -2304,12 +2304,10 @@ find_unit_order (char const *number) + <none/unknown> < 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/patches/coreutils-i18n-un-expand-BOM.patch b/coreutils/patches/coreutils-i18n-un-expand-BOM.patch new file mode 100644 index 000000000..6210ce7e8 --- /dev/null +++ b/coreutils/patches/coreutils-i18n-un-expand-BOM.patch @@ -0,0 +1,456 @@ +From 7a7c776a4e228d180e74614fd8c8afcad5d4bdf7 Mon Sep 17 00:00:00 2001 +From: Jakub Martisko jamartis@redhat.com +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 ++++ b/src/expand-common.c +@@ -19,6 +19,7 @@ + #include <assert.h> + #include <stdio.h> + #include <sys/types.h> ++#include <mbfile.h> + #include "system.h" + #include "die.h" + #include "error.h" +@@ -126,6 +127,119 @@ set_increment_size (uintmax_t tabval) + return ok; + } + ++extern 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;i<predef_locales_count;i++) ++ { ++ if (setlocale(LC_ALL,predef_locales[i])!=NULL) ++ { ++ break; ++ } ++ else if (i==predef_locales_count-1) ++ { ++ return 1; ++ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale")); ++ } ++ } ++ return 0; ++} ++ ++extern bool ++check_utf_locale(void) ++{ ++ char* locale = setlocale (LC_CTYPE , NULL); ++ if (locale == NULL) ++ { ++ return false; ++ } ++ else if (strcasestr(locale, "utf8") == NULL && strcasestr(locale, "utf-8") == NULL) ++ { ++ return false; ++ } ++ return true; ++} ++ ++extern bool ++check_bom(FILE* fp, mb_file_t *mbf) ++{ ++ int c; ++ ++ ++ c=fgetc(fp); ++ ++ /*test BOM header of the first file */ ++ mbf->bufcount=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 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. */ + 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; + ++extern int ++set_utf_locale (void); ++ ++extern bool ++check_utf_locale(void); ++ ++extern bool ++check_bom(FILE* fp, mb_file_t *mbf); ++ ++extern void ++print_bom(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 +@@ -103,11 +103,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) + { +@@ -132,6 +154,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 --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; ++ /* 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) + { +@@ -169,6 +189,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 --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 + ++ ++ ++#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 --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 ++ ++#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 +-- +2.9.3 + diff --git a/coreutils/patches/coreutils-i18n.patch b/coreutils/patches/coreutils-i18n.patch index d7cf59ce1..e3428d933 100644 --- a/coreutils/patches/coreutils-i18n.patch +++ b/coreutils/patches/coreutils-i18n.patch @@ -13,7 +13,6 @@ TODO: merge upstream 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 +++ @@ -23,9 +22,9 @@ TODO: merge upstream 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 + 17 files changed, 2430 insertions(+), 160 deletions(-) + create mode 100755 tests/i18n/sort.sh + create mode 100755 tests/misc/sort-mb-tests.sh
diff --git a/lib/linebuffer.h b/lib/linebuffer.h index 64181af..9b8fe5a 100644 @@ -315,7 +314,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 +671,7 @@ index 98b461c..9990f38 100644 + extract_field (line, ptr, lim - ptr); +} +#endif -+ ++ static void freeline (struct line *line) { @@ -845,7 +844,7 @@ index 98b461c..9990f38 100644 xfields (line);
if (prevline[which - 1]) -@@ -567,21 +807,28 @@ prfield (size_t n, struct line const *line) +@@ -563,21 +803,28 @@ prfield (size_t n, struct line const *line)
/* Output all the fields in line, other than the join field. */
@@ -877,7 +876,7 @@ index 98b461c..9990f38 100644 prfield (i, line); } } -@@ -592,7 +839,6 @@ static void +@@ -588,7 +835,6 @@ static void prjoin (struct line const *line1, struct line const *line2) { const struct outlist *outlist; @@ -885,7 +884,7 @@ index 98b461c..9990f38 100644 size_t field; struct line const *line;
-@@ -626,7 +872,7 @@ prjoin (struct line const *line1, struct line const *line2) +@@ -622,7 +868,7 @@ prjoin (struct line const *line1, struct line const *line2) o = o->next; if (o == NULL) break; @@ -894,7 +893,7 @@ index 98b461c..9990f38 100644 } putchar (eolchar); } -@@ -1104,20 +1350,43 @@ main (int argc, char **argv) +@@ -1099,20 +1345,43 @@ main (int argc, char **argv)
case 't': { @@ -1171,7 +1170,7 @@ index 26f221f..633f50e 100644 use_col_separator = true; if (optarg) separator_string (optarg); -@@ -1166,10 +1250,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err) +@@ -1165,10 +1249,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err) a number. */
static void @@ -1219,7 +1218,7 @@ index 26f221f..633f50e 100644 if (*arg) { long int tmp_long; -@@ -1191,6 +1310,11 @@ static void +@@ -1190,6 +1309,11 @@ static void init_parameters (int number_of_files) { int chars_used_by_number = 0; @@ -1231,7 +1230,7 @@ index 26f221f..633f50e 100644
lines_per_body = lines_per_page - lines_per_header - lines_per_footer; if (lines_per_body <= 0) -@@ -1228,7 +1352,7 @@ init_parameters (int number_of_files) +@@ -1227,7 +1351,7 @@ init_parameters (int number_of_files) else col_sep_string = column_separator;
@@ -1240,7 +1239,7 @@ index 26f221f..633f50e 100644 use_col_separator = true; } /* It's rather pointless to define a TAB separator with column -@@ -1258,11 +1382,11 @@ init_parameters (int number_of_files) +@@ -1257,11 +1381,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. */ @@ -1254,7 +1253,7 @@ index 26f221f..633f50e 100644
/* The number is part of the column width unless we are printing files in parallel. */ -@@ -1271,7 +1395,7 @@ init_parameters (int number_of_files) +@@ -1270,7 +1394,7 @@ init_parameters (int number_of_files) }
int sep_chars, useful_chars; @@ -1263,7 +1262,7 @@ index 26f221f..633f50e 100644 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) +@@ -1293,7 +1417,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); @@ -1272,7 +1271,7 @@ index 26f221f..633f50e 100644 }
/* Open the necessary files, -@@ -1402,7 +1526,7 @@ init_funcs (void) +@@ -1399,7 +1523,7 @@ init_funcs (void)
/* Enlarge p->start_position of first column to use the same form of padding_not_printed with all columns. */ @@ -1281,7 +1280,7 @@ index 26f221f..633f50e 100644
/* This loop takes care of all but the rightmost column. */
-@@ -1436,7 +1560,7 @@ init_funcs (void) +@@ -1433,7 +1557,7 @@ init_funcs (void) } else { @@ -1290,7 +1289,7 @@ index 26f221f..633f50e 100644 h_next = h + chars_per_column; } } -@@ -1727,9 +1851,9 @@ static void +@@ -1724,9 +1848,9 @@ static void align_column (COLUMN *p) { padding_not_printed = p->start_position; @@ -1302,7 +1301,7 @@ index 26f221f..633f50e 100644 padding_not_printed = ANYWHERE; }
-@@ -2004,13 +2128,13 @@ store_char (char c) +@@ -2001,13 +2125,13 @@ store_char (char c) /* May be too generous. */ buff = X2REALLOC (buff, &buff_allocated); } @@ -1318,7 +1317,7 @@ index 26f221f..633f50e 100644 char *s; int num_width;
-@@ -2027,22 +2151,24 @@ add_line_number (COLUMN *p) +@@ -2024,22 +2148,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. */ @@ -1347,7 +1346,7 @@ index 26f221f..633f50e 100644 output_position = POS_AFTER_TAB (chars_per_output_tab, output_position); } -@@ -2203,7 +2329,7 @@ print_white_space (void) +@@ -2198,7 +2324,7 @@ print_white_space (void) while (goal - h_old > 1 && (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal) { @@ -1356,7 +1355,7 @@ index 26f221f..633f50e 100644 h_old = h_new; } while (++h_old <= goal) -@@ -2223,6 +2349,7 @@ print_sep_string (void) +@@ -2218,6 +2344,7 @@ print_sep_string (void) { char const *s = col_sep_string; int l = col_sep_length; @@ -1364,7 +1363,7 @@ index 26f221f..633f50e 100644
if (separators_not_printed <= 0) { -@@ -2234,6 +2361,7 @@ print_sep_string (void) +@@ -2229,6 +2356,7 @@ print_sep_string (void) { for (; separators_not_printed > 0; --separators_not_printed) { @@ -1372,7 +1371,7 @@ index 26f221f..633f50e 100644 while (l-- > 0) { /* 3 types of sep_strings: spaces only, spaces and chars, -@@ -2247,12 +2375,15 @@ print_sep_string (void) +@@ -2242,12 +2370,15 @@ print_sep_string (void) } else { @@ -1389,7 +1388,7 @@ index 26f221f..633f50e 100644 /* sep_string ends with some spaces */ if (spaces_not_printed > 0) print_white_space (); -@@ -2280,7 +2411,7 @@ print_clump (COLUMN *p, int n, char *clump) +@@ -2275,7 +2406,7 @@ print_clump (COLUMN *p, int n, char *clump) required number of tabs and spaces. */
static void @@ -1398,7 +1397,7 @@ index 26f221f..633f50e 100644 { if (tabify_output) { -@@ -2304,6 +2435,74 @@ print_char (char c) +@@ -2299,6 +2430,74 @@ print_char (char c) putchar (c); }
@@ -1473,7 +1472,7 @@ index 26f221f..633f50e 100644 /* Skip to page PAGE before printing. PAGE may be larger than total number of pages. */
-@@ -2483,9 +2682,9 @@ read_line (COLUMN *p) +@@ -2476,9 +2675,9 @@ read_line (COLUMN *p) align_empty_cols = false; }
@@ -1485,8 +1484,8 @@ index 26f221f..633f50e 100644 padding_not_printed = ANYWHERE; }
-@@ -2555,7 +2754,7 @@ print_stored (COLUMN *p) - int i; +@@ -2547,7 +2746,7 @@ print_stored (COLUMN *p) + COLUMN *q;
int line = p->current_line++; - char *first = &buff[line_vector[line]]; @@ -1494,7 +1493,7 @@ index 26f221f..633f50e 100644 /* FIXME UMR: Uninitialized memory read: * This is occurring while in: -@@ -2567,7 +2766,7 @@ print_stored (COLUMN *p) +@@ -2559,7 +2758,7 @@ print_stored (COLUMN *p) xmalloc [xmalloc.c:94] init_store_cols [pr.c:1648] */ @@ -1503,7 +1502,7 @@ index 26f221f..633f50e 100644
pad_vertically = true;
-@@ -2586,9 +2785,9 @@ print_stored (COLUMN *p) +@@ -2579,9 +2778,9 @@ print_stored (COLUMN *p) } }
@@ -1515,7 +1514,7 @@ index 26f221f..633f50e 100644 padding_not_printed = ANYWHERE; }
-@@ -2601,8 +2800,8 @@ print_stored (COLUMN *p) +@@ -2594,8 +2793,8 @@ print_stored (COLUMN *p) if (spaces_not_printed == 0) { output_position = p->start_position + end_vector[line]; @@ -1526,7 +1525,7 @@ index 26f221f..633f50e 100644 }
return true; -@@ -2621,7 +2820,7 @@ print_stored (COLUMN *p) +@@ -2614,7 +2813,7 @@ print_stored (COLUMN *p) number of characters is 1.) */
static int @@ -1535,7 +1534,7 @@ index 26f221f..633f50e 100644 { unsigned char uc = c; char *s = clump_buff; -@@ -2631,10 +2830,10 @@ char_to_clump (char c) +@@ -2624,10 +2823,10 @@ char_to_clump (char c) int chars; int chars_per_c = 8;
@@ -1548,7 +1547,7 @@ index 26f221f..633f50e 100644 { width = TAB_WIDTH (chars_per_c, input_position);
-@@ -2715,6 +2914,164 @@ char_to_clump (char c) +@@ -2708,6 +2907,164 @@ char_to_clump (char c) return chars; }
@@ -1732,7 +1731,7 @@ index 6d2eec5..f189a0d 100644 #include "system.h" #include "argmatch.h" #include "die.h" -@@ -165,14 +173,39 @@ static int decimal_point; +@@ -161,14 +169,39 @@ static int decimal_point; /* Thousands separator; if -1, then there isn't one. */ static int thousands_sep;
@@ -1773,7 +1772,7 @@ index 6d2eec5..f189a0d 100644 /* The kind of blanks for '-b' to skip in various options. */ enum blanktype { bl_start, bl_end, bl_both };
-@@ -346,13 +379,11 @@ static bool reverse; +@@ -342,13 +375,11 @@ static bool reverse; they were read if all keys compare equal. */ static bool stable;
@@ -1790,7 +1789,7 @@ index 6d2eec5..f189a0d 100644
/* Flag to remove consecutive duplicate lines from the output. Only the last of a sequence of equal lines will be output. */ -@@ -811,6 +842,46 @@ reap_all (void) +@@ -806,6 +837,46 @@ reap_all (void) reap (-1); }
@@ -1837,7 +1836,7 @@ index 6d2eec5..f189a0d 100644 /* Clean up any remaining temporary files. */
static void -@@ -1255,7 +1326,7 @@ zaptemp (char const *name) +@@ -1274,7 +1345,7 @@ zaptemp (char const *name) free (node); }
@@ -1846,7 +1845,7 @@ index 6d2eec5..f189a0d 100644
static int struct_month_cmp (void const *m1, void const *m2) -@@ -1270,7 +1341,7 @@ struct_month_cmp (void const *m1, void const *m2) +@@ -1289,7 +1360,7 @@ struct_month_cmp (void const *m1, void const *m2) /* Initialize the character class tables. */
static void @@ -1855,7 +1854,7 @@ index 6d2eec5..f189a0d 100644 { size_t i;
-@@ -1282,7 +1353,7 @@ inittables (void) +@@ -1301,7 +1372,7 @@ inittables (void) fold_toupper[i] = toupper (i); }
@@ -1864,7 +1863,7 @@ index 6d2eec5..f189a0d 100644 /* If we're not in the "C" locale, read different names for months. */ if (hard_LC_TIME) { -@@ -1364,6 +1435,84 @@ specify_nmerge (int oi, char c, char const *s) +@@ -1383,6 +1454,84 @@ specify_nmerge (int oi, char c, char const *s) xstrtol_fatal (e, oi, c, long_options, s); }
@@ -1949,7 +1948,7 @@ index 6d2eec5..f189a0d 100644 /* Specify the amount of main memory to use when sorting. */ static void specify_sort_size (int oi, char c, char const *s) -@@ -1597,7 +1746,7 @@ buffer_linelim (struct buffer const *buf) +@@ -1614,7 +1763,7 @@ buffer_linelim (struct buffer const *buf) by KEY in LINE. */
static char * @@ -1958,7 +1957,7 @@ index 6d2eec5..f189a0d 100644 { char *ptr = line->text, *lim = ptr + line->length - 1; size_t sword = key->sword; -@@ -1606,10 +1755,10 @@ begfield (struct line const *line, struct keyfield const *key) +@@ -1623,10 +1772,10 @@ begfield (struct line const *line, struct keyfield const *key) /* The leading field separator itself is included in a field when -t is absent. */
@@ -1971,7 +1970,7 @@ index 6d2eec5..f189a0d 100644 ++ptr; if (ptr < lim) ++ptr; -@@ -1635,11 +1784,70 @@ begfield (struct line const *line, struct keyfield const *key) +@@ -1652,11 +1801,70 @@ begfield (struct line const *line, struct keyfield const *key) return ptr; }
@@ -2043,7 +2042,7 @@ index 6d2eec5..f189a0d 100644 { char *ptr = line->text, *lim = ptr + line->length - 1; size_t eword = key->eword, echar = key->echar; -@@ -1654,10 +1862,10 @@ limfield (struct line const *line, struct keyfield const *key) +@@ -1671,10 +1879,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. */ @@ -2056,7 +2055,7 @@ index 6d2eec5..f189a0d 100644 ++ptr; if (ptr < lim && (eword || echar)) ++ptr; -@@ -1703,10 +1911,10 @@ limfield (struct line const *line, struct keyfield const *key) +@@ -1720,10 +1928,10 @@ limfield (struct line const *line, struct keyfield const *key) */
/* Make LIM point to the end of (one byte past) the current field. */ @@ -2069,7 +2068,7 @@ index 6d2eec5..f189a0d 100644 if (newlim) lim = newlim; } -@@ -1737,6 +1945,130 @@ limfield (struct line const *line, struct keyfield const *key) +@@ -1754,6 +1962,130 @@ limfield (struct line const *line, struct keyfield const *key) return ptr; }
@@ -2200,7 +2199,7 @@ index 6d2eec5..f189a0d 100644 /* 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 -@@ -1823,8 +2155,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file) +@@ -1840,8 +2172,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file) else { if (key->skipsblanks) @@ -2225,7 +2224,7 @@ index 6d2eec5..f189a0d 100644 line->keybeg = line_start; } } -@@ -1974,7 +2320,7 @@ human_numcompare (char const *a, char const *b) +@@ -1991,7 +2337,7 @@ human_numcompare (char const *a, char const *b) hideously fast. */
static int @@ -2234,7 +2233,7 @@ index 6d2eec5..f189a0d 100644 { while (blanks[to_uchar (*a)]) a++; -@@ -1984,6 +2330,25 @@ numcompare (char const *a, char const *b) +@@ -2001,6 +2347,25 @@ numcompare (char const *a, char const *b) return strnumcmp (a, b, decimal_point, thousands_sep); }
@@ -2259,8 +2258,8 @@ index 6d2eec5..f189a0d 100644 + /* 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 -@@ -2034,7 +2399,7 @@ general_numcompare (char const *sa, char const *sb) + A and B before calling strtold. FIXME: remove this function if +@@ -2051,7 +2416,7 @@ general_numcompare (char const *sa, char const *sb) Return 0 if the name in S is not recognized. */
static int @@ -2269,7 +2268,7 @@ index 6d2eec5..f189a0d 100644 { size_t lo = 0; size_t hi = MONTHS_PER_YEAR; -@@ -2310,15 +2675,14 @@ debug_key (struct line const *line, struct keyfield const *key) +@@ -2327,15 +2692,14 @@ debug_key (struct line const *line, struct keyfield const *key) char saved = *lim; *lim = '\0';
@@ -2287,7 +2286,7 @@ index 6d2eec5..f189a0d 100644 else if (key->general_numeric) ignore_value (strtold (beg, &tighter_lim)); else if (key->numeric || key->human_numeric) -@@ -2452,7 +2816,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) +@@ -2469,7 +2833,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 */ @@ -2296,7 +2295,7 @@ index 6d2eec5..f189a0d 100644 && ((!key->skipsblanks && !implicit_skip) || (!key->skipsblanks && key->schar) || (!key->skipeblanks && key->echar))) -@@ -2510,11 +2874,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) +@@ -2527,11 +2891,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) error (0, 0, _("option '-r' only applies to last-resort comparison")); }
@@ -2385,7 +2384,7 @@ index 6d2eec5..f189a0d 100644 { struct keyfield *key = keylist;
-@@ -2599,7 +3039,7 @@ keycompare (struct line const *a, struct line const *b) +@@ -2616,7 +3056,7 @@ keycompare (struct line const *a, struct line const *b) else if (key->human_numeric) diff = human_numcompare (ta, tb); else if (key->month) @@ -2394,7 +2393,7 @@ index 6d2eec5..f189a0d 100644 else if (key->random) diff = compare_random (ta, tlena, tb, tlenb); else if (key->version) -@@ -2715,6 +3155,211 @@ keycompare (struct line const *a, struct line const *b) +@@ -2732,6 +3172,211 @@ keycompare (struct line const *a, struct line const *b) return key->reverse ? -diff : diff; }
@@ -2606,16 +2605,16 @@ index 6d2eec5..f189a0d 100644 /* Compare two lines A and B, returning negative, zero, or positive depending on whether A compares less than, equal to, or greater than B. */
-@@ -2742,7 +3387,7 @@ compare (struct line const *a, struct line const *b) +@@ -2759,7 +3404,7 @@ compare (struct line const *a, struct line const *b) diff = - NONZERO (blen); else if (blen == 0) diff = 1; - else if (hard_LC_COLLATE) + else if (hard_LC_COLLATE && !folding) { - /* Note xmemcoll0 is a performance enhancement as + /* xmemcoll0 is a performance enhancement as it will not unconditionally write '\0' after the -@@ -4139,6 +4784,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype) +@@ -4149,6 +4794,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype) break; case 'f': key->translate = fold_toupper; @@ -2623,7 +2622,7 @@ index 6d2eec5..f189a0d 100644 break; case 'g': key->general_numeric = true; -@@ -4218,7 +4864,7 @@ main (int argc, char **argv) +@@ -4228,7 +4874,7 @@ main (int argc, char **argv) initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE); @@ -2632,7 +2631,7 @@ index 6d2eec5..f189a0d 100644 hard_LC_TIME = hard_locale (LC_TIME); #endif
-@@ -4239,6 +4885,29 @@ main (int argc, char **argv) +@@ -4249,6 +4895,29 @@ main (int argc, char **argv) thousands_sep = -1; }
@@ -2662,7 +2661,7 @@ index 6d2eec5..f189a0d 100644 have_read_stdin = false; inittables ();
-@@ -4513,13 +5182,34 @@ main (int argc, char **argv) +@@ -4523,13 +5192,34 @@ main (int argc, char **argv)
case 't': { @@ -2701,7 +2700,7 @@ index 6d2eec5..f189a0d 100644 else { /* Provoke with 'sort -txx'. Complain about -@@ -4530,9 +5220,11 @@ main (int argc, char **argv) +@@ -4540,9 +5230,11 @@ main (int argc, char **argv) quote (optarg)); } } @@ -2715,7 +2714,7 @@ index 6d2eec5..f189a0d 100644 } break;
-@@ -4770,12 +5462,10 @@ main (int argc, char **argv) +@@ -4771,12 +5463,10 @@ main (int argc, char **argv) sort (files, nfiles, outfile, nthreads); }
@@ -2843,7 +2842,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 +2885,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 +2917,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 +2989,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); @@ -3118,7 +3118,7 @@ index 87a0c93..9f755d9 100644 skip_fields = 0; check_chars = SIZE_MAX; diff --git a/tests/i18n/sort.sh b/tests/i18n/sort.sh -new file mode 100644 +new file mode 100755 index 0000000..26c95de --- /dev/null +++ b/tests/i18n/sort.sh @@ -3156,7 +3156,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 = \ +@@ -368,6 +368,8 @@ all_tests = \ tests/misc/sort-discrim.sh \ tests/misc/sort-files0-from.pl \ tests/misc/sort-float.sh \ @@ -3165,32 +3165,6 @@ index 568944e..192f776 100644 tests/misc/sort-h-thousands-sep.sh \ tests/misc/sort-merge.pl \ tests/misc/sort-merge-fdlimit.sh \ -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; - --my $mb_locale = $ENV{LOCALE_FR_UTF8}; -+my $mb_locale; -+# uncommented enable multibyte paths -+$mb_locale = $ENV{LOCALE_FR_UTF8}; - ! defined $mb_locale || $mb_locale eq 'none' -- and $mb_locale = 'C'; -+ and $mb_locale = 'C'; - - my $prog = 'cut'; - my $try = "Try '$prog --help' for more information.\n"; -@@ -240,6 +242,7 @@ if ($mb_locale ne 'C') - my @new_t = @$t; - my $test_name = shift @new_t; - -+ next if ($test_name =~ "newline-[12][0-9]"); - push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; - } - push @Tests, @new; diff --git a/tests/misc/expand.pl b/tests/misc/expand.pl index 8a9cad1..9293e39 100755 --- a/tests/misc/expand.pl @@ -3211,7 +3185,7 @@ index 8a9cad1..9293e39 100755 my @Tests = ( ['t1', '--tabs=3', {IN=>"a\tb"}, {OUT=>"a b"}], -@@ -140,6 +149,8 @@ my @Tests = +@@ -168,6 +177,8 @@ my @Tests =
# Test errors @@ -3220,8 +3194,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"}], +@@ -184,6 +195,37 @@ my @Tests = + {ERR => "$prog: '/' specifier not at start of number: '/'\n"}], );
+if ($mb_locale ne 'C') @@ -3351,7 +3325,7 @@ index 4d399d8..07f2823 100755 my $delim = chr 0247; sub t_subst ($) { -@@ -329,8 +338,49 @@ foreach my $t (@tv) +@@ -333,8 +342,49 @@ foreach my $t (@tv) push @Tests, $new_ent; }
@@ -3402,7 +3376,7 @@ index 4d399d8..07f2823 100755 my $verbose = $ENV{VERBOSE};
diff --git a/tests/misc/sort-mb-tests.sh b/tests/misc/sort-mb-tests.sh -new file mode 100644 +new file mode 100755 index 0000000..11836ba --- /dev/null +++ b/tests/misc/sort-mb-tests.sh @@ -3533,7 +3507,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 +3546,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/curl/curl.nm b/curl/curl.nm index da7512e31..8ff369aed 100644 --- a/curl/curl.nm +++ b/curl/curl.nm @@ -4,7 +4,7 @@ ###############################################################################
name = curl -version = 7.64.1 +version = 7.65.1 release = 1
groups = Application/Internet diff --git a/intel-microcode/intel-microcode.nm b/intel-microcode/intel-microcode.nm new file mode 100644 index 000000000..1232a9311 --- /dev/null +++ b/intel-microcode/intel-microcode.nm @@ -0,0 +1,40 @@ +############################################################################### +# IPFire.org - An Open Source Firewall Solution # +# Copyright (C) - IPFire Development Team info@ipfire.org # +############################################################################### + +name = intel-microcode +version = 20190618 +release = 1 +arch = noarch +thisapp = microcode-%{version} + +maintainer = Arne Fitzenreiter arne.fitzenreiter@ipfire.org +groups = System/Libraries +url = https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/releases +license = Non-GPL +summary = Microcode update for Intel CPU's. + +description + intel-microcode provides some binaries that + are loaded into the Intel CPU at startup. +end + +source_dl = https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/ + +build + build + : # Nothing to do. + end + + DIR_APP = %{DIR_SRC}/Intel-Linux-Processor-Microcode-Data-Files-%{thisapp} + + install + mkdir -pv %{BUILDROOT}%{prefix}/lib/firmware + cp -prv intel-ucode %{BUILDROOT}%{prefix}/lib/firmware + end +end + +packages + package %{name} +end diff --git a/openssh/openssh.nm b/openssh/openssh.nm index cd5f32dad..0cb49bcbf 100644 --- a/openssh/openssh.nm +++ b/openssh/openssh.nm @@ -4,7 +4,7 @@ ###############################################################################
name = openssh -version = 7.5p1 +version = 8.0p1 release = 1
groups = Application/Internet diff --git a/systemd/systemd.nm b/systemd/systemd.nm index a1c3677d0..cd82ba000 100644 --- a/systemd/systemd.nm +++ b/systemd/systemd.nm @@ -5,7 +5,7 @@
name = systemd version = 242 -release = 2 +release = 4
maintainer = Stefan Schantl stefan.schantl@ipfire.org groups = System/Base @@ -52,15 +52,17 @@ build libblkid-devel libcap-devel libgcrypt-devel - libmount-devel - libuuid-devel + libmount-devel >= 2.34-2 + libseccomp-devel + libuuid-devel >= 2.34-2 m4 - meson - ninja >= 1.5 + meson >= 0.50.1 + ninja >= 1.9.0 pam-devel pciutils-devel python3-devel python3-lxml + setup >= 3.0-13 usbutils vala xz-devel @@ -95,10 +97,10 @@ build
build # Call meson and pass configure options. - meson --buildtype=plain %{configure_options} . build + %{meson} %{configure_options}
# Call ninja to start build - ninja -v %{PARALLELISMFLAGS} -C build + %{meson_build} end
test @@ -113,11 +115,8 @@ build end
install - # Export destdir. - export DESTDIR=%{BUILDROOT} - - # Call ninja to perform installation - ninja install -v %{PARALLELISMFLAGS} -C build + # Install systemd. + %{meson_install}
# Create folder in log to store the journal. mkdir -pv %{BUILDROOT}/var/log/journal @@ -242,7 +241,6 @@ packages python-dbus python-gobject3 %{name}-libs=%{thisver} - %{name}-units=%{thisver} util-linux>=2.19 end
@@ -269,6 +267,7 @@ packages
obsoletes udev < 183 + systemd-units <= 242 end
configfiles @@ -339,43 +338,6 @@ packages end end
- # Package information for systemd-units - package %{name}-units - summary = Configuration files, directories and installation tool for systemd. - description - This package contains all needed configuration files, directories - and installation / configuration tool for systemd. - end - - prerequires - /bin/sh - coreutils - end - - provides - /bin/systemctl - end - - conflicts - filesystem < 002 - end - - files - %{sysconfdir}/etc/systemd/system - %{sysconfdir}/tmpfiles.d - %{sysconfdir}/bash_completion.d/systemctl-bash-completion.sh - %{unitdir} - %{bindir}/systemctl - %{bindir}/systemd-tmpfiles - %{mandir}/man1/systemctl.* - end - - script postup - # Reload service files - /usr/bin/systemctl daemon-reload > /dev/null 2>&1 || : - end - end - package %{name}-libs template LIBS
hooks/post-receive -- IPFire 3.x development tree