Ticket #3531: bash-4.3-fixes-1.patch

File bash-4.3-fixes-1.patch, 8.7 KB (added by Miklos Karacsony, 7 years ago)

Cumulative patch (bash-4.3 patchlevel 8)

  • arrayfunc.c

    diff -U 3 -H -d -r -N -- bash-4.3/arrayfunc.c bash-4.3.mod/arrayfunc.c
    old new  
    597597      if (assoc_p (var))
    598598        {
    599599          val = expand_assignment_string_to_string (val, 0);
     600          if (val == 0)
     601            {
     602              val = (char *)xmalloc (1);
     603              val[0] = '\0';    /* like do_assignment_internal */
     604            }
    600605          free_val = 1;
    601606        }
    602607
  • bash-4.3

    diff -U 3 -H -d -r -N -- bash-4.3/jobs.c bash-4.3.mod/jobs.c
    old new  
    43744374void
    43754375end_job_control ()
    43764376{
    4377   if (interactive_shell)                /* XXX - should it be interactive? */
     4377  if (interactive_shell || job_control)         /* XXX - should it be just job_control? */
    43784378    {
    43794379      terminate_stopped_jobs ();
    43804380
  • lib/glob/glob.c

    diff -U 3 -H -d -r -N -- bash-4.3/lib/glob/glob.c bash-4.3.mod/lib/glob/glob.c
    old new  
    179179     char *pat, *dname;
    180180     int flags;
    181181{
    182   char *pp, *pe, *t;
    183   int n, r;
     182  char *pp, *pe, *t, *se;
     183  int n, r, negate;
    184184
     185  negate = *pat == '!';
    185186  pp = pat + 2;
    186   pe = pp + strlen (pp) - 1;    /*(*/
    187   if (*pe != ')')
    188     return 0;
    189   if ((t = strchr (pp, '|')) == 0)      /* easy case first */
     187  se = pp + strlen (pp) - 1;            /* end of string */
     188  pe = glob_patscan (pp, se, 0);        /* end of extglob pattern (( */
     189  /* we should check for invalid extglob pattern here */
     190  /* if pe != se we have more of the pattern at the end of the extglob
     191     pattern. Check the easy case first ( */
     192  if (pe == se && *pe == ')' && (t = strchr (pp, '|')) == 0)
    190193    {
    191194      *pe = '\0';
     195#if defined (HANDLE_MULTIBYTE)
     196      r = mbskipname (pp, dname, flags);
     197#else
    192198      r = skipname (pp, dname, flags);  /*(*/
     199#endif
    193200      *pe = ')';
    194201      return r;
    195202    }
     203
     204  /* check every subpattern */
    196205  while (t = glob_patscan (pp, pe, '|'))
    197206    {
    198207      n = t[-1];
    199208      t[-1] = '\0';
     209#if defined (HANDLE_MULTIBYTE)
     210      r = mbskipname (pp, dname, flags);
     211#else
    200212      r = skipname (pp, dname, flags);
     213#endif
    201214      t[-1] = n;
    202215      if (r == 0)       /* if any pattern says not skip, we don't skip */
    203216        return r;
    204217      pp = t;
    205218    }   /*(*/
    206219
    207   if (pp == pe)         /* glob_patscan might find end of pattern */
     220  /* glob_patscan might find end of pattern */
     221  if (pp == se)
    208222    return r;
    209223
    210   *pe = '\0';
    211 #  if defined (HANDLE_MULTIBYTE)
    212   r = mbskipname (pp, dname, flags);    /*(*/
    213 #  else
    214   r = skipname (pp, dname, flags);      /*(*/
    215 #  endif
    216   *pe = ')';
    217   return r;
     224  /* but if it doesn't then we didn't match a leading dot */
     225  return 0;
    218226}
    219227#endif
    220228
     
    277285     int flags;
    278286{
    279287#if EXTENDED_GLOB
    280   wchar_t *pp, *pe, *t, n;
    281   int r;
     288  wchar_t *pp, *pe, *t, n, *se;
     289  int r, negate;
    282290
     291  negate = *pat == L'!';
    283292  pp = pat + 2;
    284   pe = pp + wcslen (pp) - 1;    /*(*/
    285   if (*pe != L')')
    286     return 0;
    287   if ((t = wcschr (pp, L'|')) == 0)
     293  se = pp + wcslen (pp) - 1;    /*(*/
     294  pe = glob_patscan_wc (pp, se, 0);
     295
     296  if (pe == se && *pe == ')' && (t = wcschr (pp, L'|')) == 0)
    288297    {
    289298      *pe = L'\0';
    290299      r = wchkname (pp, dname); /*(*/
    291300      *pe = L')';
    292301      return r;
    293302    }
     303
     304  /* check every subpattern */
    294305  while (t = glob_patscan_wc (pp, pe, '|'))
    295306    {
    296307      n = t[-1];
     
    305316  if (pp == pe)         /* glob_patscan_wc might find end of pattern */
    306317    return r;
    307318
    308   *pe = L'\0';
    309   r = wchkname (pp, dname);     /*(*/
    310   *pe = L')';
    311   return r;
     319  /* but if it doesn't then we didn't match a leading dot */
     320  return 0;
    312321#else
    313322  return (wchkname (pat, dname));
    314323#endif
  • lib/glob/gmisc.c

    diff -U 3 -H -d -r -N -- bash-4.3/lib/glob/gmisc.c bash-4.3.mod/lib/glob/gmisc.c
    old new  
    210210    case '+':
    211211    case '!':
    212212    case '@':
     213    case '?':
    213214      return (pat[1] == LPAREN);
    214215    default:
    215216      return 0;
  • lib/readline/readline.c

    diff -U 3 -H -d -r -N -- bash-4.3/lib/readline/readline.c bash-4.3.mod/lib/readline/readline.c
    old new  
    744744    r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ));
    745745
    746746  RL_CHECK_SIGNALS ();
    747   if (r == 0)                   /* success! */
     747  /* We only treat values < 0 specially to simulate recursion. */
     748  if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0))   /* success! or failure! */
    748749    {
    749750      _rl_keyseq_chain_dispose ();
    750751      RL_UNSETSTATE (RL_STATE_MULTIKEY);
     
    964965#if defined (VI_MODE)
    965966  if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap &&
    966967      key != ANYOTHERKEY &&
    967       rl_key_sequence_length == 1 &&    /* XXX */
     968      _rl_dispatching_keymap == vi_movement_keymap &&
    968969      _rl_vi_textmod_command (key))
    969970    _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign);
    970971#endif
  • parse.y

    diff -U 3 -H -d -r -N -- bash-4.3/parse.y bash-4.3.mod/parse.y
    old new  
    33983398         within a double-quoted ${...} construct "an even number of
    33993399         unescaped double-quotes or single-quotes, if any, shall occur." */
    34003400      /* This was changed in Austin Group Interp 221 */
    3401       if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'')
     3401      if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && dolbrace_state != DOLBRACE_QUOTE2 && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'')
    34023402        continue;
    34033403
    34043404      /* Could also check open == '`' if we want to parse grouping constructs
  • patchlevel.h

    diff -U 3 -H -d -r -N -- bash-4.3/patchlevel.h bash-4.3.mod/patchlevel.h
    old new  
    2525   regexp `^#define[    ]*PATCHLEVEL', since that's what support/mkversion.sh
    2626   looks for to find the patch level (for the sccs version string). */
    2727
    28 #define PATCHLEVEL 0
     28#define PATCHLEVEL 8
    2929
    3030#endif /* _PATCHLEVEL_H_ */
  • bash-4.3

    diff -U 3 -H -d -r -N -- bash-4.3/test.c bash-4.3.mod/test.c
    old new  
    646646      return (v && invisible_p (v) == 0 && var_isset (v) ? TRUE : FALSE);
    647647
    648648    case 'R':
    649       v = find_variable (arg);
    650       return (v && invisible_p (v) == 0 && var_isset (v) && nameref_p (v) ? TRUE : FALSE);
     649      v = find_variable_noref (arg);
     650      return ((v && invisible_p (v) == 0 && var_isset (v) && nameref_p (v)) ? TRUE : FALSE);
    651651    }
    652652
    653653  /* We can't actually get here, but this shuts up gcc. */
     
    723723    case 'o': case 'p': case 'r': case 's': case 't':
    724724    case 'u': case 'v': case 'w': case 'x': case 'z':
    725725    case 'G': case 'L': case 'O': case 'S': case 'N':
     726    case 'R':
    726727      return (1);
    727728    }
    728729
  • bash-4.3

    diff -U 3 -H -d -r -N -- bash-4.3/trap.c bash-4.3.mod/trap.c
    old new  
    920920      subst_assign_varlist = 0;
    921921
    922922#if defined (JOB_CONTROL)
    923       save_pipeline (1);        /* XXX only provides one save level */
     923      if (sig != DEBUG_TRAP)    /* run_debug_trap does this */
     924        save_pipeline (1);      /* XXX only provides one save level */
    924925#endif
    925926
    926927      /* If we're in a function, make sure return longjmps come here, too. */
     
    940941      trap_exit_value = last_command_exit_value;
    941942
    942943#if defined (JOB_CONTROL)
    943       restore_pipeline (1);
     944      if (sig != DEBUG_TRAP)    /* run_debug_trap does this */
     945        restore_pipeline (1);
    944946#endif
    945947
    946948      subst_assign_varlist = save_subst_varlist;
  • y.tab.c

    diff -U 3 -H -d -r -N -- bash-4.3/y.tab.c bash-4.3.mod/y.tab.c
    old new  
    57105710         within a double-quoted ${...} construct "an even number of
    57115711         unescaped double-quotes or single-quotes, if any, shall occur." */
    57125712      /* This was changed in Austin Group Interp 221 */
    5713       if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'')
     5713      if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && dolbrace_state != DOLBRACE_QUOTE2 && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'')
    57145714        continue;
    57155715
    57165716      /* Could also check open == '`' if we want to parse grouping constructs