#12 Rebase to bash-5.0
Closed 7 months ago by ignatenkobrain. Opened 7 months ago by svashisht.
rpms/ svashisht/bash bash-5.0-rebase  into  bash-5.0-rebase

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

@@ -1,11 +0,0 @@ 

- --- bash-2.02-orig/parse.y	Wed Mar 25 18:16:23 1998

- +++ bash-2.02/parse.y	Sun Apr 19 16:46:34 1998

- @@ -923,7 +923,7 @@

-  

-  #if defined (READLINE)

-  char *current_readline_prompt = (char *)NULL;

- -char *current_readline_line = (char *)NULL;

- +unsigned char *current_readline_line = (unsigned char *)NULL;

-  int current_readline_line_index = 0;

-  

-  static int

file modified
+16 -22

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

  diff --git a/config.h.in b/config.h.in

- index a5ad9e7..62a6b32 100644

+ index 0adc903..366e639 100644

  --- a/config.h.in

  +++ b/config.h.in

- @@ -748,6 +748,9 @@

+ @@ -758,6 +758,9 @@

   /* Define if you have the pselect function.  */

   #undef HAVE_PSELECT

   

@@ -12,7 +12,7 @@ 

   /* Define if you have the putenv function.  */

   #undef HAVE_PUTENV

   

- @@ -946,6 +949,9 @@

+ @@ -956,6 +959,9 @@

   /* Define if you have the <dlfcn.h> header file.  */

   #undef HAVE_DLFCN_H

   

@@ -23,29 +23,20 @@ 

   #undef HAVE_GRP_H

   

  diff --git a/configure.ac b/configure.ac

- index ce4e9b6..eda95d6 100644

+ index 2c74f13..4e9c3a4 100644

  --- a/configure.ac

  +++ b/configure.ac

- @@ -700,7 +700,7 @@ BASH_HEADER_INTTYPES

-  AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \

-  		 memory.h locale.h termcap.h termio.h termios.h dlfcn.h \

-  		 stdbool.h stddef.h stdint.h netdb.h pwd.h grp.h strings.h \

- -		 regex.h syslog.h ulimit.h)

- +		 regex.h syslog.h ulimit.h elf.h)

-  AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h sys/ioctl.h \

-  		 sys/param.h sys/socket.h sys/stat.h \

-  		 sys/time.h sys/times.h sys/types.h sys/wait.h)

- @@ -771,7 +771,7 @@ dnl checks for system calls

+ @@ -782,7 +782,7 @@ dnl checks for system calls

   AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getgroups gethostname \

   		getpagesize getpeername getrlimit getrusage gettimeofday \

-  		kill killpg lstat pselect readlink sbrk select setdtablesize \

+  		kill killpg lstat pselect readlink select setdtablesize \

  -		setitimer tcgetpgrp uname ulimit waitpid)

  +		setitimer tcgetpgrp uname ulimit waitpid pread)

   AC_REPLACE_FUNCS(rename)

   

   dnl checks for c library functions

  diff --git a/execute_cmd.c b/execute_cmd.c

- index 2a3df6d..b5cd405 100644

+ index 4eae19c..0af6f8f 100644

  --- a/execute_cmd.c

  +++ b/execute_cmd.c

  @@ -41,6 +41,10 @@

@@ -59,7 +50,7 @@ 

   #include "posixtime.h"

   

   #if defined (HAVE_SYS_RESOURCE_H) && !defined (RLIMTYPE)

- @@ -5486,6 +5490,14 @@ shell_execve (command, args, env)

+ @@ -5706,6 +5710,14 @@ shell_execve (command, args, env)

   	{

   	  /* The file has the execute bits set, but the kernel refuses to

   	     run it for some reason.  See why. */

@@ -74,18 +65,19 @@ 

   #if defined (HAVE_HASH_BANG_EXEC)

   	  READ_SAMPLE_BUF (command, sample, sample_len);

   	  if (sample_len > 0)

- @@ -5495,6 +5507,7 @@ shell_execve (command, args, env)

+ @@ -5715,6 +5727,7 @@ shell_execve (command, args, env)

   	      char *interp;

   	      int ilen;

   

- +              close (fd);

+ +          close (fd);

   	      interp = getinterp (sample, sample_len, (int *)NULL);

   	      ilen = strlen (interp);

   	      errno = i;

- @@ -5510,6 +5523,136 @@ shell_execve (command, args, env)

+ @@ -5730,7 +5743,138 @@ shell_execve (command, args, env)

   	      return (EX_NOEXEC);

   	    }

   #endif

+ -	  errno = i;

  +#if defined (HAVE_ELF_H)

  +	  if (i == ENOENT

  +	      && sample_len > EI_NIDENT

@@ -216,9 +208,11 @@ 

  +#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)

  +	  close (fd);

  +#endif

-  	  errno = i;

+ +

+ +      errno = i;

   	  file_error (command);

   	}

+        return (last_command_exit_value);

  -- 

- 2.9.3

+ 2.17.2

  

file removed
-10

@@ -1,10 +0,0 @@ 

- --- bash-2.05b/doc/builtins.1.manso	2003-02-10 18:58:21.000000000 +0000

- +++ bash-2.05b/doc/builtins.1	2003-02-10 18:58:28.000000000 +0000

- @@ -10,6 +10,6 @@

-  ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1)

-  .SH BASH BUILTIN COMMANDS

-  .nr zZ 1

- -.so bash.1

- +.so man1/bash.1

-  .SH SEE ALSO

-  bash(1), sh(1)

file removed
-19

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

-  

@@ -1,11 +0,0 @@ 

- diff -pruN bash-4.1/jobs.c bash-4.1.patched/jobs.c

- --- bash-4.1/jobs.c	2009-11-30 03:42:05.000000000 +0530

- +++ bash-4.1.patched/jobs.c	2012-03-06 16:44:15.706595703 +0530

- @@ -3037,6 +3037,7 @@ waitchld (wpid, block)

-    pid_t pid;

-  

-    int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;

- +  int called_from_sighand = sigchld;

-    static int wcontinued = WCONTINUED;	/* run-time fix for glibc problem */

-  

-    call_set_current = children_exited = 0;

file modified
+17 -13

@@ -1,7 +1,8 @@ 

- diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c

- --- bash-4.2/execute_cmd.c.coverity	2011-02-24 13:04:35.000000000 +0100

- +++ bash-4.2/execute_cmd.c	2011-02-24 13:49:13.000000000 +0100

- @@ -5036,7 +5036,7 @@ shell_execve (command, args, env)

+ diff --git a/execute_cmd.c b/execute_cmd.c

+ index a988400..412128c 100644

+ --- a/execute_cmd.c

+ +++ b/execute_cmd.c

+ @@ -5760,7 +5760,7 @@ shell_execve (command, args, env)

   		  Elf32_Ehdr ehdr;

   		  Elf32_Phdr *phdr;

                     Elf32_Shdr *shdr;

