source: patches/bash-4.4-branch_update-1.patch@ 2cc1e81

systemd
Last change on this file since 2cc1e81 was 5344c0b, checked in by William Harrington <kb0iic@…>, 8 years ago

Add bash-4.4-branch_update-1.patch for Bash 4.4 upgrade.

  • Property mode set to 100644
File size: 16.2 KB
  • bashline.c

    Submitted By: William Harrington (kb0iic at cross-lfs dot org)
    Date: 05-03-2017
    Initial Package Version: 4.4
    Origin: Upstream
    Upstream Status: Applied
    Description: Contains all upstream patches up to 4.4-012
    
    diff -Naur bash-4.4.orig/bashline.c bash-4.4/bashline.c
    old new  
    142142static rl_icppfunc_t *save_directory_hook __P((void));
    143143static void restore_directory_hook __P((rl_icppfunc_t));
    144144
    145 static int directory_exists __P((const char *));
     145static int directory_exists __P((const char *, int));
    146146
    147147static void cleanup_expansion_error __P((void));
    148148static void maybe_make_readline_line __P((char *));
     
    31023102    rl_directory_rewrite_hook = hookf;
    31033103}
    31043104
    3105 /* Check whether not the (dequoted) version of DIRNAME, with any trailing slash
    3106    removed, exists. */
     3105/* Check whether not DIRNAME, with any trailing slash removed, exists.  If
     3106   SHOULD_DEQUOTE is non-zero, we dequote the directory name first. */
    31073107static int
    3108 directory_exists (dirname)
     3108directory_exists (dirname, should_dequote)
    31093109     const char *dirname;
     3110     int should_dequote;
    31103111{
    31113112  char *new_dirname;
    31123113  int dirlen, r;
    31133114  struct stat sb;
    31143115
    3115   /* First, dequote the directory name */
    3116   new_dirname = bash_dequote_filename ((char *)dirname, rl_completion_quote_character);
     3116  /* We save the string and chop the trailing slash because stat/lstat behave
     3117     inconsistently if one is present. */
     3118  new_dirname = should_dequote ? bash_dequote_filename ((char *)dirname, rl_completion_quote_character) : savestring (dirname);
    31173119  dirlen = STRLEN (new_dirname);
    31183120  if (new_dirname[dirlen - 1] == '/')
    31193121    new_dirname[dirlen - 1] = '\0';
     
    31453147  else if (t = mbschr (local_dirname, '`'))     /* XXX */
    31463148    should_expand_dirname = '`';
    31473149
    3148   if (should_expand_dirname && directory_exists (local_dirname))
     3150  if (should_expand_dirname && directory_exists (local_dirname, 0))
    31493151    should_expand_dirname = 0;
    31503152 
    31513153  if (should_expand_dirname) 
     
    31553157         have to worry about restoring this setting. */
    31563158      global_nounset = unbound_vars_is_error;
    31573159      unbound_vars_is_error = 0;
    3158       wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE);        /* does the right thing */
     3160      wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE);    /* does the right thing */
    31593161      unbound_vars_is_error = global_nounset;
    31603162      if (wl)
    31613163        {
     
    32443246        should_expand_dirname = '`';
    32453247    }
    32463248
    3247   if (should_expand_dirname && directory_exists (local_dirname))
     3249  if (should_expand_dirname && directory_exists (local_dirname, 1))
    32483250    should_expand_dirname = 0;
    32493251
    32503252  if (should_expand_dirname) 
    32513253    {
    32523254      new_dirname = savestring (local_dirname);
    3253       wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE);        /* does the right thing */
     3255      wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE);    /* does the right thing */
    32543256      if (wl)
    32553257        {
    32563258          *dirname = string_list (wl);
  • builtins/evalstring.c

    diff -Naur bash-4.4.orig/builtins/evalstring.c bash-4.4/builtins/evalstring.c
    old new  
    104104          running_trap == 0 &&
    105105          *bash_input.location.string == '\0' &&
    106106          command->type == cm_simple &&
    107 #if 0
    108107          signal_is_trapped (EXIT_TRAP) == 0 &&
    109108          signal_is_trapped (ERROR_TRAP) == 0 &&
    110 #else
    111109          any_signals_trapped () < 0 &&
    112 #endif
    113110          command->redirects == 0 && command->value.Simple->redirects == 0 &&
    114111          ((command->flags & CMD_TIME_PIPELINE) == 0) &&
    115112          ((command->flags & CMD_INVERT_RETURN) == 0));
  • builtins/pushd.def

    diff -Naur bash-4.4.orig/builtins/pushd.def bash-4.4/builtins/pushd.def
    old new  
    365365        break;
    366366    }
    367367
    368   if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
     368  if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0))
    369369    {
    370370      pushd_error (directory_list_offset, which_word ? which_word : "");
    371371      return (EXECUTION_FAILURE);
     
    387387         remove that directory from the list and shift the remainder
    388388         of the list into place. */
    389389      i = (direction == '+') ? directory_list_offset - which : which;
     390      if (i < 0 || i > directory_list_offset)
     391        {
     392          pushd_error (directory_list_offset, which_word ? which_word : "");
     393          return (EXECUTION_FAILURE);
     394        }
    390395      free (pushd_directory_list[i]);
    391396      directory_list_offset--;
    392397
  • builtins/read.def

    diff -Naur bash-4.4.orig/builtins/read.def bash-4.4/builtins/read.def
    old new  
    181181     WORD_LIST *list;
    182182{
    183183  register char *varname;
    184   int size, i, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2;
     184  int size, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2;
     185  volatile int i;
    185186  int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul;
    186187  int raw, edit, nchars, silent, have_timeout, ignore_delim, fd, lastsig, t_errno;
    187188  unsigned int tmsec, tmusec;
  • bash-4.4

    diff -Naur bash-4.4.orig/expr.c bash-4.4/expr.c
    old new  
    578578  rval = cval = explor ();
    579579  if (curtok == QUES)           /* found conditional expr */
    580580    {
    581       readtok ();
    582       if (curtok == 0 || curtok == COL)
    583         evalerror (_("expression expected"));
    584581      if (cval == 0)
    585582        {
    586583          set_noeval = 1;
    587584          noeval++;
    588585        }
    589586
     587      readtok ();
     588      if (curtok == 0 || curtok == COL)
     589        evalerror (_("expression expected"));
     590
    590591      val1 = EXP_HIGHEST ();
    591592
    592593      if (set_noeval)
    593594        noeval--;
    594595      if (curtok != COL)
    595596        evalerror (_("`:' expected for conditional expression"));
    596       readtok ();
    597       if (curtok == 0)
    598         evalerror (_("expression expected"));
     597
    599598      set_noeval = 0;
    600599      if (cval)
    601600        {
     
    603602          noeval++;
    604603        }
    605604
     605      readtok ();
     606      if (curtok == 0)
     607        evalerror (_("expression expected"));
    606608      val2 = expcond ();
     609
    607610      if (set_noeval)
    608611        noeval--;
    609612      rval = cval ? val1 : val2;
  • bash-4.4

    diff -Naur bash-4.4.orig/jobs.c bash-4.4/jobs.c
    old new  
    453453    discard_pipeline (disposer);
    454454}
    455455
     456void
     457discard_last_procsub_child ()
     458{
     459  PROCESS *disposer;
     460  sigset_t set, oset;
     461
     462  BLOCK_CHILD (set, oset);
     463  disposer = last_procsub_child;
     464  last_procsub_child = (PROCESS *)NULL;
     465  UNBLOCK_CHILD (oset);
     466
     467  if (disposer)
     468    discard_pipeline (disposer);
     469}
     470
    456471struct pipeline_saver *
    457472alloc_pipeline_saver ()
    458473{
  • bash-4.4

    diff -Naur bash-4.4.orig/jobs.h bash-4.4/jobs.h
    old new  
    190190extern void making_children __P((void));
    191191extern void stop_making_children __P((void));
    192192extern void cleanup_the_pipeline __P((void));
     193extern void discard_last_procsub_child __P((void));
    193194extern void save_pipeline __P((int));
    194195extern PROCESS *restore_pipeline __P((int));
    195196extern void start_pipeline __P((void));
  • lib/glob/sm_loop.c

    diff -Naur bash-4.4.orig/lib/glob/sm_loop.c bash-4.4/lib/glob/sm_loop.c
    old new  
    330330  for (pc = 0; p[pc]; pc++)
    331331    if (p[pc] == L('.') && p[pc+1] == L(']'))
    332332      break;
     333   if (p[pc] == 0)
     334    {
     335      if (vp)
     336        *vp = INVALID;
     337      return (p + pc);
     338    }
    333339   val = COLLSYM (p, pc);
    334340   if (vp)
    335341     *vp = val;
     
    483489      c = *p++;
    484490      c = FOLD (c);
    485491
     492      if (c == L('\0'))
     493        return ((test == L('[')) ? savep : (CHAR *)0);
     494
    486495      if ((flags & FNM_PATHNAME) && c == L('/'))
    487496        /* [/] can never match when matching a pathname.  */
    488497        return (CHAR *)0;
  • lib/readline/history.c

    diff -Naur bash-4.4.orig/lib/readline/history.c bash-4.4/lib/readline/history.c
    old new  
    5757/* How big to make the_history when we first allocate it. */
    5858#define DEFAULT_HISTORY_INITIAL_SIZE    502
    5959
     60#define MAX_HISTORY_INITIAL_SIZE        8192
     61
    6062/* The number of slots to increase the_history by. */
    6163#define DEFAULT_HISTORY_GROW_SIZE 50
    6264
     
    277279     const char *string;
    278280{
    279281  HIST_ENTRY *temp;
     282  int new_length;
    280283
    281284  if (history_stifled && (history_length == history_max_entries))
    282285    {
     
    293296
    294297      /* Copy the rest of the entries, moving down one slot.  Copy includes
    295298         trailing NULL.  */
    296 #if 0
    297       for (i = 0; i < history_length; i++)
    298         the_history[i] = the_history[i + 1];
    299 #else
    300299      memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
    301 #endif
    302300
     301      new_length = history_length;
    303302      history_base++;
    304303    }
    305304  else
     
    307306      if (history_size == 0)
    308307        {
    309308          if (history_stifled && history_max_entries > 0)
    310             history_size = history_max_entries + 2;
     309            history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE)
     310                                ? MAX_HISTORY_INITIAL_SIZE
     311                                : history_max_entries + 2;
    311312          else
    312313            history_size = DEFAULT_HISTORY_INITIAL_SIZE;
    313314          the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
    314           history_length = 1;
     315          new_length = 1;
    315316        }
    316317      else
    317318        {
     
    321322              the_history = (HIST_ENTRY **)
    322323                xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
    323324            }
    324           history_length++;
     325          new_length = history_length + 1;
    325326        }
    326327    }
    327328
    328329  temp = alloc_history_entry ((char *)string, hist_inittime ());
    329330
    330   the_history[history_length] = (HIST_ENTRY *)NULL;
    331   the_history[history_length - 1] = temp;
     331  the_history[new_length] = (HIST_ENTRY *)NULL;
     332  the_history[new_length - 1] = temp;
     333  history_length = new_length;
    332334}
    333335
    334336/* Change the time stamp of the most recent history entry to STRING. */
  • patchlevel.h

    diff -Naur bash-4.4.orig/patchlevel.h bash-4.4/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 12
    2929
    3030#endif /* _PATCHLEVEL_H_ */
  • bash-4.4

    diff -Naur bash-4.4.orig/sig.c bash-4.4/sig.c
    old new  
    585585#if defined (JOB_CONTROL)
    586586  if (sig == SIGHUP && (interactive || (subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB))))
    587587    hangup_all_jobs ();
    588   end_job_control ();
     588  if ((subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB)) == 0)
     589    end_job_control ();
    589590#endif /* JOB_CONTROL */
    590591
    591592#if defined (PROCESS_SUBSTITUTION)
  • subst.c

    diff -Naur bash-4.4.orig/subst.c bash-4.4/subst.c
    old new  
    28252825
    28262826/* Parse a single word from STRING, using SEPARATORS to separate fields.
    28272827   ENDPTR is set to the first character after the word.  This is used by
    2828    the `read' builtin.  This is never called with SEPARATORS != $IFS;
    2829    it should be simplified.
     2828   the `read' builtin.
     2829   
     2830   This is never called with SEPARATORS != $IFS, and takes advantage of that.
    28302831
    28312832   XXX - this function is very similar to list_string; they should be
    28322833         combined - XXX */
     2834
     2835#define islocalsep(c)   (local_cmap[(unsigned char)(c)] != 0)
     2836
    28332837char *
    28342838get_word_from_string (stringp, separators, endptr)
    28352839     char **stringp, *separators, **endptr;
     
    28372841  register char *s;
    28382842  char *current_word;
    28392843  int sindex, sh_style_split, whitesep, xflags;
     2844  unsigned char local_cmap[UCHAR_MAX+1];        /* really only need single-byte chars here */
    28402845  size_t slen;
    28412846
    28422847  if (!stringp || !*stringp || !**stringp)
     
    28462851                                 separators[1] == '\t' &&
    28472852                                 separators[2] == '\n' &&
    28482853                                 separators[3] == '\0';
    2849   for (xflags = 0, s = ifs_value; s && *s; s++)
     2854  memset (local_cmap, '\0', sizeof (local_cmap));
     2855  for (xflags = 0, s = separators; s && *s; s++)
    28502856    {
    28512857      if (*s == CTLESC) xflags |= SX_NOCTLESC;
    28522858      if (*s == CTLNUL) xflags |= SX_NOESCCTLNUL;
     2859      local_cmap[(unsigned char)*s] = 1;        /* local charmap of separators */
    28532860    }
    28542861
    28552862  s = *stringp;
    28562863  slen = 0;
    28572864
    28582865  /* Remove sequences of whitespace at the beginning of STRING, as
    2859      long as those characters appear in IFS. */
    2860   if (sh_style_split || !separators || !*separators)
     2866     long as those characters appear in SEPARATORS.  This happens if
     2867     SEPARATORS == $' \t\n' or if IFS is unset. */
     2868  if (sh_style_split || separators == 0)
    28612869    {
    2862       for (; *s && spctabnl (*s) && isifs (*s); s++);
     2870      for (; *s && spctabnl (*s) && islocalsep (*s); s++);
    28632871
    28642872      /* If the string is nothing but whitespace, update it and return. */
    28652873      if (!*s)
     
    28782886
    28792887     This obeys the field splitting rules in Posix.2. */
    28802888  sindex = 0;
    2881   /* Don't need string length in ADVANCE_CHAR or string_extract_verbatim
    2882      unless multibyte chars are possible. */
    2883   slen = (MB_CUR_MAX > 1) ? STRLEN (s) : 1;
     2889  /* Don't need string length in ADVANCE_CHAR unless multibyte chars are
     2890     possible, but need it in string_extract_verbatim for bounds checking */
     2891  slen = STRLEN (s);
    28842892  current_word = string_extract_verbatim (s, slen, &sindex, separators, xflags);
    28852893
    28862894  /* Set ENDPTR to the first character after the end of the word. */
     
    28992907
    29002908  /* Now skip sequences of space, tab, or newline characters if they are
    29012909     in the list of separators. */
    2902   while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex]))
     2910  while (s[sindex] && spctabnl (s[sindex]) && islocalsep (s[sindex]))
    29032911    sindex++;
    29042912
    29052913  /* If the first separator was IFS whitespace and the current character is
    29062914     a non-whitespace IFS character, it should be part of the current field
    29072915     delimiter, not a separate delimiter that would result in an empty field.
    29082916     Look at POSIX.2, 3.6.5, (3)(b). */
    2909   if (s[sindex] && whitesep && isifs (s[sindex]) && !spctabnl (s[sindex]))
     2917  if (s[sindex] && whitesep && islocalsep (s[sindex]) && !spctabnl (s[sindex]))
    29102918    {
    29112919      sindex++;
    29122920      /* An IFS character that is not IFS white space, along with any adjacent
    29132921         IFS white space, shall delimit a field. */
    2914       while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex]))
     2922      while (s[sindex] && spctabnl (s[sindex]) && islocalsep(s[sindex]))
    29152923        sindex++;
    29162924    }
    29172925
     
    58085816    {
    58095817#if defined (JOB_CONTROL)
    58105818      if (last_procsub_child)
    5811         {
    5812           discard_pipeline (last_procsub_child);
    5813           last_procsub_child = (PROCESS *)NULL;
    5814         }
     5819        discard_last_procsub_child ();
    58155820      last_procsub_child = restore_pipeline (0);
    58165821#endif
    58175822
     
    59315936  char *istring, buf[128], *bufp, *s;
    59325937  int istring_index, istring_size, c, tflag, skip_ctlesc, skip_ctlnul;
    59335938  ssize_t bufn;
     5939  int nullbyte;
    59345940
    59355941  istring = (char *)NULL;
    59365942  istring_index = istring_size = bufn = tflag = 0;
     
    59385944  for (skip_ctlesc = skip_ctlnul = 0, s = ifs_value; s && *s; s++)
    59395945    skip_ctlesc |= *s == CTLESC, skip_ctlnul |= *s == CTLNUL;
    59405946
     5947  nullbyte = 0;
     5948
    59415949  /* Read the output of the command through the pipe.  This may need to be
    59425950     changed to understand multibyte characters in the future. */
    59435951  while (1)
     
    59565964      if (c == 0)
    59575965        {
    59585966#if 1
    5959           internal_warning ("%s", _("command substitution: ignored null byte in input"));
     5967          if (nullbyte == 0)
     5968            {
     5969              internal_warning ("%s", _("command substitution: ignored null byte in input"));
     5970              nullbyte = 1;
     5971            }
    59605972#endif
    59615973          continue;
    59625974        }
     
    94549466                tword->flags |= word->flags & (W_ASSIGNARG|W_ASSIGNRHS);        /* affects $@ */
    94559467              if (word->flags & W_COMPLETE)
    94569468                tword->flags |= W_COMPLETE;     /* for command substitutions */
     9469              if (word->flags & W_NOCOMSUB)
     9470                tword->flags |= W_NOCOMSUB;
     9471              if (word->flags & W_NOPROCSUB)
     9472                tword->flags |= W_NOPROCSUB;
    94579473
    94589474              temp = (char *)NULL;
    94599475
Note: See TracBrowser for help on using the repository browser.