#11 Rebase to bash-5.0
Closed 8 months ago by svashisht. Opened 8 months ago by svashisht.

file modified
+1

@@ -3,3 +3,4 @@ 

  /bash-4.2.tar.gz

  /bash-4.3.tar.gz

  /bash-4.4.tar.gz

+ /bash-5.0.tar.gz

file added
+150

@@ -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

+ 

@@ -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

+ 

file modified
+75 -75

@@ -1,13 +1,13 @@ 

  #% define beta_tag rc2

  %global _hardened_build 1

This is not needed anymore. All builds are hardened by default.

- %define patchleveltag .23

- %define baseversion 4.4

+ %define patchleveltag .2

+ %define baseversion 5.0

  %bcond_without tests

  

  Version: %{baseversion}%{patchleveltag}

  Name: bash

  Summary: The GNU Bourne Again shell

- Release: 7%{?dist}

+ Release: 0%{?dist}

Should be 1

  License: GPLv3+

  Url: https://www.gnu.org/software/bash

  Source0: https://ftp.gnu.org/gnu/bash/bash-%{baseversion}.tar.gz

@@ -21,80 +21,80 @@ 

  

  # Official upstream patches

  # Patches are converted to apply with '-p1'

- %{lua:for i=1,23 do print(string.format("Patch%u: bash-4.4-patch-%u.patch\n", i, i)) end}

+ %{lua:for i=1,2 do print(string.format("Patch%u: bash-5.0-patch-%u.patch\n", i, i)) end}

  

  # Other patches

- Patch101: bash-2.02-security.patch

- Patch102: bash-2.03-paths.patch

- Patch103: bash-2.03-profile.patch

- Patch104: bash-2.05a-interpreter.patch

- Patch105: bash-2.05b-debuginfo.patch

- Patch106: bash-2.05b-manso.patch

- Patch107: bash-2.05b-pgrp_sync.patch

- Patch108: bash-2.05b-xcc.patch

- Patch109: bash-3.2-audit.patch

- Patch110: bash-3.2-ssh_source_bash.patch

- Patch112: bash-infotags.patch

- Patch113: bash-requires.patch

- Patch114: bash-setlocale.patch

- Patch115: bash-tty-tests.patch

- 

- # 484809, check if interp section is NOBITS

- Patch116: bash-4.0-nobits.patch

- 

- # Do the same CFLAGS in generated Makefile in examples

- Patch117: bash-4.1-examples.patch

- 

- # Builtins like echo and printf won't report errors

- # when output does not succeed due to EPIPE

- Patch118: bash-4.1-broken_pipe.patch

- 

- # Enable system-wide .bash_logout for login shells

- Patch119: bash-4.2-rc2-logout.patch

- 

- # Static analyzis shows some issues in bash-2.05a-interpreter.patch

- Patch120: bash-4.2-coverity.patch

- 

- # Don't call malloc in signal handler

- Patch121: bash-4.1-defer-sigchld-trap.patch

- 

- # 799958, updated info about trap

- Patch122: bash-4.2-manpage_trap.patch

- 

- # https://www.securecoding.cert.org/confluence/display/seccode/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow

- Patch123: bash-4.2-size_type.patch

- 

- # 1112710 - mention ulimit -c and -f POSIX block size

- Patch124: bash-4.3-man-ulimit.patch

- 

- # 1102815 - fix double echoes in vi visual mode

- Patch125: bash-4.3-noecho.patch

- 

- #1241533,1224855 - bash leaks memory when LC_ALL set

- Patch126: bash-4.3-memleak-lc_all.patch

- 

- # bash-4.4 builds loadable builtin examples by default

- # this patch disables it

- Patch127: bash-4.4-no-loadable-builtins.patch

- 

- # 1068697 - Explicitly unset nonblocking mode while reading from stdin

- # This should be dropped while rebasing to bash-4.5

- Patch128: bash-4.4-unset-nonblock-stdin.patch

- 

- # 1389838 - command builtin should not abort on variable assignment errors

- # This should be dropped while rebasing to bash-4.5

- Patch129: bash-4.4-assignment-error.patch

- 

- # 1458008 - test builtin ignores subsecond while comparing file modification times

- # This should be dropped while rebasing to bash-4.5

- Patch130: bash-4.5-test-modification-time.patch

- 

- # 1556867 - case in a for loop inside subshell causes syntax error

- # This should be dropped while rebasing to bash-4.5

- Patch131: bash-4.4-case-in-command-subst.patch