@@ -10,7 +11,7 @@ 

   

   		  /* We have to copy the data since the sample buffer

   		     might not be aligned correctly to be accessed as

- @@ -5044,12 +5044,12 @@ shell_execve (command, args, env)

+ @@ -5768,12 +5768,12 @@ shell_execve (command, args, env)

   		  memcpy (&ehdr, sample, sizeof (Elf32_Ehdr));

   

   		  nshdr = ehdr.e_shnum;

@@ -25,7 +26,7 @@ 

   					  ehdr.e_shoff);

   #else

   		      if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)

- @@ -5091,11 +5091,11 @@ shell_execve (command, args, env)

+ @@ -5815,11 +5815,11 @@ shell_execve (command, args, env)

   		    }

   

   		  nphdr = ehdr.e_phnum;

@@ -39,7 +40,7 @@ 

   					  ehdr.e_phoff);

   #else

   		      if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)

- @@ -5120,7 +5120,7 @@ shell_execve (command, args, env)

+ @@ -5844,7 +5844,7 @@ shell_execve (command, args, env)

   		  Elf64_Ehdr ehdr;

   		  Elf64_Phdr *phdr;

                     Elf64_Shdr *shdr;

@@ -48,7 +49,7 @@ 

   

   		  /* We have to copy the data since the sample buffer

   		     might not be aligned correctly to be accessed as

- @@ -5128,11 +5128,11 @@ shell_execve (command, args, env)

+ @@ -5852,11 +5852,11 @@ shell_execve (command, args, env)

   		  memcpy (&ehdr, sample, sizeof (Elf64_Ehdr));

   

   		  nshdr = ehdr.e_shnum;

@@ -62,7 +63,7 @@ 

   					  ehdr.e_shoff);

   #else

   		      if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)

- @@ -5174,11 +5174,11 @@ shell_execve (command, args, env)

+ @@ -5898,11 +5898,11 @@ shell_execve (command, args, env)

   		    }

   

   		  nphdr = ehdr.e_phnum;

@@ -76,7 +77,7 @@ 

   					  ehdr.e_phoff);

   #else

   		      if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)

- @@ -5200,8 +5200,8 @@ shell_execve (command, args, env)

+ @@ -5924,8 +5924,8 @@ shell_execve (command, args, env)

   

   	      if (offset != -1)

   		{

@@ -87,7 +88,7 @@ 

   		  char *interp = NULL;

   

   		  do

- @@ -5250,7 +5250,8 @@ shell_execve (command, args, env)

+ @@ -5974,7 +5974,8 @@ shell_execve (command, args, env)

   	    }

   #endif

   #if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)

@@ -95,5 +96,8 @@ 

  +          if (fd >= 0)

  +	    close (fd);

   #endif

-  	  errno = i;

-  	  file_error (command);

+  

+        errno = i;

+ -- 

+ 2.17.2

+ 

file removed
-60

@@ -1,60 +0,0 @@ 

- commit 41d203e21f94c1b8bfc457606ee633c22da3cf04

- Author: Chet Ramey <chet.ramey@case.edu>

- Date:   Wed Jun 12 09:29:51 2013 -0400

- 

-     commit bash-20130523 snapshot

- 

- diff --git a/trap.c b/trap.c

- index 1e11d1f..da59b26 100644

- --- a/trap.c

- +++ b/trap.c

- @@ -286,6 +286,9 @@ run_pending_traps ()

-    if (catch_flag == 0)		/* simple optimization */

-      return;

-  

- +  if (running_trap > 0)

- +    return;			/* no recursive trap invocations */

- +

-    catch_flag = trapped_signal_received = 0;

-  

-    /* Preserve $? when running trap. */

- @@ -304,6 +307,8 @@ run_pending_traps ()

-  

-  	  BLOCK_SIGNAL (sig, set, oset);

-  

- +	  running_trap = sig + 1;

- +

-  	  if (sig == SIGINT)

-  	    {

-  	      run_interrupt_trap ();

- @@ -324,6 +329,7 @@ run_pending_traps ()

-  	    {

-  	      /* This can happen when run_pending_traps is called while

-  		 running a SIGCHLD trap handler. */

- +	      running_trap = 0;

-  	      UNBLOCK_SIGNAL (oset);

-  	      continue;					/* XXX */

-  	    }

- @@ -359,7 +365,14 @@ run_pending_traps ()

-  	      save_subst_varlist = subst_assign_varlist;

-  	      subst_assign_varlist = 0;

-  

- +#if defined (JOB_CONTROL)

- +	      save_pipeline (1);	/* XXX only provides one save level */

- +#endif

-  	      evalstring (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);

- +#if defined (JOB_CONTROL)

- +	      restore_pipeline (1);

- +#endif

- +

-  	      restore_token_state (token_state);

-  	      free (token_state);

-  

- @@ -367,6 +380,7 @@ run_pending_traps ()

-  	    }

-  

-  	  pending_traps[sig] = 0;

- +	  running_trap = 0;

-  

-  	  UNBLOCK_SIGNAL (oset);

-  	}

@@ -1,47 +0,0 @@ 

- *** ../bash-4.3-patched/shell.h	2012-12-25 21:11:01.000000000 -0500

- --- shell.h	2014-06-03 09:24:28.000000000 -0400

- ***************

- *** 169,173 ****

-     int expand_aliases;

-     int echo_input_at_read;

- !   

-   } sh_parser_state_t;

-   

- --- 169,174 ----

-     int expand_aliases;

-     int echo_input_at_read;

- !   int need_here_doc;

- ! 

-   } sh_parser_state_t;

-   

- *** ../bash-4.3-patched/parse.y	2014-05-14 09:16:40.000000000 -0400

- --- parse.y	2014-04-30 09:27:59.000000000 -0400

- ***************

- *** 2643,2647 ****

-   

-     r = 0;

- !   while (need_here_doc)

