From 6bf8a8a76a1446f7278a392b5515488a68474192 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Thu, 8 Dec 2011 20:19:23 -0500 Subject: [PATCH] commit bash-20091029 snapshot --- COMPAT | 44 +++++++++++++++++++++++++++++++++++++------- CWRU/CWRU.chlog | 35 +++++++++++++++++++++++++++++++++++ MANIFEST | 1 + builtins/mapfile.def | 4 ++-- builtins/shopt.def | 3 +++ configure.in | 4 ++-- doc/bash.1 | 4 ++++ doc/bashref.texi | 3 +++ mailcheck.c | 4 ++-- shell.c | 2 +- support/shobj-conf | 6 +++--- test.c | 2 +- 12 files changed, 94 insertions(+), 18 deletions(-) diff --git a/COMPAT b/COMPAT index 63940e6d7..ec68c2faf 100644 --- a/COMPAT +++ b/COMPAT @@ -1,10 +1,12 @@ +Compatibility with previous versions +==================================== + This document details the incompatibilities between this version of bash, -bash-4.0, and the previous widely-available versions, bash-1.14 (which is -still the `standard' version for a few Linux distributions) and bash-2.x. +bash-4.1, and the previous widely-available versions, bash-2.x (which is +still the `standard' version for a few Linux distributions) and bash-3.x. These were discovered by users of bash-2.x and 3.x, so this list is not comprehensive. Some of these incompatibilities occur between the current -version and versions 2.0 and above. (The differences between bash-1.14 and -bash-2.0 were significant.) +version and versions 2.0 and above. 1. Bash uses a new quoting syntax, $"...", to do locale-specific string translation. Users who have relied on the (undocumented) @@ -277,7 +279,8 @@ bash-2.0 were significant.) than a regular expression. 34. Bash-4.0 allows the behavior in the previous item to be modified using - the notion of a shell `compatibility level'. + the notion of a shell `compatibility level'. If the compat31 shopt + option is set, quoting the pattern has no special effect. 35. Bash-3.2 (patched) and Bash-4.0 fix a bug that leaves the shell in an inconsistent internal state following an assignment error. One of the @@ -311,7 +314,8 @@ bash-2.0 were significant.) 41. Beginning with bash-4.0, when one of the commands in a pipeline is killed by a SIGINT while executing a command list, the shell acts as if it - received the interrupt. + received the interrupt. This can be disabled by setting the compat31 or + compat32 shell options. 42. Bash-4.0 changes the handling of the set -e option so that the shell exits if a pipeline fails (and not just if the last command in the failing @@ -325,4 +329,30 @@ bash-2.0 were significant.) case. 44. Bash-4.1 uses the current locale when comparing strings using the < and - > operators to the `[[' command. + > operators to the `[[' command. This can be reverted to the previous + behavior by setting one of the `compatNN' shopt options. + +Shell Compatibility Level +========================= + +Bash-3.2 introduced the concept of a `shell compatibility level', specified +as a set of options to the shopt builtin (compat31, compat32, compat40 at +this writing). There is only one current compatibility level -- each +option is mutually exclusive. + +compat31 set + - the < and > operators to the [[ command do not consider the current + locale when comparing strings + +compat32 set + - the < and > operators to the [[ command do not consider the current + locale when comparing strings + - quoting the rhs of the regexp matching operator (=~) has no + special effect + +compat40 set + - the < and > operators to the [[ command do not consider the current + locale when comparing strings + - interrupting a command list such as "a ; b ; c" causes the execution + of the entire list to be aborted + diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index f06b996ce..0392f2406 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -9095,3 +9095,38 @@ lib/readline/complete.c - in insert_match, skip over a close quote in the replacement text if the character at point when completion is invoked is a single quote. Fixes complaint from bash-bugs@atu.cjb.net + + 10/26 + ----- +shell.c + - in main, make sure "$EMACS" is non-null before calling strstr on its + value. Fixes Red Hat bug 530911 submitted by Mitchell Berger + +builtins/mapfile.def + - don't save callback commands in shell history. Suggested by + Jan Schampera + +mailcheck.c + - in file_mod_date_changed, make sure the modification time is later + than the saved modification date, not just that it's not equal. + Fix from Evgeniy Dushistov + - in file_access_date_changed, make sure the access time is later + than the saved access time, not just that it's not equal + + 10/27 + ----- +builtins/shopt.def + - added new `compat40' compatibility variable, with associated changes + to shell_compatibility_level(), since the default compatibility level + is now 41 + +test.c + - make the < and > operators to [[ use strcoll() only if the shell + compatibility level is greater than 40 (it is 41 by default in + bash-4.1) + + 10/28 + ----- +support/shobj-conf + - decrease the default version of FreeBSD that creates shared libraries + to 4.x. Advice from Peter Jeremy diff --git a/MANIFEST b/MANIFEST index c8d5c2e15..e42d7d70e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -38,6 +38,7 @@ support d tests d tests/misc d ABOUT-NLS f +ChangeLog s CWRU/changelog CHANGES f COMPAT f COPYING f diff --git a/builtins/mapfile.def b/builtins/mapfile.def index bd71a14ef..0946de3ee 100644 --- a/builtins/mapfile.def +++ b/builtins/mapfile.def @@ -112,10 +112,10 @@ run_callback(callback, current_index) execlen += 2; execstr = xmalloc (execlen); - flags = 0; + flags = SEVAL_NOHIST; #if 0 if (interactive) - flags |= SEVAL_NOHIST|SEVAL_INTERACT; + flags |= SEVAL_INTERACT; #endif snprintf (execstr, execlen, "%s %d", callback, current_index); return parse_and_execute(execstr, NULL, flags); diff --git a/builtins/shopt.def b/builtins/shopt.def index 643558194..71a2b6e24 100644 --- a/builtins/shopt.def +++ b/builtins/shopt.def @@ -145,6 +145,7 @@ static struct { #endif { "compat31", &shopt_compat31, set_compatibility_level }, { "compat32", &shopt_compat32, set_compatibility_level }, + { "compat40", &shopt_compat40, set_compatibility_level }, #if defined (READLINE) { "dirspell", &dircomplete_spelling, (shopt_set_func_t *)NULL }, #endif @@ -502,6 +503,8 @@ set_compatibility_level (mode) shell_compatibility_level = 31; else if (shopt_compat32) shell_compatibility_level = 32; + else if (shopt_compat40) + shell_compatibility_level = 40; else shell_compatibility_level = DEFAULT_COMPAT_LEVEL; return 0; diff --git a/configure.in b/configure.in index 0d61ceb50..65864107b 100644 --- a/configure.in +++ b/configure.in @@ -21,10 +21,10 @@ dnl Process this file with autoconf to produce a configure script. # You should have received a copy of the GNU General Public License # along with this program. If not, see . -AC_REVISION([for Bash 4.1, version 4.015])dnl +AC_REVISION([for Bash 4.1, version 4.016])dnl define(bashvers, 4.1) -define(relstatus, alpha) +define(relstatus, beta) AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org]) diff --git a/doc/bash.1 b/doc/bash.1 index 0c3cdf95f..f124704d9 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -3820,6 +3820,10 @@ descriptor 0, 1, or 2, respectively, is checked. .PP Unless otherwise specified, primaries that operate on files follow symbolic links and operate on the target of the link, rather than the link itself. +.if t .sp 0.5 +.if n .sp 1 +When used with \fB[[\fP, The \fB<\fP and \fB>\fP operators sort +lexicographically using the current locale. .sp 1 .PD 0 .TP diff --git a/doc/bashref.texi b/doc/bashref.texi index e53a8163d..f36be6c9f 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -5716,6 +5716,9 @@ If the @var{file} argument to one of the primaries is one of @file{/dev/stdin}, @file{/dev/stdout}, or @file{/dev/stderr}, file descriptor 0, 1, or 2, respectively, is checked. +When used with @samp{[[}, The @samp{<} and @samp{>} operators sort +lexicographically using the current locale. + Unless otherwise specified, primaries that operate on files follow symbolic links and operate on the target of the link, rather than the link itself. diff --git a/mailcheck.c b/mailcheck.c index ed64bdfb3..bd95f0d6d 100644 --- a/mailcheck.c +++ b/mailcheck.c @@ -268,7 +268,7 @@ file_mod_date_changed (i) mtime = mailfiles[i]->mod_time; if ((mailstat (file, &finfo) == 0) && (finfo.st_size > 0)) - return (mtime != finfo.st_mtime); + return (mtime < finfo.st_mtime); if (finfo.st_size == 0 && mailfiles[i]->file_size > 0) UPDATE_MAIL_FILE (i, finfo); @@ -289,7 +289,7 @@ file_access_date_changed (i) atime = mailfiles[i]->access_time; if ((mailstat (file, &finfo) == 0) && (finfo.st_size > 0)) - return (atime != finfo.st_atime); + return (atime < finfo.st_atime); return (0); } diff --git a/shell.c b/shell.c index 6e650cea7..87feb1429 100644 --- a/shell.c +++ b/shell.c @@ -574,7 +574,7 @@ main (argc, argv, env) /* running_under_emacs == 2 for `eterm' */ running_under_emacs = (emacs != 0) || (term && STREQN (term, "emacs", 5)); - running_under_emacs += term && STREQN (term, "eterm", 5) && strstr (emacs, "term"); + running_under_emacs += term && STREQN (term, "eterm", 5) && emacs && strstr (emacs, "term"); if (running_under_emacs) gnu_error_format = 1; diff --git a/support/shobj-conf b/support/shobj-conf index 084a7414b..5a63e80aa 100644 --- a/support/shobj-conf +++ b/support/shobj-conf @@ -128,7 +128,7 @@ freebsd2*) ;; # FreeBSD-3.x ELF -freebsd[3-6]*|freebsdelf[3-6]*|freebsdaout[3-6]*|dragonfly*) +freebsd3*|freebsdaout*) SHOBJ_CFLAGS=-fPIC SHOBJ_LD='${CC}' @@ -145,8 +145,8 @@ freebsd[3-6]*|freebsdelf[3-6]*|freebsdaout[3-6]*|dragonfly*) fi ;; -# FreeBSD-7.x and later have only ELF -freebsd[7-9]*|freebsdelf[7-9]*) +# FreeBSD-4.x and later have only ELF +freebsd[4-9]*|freebsdelf*|dragonfly*) SHOBJ_CFLAGS=-fPIC SHOBJ_LD='${CC}' diff --git a/test.c b/test.c index 206c9cf5e..180940c9c 100644 --- a/test.c +++ b/test.c @@ -378,7 +378,7 @@ binary_test (op, arg1, arg2, flags) return (patmatch ? patcomp (arg1, arg2, EQ) : STREQ (arg1, arg2)); else if ((op[0] == '>' || op[0] == '<') && op[1] == '\0') { - if (flags & TEST_LOCALE) + if (shell_compatibility_level > 40 && flags & TEST_LOCALE) return ((op[0] == '>') ? (strcoll (arg1, arg2) > 0) : (strcoll (arg1, arg2) < 0)); else return ((op[0] == '>') ? (strcmp (arg1, arg2) > 0) : (strcmp (arg1, arg2) < 0)); -- 2.47.3