[bash/f15/master] Patchlevel 5, fix bugs in previuos patches, some cleanup

Roman Rakus rrakus at fedoraproject.org
Tue Mar 1 14:06:08 UTC 2011


commit ee79c04b9f42658e8cbfe4487875839387cc2561
Author: Roman Rakus <rrakus at redhat.com>
Date:   Tue Mar 1 15:03:52 2011 +0100

    Patchlevel 5, fix bugs in previuos patches, some cleanup
    
    Signed-off-by: Roman Rakus <rrakus at redhat.com>

 bash-4.2-coverity.patch |   99 +++++++++++++++
 bash.spec               |   71 ++++++-----
 bash41-001              |   48 -------
 bash41-002              |   65 ----------
 bash41-003              |   48 -------
 bash41-004              |   47 -------
 bash41-005              |   56 --------
 bash41-006              |   76 -----------
 bash41-007              |   47 -------
 bash41-008              |   49 -------
 bash41-009              |   48 -------
 bash42-001              |   78 ++++++++++++
 bash42-002              |   60 +++++++++
 bash42-003              |  318 +++++++++++++++++++++++++++++++++++++++++++++++
 bash42-004              |   53 ++++++++
 bash42-005              |  131 +++++++++++++++++++
 patmatch.patch          |   18 ---
 17 files changed, 780 insertions(+), 532 deletions(-)