-       {

-         parser_state |= PST_HEREDOC;

- --- 2643,2647 ----

-   

-     r = 0;

- !   while (need_here_doc > 0)

-       {

-         parser_state |= PST_HEREDOC;

- ***************

- *** 6076,6079 ****

- --- 6076,6080 ----

-     ps->expand_aliases = expand_aliases;

-     ps->echo_input_at_read = echo_input_at_read;

- +   ps->need_here_doc = need_here_doc;

-   

-     ps->token = token;

- ***************

- *** 6124,6127 ****

- --- 6125,6129 ----

-     expand_aliases = ps->expand_aliases;

-     echo_input_at_read = ps->echo_input_at_read;

- +   need_here_doc = ps->need_here_doc;

-   

-     FREE (token);

@@ -1,24 +0,0 @@ 

- *** ../bash-4.3-patched/execute_cmd.c	2014-01-31 10:54:52.000000000 -0500

- --- execute_cmd.c	2014-06-19 08:05:49.000000000 -0400

- ***************

- *** 2410,2414 ****

-         lstdin = wait_for (lastpid);

-   #if defined (JOB_CONTROL)

- !       exec_result = job_exit_status (lastpipe_jid);

-   #endif

-         unfreeze_jobs_list ();

- --- 2425,2438 ----

-         lstdin = wait_for (lastpid);

-   #if defined (JOB_CONTROL)

- !       /* If wait_for removes the job from the jobs table, use result of last

- ! 	 command as pipeline's exit status as usual.  The jobs list can get

- ! 	 frozen and unfrozen at inconvenient times if there are multiple pipelines

- ! 	 running simultaneously. */

- !       if (INVALID_JOB (lastpipe_jid) == 0)

- ! 	exec_result = job_exit_status (lastpipe_jid);

- !       else if (pipefail_opt)

- ! 	exec_result = exec_result | lstdin;	/* XXX */

- !       /* otherwise we use exec_result */

- !         

-   #endif

-         unfreeze_jobs_list ();

file modified
+10 -10

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

  diff --git a/parse.y b/parse.y

- index 30425a5..85f1c4f 100644

+ index 07e6e3e..4cd373f 100644

  --- a/parse.y

  +++ b/parse.y

- @@ -4228,6 +4228,8 @@ xparse_dolparen (base, string, indp, flags)

+ @@ -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 ')' */ /*(*/

+  #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 f1a4df1..a93a4ce 100644

+ index 9559187..0c2caa6 100644

  --- a/subst.c

  +++ b/subst.c

- @@ -8513,6 +8513,7 @@ param_expand (string, sindex, quoted, expanded_something,

+ @@ -9145,6 +9145,7 @@ param_expand (string, sindex, quoted, expanded_something,

     WORD_LIST *list;

     WORD_DESC *tdesc, *ret;

     int tflag;

@@ -23,7 +23,7 @@ 

   

   /*itrace("param_expand: `%s' pflags = %d", string+*sindex, pflags);*/

     zindex = *sindex;

- @@ -8831,6 +8832,9 @@ arithsub:

+ @@ -9514,6 +9515,9 @@ arithsub:

   	}

   

   comsub:

@@ -33,7 +33,7 @@ 

         if (pflags & PF_NOCOMSUB)

   	/* we need zindex+1 because string[zindex] == RPAREN */

   	temp1 = substring (string, *sindex, zindex+1);

- @@ -8843,6 +8847,7 @@ comsub:

+ @@ -9526,6 +9530,7 @@ comsub:

   	}

         FREE (temp);

         temp = temp1;

@@ -42,5 +42,5 @@ 

   

       /* Do POSIX.2d9-style arithmetic substitution.  This will probably go

  -- 

- 2.9.3

+ 2.17.2

  

@@ -1,28 +0,0 @@ 

- *** ../bash-4.3-patched/parse.y	2014-04-07 11:56:12.000000000 -0400

- --- parse.y	2014-06-11 10:25:53.000000000 -0400

- ***************

- *** 2789,2797 ****

-       case OR_OR:

-       case '&':

-       case DO:

-       case THEN:

-       case ELSE:

-       case '{':		/* } */

- !     case '(':		/* ) */

-       case BANG:		/* ! time pipeline */

-       case TIME:		/* time time pipeline */

- --- 2789,2802 ----

-       case OR_OR:

-       case '&':

- +     case WHILE:

-       case DO:

- +     case UNTIL:

- +     case IF:

-       case THEN:

- +     case ELIF:

-       case ELSE:

-       case '{':		/* } */

- !     case '(':		/* )( */

- !     case ')':		/* only valid in case statement */

-       case BANG:		/* ! time pipeline */

-       case TIME:		/* time time pipeline */

@@ -1,18 +0,0 @@ 

- *** ../bash-4.3-patched/lib/readline/misc.c	2012-09-01 18:03:11.000000000 -0400

- --- lib/readline/misc.c	2014-06-30 13:41:19.000000000 -0400

- ***************

- *** 462,465 ****

- --- 462,466 ----

-   	  /* Set up rl_line_buffer and other variables from history entry */

-   	  rl_replace_from_history (entry, 0);	/* entry->line is now current */

- + 	  entry->data = 0;			/* entry->data is now current undo list */

-   	  /* Undo all changes to this history entry */

-   	  while (rl_undo_list)

- ***************

- *** 469,473 ****

-   	  FREE (entry->line);

-   	  entry->line = savestring (rl_line_buffer);

- - 	  entry->data = 0;

-   	}

-         entry = previous_history ();

- --- 470,473 ----

@@ -1,31 +0,0 @@ 

- diff --git a/execute_cmd.h b/execute_cmd.h

- --- a/execute_cmd.h

- +++ b/execute_cmd.h

- @@ -37,6 +37,9 @@ struct func_array_state

-    };

-  #endif

-  

- +/* Variables delared in execute_cmd.c, used by many other files */

- +extern int executing_command_builtin;

- +

-  extern struct fd_bitmap *new_fd_bitmap __P((int));

-  extern void dispose_fd_bitmap __P((struct fd_bitmap *));

-  extern void close_fd_bitmap __P((struct fd_bitmap *));

- diff --git a/subst.c b/subst.c

- --- a/subst.c

- +++ b/subst.c

- @@ -10676,11 +10676,12 @@ expand_word_list_internal (list, eflags)

-  		  tint = do_word_assignment (temp_list->word, 0);

-  		  this_command_name = savecmd;

-  		  /* Variable assignment errors in non-interactive shells

- -		     running in Posix.2 mode cause the shell to exit. */

- +		     running in Posix.2 mode cause the shell to exit, unless 

- +		     they are being run by the `command' builtin. */

-  		  if (tint == 0)

-  		    {

-  		      last_command_exit_value = EXECUTION_FAILURE;

- -		      if (interactive_shell == 0 && posixly_correct)

- +		      if (interactive_shell == 0 && posixly_correct && executing_command_builtin == 0)

-  			exp_jump_to_top_level (FORCE_EOF);

-  		      else

-  			exp_jump_to_top_level (DISCARD);

@@ -1,18 +0,0 @@ 

- diff --git a/parse.y b/parse.y

- --- a/parse.y

- +++ b/parse.y

- @@ -4011,11 +4011,13 @@ eof_error:

-  		  tflags |= LEX_RESWDOK;

-  		  lex_rwlen = 0;

-  		}

- -	       else

- +	       else if (shellmeta (ch) == 0)

-  		{

-  		  tflags &= ~LEX_RESWDOK;

-  /*itrace("parse_comsub:%d: found `%.4s', lex_reswdok -> 0", line_number, ret+retind-4);*/

-  		}

- +	      else	/* can't be in a reserved word any more */

- +	        lex_rwlen = 0;

-  	    }

-  	  else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))

-  	    ;	/* don't modify LEX_RESWDOK if we're starting a comment */

file removed
-203

@@ -1,203 +0,0 @@ 

- diff --git a/builtins/fc.def b/builtins/fc.def

- index fe16471..98c53db 100644

- --- a/builtins/fc.def