- 

- # 1637018

- Patch132: bash-4.4-coverity.patch

+ # Patch101: bash-2.02-security.patch

Seems you didn't push right version

Looks like I opened pull request from repo. I will redo this pull request.

+ # Patch102: bash-2.03-paths.patch

+ # Patch103: bash-2.03-profile.patch

+ # Patch104: bash-2.05a-interpreter.patch

+ # Patch105: bash-2.05b-debuginfo.patch

+ # Patch106: bash-2.05b-manso.patch

+ # Patch107: bash-2.05b-pgrp_sync.patch

+ # Patch108: bash-2.05b-xcc.patch

+ # Patch109: bash-3.2-audit.patch

+ # Patch110: bash-3.2-ssh_source_bash.patch

+ # Patch112: bash-infotags.patch

+ # Patch113: bash-requires.patch

+ # Patch114: bash-setlocale.patch

+ # Patch115: bash-tty-tests.patch

+ # 

+ # # 484809, check if interp section is NOBITS

+ # Patch116: bash-4.0-nobits.patch

+ # 

+ # # Do the same CFLAGS in generated Makefile in examples

+ # Patch117: bash-4.1-examples.patch

+ # 

+ # # Builtins like echo and printf won't report errors

+ # # when output does not succeed due to EPIPE

+ # Patch118: bash-4.1-broken_pipe.patch

+ # 

+ # # Enable system-wide .bash_logout for login shells

+ # Patch119: bash-4.2-rc2-logout.patch

+ # 

+ # # Static analyzis shows some issues in bash-2.05a-interpreter.patch

+ # Patch120: bash-4.2-coverity.patch

+ # 

+ # # Don't call malloc in signal handler

+ # Patch121: bash-4.1-defer-sigchld-trap.patch

+ # 

+ # # 799958, updated info about trap

+ # Patch122: bash-4.2-manpage_trap.patch

+ # 

+ # # https://www.securecoding.cert.org/confluence/display/seccode/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow

+ # Patch123: bash-4.2-size_type.patch

+ # 

+ # # 1112710 - mention ulimit -c and -f POSIX block size

+ # Patch124: bash-4.3-man-ulimit.patch

+ # 

+ # # 1102815 - fix double echoes in vi visual mode

+ # Patch125: bash-4.3-noecho.patch

+ # 

+ # #1241533,1224855 - bash leaks memory when LC_ALL set

+ # Patch126: bash-4.3-memleak-lc_all.patch

+ # 

+ # # bash-4.4 builds loadable builtin examples by default

+ # # this patch disables it

+ # Patch127: bash-4.4-no-loadable-builtins.patch

+ # 

+ # # 1068697 - Explicitly unset nonblocking mode while reading from stdin

+ # # This should be dropped while rebasing to bash-4.5

+ # Patch128: bash-4.4-unset-nonblock-stdin.patch

+ # 

+ # # 1389838 - command builtin should not abort on variable assignment errors

+ # # This should be dropped while rebasing to bash-4.5

+ # Patch129: bash-4.4-assignment-error.patch

+ # 

+ # # 1458008 - test builtin ignores subsecond while comparing file modification times

+ # # This should be dropped while rebasing to bash-4.5

+ # Patch130: bash-4.5-test-modification-time.patch

+ # 

+ # # 1556867 - case in a for loop inside subshell causes syntax error

+ # # This should be dropped while rebasing to bash-4.5

+ # Patch131: bash-4.4-case-in-command-subst.patch

+ # 

+ # # 1637018

+ # Patch132: bash-4.4-coverity.patch

  

  BuildRequires:  gcc

  BuildRequires: texinfo bison

file modified
+1 -1

@@ -1,1 +1,1 @@ 

- SHA512 (bash-4.4.tar.gz) = 73de3b425faaac55e45456b0f6f6d8077b5dfa7bb76e0d1894a19361b4a2b6bd4fbbe182117ddbfe9b07b4d898fba03537c261badc9533dd3c0da891764c7f29

+ SHA512 (bash-5.0.tar.gz) = bb4519f06e278f271d08722b531e49d2e842cc3e0b02a6b3eee422e2efcb5b6226111af43f5e5eae56beb85ac8bfebcd6a4aacbabb8f609e529aa4d571890864

no initial comment

This is not needed anymore. All builds are hardened by default.

Seems you didn't push right version

Looks like I opened pull request from repo. I will redo this pull request.

Pull-Request has been closed by svashisht

8 months ago