diff --git a/assignment-preceding-builtin.patch b/assignment-preceding-builtin.patch deleted file mode 100644 index 72ac06d9..00000000 --- a/assignment-preceding-builtin.patch +++ /dev/null @@ -1,137 +0,0 @@ -From: Chet Ramey -Subject: Re: [bug-bash] bash-5.0: problem with variable scoping in posix-mode - -> > Description: -> > -> > There is a problem with variable scoping when variable is created from -> > assignment statement preceding function call in posix-mode. See an -> > example below. -> > -> > -> > Repeat-By: -> > -> > $ cat test.sh -> > #!/bin/sh -> > -> > myecho() { -> > echo $var -> > } -> > -> > foo() { -> > local var="foo: FAIL" -> > var="foo: bar" myecho -> > } -> > -> > foo -> > -> > $ bash test.sh -> > foo: bar -> > $ bash --posix test.sh -> > foo: FAIL -> -> This is a consequence of a combination of two POSIX features. First, POSIX -> requires assignment statements preceding special builtins to create global -> variables (POSIX has no local variables) that persist in the shell context -> after the special builtin completes. Second, POSIX requires* that -> assignment statements preceding function calls have the same variable- -> assignment behavior as special builtins. -> -> So the variable assignment preceding the function call creates a global -> variable, and the local variable is found before that global when `myecho' -> is executed according to the standard bash dynamic scoping rules. If you -> add an `echo $var' after the call to foo, you'll see this behavior. -> -> (*) The most recent version of the standard has removed this requirement -> for shell functions, and I will change that behavior for the next release -> of bash. Until then, the old behavior persists. - -This behavior is not quite backwards-compatible with bash-4.4. Here is a -patch that implements a portion of the proposed bash-5.1 behavior. It -changes the variable assignment semantics so that variable assignments -preceding builtins and shell functions act more like standalone assignment -statements and modify the "current execution environment" (in POSIX terms) -instead of unconditionally modifying the global variable scope. - -This means that assignments preceding shell functions and special builtins -will modify existing local variables and modifications to local variables -will not propagate to the calling environment, and will create global -variables if there is not an existing local variable with that name. This -is compatible with other POSIX shells that implement local variables. - -It is not completely compatible with bash-4.4, since the bash-4.4 behavior -wasn't fully POSIX-conformant and had variable scoping bugs as well. - -The original discussion concerning this is at - -http://lists.gnu.org/archive/html/bug-bash/2018-05/msg00002.html - -Chet - ---- - variables.c | 35 ++++++++++++++++++++++++++++++----- - 1 file changed, 30 insertions(+), 5 deletions(-) - ---- variables.c -+++ variables.c 2019-03-21 08:21:21.777597991 +0000 -@@ -4507,16 +4507,38 @@ push_posix_temp_var (data) - - var = (SHELL_VAR *)data; - -+#if 1 /* TAG:bash-5.1 */ -+ /* Just like do_assignment_internal(). This makes assignments preceding -+ special builtins act like standalone assignment statements when in -+ posix mode, satisfying the posix requirement that this affect the -+ "current execution environment." */ -+ v = bind_variable (var->name, value_cell (var), ASS_FORCE|ASS_NOLONGJMP); -+ -+ /* If this modifies an existing local variable, v->context will be non-zero. -+ If it comes back with v->context == 0, we bound at the global context. -+ Set binding_table appropriately. It doesn't matter whether it's correct -+ if the variable is local, only that it's not global_variables->table */ -+ binding_table = v->context ? shell_variables->table : global_variables->table; -+#else - binding_table = global_variables->table; - if (binding_table == 0) - binding_table = global_variables->table = hash_create (VARIABLES_HASH_BUCKETS); - - v = bind_variable_internal (var->name, value_cell (var), binding_table, 0, ASS_FORCE|ASS_NOLONGJMP); -+#endif - - /* global variables are no longer temporary and don't need propagating. */ -- var->attributes &= ~(att_tempvar|att_propagate); -+ if (binding_table == global_variables->table) -+ var->attributes &= ~(att_tempvar|att_propagate); -+ - if (v) -- v->attributes |= var->attributes; -+ { -+ v->attributes |= var->attributes; -+ v->attributes &= ~att_tempvar; /* not a temp var now */ -+#if 0 /* TAG:bash-5.1 code doesn't need this, disable for bash-5.1 */ -+ v->context = (binding_table == global_variables->table) ? 0 : shell_variables->scope; -+#endif -+ } - - if (find_special_var (var->name) >= 0) - tempvar_list[tvlist_ind++] = savestring (var->name); -@@ -4610,14 +4632,17 @@ dispose_temporary_env (pushf) - sh_free_func_t *pushf; - { - int i; -+ HASH_TABLE *disposer; - - tempvar_list = strvec_create (HASH_ENTRIES (temporary_env) + 1); - tempvar_list[tvlist_ind = 0] = 0; -- -- hash_flush (temporary_env, pushf); -- hash_dispose (temporary_env); -+ -+ disposer = temporary_env; - temporary_env = (HASH_TABLE *)NULL; - -+ hash_flush (disposer, pushf); -+ hash_dispose (disposer); -+ - tempvar_list[tvlist_ind] = 0; - - array_needs_making = 1; diff --git a/bash-4.1-completion.dif b/bash-4.1-completion.dif index e145bcac..6912f0ab 100644 --- a/bash-4.1-completion.dif +++ b/bash-4.1-completion.dif @@ -4,7 +4,7 @@ --- bashline.c +++ bashline.c 2018-11-29 08:12:25.876588305 +0000 -@@ -2045,6 +2045,13 @@ globword: +@@ -2046,6 +2046,13 @@ globword: return ((char *)NULL); } diff --git a/bash-5.0-patches.tar.bz2 b/bash-5.0-patches.tar.bz2 index ac7105c7..5f3888ab 100644 --- a/bash-5.0-patches.tar.bz2 +++ b/bash-5.0-patches.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0e159d1054254d66c5bf02f0c59eb468df678253b29ee4485def1e5e26ffe9c2 -size 7451 +oid sha256:5d79e2089f5f7fa7aa1907a027d25a868d2833fcd401751796e9a5a393f0a203 +size 9670 diff --git a/bash.changes b/bash.changes index 8c277914..ff0acef6 100644 --- a/bash.changes +++ b/bash.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Mon Sep 9 08:06:54 UTC 2019 - Dr. Werner Fink + +- Use new version scheme which now includes patch level as well +- Add official patch bash50-010 + * Change posix mode bahviour + * Remove patch assignment-preceding-builtin.patch +- Add official patch bash50-011 + The conditional command did not perform appropriate quoted null + character removal on its arguments, causing syntax errors and + attempts to stat invalid pathnames. + +------------------------------------------------------------------- +Wed Sep 4 09:08:53 UTC 2019 - Ludwig Nussel + +- Avoid pulling in bash-doc into every installation. Instead of + recommeding it, supplement the documentation pattern. + ------------------------------------------------------------------- Thu Aug 15 13:43:55 UTC 2019 - Dr. Werner Fink diff --git a/bash.spec b/bash.spec index 785cf787..091925e3 100644 --- a/bash.spec +++ b/bash.spec @@ -21,7 +21,9 @@ Name: bash %define bextend %nil -Version: 5.0 +%define bversion 5.0 +%define bpatchlvl 11 +Version: %{bversion}.%{bpatchlvl} Release: 0 Summary: The GNU Bourne-Again Shell License: GPL-3.0-or-later @@ -31,11 +33,11 @@ Recommends: bash-lang = %version # bugs which will hit at most this package #Recommends: bash-completion Suggests: command-not-found -Recommends: bash-doc = %version +Suggests: bash-doc = %version Url: http://www.gnu.org/software/bash/bash.html # Git: http://git.savannah.gnu.org/cgit/bash.git -Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{version}%{bextend}.tar.gz -Source1: bash-%{version}-patches.tar.bz2 +Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{bversion}%{bextend}.tar.gz +Source1: bash-%{bversion}-patches.tar.bz2 Source4: run-tests Source5: dot.bashrc Source6: dot.profile @@ -46,7 +48,7 @@ Source8: baselibs.conf # http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00071.html # http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00073.html Source9: bash-4.2-history-myown.dif.bz2 -Patch0: bash-%{version}.dif +Patch0: bash-%{bversion}.dif Patch1: bash-2.03-manual.patch Patch2: bash-4.0-security.patch Patch3: bash-4.3-2.4.4.patch @@ -72,8 +74,6 @@ Patch47: bash-4.3-perl522.patch Patch48: bash-4.3-extra-import-func.patch # PATCH-EXTEND-SUSE Allow root to clean file system if filled up Patch49: bash-4.3-pathtemp.patch -# PATCH-EXTEND-UPSTREAM bash-5.0: problem with variable scoping in posix-mode -Patch100: assignment-preceding-builtin.patch BuildRequires: audit-devel BuildRequires: autoconf BuildRequires: bison @@ -105,6 +105,7 @@ specification (IEEE Working Group 1003.2). Summary: Documentation how to Use the GNU Bourne-Again Shell Group: Documentation/Man Provides: bash:%{_infodir}/bash.info.gz +Supplements: packageand(bash:patterns-base-documentation) PreReq: %install_info_prereq BuildArch: noarch @@ -198,9 +199,9 @@ echo -e '\033[1m\033[31mWarning: Shift JIS support is enabled\033[m' %else echo -e '\033[1m\032[31mShift JIS support disabled\033[m' %endif -%setup -q -n bash-%{version}%{bextend} -b1 +%setup -q -n bash-%{bversion}%{bextend} -b1 typeset -i level -for patch in ../bash-%{version}-patches/*; do +for patch in ../bash-%{bversion}-patches/*; do test -e $patch || break let level=0 || true file=$(lsdiff --files=1 $patch) @@ -209,7 +210,7 @@ for patch in ../bash-%{version}-patches/*; do let level++ || true fi test -e $file || exit 1 - sed -ri '/^\*\*\* \.\./{ s@\.\./bash-%{version}[^/]*/@@ }' $patch + sed -ri '/^\*\*\* \.\./{ s@\.\./bash-%{bversion}[^/]*/@@ }' $patch echo Patch $patch patch -s -p$level < $patch done @@ -237,7 +238,6 @@ done %patch48 -b .eif %endif %patch49 -p0 -b .pthtmp -%patch100 -p0 -b .posix %patch0 -p0 -b .0 # This has to be always the same version as included in the bash its self @@ -475,9 +475,9 @@ that is e.g. wide character support for UTF-8. This causes problems in geting the current cursor position within the readline runtime library: | -bash-%{version}> LANG=ja_JP -bash-%{version}> echo -n "Hello" -bash-%{version}> +bash-%{bversion}> LANG=ja_JP +bash-%{bversion}> echo -n "Hello" +bash-%{bversion}> | In other words the prompt overwrites the output of the echo comand. The boolean variable byte-oriented