- +++ b/builtins/fc.def

- @@ -423,6 +423,7 @@ fc_builtin (list)

-      {

-        sh_wrerror ();

-        fclose (stream);

- +      FREE (fn);

-        return (EXECUTION_FAILURE);

-      }

-    fclose (stream);

- diff --git a/execute_cmd.c b/execute_cmd.c

- index 63a332a..15b5e19 100644

- --- a/execute_cmd.c

- +++ b/execute_cmd.c

- @@ -2196,8 +2196,10 @@ coproc_setvars (cp)

-    if (v == 0)

-      {

-        v = find_variable_nameref_for_create (cp->c_name, 1);

- -      if (v == INVALID_NAMEREF_VALUE)

- -	return;

- +      if (v == INVALID_NAMEREF_VALUE) {

- +        free (namevar);

- +        return;

- +      }

-        if (v && nameref_p (v))

-  	{

-  	  free (cp->c_name);

- @@ -2210,6 +2212,7 @@ coproc_setvars (cp)

-      {

-        if (readonly_p (v))

-  	err_readonly (cp->c_name);

- +      free (namevar);

-        return;

-      }

-    if (v == 0)

- @@ -5528,7 +5531,6 @@ shell_execve (command, args, env)

-  	      char *interp;

-  	      int ilen;

-  

- -              close (fd);

-  	      interp = getinterp (sample, sample_len, (int *)NULL);

-  	      ilen = strlen (interp);

-  	      errno = i;

- diff --git a/expr.c b/expr.c

- index 172964a..5dc57c0 100644

- --- a/expr.c

- +++ b/expr.c

- @@ -207,7 +207,8 @@ static intmax_t exp5 __P((void));

-  static intmax_t exp4 __P((void));

-  static intmax_t expshift __P((void));

-  static intmax_t exp3 __P((void));

- -static intmax_t exp2 __P((void));

- +/* Avoid name clash with standard exp2 */

- +static intmax_t bash_exp2 __P((void));

-  static intmax_t	exppower __P((void));

-  static intmax_t exp1 __P((void));

-  static intmax_t exp0 __P((void));

- @@ -809,14 +810,14 @@ exp3 ()

-  {

-    register intmax_t val1, val2;

-  

- -  val1 = exp2 ();

- +  val1 = bash_exp2 ();

-  

-    while ((curtok == PLUS) || (curtok == MINUS))

-      {

-        int op = curtok;

-  

-        readtok ();

- -      val2 = exp2 ();

- +      val2 = bash_exp2 ();

-  

-        if (op == PLUS)

-  	val1 += val2;

- @@ -828,7 +829,7 @@ exp3 ()

-  }

-  

-  static intmax_t

- -exp2 ()

- +bash_exp2 ()

-  {

-    register intmax_t val1, val2;

-  #if defined (HAVE_IMAXDIV)

- diff --git a/lib/glob/glob.c b/lib/glob/glob.c

- index 7f6eafe..c018e29 100644

- --- a/lib/glob/glob.c

- +++ b/lib/glob/glob.c

- @@ -576,7 +576,7 @@ glob_vector (pat, dir, flags)

-    register char *nextname, *npat, *subdir;

-    unsigned int count;

-    int lose, skip, ndirs, isdir, sdlen, add_current, patlen;

- -  register char **name_vector;

- +  register char **name_vector = NULL;

-    register unsigned int i;

-    int mflags;		/* Flags passed to strmatch (). */

-    int pflags;		/* flags passed to sh_makepath () */

- @@ -894,7 +894,7 @@ glob_vector (pat, dir, flags)

-  	}

-  

-        /* Don't call QUIT; here; let higher layers deal with it. */

- -

- +      FREE (name_vector);

-        return ((char **)NULL);

-      }

-  

- diff --git a/lib/sh/pathcanon.c b/lib/sh/pathcanon.c

- index f19bd55..2a565d6 100644

- --- a/lib/sh/pathcanon.c

- +++ b/lib/sh/pathcanon.c

- @@ -227,7 +227,7 @@ sh_canonpath (path, flags)

-        if (result[2] == '\0')	/* short-circuit for bare `//' */

-  	result[1] = '\0';

-        else

- -	strcpy (result, result + 1);

- +	memmove(result, result + 1, strlen(result + 1) + 1);

-      }

-  

-    return (result);

- diff --git a/lib/sh/pathphys.c b/lib/sh/pathphys.c

- index 26016b7..b64c4cd 100644

- --- a/lib/sh/pathphys.c

- +++ b/lib/sh/pathphys.c

- @@ -245,7 +245,7 @@ error:

-        if (result[2] == '\0')	/* short-circuit for bare `//' */

-  	result[1] = '\0';

-        else

- -	strcpy (result, result + 1);

- +	memmove(result, result + 1, strlen(result + 1) + 1);

-      }

-  

-    return (result);

- diff --git a/shell.c b/shell.c

- index b43de50..4aae182 100644

- --- a/shell.c

- +++ b/shell.c

- @@ -1948,8 +1948,10 @@ show_shell_usage (fp, extra)

-    fputs (_("\t-ilrsD or -c command or -O shopt_option\t\t(invocation only)\n"), fp);

-  

-    for (i = 0, set_opts = 0; shell_builtins[i].name; i++)

- -    if (STREQ (shell_builtins[i].name, "set"))

- +    if (STREQ (shell_builtins[i].name, "set")) {

-        set_opts = savestring (shell_builtins[i].short_doc);

- +      break;

- +    }

-    if (set_opts)

