Mailinglist Archive: opensuse-commit (1903 mails)

< Previous Next >
commit bash for openSUSE:Factory
Hello community,

here is the log from the commit of package bash for openSUSE:Factory checked in
at 2019-04-08 10:29:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/bash (Old)
and /work/SRC/openSUSE:Factory/.bash.new.3908 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "bash"

Mon Apr 8 10:29:52 2019 rev:154 rq:691415 version:5.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/bash/bash.changes 2019-03-18
10:33:36.503556821 +0100
+++ /work/SRC/openSUSE:Factory/.bash.new.3908/bash.changes 2019-04-08
10:29:55.039107810 +0200
@@ -1,0 +2,17 @@
+Thu Apr 4 07:18:57 UTC 2019 - Dr. Werner Fink <werner@xxxxxxx>
+
+- Add temporary fix from upstream for boo#1128936
+
+-------------------------------------------------------------------
+Thu Mar 21 08:24:11 UTC 2019 - Dr. Werner Fink <werner@xxxxxxx>
+
+- Add patch assignment-preceding-builtin.patch from upstream
+ mailing list. Note that this break backward behaviour with
+ bash-4.4 but implies that POSIX mode is more correct
+
+-------------------------------------------------------------------
+Thu Mar 21 07:57:41 UTC 2019 - Dr. Werner Fink <werner@xxxxxxx>
+
+- Replace the temporary patch with official bash50-003
+
+-------------------------------------------------------------------

New:
----
assignment-preceding-builtin.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ bash.spec ++++++
--- /var/tmp/diff_new_pack.mDvSAo/_old 2019-04-08 10:29:58.187111632 +0200
+++ /var/tmp/diff_new_pack.mDvSAo/_new 2019-04-08 10:29:58.191111637 +0200
@@ -72,6 +72,8 @@
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
@@ -235,6 +237,7 @@
%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