---
diff --git a/bash-4.2-coverity.patch b/bash-4.2-coverity.patch
new file mode 100644
index 0000000..5fc8456
--- /dev/null
+++ b/bash-4.2-coverity.patch
@@ -0,0 +1,99 @@
+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)
+ 		  Elf32_Ehdr ehdr;
+ 		  Elf32_Phdr *phdr;
+                   Elf32_Shdr *shdr;
+-		  int nphdr, nshdr;
++		  Elf32_Half nphdr, nshdr;
+ 
+ 		  /* 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)
+ 		  memcpy (&ehdr, sample, sizeof (Elf32_Ehdr));
+ 
+ 		  nshdr = ehdr.e_shnum;
+-		  shdr = (Elf32_Shdr *) malloc (nshdr * ehdr.e_shentsize);
++		  shdr = (Elf32_Shdr *) malloc ((size_t)nshdr * (size_t)ehdr.e_shentsize);
+                   
+ 		  if (shdr != NULL)
+ 		    {
+ #ifdef HAVE_PREAD
+-		      sample_len = pread (fd, shdr, nshdr * ehdr.e_shentsize,
++		      sample_len = pread (fd, shdr, (size_t)nshdr * (size_t)ehdr.e_shentsize,
+ 					  ehdr.e_shoff);
+ #else
+ 		      if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
+@@ -5091,11 +5091,11 @@ shell_execve (command, args, env)
+ 		    }
+ 
+ 		  nphdr = ehdr.e_phnum;
+-		  phdr = (Elf32_Phdr *) malloc (nphdr * ehdr.e_phentsize);
++		  phdr = (Elf32_Phdr *) malloc ((size_t)nphdr * (size_t)ehdr.e_phentsize);
+ 		  if (phdr != NULL)
+ 		    {
+ #ifdef HAVE_PREAD
+-		      sample_len = pread (fd, phdr, nphdr * ehdr.e_phentsize,
++		      sample_len = pread (fd, phdr, (size_t)nphdr * (size_t)ehdr.e_phentsize,
+ 					  ehdr.e_phoff);
+ #else
+ 		      if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
+@@ -5120,7 +5120,7 @@ shell_execve (command, args, env)
+ 		  Elf64_Ehdr ehdr;
+ 		  Elf64_Phdr *phdr;
+                   Elf64_Shdr *shdr;
+-		  int nphdr, nshdr;
++		  Elf32_Half nphdr, nshdr;
+ 
+ 		  /* 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)
+ 		  memcpy (&ehdr, sample, sizeof (Elf64_Ehdr));
+ 
+ 		  nshdr = ehdr.e_shnum;
+-		  shdr = (Elf64_Shdr *) malloc (nshdr * ehdr.e_shentsize);
++		  shdr = (Elf64_Shdr *) malloc ((size_t)nshdr * (size_t)ehdr.e_shentsize);
+ 		  if (shdr != NULL)
+ 		    {
+ #ifdef HAVE_PREAD
+-		      sample_len = pread (fd, shdr, nshdr * ehdr.e_shentsize,
++		      sample_len = pread (fd, shdr, (size_t)nshdr * (size_t)ehdr.e_shentsize,
+ 					  ehdr.e_shoff);
+ #else
+ 		      if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
+@@ -5174,11 +5174,11 @@ shell_execve (command, args, env)
+ 		    }
+ 
+ 		  nphdr = ehdr.e_phnum;
+-		  phdr = (Elf64_Phdr *) malloc (nphdr * ehdr.e_phentsize);
++		  phdr = (Elf64_Phdr *) malloc ((size_t)nphdr * (size_t)ehdr.e_phentsize);
+ 		  if (phdr != NULL)
+ 		    {
+ #ifdef HAVE_PREAD
+-		      sample_len = pread (fd, phdr, nphdr * ehdr.e_phentsize,
++		      sample_len = pread (fd, phdr, (size_t)nphdr * (size_t)ehdr.e_phentsize,
+ 					  ehdr.e_phoff);
+ #else
+ 		      if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
+@@ -5200,8 +5200,8 @@ shell_execve (command, args, env)
+ 
+ 	      if (offset != -1)
+ 		{
+-		  size_t maxlen = 0;
+-		  size_t actlen = 0;
++		  ssize_t maxlen = 0;
++		  ssize_t actlen = 0;
+ 		  char *interp = NULL;
+ 
+ 		  do
+@@ -5250,7 +5250,8 @@ shell_execve (command, args, env)
+ 	    }
+ #endif
+ #if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
+-	  close (fd);
++          if (fd >= 0)
++	    close (fd);
+ #endif
+ 	  errno = i;
+ 	  file_error (command);
diff --git a/bash.spec b/bash.spec
index b41373d..ddf6dbd 100644
--- a/bash.spec
+++ b/bash.spec
@@ -1,12 +1,12 @@
 #% define beta_tag rc2
-%define patchleveltag .0
+%define patchleveltag .5
 %define baseversion 4.2
 %bcond_without tests
 
 Version: %{baseversion}%{patchleveltag}
 Name: bash
 Summary: The GNU Bourne Again shell
-Release: 2%{?dist}
+Release: 1%{?dist}
 Group: System Environment/Shells
 License: GPLv3+
 Url: http://www.gnu.org/software/bash
@@ -20,7 +20,12 @@ Source2: dot-bash_profile
 Source3: dot-bash_logout
 
 # Official upstream patches
-# none yet
+Patch001: ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2-patches/bash42-001
+Patch002: ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2-patches/bash42-002
+Patch003: ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2-patches/bash42-003
+Patch004: ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2-patches/bash42-004
+Patch005: ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2-patches/bash42-005
+
 
 # Other patches
 Patch101: bash-2.02-security.patch
@@ -33,32 +38,29 @@ Patch107: bash-2.05b-pgrp_sync.patch
 Patch108: bash-2.05b-readline-oom.patch
 Patch109: bash-2.05b-xcc.patch
 Patch110: bash-3.2-audit.patch
-Patch112: bash-3.2-ssh_source_bash.patch
-Patch113: bash-bashbug.patch
-Patch115: bash-infotags.patch
-Patch116: bash-requires.patch
-Patch117: bash-setlocale.patch
-Patch118: bash-tty-tests.patch
+Patch111: bash-3.2-ssh_source_bash.patch
+Patch112: bash-bashbug.patch
+Patch113: bash-infotags.patch
+Patch114: bash-requires.patch
+Patch115: bash-setlocale.patch
+Patch116: bash-tty-tests.patch
 
 
 # 484809, check if interp section is NOBITS
-Patch123: bash-4.0-nobits.patch
+Patch117: bash-4.0-nobits.patch
 
 # Do the same CFLAGS in generated Makefile in examples
-Patch124: bash-4.1-examples.patch
+Patch118: bash-4.1-examples.patch
 
 # Builtins like echo and printf won't report errors
 # when output does not succeed due to EPIPE
-Patch126: bash-4.1-broken_pipe.patch
+Patch119: bash-4.1-broken_pipe.patch
 
 # Enable system-wide .bash_logout for login shells
-Patch127: bash-4.2-rc2-logout.patch
-
-# Patch from upstream, some pattern matching glitch
-# See http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00136.html
-Patch128: patmatch.patch
+Patch120: bash-4.2-rc2-logout.patch
 
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+# Static analyzis shows some issues in bash-2.05a-interpreter.patch
+Patch121: bash-4.2-coverity.patch
 
 BuildRequires: texinfo bison
 BuildRequires: ncurses-devel
@@ -85,7 +87,11 @@ This package contains documentation files for %{name}.
 %setup -q -n %{name}-%{baseversion}
 
 # Official upstream patches
-# none yet
+%patch001 -p0 -b .001
+%patch002 -p0 -b .002
+%patch003 -p0 -b .003
+%patch004 -p0 -b .004
+%patch005 -p0 -b .005
 
 # Other patches
 %patch101 -p1 -b .security
@@ -98,17 +104,17 @@ This package contains documentation files for %{name}.
 %patch108 -p1 -b .readline_oom
 %patch109 -p1 -b .xcc
 %patch110 -p1 -b .audit
-%patch112 -p1 -b .ssh_source_bash
-%patch113 -p1 -b .bashbug
-%patch115 -p1 -b .infotags
-%patch116 -p1 -b .requires
-%patch117 -p1 -b .setlocale
-%patch118 -p1 -b .tty_tests
-%patch123 -p1 -b .nobits
-%patch124 -p1 -b .examples
-%patch126 -p1 -b .broken_pipe
-%patch127 -p1 -b .logout
-%patch128 -p0 -b .patmatch
+%patch111 -p1 -b .ssh_source_bash
+%patch112 -p1 -b .bashbug
+%patch113 -p1 -b .infotags
+%patch114 -p1 -b .requires
+%patch115 -p1 -b .setlocale
+%patch116 -p1 -b .tty_tests
+%patch117 -p1 -b .nobits
+%patch118 -p1 -b .examples
+%patch119 -p1 -b .broken_pipe
+%patch120 -p1 -b .logout
+%patch121 -p1 -b .coverity
 
 echo %{version} > _distribution
 echo %{release} > _patchlevel
@@ -287,6 +293,11 @@ fi
 #%doc doc/*.ps doc/*.0 doc/*.html doc/article.txt
 
 %changelog
+* Tue Mar 01 2011 Roman Rakus <rrakus at redhat.com> - 4.2.5-1
+- Patchlevel 5
+- Static analyzis show some issues in some patches
+- Some cleanup
+
 * Wed Feb 16 2011 Roman Rakus <rrakus at redhat.com> - 4.2.0-2
 - pattern matching glitch, patch from upstream
 
diff --git a/bash42-001 b/bash42-001
new file mode 100644
index 0000000..547aaa0
--- /dev/null
+++ b/bash42-001
@@ -0,0 +1,78 @@
+			     BASH PATCH REPORT
+			     =================
+
+Bash-Release:	4.2
+Patch-ID:	bash42-001
+
+Bug-Reported-by:	Juergen Daubert <jue at jue.li>
+Bug-Reference-ID:	<20110214175132.GA19813 at jue.netz>
+Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00125.html
+
+Bug-Description:
+
+When running in Posix mode, bash does not correctly expand the right-hand
+side of a double-quoted word expansion containing single quotes.
+
+Patch (apply with `patch -p0'):
+
+*** ../bash-4.2-patched/subst.c	2011-01-02 16:12:51.000000000 -0500
+--- subst.c	2011-02-19 00:00:00.000000000 -0500
+***************
+*** 1380,1387 ****
+  
+    /* The handling of dolbrace_state needs to agree with the code in parse.y:
+!      parse_matched_pair() */
+!   dolbrace_state = 0;
+!   if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
+!     dolbrace_state = (flags & SX_POSIXEXP) ? DOLBRACE_QUOTE : DOLBRACE_PARAM;
+  
+    i = *sindex;
+--- 1380,1389 ----
+  
+    /* The handling of dolbrace_state needs to agree with the code in parse.y:
+!      parse_matched_pair().  The different initial value is to handle the
+!      case where this function is called to parse the word in
+!      ${param op word} (SX_WORD). */
+!   dolbrace_state = (flags & SX_WORD) ? DOLBRACE_WORD : DOLBRACE_PARAM;
+!   if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && (flags & SX_POSIXEXP))
+!     dolbrace_state = DOLBRACE_QUOTE;
+  
+    i = *sindex;
+***************
+*** 7177,7181 ****
+        /* Extract the contents of the ${ ... } expansion
+  	 according to the Posix.2 rules. */
+!       value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#') ? SX_POSIXEXP : 0);
+        if (string[sindex] == RBRACE)
+  	sindex++;
+--- 7181,7185 ----
+        /* Extract the contents of the ${ ... } expansion
+  	 according to the Posix.2 rules. */
+!       value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#' || c =='/' || c == '^' || c == ',' || c ==':') ? SX_POSIXEXP|SX_WORD : SX_WORD);
+        if (string[sindex] == RBRACE)
+  	sindex++;
+*** ../bash-4.2-patched/subst.h	2010-12-02 20:21:29.000000000 -0500
+--- subst.h	2011-02-16 21:12:09.000000000 -0500
+***************
+*** 57,60 ****
+--- 57,61 ----
+  #define SX_ARITHSUB	0x0080	/* extracting $(( ... )) (currently unused) */
+  #define SX_POSIXEXP	0x0100	/* extracting new Posix pattern removal expansions in extract_dollar_brace_string */
++ #define SX_WORD		0x0200	/* extracting word in ${param op word} */
+  
+  /* Remove backslashes which are quoting backquotes from STRING.  Modifies
+*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
+--- patchlevel.h	Thu Feb 24 21:41:34 2011
+***************
+*** 26,30 ****
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 0
+  
+  #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 1
+  
+  #endif /* _PATCHLEVEL_H_ */
diff --git a/bash42-002 b/bash42-002
new file mode 100644
index 0000000..077c7e0
--- /dev/null
+++ b/bash42-002
@@ -0,0 +1,60 @@
+			     BASH PATCH REPORT
+			     =================
+
+Bash-Release:	4.2
+Patch-ID:	bash42-002
+
+Bug-Reported-by:	Clark J. Wang <dearvoid at gmail.com>
+Bug-Reference-ID:	<AANLkTimGbW7aC4E5infXP6ku5WPci4t=xVc+L1SyHqrD at mail.gmail.com>
+Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00157.html
+
+Bug-Description:
+
+The readline vi-mode `cc', `dd', and `yy' commands failed to modify the
+entire line.
+
+Patch (apply with `patch -p0'):
+
+*** ../bash-4.2-patched/lib/readline/vi_mode.c	2010-11-20 19:51:39.000000000 -0500
+--- lib/readline/vi_mode.c	2011-02-17 20:24:25.000000000 -0500
+***************
+*** 1115,1119 ****
+        _rl_vi_last_motion = c;
+        RL_UNSETSTATE (RL_STATE_VIMOTION);
+!       return (0);
+      }
+  #if defined (READLINE_CALLBACKS)
+--- 1115,1119 ----
+        _rl_vi_last_motion = c;
+        RL_UNSETSTATE (RL_STATE_VIMOTION);
+!       return (vidomove_dispatch (m));
+      }
+  #if defined (READLINE_CALLBACKS)
+*** ../bash-4.2-patched/lib/readline/callback.c	2010-06-06 12:18:58.000000000 -0400
+--- lib/readline/callback.c	2011-02-17 20:43:28.000000000 -0500
+***************
+*** 149,152 ****
+--- 149,155 ----
+  	  /* Should handle everything, including cleanup, numeric arguments,
+  	     and turning off RL_STATE_VIMOTION */
++ 	  if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
++ 	    _rl_internal_char_cleanup ();
++ 
+  	  return;
+  	}
+*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
+--- patchlevel.h	Thu Feb 24 21:41:34 2011
+***************
+*** 26,30 ****
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 1
+  
+  #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 2
+  
+  #endif /* _PATCHLEVEL_H_ */
+
diff --git a/bash42-003 b/bash42-003
new file mode 100644
index 0000000..c488e96
--- /dev/null
+++ b/bash42-003
@@ -0,0 +1,318 @@
+			     BASH PATCH REPORT
+			     =================
+
+Bash-Release:	4.2
+Patch-ID:	bash42-003
+
+Bug-Reported-by:	Clark J. Wang <dearvoid at gmail.com>
+Bug-Reference-ID:	<AANLkTikZ_rVV-frR8Fh0PzhXnMKnm5XsUR-F3qtPPs5G at mail.gmail.com>
+Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00136.html
+
+Bug-Description:
+
+When using the pattern replacement and pattern removal word expansions, bash
+miscalculates the possible match length in the presence of an unescaped left
+bracket without a closing right bracket, resulting in a failure to match
+the pattern.
+
+Patch (apply with `patch -p0'):
+
+*** ../bash-4.2-patched/lib/glob/gmisc.c	2011-02-05 16:11:17.000000000 -0500
+--- lib/glob/gmisc.c	2011-02-18 23:53:42.000000000 -0500
+***************
+*** 78,83 ****
+       size_t wmax;
+  {
+!   wchar_t wc, *wbrack;
+!   int matlen, t, in_cclass, in_collsym, in_equiv;
+  
+    if (*wpat == 0)
+--- 78,83 ----
+       size_t wmax;
+  {
+!   wchar_t wc;
+!   int matlen, bracklen, t, in_cclass, in_collsym, in_equiv;
+  
+    if (*wpat == 0)
+***************
+*** 119,123 ****
+  	case L'[':
+  	  /* scan for ending `]', skipping over embedded [:...:] */
+! 	  wbrack = wpat;
+  	  wc = *wpat++;
+  	  do
+--- 119,123 ----
+  	case L'[':
+  	  /* scan for ending `]', skipping over embedded [:...:] */
+! 	  bracklen = 1;
+  	  wc = *wpat++;
+  	  do
+***************
+*** 125,140 ****
+  	      if (wc == 0)
+  		{
+! 	          matlen += wpat - wbrack - 1;	/* incremented below */
+! 	          break;
+  	        }
+  	      else if (wc == L'\\')
+  		{
+! 		  wc = *wpat++;
+! 		  if (*wpat == 0)
+! 		    break;
+  		}
+  	      else if (wc == L'[' && *wpat == L':')	/* character class */
+  		{
+  		  wpat++;
+  		  in_cclass = 1;
+  		}
+--- 125,148 ----
+  	      if (wc == 0)
+  		{
+! 		  wpat--;			/* back up to NUL */
+! 	          matlen += bracklen;
+! 	          goto bad_bracket;
+  	        }
+  	      else if (wc == L'\\')
+  		{
+! 		  /* *wpat == backslash-escaped character */
+! 		  bracklen++;
+! 		  /* If the backslash or backslash-escape ends the string,
+! 		     bail.  The ++wpat skips over the backslash escape */
+! 		  if (*wpat == 0 || *++wpat == 0)
+! 		    {
+! 		      matlen += bracklen;
+! 		      goto bad_bracket;
+! 		    }
+  		}
+  	      else if (wc == L'[' && *wpat == L':')	/* character class */
+  		{
+  		  wpat++;
++ 		  bracklen++;
+  		  in_cclass = 1;
+  		}
+***************
+*** 142,145 ****
+--- 150,154 ----
+  		{
+  		  wpat++;
++ 		  bracklen++;
+  		  in_cclass = 0;
+  		}
+***************
+*** 147,152 ****
+  		{
+  		  wpat++;
+  		  if (*wpat == L']')	/* right bracket can appear as collating symbol */
+! 		    wpat++;
+  		  in_collsym = 1;
+  		}
+--- 156,165 ----
+  		{
+  		  wpat++;
++ 		  bracklen++;
+  		  if (*wpat == L']')	/* right bracket can appear as collating symbol */
+! 		    {
+! 		      wpat++;
+! 		      bracklen++;
+! 		    }
+  		  in_collsym = 1;
+  		}
+***************
+*** 154,157 ****
+--- 167,171 ----
+  		{
+  		  wpat++;
++ 		  bracklen++;
+  		  in_collsym = 0;
+  		}
+***************
+*** 159,164 ****
+  		{
+  		  wpat++;
+  		  if (*wpat == L']')	/* right bracket can appear as equivalence class */
+! 		    wpat++;
+  		  in_equiv = 1;
+  		}
+--- 173,182 ----
+  		{
+  		  wpat++;
++ 		  bracklen++;
+  		  if (*wpat == L']')	/* right bracket can appear as equivalence class */
+! 		    {
+! 		      wpat++;
+! 		      bracklen++;
+! 		    }
+  		  in_equiv = 1;
+  		}
+***************
+*** 166,174 ****
+--- 184,196 ----
+  		{
+  		  wpat++;
++ 		  bracklen++;
+  		  in_equiv = 0;
+  		}
++ 	      else
++ 		bracklen++;
+  	    }
+  	  while ((wc = *wpat++) != L']');
+  	  matlen++;		/* bracket expression can only match one char */
++ bad_bracket:
+  	  break;
+  	}
+***************
+*** 214,219 ****
+       size_t max;
+  {
+!   char c, *brack;
+!   int matlen, t, in_cclass, in_collsym, in_equiv;
+  
+    if (*pat == 0)
+--- 236,241 ----
+       size_t max;
+  {
+!   char c;
+!   int matlen, bracklen, t, in_cclass, in_collsym, in_equiv;
+  
+    if (*pat == 0)
+***************
+*** 255,259 ****
+  	case '[':
+  	  /* scan for ending `]', skipping over embedded [:...:] */
+! 	  brack = pat;
+  	  c = *pat++;
+  	  do
+--- 277,281 ----
+  	case '[':
+  	  /* scan for ending `]', skipping over embedded [:...:] */
+! 	  bracklen = 1;
+  	  c = *pat++;
+  	  do
+***************
+*** 261,276 ****
+  	      if (c == 0)
+  		{
+! 	          matlen += pat - brack - 1;	/* incremented below */
+! 	          break;
+  	        }
+  	      else if (c == '\\')
+  		{
+! 		  c = *pat++;
+! 		  if (*pat == 0)
+! 		    break;
+  		}
+  	      else if (c == '[' && *pat == ':')	/* character class */
+  		{
+  		  pat++;
+  		  in_cclass = 1;
+  		}
+--- 283,306 ----
+  	      if (c == 0)
+  		{
+! 		  pat--;			/* back up to NUL */
+! 		  matlen += bracklen;
+! 		  goto bad_bracket;
+  	        }
+  	      else if (c == '\\')
+  		{
+! 		  /* *pat == backslash-escaped character */
+! 		  bracklen++;
+! 		  /* If the backslash or backslash-escape ends the string,
+! 		     bail.  The ++pat skips over the backslash escape */
+! 		  if (*pat == 0 || *++pat == 0)
+! 		    {
+! 		      matlen += bracklen;
+! 		      goto bad_bracket;
+! 		    }
+  		}
+  	      else if (c == '[' && *pat == ':')	/* character class */
+  		{
+  		  pat++;
++ 		  bracklen++;
+  		  in_cclass = 1;
+  		}
+***************
+*** 278,281 ****
+--- 308,312 ----
+  		{
+  		  pat++;
++ 		  bracklen++;
+  		  in_cclass = 0;
+  		}
+***************
+*** 283,288 ****
+  		{
+  		  pat++;
+  		  if (*pat == ']')	/* right bracket can appear as collating symbol */
+! 		    pat++;
+  		  in_collsym = 1;
+  		}
+--- 314,323 ----
+  		{
+  		  pat++;
++ 		  bracklen++;
+  		  if (*pat == ']')	/* right bracket can appear as collating symbol */
+! 		    {
+! 		      pat++;
+! 		      bracklen++;
+! 		    }
+  		  in_collsym = 1;
+  		}
+***************
+*** 290,293 ****
+--- 325,329 ----
+  		{
+  		  pat++;
++ 		  bracklen++;
+  		  in_collsym = 0;
+  		}
+***************
+*** 295,300 ****
+  		{
+  		  pat++;
+  		  if (*pat == ']')	/* right bracket can appear as equivalence class */
+! 		    pat++;
+  		  in_equiv = 1;
+  		}
+--- 331,340 ----
+  		{
+  		  pat++;
++ 		  bracklen++;
+  		  if (*pat == ']')	/* right bracket can appear as equivalence class */
+! 		    {
+! 		      pat++;
+! 		      bracklen++;
+! 		    }
+  		  in_equiv = 1;
+  		}
+***************
+*** 302,310 ****
+--- 342,354 ----
+  		{
+  		  pat++;
++ 		  bracklen++;
+  		  in_equiv = 0;
+  		}
++ 	      else
++ 		bracklen++;
+  	    }
+  	  while ((c = *pat++) != ']');
+  	  matlen++;		/* bracket expression can only match one char */
++ bad_bracket:
+  	  break;
+  	}
+*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
+--- patchlevel.h	Thu Feb 24 21:41:34 2011
+***************
+*** 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 --git a/bash42-004 b/bash42-004
new file mode 100644
index 0000000..fe29f82
--- /dev/null
+++ b/bash42-004
@@ -0,0 +1,53 @@
+			     BASH PATCH REPORT
+			     =================
+
+Bash-Release:	4.2
+Patch-ID:	bash42-004
+
+Bug-Reported-by:	Mike Frysinger <vapier at gentoo.org>
+Bug-Reference-ID:	<201102182106.17834.vapier at gentoo.org>
+Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00222.html
+
+Bug-Description:
+
+When used in contexts where word splitting and quote removal were not
+performed, such as pattern removal or pattern substitution, empty strings
+(either literal or resulting from quoted variables that were unset or
+null) were not matched correctly, resulting in failure.
+
+Patch (apply with `patch -p0'):
+
+*** ../bash-4.2-patched/subst.c	2011-01-02 16:12:51.000000000 -0500
+--- subst.c	2011-02-18 22:30:13.000000000 -0500
+***************
+*** 3373,3379 ****
+    if (string == 0 || *string == '\0')
+      return (WORD_LIST *)NULL;
+  
+!   td.flags = 0;
+    td.word = string;
+    tresult = call_expand_word_internal (&td, quoted, 1, dollar_at_p, has_dollar_at);
+    return (tresult);
+--- 3373,3379 ----
+    if (string == 0 || *string == '\0')
+      return (WORD_LIST *)NULL;
+  
+!   td.flags = W_NOSPLIT2;		/* no splitting, remove "" and '' */
+    td.word = string;
+    tresult = call_expand_word_internal (&td, quoted, 1, dollar_at_p, has_dollar_at);
+    return (tresult);
+*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
+--- patchlevel.h	Thu Feb 24 21:41:34 2011
+***************
+*** 26,30 ****
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 3
+  
+  #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 4
+  
+  #endif /* _PATCHLEVEL_H_ */
diff --git a/bash42-005 b/bash42-005
new file mode 100644
index 0000000..3ca9fc1
--- /dev/null
+++ b/bash42-005
@@ -0,0 +1,131 @@
+			     BASH PATCH REPORT
+			     =================
+
+Bash-Release:	4.2
+Patch-ID:	bash42-005
+
+Bug-Reported-by:	Dennis Williamson <dennistwilliamson at gmail.com>
+Bug-Reference-ID:	<AANLkTikDbEV5rnbPc0zOfmZfBcg0xGetzLLzK+KjRiNa at mail.gmail.com>
+Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00147.html
+
+Bug-Description:
+
+Systems that use tzset() to set the local timezone require the TZ variable
+to be in the environment.  Bash must make sure the environment has been
+modified with any updated value for TZ before calling tzset().  This
+affects prompt string expansions and the `%T' printf conversion specification
+on systems that do not allow bash to supply a replacement for getenv(3).
+
+Patch (apply with `patch -p0'):
+
+*** ../bash-4.2-patched/variables.h	2010-12-02 20:22:01.000000000 -0500
+--- variables.h	2011-02-19 19:57:12.000000000 -0500
+***************
+*** 314,317 ****
+--- 314,318 ----
+  extern void sort_variables __P((SHELL_VAR **));
+  
++ extern int chkexport __P((char *));
+  extern void maybe_make_export_env __P((void));
+  extern void update_export_env_inplace __P((char *, int, char *));
+*** ../bash-4.2-patched/variables.c	2011-01-24 20:07:48.000000000 -0500
+--- variables.c	2011-02-19 20:04:50.000000000 -0500
+***************
+*** 3654,3657 ****
+--- 3654,3673 ----
+  }
+  
++ int
++ chkexport (name)
++      char *name;
++ {
++   SHELL_VAR *v;
++ 
++   v = find_variable (name);
++   if (exported_p (v))
++     {
++       array_needs_making = 1;
++       maybe_make_export_env ();
++       return 1;
++     }
++   return 0;
++ }
++ 
+  void
+  maybe_make_export_env ()
+***************
+*** 4215,4219 ****
+    { "TEXTDOMAINDIR", sv_locale },
+  
+! #if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
+    { "TZ", sv_tz },
+  #endif
+--- 4231,4235 ----
+    { "TEXTDOMAINDIR", sv_locale },
+  
+! #if defined (HAVE_TZSET)
+    { "TZ", sv_tz },
+  #endif
+***************
+*** 4559,4568 ****
+  #endif /* HISTORY */
+  
+! #if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
+  void
+  sv_tz (name)
+       char *name;
+  {
+!   tzset ();
+  }
+  #endif
+--- 4575,4585 ----
+  #endif /* HISTORY */
+  
+! #if defined (HAVE_TZSET)
+  void
+  sv_tz (name)
+       char *name;
+  {
+!   if (chkexport (name))
+!     tzset ();
+  }
+  #endif
+*** ../bash-4.2-patched/parse.y	2011-01-02 15:48:11.000000000 -0500
+--- parse.y	2011-02-19 20:05:00.000000000 -0500
+***************
+*** 5136,5139 ****
+--- 5136,5142 ----
+  	      /* Make the current time/date into a string. */
+  	      (void) time (&the_time);
++ #if defined (HAVE_TZSET)
++ 	      sv_tz ("TZ");		/* XXX -- just make sure */
++ #endif
+  	      tm = localtime (&the_time);
+  
+*** ../bash-4.2-patched/builtins/printf.def	2010-11-23 10:02:55.000000000 -0500
+--- builtins/printf.def	2011-02-19 20:05:04.000000000 -0500
+***************
+*** 466,469 ****
+--- 466,472 ----
+  		else
+  		  secs = arg;
++ #if defined (HAVE_TZSET)
++ 		sv_tz ("TZ");		/* XXX -- just make sure */
++ #endif
+  		tm = localtime (&secs);
+  		n = strftime (timebuf, sizeof (timebuf), timefmt, tm);
+*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
+--- patchlevel.h	Thu Feb 24 21:41:34 2011
+***************
+*** 26,30 ****
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 4
+  
+  #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 5
+  
+  #endif /* _PATCHLEVEL_H_ */


More information about the scm-commits mailing list