-      {

-        s = strchr (set_opts, '[');

- diff --git a/subst.c b/subst.c

- index 5f3e41e..7574617 100644

- --- a/subst.c

- +++ b/subst.c

- @@ -5182,8 +5182,11 @@ parameter_list_transform (xc, itype, quoted)

-    list = list_rest_of_args ();

-    if (list == 0)

-      return ((char *)NULL);

- -  if (xc == 'A')

- -    return (pos_params_assignment (list, itype, quoted));

- +  if (xc == 'A') {

- +      ret = pos_params_assignment (list, itype, quoted);

- +      dispose_words (list);

- +      return (ret);

- +  }

-    ret = list_transform (xc, (SHELL_VAR *)0, list, itype, quoted);

-    dispose_words (list);

-    return (ret);

- @@ -6813,6 +6816,7 @@ parameter_brace_expand_rhs (name, value, c, quoted, pflags, qdollaratp, hasdolla

-  	{

-  	  report_error (_("%s: invalid indirect expansion"), name);

-  	  free (vname);

- +      free (t1);

-  	  dispose_word (w);

-  	  return &expand_wdesc_error;

-  	}

- @@ -6820,6 +6824,7 @@ parameter_brace_expand_rhs (name, value, c, quoted, pflags, qdollaratp, hasdolla

-  	{

-  	  report_error (_("%s: invalid variable name"), vname);

-  	  free (vname);

- +      free (t1);

-  	  dispose_word (w);

-  	  return &expand_wdesc_error;

-  	}

- diff --git a/support/man2html.c b/support/man2html.c

- index 6ba5061..1d9e376 100644

- --- a/support/man2html.c

- +++ b/support/man2html.c

- @@ -522,6 +522,7 @@ read_man_page(char *filename)

-  			man_buf[buf_size] = '\n';

-  			man_buf[buf_size + 1] = man_buf[buf_size + 2] = '\0';

-  		} else {

- +            free (man_buf);

-  			man_buf = NULL;

-  		}

-  		fclose(man_stream);

- @@ -2562,7 +2563,6 @@ scan_request(char *c)

-  					h = name;

-  				if (stat(h, &stbuf) != -1)

-  					l = stbuf.st_size;

- -				buf = stralloc(l + 4);

-  #if NOCGI

-  				if (!out_length) {

-  					char   *t, *s;

file removed
-49

@@ -1,49 +0,0 @@ 

- From 8ddc8d6e3a3d85eec6d4ba9b9ed2bc36bce56716 Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Mon, 14 Nov 2016 14:26:51 -0500

- Subject: [PATCH] Bash-4.4 patch 1

- 

- ---

-  lib/readline/history.c | 6 +++++-

-  patchlevel.h           | 2 +-

-  2 files changed, 6 insertions(+), 2 deletions(-)

- 

- diff --git a/lib/readline/history.c b/lib/readline/history.c

- index 3b8dbc5..9ff25a7 100644

- --- a/lib/readline/history.c

- +++ b/lib/readline/history.c

- @@ -57,6 +57,8 @@ extern int errno;

-  /* How big to make the_history when we first allocate it. */

-  #define DEFAULT_HISTORY_INITIAL_SIZE	502

-  

- +#define MAX_HISTORY_INITIAL_SIZE	8192

- +

-  /* The number of slots to increase the_history by. */

-  #define DEFAULT_HISTORY_GROW_SIZE 50

-  

- @@ -307,7 +309,9 @@ add_history (string)

-        if (history_size == 0)

-  	{

-  	  if (history_stifled && history_max_entries > 0)

- -	    history_size = history_max_entries + 2;

- +	    history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE)

- +				? MAX_HISTORY_INITIAL_SIZE

- +				: history_max_entries + 2;

-  	  else

-  	    history_size = DEFAULT_HISTORY_INITIAL_SIZE;

-  	  the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));

- diff --git a/patchlevel.h b/patchlevel.h

- index 1cd7c96..40db1a3 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.9.3

- 

file removed
-39

@@ -1,39 +0,0 @@ 

- From 5b9762d6f0cd36ff1b88bde22efa30ad0ed27ec6 Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Fri, 20 Jan 2017 15:38:38 -0500

- Subject: [PATCH] Bash-4.4 patch 10

- 

- ---

-  builtins/read.def | 3 ++-

-  patchlevel.h      | 2 +-

-  2 files changed, 3 insertions(+), 2 deletions(-)

- 

- diff --git a/builtins/read.def b/builtins/read.def

- index 48fda33..33821f3 100644

- --- a/builtins/read.def

- +++ b/builtins/read.def

- @@ -181,7 +181,8 @@ read_builtin (list)

-       WORD_LIST *list;

-  {

-    register char *varname;

- -  int size, i, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2;

- +  int size, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2;

- +  volatile int i;

-    int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul;

-    int raw, edit, nchars, silent, have_timeout, ignore_delim, fd, lastsig, t_errno;

-    unsigned int tmsec, tmusec;

- diff --git a/patchlevel.h b/patchlevel.h

- index 02f1d60..8002af7 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 9

- +#define PATCHLEVEL 10

-  

-  #endif /* _PATCHLEVEL_H_ */

- -- 

- 2.9.3

- 

file removed
-39

@@ -1,39 +0,0 @@ 

- From 76bb456d8fcd870cd31b7bf9d90798cd97cee2ab Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Fri, 20 Jan 2017 15:38:49 -0500

- Subject: [PATCH] Bash-4.4 patch 11

- 

- ---

-  patchlevel.h | 2 +-

-  sig.c        | 3 ++-

-  2 files changed, 3 insertions(+), 2 deletions(-)

- 

- diff --git a/patchlevel.h b/patchlevel.h

- index 8002af7..772676c 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 10

- +#define PATCHLEVEL 11

-  

-  #endif /* _PATCHLEVEL_H_ */

- diff --git a/sig.c b/sig.c

- index ad01631..e5bb739 100644

- --- a/sig.c

- +++ b/sig.c

- @@ -585,7 +585,8 @@ termsig_handler (sig)

-  #if defined (JOB_CONTROL)

-    if (sig == SIGHUP && (interactive || (subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB))))

-      hangup_all_jobs ();

- -  end_job_control ();

- +  if ((subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB)) == 0)

- +    end_job_control ();

-  #endif /* JOB_CONTROL */

-  

-  #if defined (PROCESS_SUBSTITUTION)

- -- 

- 2.9.3

- 

file removed
-119

@@ -1,119 +0,0 @@ 

- From bc007799f0e1362100375bb95d952d28de4c62fb Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Fri, 27 Jan 2017 11:25:44 -0500

- Subject: [PATCH] Bash-4.4 patch 12

- 

- ---

-  patchlevel.h |  2 +-

-  subst.c      | 32 ++++++++++++++++++++------------

-  2 files changed, 21 insertions(+), 13 deletions(-)

- 

- diff --git a/patchlevel.h b/patchlevel.h

- index 772676c..93dbe0d 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 11

- +#define PATCHLEVEL 12

-  

-  #endif /* _PATCHLEVEL_H_ */

- diff --git a/subst.c b/subst.c

- index 027a13e..dbf0157 100644

- --- a/subst.c

- +++ b/subst.c

- @@ -2825,11 +2825,15 @@ list_string (string, separators, quoted)

-  

-  /* Parse a single word from STRING, using SEPARATORS to separate fields.

-     ENDPTR is set to the first character after the word.  This is used by

- -   the `read' builtin.  This is never called with SEPARATORS != $IFS;

- -   it should be simplified.

- +   the `read' builtin.

- +   

- +   This is never called with SEPARATORS != $IFS, and takes advantage of that.

-  

-     XXX - this function is very similar to list_string; they should be

-  	 combined - XXX */

- +

- +#define islocalsep(c)	(local_cmap[(unsigned char)(c)] != 0)

- +

-  char *

-  get_word_from_string (stringp, separators, endptr)

-       char **stringp, *separators, **endptr;

- @@ -2837,6 +2841,7 @@ get_word_from_string (stringp, separators, endptr)

-    register char *s;

-    char *current_word;

-    int sindex, sh_style_split, whitesep, xflags;

- +  unsigned char local_cmap[UCHAR_MAX+1];	/* really only need single-byte chars here */

-    size_t slen;

-  

-    if (!stringp || !*stringp || !**stringp)

- @@ -2846,20 +2851,23 @@ get_word_from_string (stringp, separators, endptr)