++++++ assignment-preceding-builtin.patch ++++++
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;
++++++ bash-5.0-patches.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bash-5.0-patches/bash50-003
new/bash-5.0-patches/bash50-003
--- old/bash-5.0-patches/bash50-003 1970-01-01 01:00:00.000000000 +0100
+++ new/bash-5.0-patches/bash50-003 2019-03-21 09:21:21.741598677 +0100
@@ -0,0 +1,239 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 5.0
+Patch-ID: bash50-003
+
+Bug-Reported-by: Andrew Church <achurch+bash@xxxxxxxxxxx>
+Bug-Reference-ID: <5c534aa2.04371@xxxxxxxxxxxxxxxxx>
+Bug-Reference-URL:
http://lists.gnu.org/archive/html/bug-bash/2019-01/msg00276.html
+
+Bug-Description:
+
+There are several incompatibilities in how bash-5.0 processes pathname
+expansion (globbing) of filename arguments that have backslashes in the
+directory portion.
+
+Patch (apply with `patch -p0'):
+
+*** lib/glob/glob_loop.c 2019-01-16 16:13:21.000000000 -0500
+--- lib/glob/glob_loop.c 2019-02-01 09:45:11.000000000 -0500
+***************
+*** 27,34 ****
+ register const GCHAR *p;
+ register GCHAR c;
+! int bopen;
+
+ p = pattern;
+! bopen = 0;
+
+ while ((c = *p++) != L('\0'))
+--- 27,34 ----
+ register const GCHAR *p;
+ register GCHAR c;
+! int bopen, bsquote;
+
+ p = pattern;
+! bopen = bsquote = 0;
+
+ while ((c = *p++) != L('\0'))
+***************
+*** 56,66 ****
+ 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'));
+ }
+
+! return 0;
+ }
+
+--- 56,75 ----
+ 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 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 bsquote ? 2 : 0;
+ }
+
+*** lib/glob/glob.h 2013-10-28 14:46:12.000000000 -0400
+--- lib/glob/glob.h 2019-03-07 11:06:47.000000000 -0500
+***************
+*** 31,34 ****
+--- 31,35 ----
+ #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 *));
+*** lib/glob/glob.c 2018-09-20 10:53:23.000000000 -0400
+--- lib/glob/glob.c 2019-03-07 14:23:43.000000000 -0500
+***************
+*** 1062,1066 ****
+ unsigned int directory_len;
+ int free_dirname; /* flag */
+! int dflags;
+
+ result = (char **) malloc (sizeof (char *));
+--- 1078,1082 ----
+ unsigned int directory_len;
+ int free_dirname; /* flag */
+! int dflags, hasglob;
+
+ result = (char **) malloc (sizeof (char *));
+***************
+*** 1111,1117 ****
+ }
+
+ /* 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))
+ {
+ char **directories, *d, *p;
+--- 1127,1136 ----
+ }
+
++ hasglob = 0;
+ /* If directory_name contains globbing characters, then we
+! 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;
+***************
+*** 1176,1180 ****
+ d[directory_len - 1] = '\0';
+
+! directories = glob_filename (d, dflags);
+
+ if (free_dirname)
+--- 1195,1199 ----
+ d[directory_len - 1] = '\0';
+
+! directories = glob_filename (d, dflags|GX_RECURSE);
+
+ if (free_dirname)
+***************
+*** 1333,1336 ****
+--- 1352,1369 ----
+ 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);
+*** pathexp.c 2018-04-29 17:44:48.000000000 -0400
+--- pathexp.c 2019-01-31 20:19:41.000000000 -0500
+***************
+*** 66,74 ****
+ register int c;
+ char *send;
+! int open;
+
+ DECLARE_MBSTATE;
+
+! open = 0;
+ send = string + strlen (string);
+
+--- 66,74 ----
+ register int c;
+ char *send;
+! int open, bsquote;
+
+ DECLARE_MBSTATE;
+
+! open = bsquote = 0;
+ send = string + strlen (string);
+
+***************
+*** 101,105 ****
+ globbing. */
+ case '\\':
+! return (*string != 0);
+
+ case CTLESC:
+--- 101,112 ----
+ globbing. */
+ case '\\':
+! if (*string != '\0' && *string != '/')
+! {
+! bsquote = 1;
+! string++;
+! continue;
+! }
+! else if (*string == 0)
+! return (0);
+
+ case CTLESC:
+***************
+*** 118,122 ****
+ #endif
+ }
+! return (0);
+ }
+
+--- 125,130 ----
+ #endif
+ }
+!
+! return (bsquote ? 2 : 0);
+ }
+
+*** bashline.c 2019-01-16 16:13:21.000000000 -0500
+--- bashline.c 2019-02-22 09:29:08.000000000 -0500
+***************
+*** 3753,3757 ****
+
+ case '\\':
+! if (*string == 0)
+ return (0);
+ }
+--- 3766,3770 ----
+
+ case '\\':
+! if (*string++ == 0)
+ return (0);
+ }
+*** patchlevel.h 2016-06-22 14:51:03.000000000 -0400
+--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 2
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 3
+
+ #endif /* _PATCHLEVEL_H_ */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bash-5.0-patches/globpat-backslashes.patch
new/bash-5.0-patches/globpat-backslashes.patch
--- old/bash-5.0-patches/globpat-backslashes.patch 2019-03-11
08:17:46.738836000 +0100
+++ new/bash-5.0-patches/globpat-backslashes.patch 1970-01-01
01:00:00.000000000 +0100
@@ -1,206 +0,0 @@
-*** ../bash-5.0-patched/lib/glob/glob_loop.c 2019-01-16 16:13:21.000000000
-0500
---- lib/glob/glob_loop.c 2019-02-01 09:45:11.000000000 -0500
-***************
-*** 27,34 ****
- register const GCHAR *p;
- register GCHAR c;
-! int bopen;
-
- p = pattern;
-! bopen = 0;
-
- while ((c = *p++) != L('\0'))
---- 27,34 ----
- register const GCHAR *p;
- register GCHAR c;
-! int bopen, bsquote;
-
- p = pattern;
-! bopen = bsquote = 0;
-
- while ((c = *p++) != L('\0'))
-***************
-*** 56,66 ****
- 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'));
- }
-
-! return 0;
- }
-
---- 56,75 ----
- 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 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 bsquote ? 2 : 0;
- }
-
-*** ../bash-5.0-patched/lib/glob/glob.h 2013-10-28 14:46:12.000000000
-0400
---- lib/glob/glob.h 2019-03-07 11:06:47.000000000 -0500
-***************
-*** 31,34 ****
---- 31,35 ----
- #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 *));
-*** ../bash-5.0-patched/lib/glob/glob.c 2018-09-20 10:53:23.000000000
-0400
---- lib/glob/glob.c 2019-03-07 14:23:43.000000000 -0500
-***************
-*** 1062,1066 ****
- unsigned int directory_len;
- int free_dirname; /* flag */
-! int dflags;
-
- result = (char **) malloc (sizeof (char *));
---- 1078,1082 ----
- unsigned int directory_len;
- int free_dirname; /* flag */
-! int dflags, hasglob;
-
- result = (char **) malloc (sizeof (char *));
-***************
-*** 1111,1117 ****
- }
-
- /* 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))
- {
- char **directories, *d, *p;
---- 1127,1136 ----
- }
-
-+ hasglob = 0;
- /* If directory_name contains globbing characters, then we
-! 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;
-***************
-*** 1176,1180 ****
- d[directory_len - 1] = '\0';
-
-! directories = glob_filename (d, dflags);
-
- if (free_dirname)
---- 1195,1199 ----
- d[directory_len - 1] = '\0';
-
-! directories = glob_filename (d, dflags|GX_RECURSE);
-
- if (free_dirname)
-***************
-*** 1333,1336 ****
---- 1352,1369 ----
- 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);
-*** ../bash-5.0-patched/pathexp.c 2018-04-29 17:44:48.000000000 -0400
---- pathexp.c 2019-01-31 20:19:41.000000000 -0500
-***************
-*** 66,74 ****
- register int c;
- char *send;
-! int open;
-
- DECLARE_MBSTATE;
-
-! open = 0;
- send = string + strlen (string);
-
---- 66,74 ----
- register int c;
- char *send;
-! int open, bsquote;
-
- DECLARE_MBSTATE;
-
-! open = bsquote = 0;
- send = string + strlen (string);
-
-***************
-*** 101,105 ****
- globbing. */
- case '\\':
-! return (*string != 0);
-
- case CTLESC:
---- 101,112 ----
- globbing. */
- case '\\':
-! if (*string != '\0' && *string != '/')
-! {
-! bsquote = 1;
-! string++;
-! continue;
-! }
-! else if (*string == 0)
-! return (0);
-
- case CTLESC:
-***************
-*** 118,122 ****
- #endif
- }
-! return (0);
- }
-
---- 125,130 ----
- #endif
- }
-!
-! return (bsquote ? 2 : 0);
- }
-
-*** ../bash-5.0-patched/bashline.c 2019-01-16 16:13:21.000000000 -0500
---- bashline.c 2019-02-22 09:29:08.000000000 -0500
-***************
-*** 3753,3757 ****
-
- case '\\':
-! if (*string == 0)
- return (0);
- }
---- 3766,3770 ----
-
- case '\\':
-! if (*string++ == 0)
- return (0);
- }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bash-5.0-patches/temporary
new/bash-5.0-patches/temporary
--- old/bash-5.0-patches/temporary 1970-01-01 01:00:00.000000000 +0100
+++ new/bash-5.0-patches/temporary 2019-04-04 09:05:06.880872233 +0200
@@ -0,0 +1,19 @@
+--- execute_cmd.c
++++ execute_cmd.c
+@@ -624,6 +624,7 @@ execute_command_internal (command, asynchronous, pipe_in,
pipe_out,
+
+ /* Fork a subshell, turn off the subshell bit, turn off job
+ control and call execute_command () on the command again. */
++ save_line_number = line_number;
+ if (command->type == cm_subshell)
+ line_number_for_err_trap = line_number = command->value.Subshell->line;
/* XXX - save value? */
+ /* Otherwise we defer setting line_number */
+@@ -677,6 +678,8 @@ execute_command_internal (command, asynchronous, pipe_in,
pipe_out,
+
+ stop_pipeline (asynchronous, (COMMAND *)NULL);
+
++ line_number = save_line_number;
++
+ if (asynchronous == 0)
+ {
+ was_error_trap = signal_is_trapped (ERROR_TRAP) &&
signal_is_ignored (ERROR_TRAP) == 0;


< Previous Next >
This Thread