-  				 separators[1] == '\t' &&

-  				 separators[2] == '\n' &&

-  				 separators[3] == '\0';

- -  for (xflags = 0, s = ifs_value; s && *s; s++)

- +  memset (local_cmap, '\0', sizeof (local_cmap));

- +  for (xflags = 0, s = separators; s && *s; s++)

-      {

-        if (*s == CTLESC) xflags |= SX_NOCTLESC;

-        if (*s == CTLNUL) xflags |= SX_NOESCCTLNUL;

- +      local_cmap[(unsigned char)*s] = 1;	/* local charmap of separators */

-      }

-  

-    s = *stringp;

-    slen = 0;

-  

-    /* Remove sequences of whitespace at the beginning of STRING, as

- -     long as those characters appear in IFS. */

- -  if (sh_style_split || !separators || !*separators)

- +     long as those characters appear in SEPARATORS.  This happens if

- +     SEPARATORS == $' \t\n' or if IFS is unset. */

- +  if (sh_style_split || separators == 0)

-      {

- -      for (; *s && spctabnl (*s) && isifs (*s); s++);

- +      for (; *s && spctabnl (*s) && islocalsep (*s); s++);

-  

-        /* If the string is nothing but whitespace, update it and return. */

-        if (!*s)

- @@ -2878,9 +2886,9 @@ get_word_from_string (stringp, separators, endptr)

-  

-       This obeys the field splitting rules in Posix.2. */

-    sindex = 0;

- -  /* Don't need string length in ADVANCE_CHAR or string_extract_verbatim

- -     unless multibyte chars are possible. */

- -  slen = (MB_CUR_MAX > 1) ? STRLEN (s) : 1;

- +  /* Don't need string length in ADVANCE_CHAR unless multibyte chars are

- +     possible, but need it in string_extract_verbatim for bounds checking */

- +  slen = STRLEN (s);

-    current_word = string_extract_verbatim (s, slen, &sindex, separators, xflags);

-  

-    /* Set ENDPTR to the first character after the end of the word. */

- @@ -2899,19 +2907,19 @@ get_word_from_string (stringp, separators, endptr)

-  

-    /* Now skip sequences of space, tab, or newline characters if they are

-       in the list of separators. */

- -  while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex]))

- +  while (s[sindex] && spctabnl (s[sindex]) && islocalsep (s[sindex]))

-      sindex++;

-  

-    /* If the first separator was IFS whitespace and the current character is

-       a non-whitespace IFS character, it should be part of the current field

-       delimiter, not a separate delimiter that would result in an empty field.

-       Look at POSIX.2, 3.6.5, (3)(b). */

- -  if (s[sindex] && whitesep && isifs (s[sindex]) && !spctabnl (s[sindex]))

- +  if (s[sindex] && whitesep && islocalsep (s[sindex]) && !spctabnl (s[sindex]))

-      {

-        sindex++;

-        /* An IFS character that is not IFS white space, along with any adjacent

-  	 IFS white space, shall delimit a field. */

- -      while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex]))

- +      while (s[sindex] && spctabnl (s[sindex]) && islocalsep(s[sindex]))

-  	sindex++;

-      }

-  

- -- 

- 2.9.3

- 

file removed
-38

@@ -1,38 +0,0 @@ 

- From 1aef9c7b55dcef4af239caf93e01419e1c8e04ad Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Mon, 29 Jan 2018 16:03:33 -0500

- Subject: [PATCH] Bash-4.4 patch 13

- 

- ---

-  patchlevel.h | 2 +-

-  redir.c      | 2 ++

-  2 files changed, 3 insertions(+), 1 deletion(-)

- 

- diff --git a/patchlevel.h b/patchlevel.h

- index 93dbe0db..779671cd 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 12

- +#define PATCHLEVEL 13

-  

-  #endif /* _PATCHLEVEL_H_ */

- diff --git a/redir.c b/redir.c

- index 25488eaf..1858b0b0 100644

- --- a/redir.c

- +++ b/redir.c

- @@ -469,6 +469,8 @@ here_document_to_fd (redirectee, ri)

-        return (fd);

-      }

-  

- +  SET_CLOSE_ON_EXEC (fd);

- +

-    errno = r = 0;		/* XXX */

-    /* write_here_document returns 0 on success, errno on failure. */

-    if (redirectee->word)

- -- 

- 2.13.6

- 

file removed
-85

@@ -1,85 +0,0 @@ 

- From 2fb21d75bfddd724b0e45d4a51455a166467e496 Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Mon, 29 Jan 2018 16:03:47 -0500

- Subject: [PATCH] Bash-4.4 patch 14

- 

- ---

-  execute_cmd.c | 19 ++++++++++++++++---

-  patchlevel.h  |  2 +-

-  2 files changed, 17 insertions(+), 4 deletions(-)

- 

- diff --git a/execute_cmd.c b/execute_cmd.c

- index 2a3df6d6..76a80766 100644

- --- a/execute_cmd.c

- +++ b/execute_cmd.c

- @@ -726,6 +726,8 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,

-      {

-        ofifo = num_fifos ();

-        ofifo_list = copy_fifo_list ((int *)&osize);

- +      begin_unwind_frame ("internal_fifos");

- +      add_unwind_protect (xfree, ofifo_list);

-        saved_fifo = 1;

-      }

-    else

- @@ -741,7 +743,10 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,

-        dispose_exec_redirects ();

-  #if defined (PROCESS_SUBSTITUTION)

-        if (saved_fifo)

- -	free ((void *)ofifo_list);

- +        {

- +	  free ((void *)ofifo_list);

- +	  discard_unwind_frame ("internal_fifos");

- +        }

-  #endif

-        return (last_command_exit_value = EXECUTION_FAILURE);

-      }

- @@ -1060,6 +1065,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,

-        if (nfifo > ofifo)

-  	close_new_fifos ((char *)ofifo_list, osize);

-        free ((void *)ofifo_list);

- +      discard_unwind_frame ("internal_fifos");

-      }

-  #endif

-  

- @@ -4977,9 +4983,14 @@ execute_builtin_or_function (words, builtin, var, redirects,

-    char *ofifo_list;

-  #endif

-  

- -#if defined (PROCESS_SUBSTITUTION)  

- +#if defined (PROCESS_SUBSTITUTION)

- +  begin_unwind_frame ("saved_fifos");

- +  /* If we return, we longjmp and don't get a chance to restore the old

- +     fifo list, so we add an unwind protect to free it */

-    ofifo = num_fifos ();

-    ofifo_list = copy_fifo_list (&osize);

- +  if (ofifo_list)

- +    add_unwind_protect (xfree, ofifo_list);

-  #endif

-  

-    if (do_redirections (redirects, RX_ACTIVE|RX_UNDOABLE) != 0)

- @@ -5063,7 +5074,9 @@ execute_builtin_or_function (words, builtin, var, redirects,

-    nfifo = num_fifos ();

-    if (nfifo > ofifo)

-      close_new_fifos (ofifo_list, osize);

- -  free (ofifo_list);

- +  if (ofifo_list)

- +    free (ofifo_list);

- +  discard_unwind_frame ("saved_fifos");

-  #endif

-  

-    return (result);

- diff --git a/patchlevel.h b/patchlevel.h

- index 779671cd..09a3cc84 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 13

- +#define PATCHLEVEL 14

-  

-  #endif /* _PATCHLEVEL_H_ */

- -- 

- 2.13.6

- 

file removed
-38

@@ -1,38 +0,0 @@ 

- From 9cce630e80008e74fa9a1d9408367341caf363f2 Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Mon, 29 Jan 2018 16:04:01 -0500

- Subject: [PATCH] Bash-4.4 patch 15

- 

- ---

-  patchlevel.h | 2 +-

-  subst.c      | 2 ++

-  2 files changed, 3 insertions(+), 1 deletion(-)

- 

- diff --git a/patchlevel.h b/patchlevel.h

- index 09a3cc84..6e9ed3fc 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 14

- +#define PATCHLEVEL 15

-  

-  #endif /* _PATCHLEVEL_H_ */

- diff --git a/subst.c b/subst.c

- index dbf0157e..fc00cab0 100644

- --- a/subst.c

- +++ b/subst.c

- @@ -5906,6 +5906,8 @@ process_substitute (string, open_for_read_in_child)

-       parent. */

-    expanding_redir = 0;

-  

- +  remove_quoted_escapes (string);

- +

-    subshell_level++;

-    result = parse_and_execute (string, "process substitution", (SEVAL_NONINT|SEVAL_NOHIST));

-    subshell_level--;

- -- 

- 2.13.6

- 

file removed
-68

@@ -1,68 +0,0 @@ 

- From c9f1b04651dae16e33f0aa8974c5122e26b362ae Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Mon, 29 Jan 2018 16:04:20 -0500

- Subject: [PATCH] Bash-4.4 patch 16

- 

- ---

-  lib/sh/zread.c | 23 +++++++++--------------

-  patchlevel.h   |  2 +-

-  2 files changed, 10 insertions(+), 15 deletions(-)

- 

- diff --git a/lib/sh/zread.c b/lib/sh/zread.c

- index 868f9705..496f20b8 100644

- --- a/lib/sh/zread.c

- +++ b/lib/sh/zread.c

- @@ -37,7 +37,10 @@ extern int errno;

-  #  define SEEK_CUR 1

-  #endif

-  

- +extern int executing_builtin;

- +

-  extern void check_signals_and_traps (void);

- +extern void check_signals (void);

-  extern int signal_is_trapped (int);

-  

-  /* Read LEN bytes from FD into BUF.  Retry the read on EINTR.  Any other

- @@ -50,21 +53,13 @@ zread (fd, buf, len)

-  {

-    ssize_t r;

-  

- -#if 0

- -#if defined (HAVE_SIGINTERRUPT)

- -  if (signal_is_trapped (SIGCHLD))

- -    siginterrupt (SIGCHLD, 1);

- -#endif

- -#endif

- -

-    while ((r = read (fd, buf, len)) < 0 && errno == EINTR)

- -    check_signals_and_traps ();	/* XXX - should it be check_signals()? */

- -

- -#if 0 

- -#if defined (HAVE_SIGINTERRUPT)

- -  siginterrupt (SIGCHLD, 0);

- -#endif

- -#endif

- +    /* XXX - bash-5.0 */

- +    /* We check executing_builtin and run traps here for backwards compatibility */

- +    if (executing_builtin)

- +      check_signals_and_traps ();	/* XXX - should it be check_signals()? */

- +    else

- +      check_signals ();

-  

-    return r;

-  }

- diff --git a/patchlevel.h b/patchlevel.h

- index 6e9ed3fc..9074f4dd 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 15

- +#define PATCHLEVEL 16

-  

-  #endif /* _PATCHLEVEL_H_ */

- -- 

- 2.13.6

- 

file removed
-41

@@ -1,41 +0,0 @@ 

- From b3a5ec8dd510a68dc850f3f516c0cf9afd87451f Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Mon, 29 Jan 2018 16:04:37 -0500

- Subject: [PATCH] Bash-4.4 patch 17

- 

- ---

-  builtins/read.def | 5 +++++

-  patchlevel.h      | 2 +-

-  2 files changed, 6 insertions(+), 1 deletion(-)

- 

- diff --git a/builtins/read.def b/builtins/read.def

- index 33821f3f..803bea35 100644

- --- a/builtins/read.def

- +++ b/builtins/read.def

- @@ -690,6 +690,11 @@ add_char:

-    input_string[i] = '\0';

-    CHECK_ALRM;

-  

- +#if defined (READLINE)

- +  if (edit)

- +    free (rlbuf);

- +#endif

- +

-    if (retval < 0)

-      {

-        t_errno = errno;

- diff --git a/patchlevel.h b/patchlevel.h

- index 9074f4dd..98e714da 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 16

- +#define PATCHLEVEL 17

-  

-  #endif /* _PATCHLEVEL_H_ */

- -- 

- 2.13.6

- 

file removed
-38

@@ -1,38 +0,0 @@ 

- From eb78197af36bb0fb95493ebf8fce104be6832ec9 Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Mon, 29 Jan 2018 16:04:56 -0500

- Subject: [PATCH] Bash-4.4 patch 18

- 

- ---

-  builtins/read.def | 2 +-

-  patchlevel.h      | 2 +-

-  2 files changed, 2 insertions(+), 2 deletions(-)

- 

- diff --git a/builtins/read.def b/builtins/read.def

- index 803bea35..b54b3af6 100644

- --- a/builtins/read.def

- +++ b/builtins/read.def

- @@ -610,7 +610,7 @@ read_builtin (list)

-  	}

-  

-        CHECK_ALRM;

- -

- +      QUIT;		/* in case we didn't call check_signals() */

-  #if defined (READLINE)

-  	}

-  #endif

- diff --git a/patchlevel.h b/patchlevel.h

- index 98e714da..f0ee56e4 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 17

- +#define PATCHLEVEL 18

-  

-  #endif /* _PATCHLEVEL_H_ */

- -- 

- 2.13.6

- 

file removed
-40

@@ -1,40 +0,0 @@ 

- From b0776d8c49ab4310fa056ce1033985996c5b9807 Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Tue, 6 Feb 2018 16:22:34 -0500

- Subject: [PATCH] Bash-4.4 patch 19

- 

- ---

-  lib/readline/display.c | 4 +++-

-  patchlevel.h           | 2 +-

-  2 files changed, 4 insertions(+), 2 deletions(-)

- 

- diff --git a/lib/readline/display.c b/lib/readline/display.c

- index 41fb0531..2d2e768a 100644

- --- a/lib/readline/display.c

- +++ b/lib/readline/display.c

- @@ -771,7 +771,9 @@ rl_redisplay ()

-  	 appear in the first and last lines of the prompt */

-        wadjust = (newlines == 0)

-  		  ? prompt_invis_chars_first_line

- -		  : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line);

- +		  : ((newlines == prompt_lines_estimate)

- +		  	? (wrap_offset - prompt_invis_chars_first_line)

- +		  	: 0);

-  

-        /* fix from Darin Johnson <darin@acuson.com> for prompt string with

-           invisible characters that is longer than the screen width.  The

- diff --git a/patchlevel.h b/patchlevel.h

- index f0ee56e4..a711c495 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 18

- +#define PATCHLEVEL 19

-  

-  #endif /* _PATCHLEVEL_H_ */

- -- 

- 2.13.6

- 

file removed
-59

@@ -1,59 +0,0 @@ 

- From 280bd77d8d3e7f7c90c9fa07de3d1e8f8e18ac29 Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Mon, 14 Nov 2016 14:27:06 -0500

- Subject: [PATCH] Bash-4.4 patch 2

- 

- ---

-  patchlevel.h | 2 +-

-  subst.c      | 9 ++++++++-

-  2 files changed, 9 insertions(+), 2 deletions(-)

- 

- diff --git a/patchlevel.h b/patchlevel.h

- index 40db1a3..a988d85 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/subst.c b/subst.c

- index f1a4df1..4d498ef 100644

- --- a/subst.c

- +++ b/subst.c

- @@ -5931,6 +5931,7 @@ read_comsub (fd, quoted, rflag)

-    char *istring, buf[128], *bufp, *s;

-    int istring_index, istring_size, c, tflag, skip_ctlesc, skip_ctlnul;

-    ssize_t bufn;

- +  int nullbyte;

-  

-    istring = (char *)NULL;

-    istring_index = istring_size = bufn = tflag = 0;

- @@ -5938,6 +5939,8 @@ read_comsub (fd, quoted, rflag)

-    for (skip_ctlesc = skip_ctlnul = 0, s = ifs_value; s && *s; s++)

-      skip_ctlesc |= *s == CTLESC, skip_ctlnul |= *s == CTLNUL;

-  

- +  nullbyte = 0;

- +

-    /* Read the output of the command through the pipe.  This may need to be

-       changed to understand multibyte characters in the future. */

-    while (1)

- @@ -5956,7 +5959,11 @@ read_comsub (fd, quoted, rflag)

-        if (c == 0)

-  	{

-  #if 1

- -	  internal_warning ("%s", _("command substitution: ignored null byte in input"));

- +	  if (nullbyte == 0)

- +	    {

- +	      internal_warning ("%s", _("command substitution: ignored null byte in input"));

- +	      nullbyte = 1;

- +	    }

-  #endif

-  	  continue;

-  	}

- -- 

- 2.9.3

- 

file removed
-136

@@ -1,136 +0,0 @@ 

- From 354efb96f1e4574f458e994163bbe31c76769573 Mon Sep 17 00:00:00 2001

- From: Chet Ramey <chet.ramey@case.edu>

- Date: Fri, 1 Jun 2018 10:19:56 -0400

- Subject: [PATCH] saved background process status hash table loop fixes

- 

- ---

-  jobs.c       | 62 +++++++++++++++++++++++++++++++++++++++++++++++-------------

-  patchlevel.h |  2 +-

-  2 files changed, 50 insertions(+), 14 deletions(-)

- 

- diff --git a/jobs.c b/jobs.c

- index fc966036..2684632d 100644

- --- a/jobs.c

- +++ b/jobs.c

- @@ -812,8 +812,22 @@ bgp_add (pid, status)

-    ps_index_t *bucket, psi;

-    struct pidstat *ps;

-  

- -  bucket = pshash_getbucket (pid);

- -  psi = bgp_getindex ();

- +  /* bucket == existing chain of pids hashing to same value

- +     psi = where were going to put this pid/status */

- +

- +  bucket = pshash_getbucket (pid);	/* index into pidstat_table */

- +  psi = bgp_getindex ();		/* bgpids.head, index into storage */

- +

- +  /* XXX - what if psi == *bucket? */

- +  if (psi == *bucket)

- +    {

- +#ifdef DEBUG

- +      internal_warning ("hashed pid %d (pid %d) collides with bgpids.head, skipping", psi, pid);

- +#endif

- +      bgpids.storage[psi].pid = NO_PID;		/* make sure */

- +      psi = bgp_getindex ();			/* skip to next one */

- +    }

- +

-    ps = &bgpids.storage[psi];

-  

-    ps->pid = pid;

- @@ -841,32 +855,47 @@ pshash_delindex (psi)

-       ps_index_t psi;

-  {

-    struct pidstat *ps;

- +  ps_index_t *bucket;

-  

-    ps = &bgpids.storage[psi];

-    if (ps->pid == NO_PID)

-      return;

-  

- -  if (ps->bucket_next != NO_PID)

- +  if (ps->bucket_next != NO_PIDSTAT)

-      bgpids.storage[ps->bucket_next].bucket_prev = ps->bucket_prev;

- -  if (ps->bucket_prev != NO_PID)

- +  if (ps->bucket_prev != NO_PIDSTAT)

-      bgpids.storage[ps->bucket_prev].bucket_next = ps->bucket_next;

-    else

- -    *(pshash_getbucket (ps->pid)) = ps->bucket_next;

- +    {

- +      bucket = pshash_getbucket (ps->pid);

- +      *bucket = ps->bucket_next;	/* deleting chain head in hash table */

- +    }

- +

- +  /* clear out this cell, just in case */

- +  ps->pid = NO_PID;

- +  ps->bucket_next = ps->bucket_prev = NO_PIDSTAT;

-  }

-  

-  static int

-  bgp_delete (pid)

-       pid_t pid;

-  {

- -  ps_index_t psi;

- +  ps_index_t psi, orig_psi;

-  

-    if (bgpids.storage == 0 || bgpids.nalloc == 0 || bgpids.npid == 0)

-      return 0;

-  

-    /* Search chain using hash to find bucket in pidstat_table */

- -  for (psi = *(pshash_getbucket (pid)); psi != NO_PIDSTAT; psi = bgpids.storage[psi].bucket_next)

- -    if (bgpids.storage[psi].pid == pid)

- -      break;

- +  for (orig_psi = psi = *(pshash_getbucket (pid)); psi != NO_PIDSTAT; psi = bgpids.storage[psi].bucket_next)

- +    {

- +      if (bgpids.storage[psi].pid == pid)

- +	break;

- +      if (orig_psi == bgpids.storage[psi].bucket_next)	/* catch reported bug */

- +	{

- +	  internal_warning ("bgp_delete: LOOP: psi (%d) == storage[psi].bucket_next", psi);

- +	  return 0;

- +	}

- +    }

-  

-    if (psi == NO_PIDSTAT)

-      return 0;		/* not found */

- @@ -904,15 +933,22 @@ static int

-  bgp_search (pid)