source: clfs-sysroot/patches/bash-3.2-fixes-5.patch@ 84e7860

Last change on this file since 84e7860 was f0590dc, checked in by Joe Ciccone <jciccone@…>, 17 years ago

Update the bash fixes and the vim fixes patches.

  • Property mode set to 100644
File size: 32.0 KB
  • array.c

    Submitted By: Joe Ciccone <jciccone@gmail.com>
    Date: 2007-07-23
    Initial Package Version: 3.2
    Origin: ftp://ftp.cwru.edu/pub/bash/bash-3.2-patches/
    Upstream Status: From Upstream
    Description: Contains patches 001-017 from upstream
    
    diff -Naur bash-3.2.orig/array.c bash-3.2/array.c
    old new  
    120120        return(a1);
    121121}
    122122
    123 #ifdef INCLUDE_UNUSED
    124123/*
    125124 * Make and return a new array composed of the elements in array A from
    126125 * S to E, inclusive.
     
    141140        for (p = s, i = 0; p != e; p = element_forw(p), i++) {
    142141                n = array_create_element (element_index(p), element_value(p));
    143142                ADD_BEFORE(a->head, n);
    144                 mi = element_index(ae);
     143                mi = element_index(n);
    145144        }
    146145        a->num_elements = i;
    147146        a->max_index = mi;
    148147        return a;
    149148}
    150 #endif
    151149
    152150/*
    153151 * Walk the array, calling FUNC once for each element, with the array
     
    300298        return array;
    301299}
    302300
     301ARRAY   *
     302array_quote_escapes(array)
     303ARRAY   *array;
     304{
     305        ARRAY_ELEMENT   *a;
     306        char    *t;
     307
     308        if (array == 0 || array_head(array) == 0 || array_empty(array))
     309                return (ARRAY *)NULL;
     310        for (a = element_forw(array->head); a != array->head; a = element_forw(a)) {
     311                t = quote_escapes (a->value);
     312                FREE(a->value);
     313                a->value = t;
     314        }
     315        return array;
     316}
     317
    303318/*
    304319 * Return a string whose elements are the members of array A beginning at
    305320 * index START and spanning NELEM members.  Null elements are counted.
     
    311326arrayind_t      start, nelem;
    312327int     starsub, quoted;
    313328{
     329        ARRAY           *a2;
    314330        ARRAY_ELEMENT   *h, *p;
    315331        arrayind_t      i;
    316         char            *ifs, sep[2];
     332        char            *ifs, sep[2], *t;
    317333
    318334        p = a ? array_head (a) : 0;
    319335        if (p == 0 || array_empty (a) || start > array_max_index(a))
     
    336352        for (i = 0, h = p; p != a->head && i < nelem; i++, p = element_forw(p))
    337353                ;
    338354
     355        a2 = array_slice(a, h, p);
     356
     357        if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
     358                array_quote(a2);
     359        else
     360                array_quote_escapes(a2);
     361
    339362        if (starsub && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) {
    340363                ifs = getifs();
    341364                sep[0] = ifs ? *ifs : '\0';
     
    343366                sep[0] = ' ';
    344367        sep[1] = '\0';
    345368
    346         return (array_to_string_internal (h, p, sep, quoted));
     369        t = array_to_string (a2, sep, 0);
     370        array_dispose(a2);
     371
     372        return t;
    347373}
    348374
    349375char *
     
    367393        }
    368394
    369395        if (mflags & MATCH_QUOTED)
    370                 array_quote (a2);
     396                array_quote(a2);
     397        else
     398                array_quote_escapes(a2);
    371399        if (mflags & MATCH_STARSUB) {
    372400                ifs = getifs();
    373401                sifs[0] = ifs ? *ifs : '\0';
  • array.h

    diff -Naur bash-3.2.orig/array.h bash-3.2/array.h
    old new  
    5555extern ARRAY_ELEMENT *array_unshift_element __P((ARRAY *));
    5656extern int      array_shift_element __P((ARRAY *, char *));
    5757extern ARRAY    *array_quote __P((ARRAY *));
     58extern ARRAY    *array_quote_escapes __P((ARRAY *));
    5859
    5960extern char     *array_subrange __P((ARRAY *, arrayind_t, arrayind_t, int, int));
    6061extern char     *array_patsub __P((ARRAY *, char *, char *, int));
  • builtins/common.c

    diff -Naur bash-3.2.orig/builtins/common.c bash-3.2/builtins/common.c
    old new  
    1 /* Copyright (C) 1987-2005 Free Software Foundation, Inc.
     1/* Copyright (C) 1987-2007 Free Software Foundation, Inc.
    22
    33   This file is part of GNU Bash, the Bourne Again SHell.
    44
     
    475475
    476476  if (the_current_working_directory == 0)
    477477    {
     478#if defined (GETCWD_BROKEN)
     479      the_current_working_directory = getcwd (0, PATH_MAX);
     480#else
    478481      the_current_working_directory = getcwd (0, 0);
     482#endif
    479483      if (the_current_working_directory == 0)
    480484        {
    481485          fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"),
  • builtins/printf.def

    diff -Naur bash-3.2.orig/builtins/printf.def bash-3.2/builtins/printf.def
    old new  
    11This file is printf.def, from which is created printf.c.
    22It implements the builtin "printf" in Bash.
    33
    4 Copyright (C) 1997-2005 Free Software Foundation, Inc.
     4Copyright (C) 1997-2007 Free Software Foundation, Inc.
    55
    66This file is part of GNU Bash, the Bourne Again SHell.
    77
     
    4949#  define INT_MIN               (-2147483647-1)
    5050#endif
    5151
     52#if defined (PREFER_STDARG)
     53#  include <stdarg.h>
     54#else
     55#  include <varargs.h>
     56#endif
     57
    5258#include <stdio.h>
    5359#include <chartypes.h>
    5460
     
    6470#include "bashgetopt.h"
    6571#include "common.h"
    6672
     73#if defined (PRI_MACROS_BROKEN)
     74#  undef PRIdMAX
     75#endif
     76
    6777#if !defined (PRIdMAX)
    6878#  if HAVE_LONG_LONG
    6979#    define PRIdMAX     "lld"
     
    151161#define SKIP1 "#'-+ 0"
    152162#define LENMODS "hjlLtz"
    153163
     164#ifndef HAVE_ASPRINTF
     165extern int asprintf __P((char **, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
     166#endif
     167
    154168static void printf_erange __P((char *));
    155169static int printstr __P((char *, char *, int, int, int));
    156170static int tescape __P((char *, char *, int *));
  • config-bot.h

    diff -Naur bash-3.2.orig/config-bot.h bash-3.2/config-bot.h
    old new  
    11/* config-bot.h */
    22/* modify settings or make new ones based on what autoconf tells us. */
    33
    4 /* Copyright (C) 1989-2002 Free Software Foundation, Inc.
     4/* Copyright (C) 1989-2007 Free Software Foundation, Inc.
    55
    66   This file is part of GNU Bash, the Bourne Again SHell.
    77
     
    7070#  define TERMIOS_MISSING
    7171#endif
    7272
    73 /* If we have a getcwd(3), but it calls popen(), #undef HAVE_GETCWD so
    74    the replacement in getcwd.c will be built. */
    75 #if defined (HAVE_GETCWD) && defined (GETCWD_BROKEN)
     73/* If we have a getcwd(3), but one that does not dynamically allocate memory,
     74   #undef HAVE_GETCWD so the replacement in getcwd.c will be built.  We do
     75   not do this on Solaris, because their implementation of loopback mounts
     76   breaks the traditional file system assumptions that getcwd uses. */
     77#if defined (HAVE_GETCWD) && defined (GETCWD_BROKEN) && !defined (SOLARIS)
    7678#  undef HAVE_GETCWD
    7779#endif
    7880
  • config.h.in

    diff -Naur bash-3.2.orig/config.h.in bash-3.2/config.h.in
    old new  
    11/* config.h -- Configuration file for bash. */
    22
    3 /* Copyright (C) 1987-2006 Free Software Foundation, Inc.
     3/* Copyright (C) 1987-2007 Free Software Foundation, Inc.
    44
    55   This file is part of GNU Bash, the Bourne Again SHell.
    66
     
    413413
    414414#undef HAVE_DECL_STRTOLD
    415415
     416#undef PRI_MACROS_BROKEN
     417
    416418#undef STRTOLD_BROKEN
    417419
    418420/* Define if WCONTINUED is defined in system headers, but rejected by waitpid */
     
    10061008/* Define if you have the `dcgettext' function. */
    10071009#undef HAVE_DCGETTEXT
    10081010
     1011/* Define if you have the `localeconv' function. */
     1012#undef HAVE_LOCALECONV
     1013
    10091014/* Define if your system has a working `malloc' function. */
    10101015/* #undef HAVE_MALLOC */
    10111016
  • configure

    diff -Naur bash-3.2.orig/configure bash-3.2/configure
    old new  
    2731627316sco3.2v4*)      LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
    2731727317sco3.2*)        LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
    2731827318sunos4*)        LOCAL_CFLAGS=-DSunOS4 ;;
    27319 solaris2.5*)    LOCAL_CFLAGS=-DSunOS5 ;;
     27319solaris2.5*)    LOCAL_CFLAGS="-DSunOS5 -DSOLARIS" ;;
     27320solaris2*)      LOCAL_CFLAGS=-DSOLARIS ;;
    2732027321lynxos*)        LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
    2732127322linux*)         LOCAL_LDFLAGS=-rdynamic          # allow dynamic loading
    2732227323                case "`uname -r`" in
  • configure.in

    diff -Naur bash-3.2.orig/configure.in bash-3.2/configure.in
    old new  
    55dnl
    66dnl Process this file with autoconf to produce a configure script.
    77
    8 # Copyright (C) 1987-2006 Free Software Foundation, Inc.
     8# Copyright (C) 1987-2007 Free Software Foundation, Inc.
    99
    1010# This program is free software; you can redistribute it and/or modify
    1111# it under the terms of the GNU General Public License as published by
     
    991991sco3.2v4*)      LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
    992992sco3.2*)        LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
    993993sunos4*)        LOCAL_CFLAGS=-DSunOS4 ;;
    994 solaris2.5*)    LOCAL_CFLAGS=-DSunOS5 ;;
     994solaris2.5*)    LOCAL_CFLAGS="-DSunOS5 -DSOLARIS" ;;
     995solaris2*)      LOCAL_CFLAGS=-DSOLARIS ;;
    995996lynxos*)        LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
    996997linux*)         LOCAL_LDFLAGS=-rdynamic          # allow dynamic loading
    997998                case "`uname -r`" in
  • execute_cmd.c

    diff -Naur bash-3.2.orig/execute_cmd.c bash-3.2/execute_cmd.c
    old new  
    11/* execute_cmd.c -- Execute a COMMAND structure. */
    22
    3 /* Copyright (C) 1987-2005 Free Software Foundation, Inc.
     3/* Copyright (C) 1987-2007 Free Software Foundation, Inc.
    44
    55   This file is part of GNU Bash, the Bourne Again SHell.
    66
     
    25462546      arg1 = cond_expand_word (cond->left->op, 0);
    25472547      if (arg1 == 0)
    25482548        arg1 = nullstr;
    2549       arg2 = cond_expand_word (cond->right->op, patmatch||rmatch);
     2549      arg2 = cond_expand_word (cond->right->op, rmatch ? 2 : (patmatch ? 1 : 0));
    25502550      if (arg2 == 0)
    25512551        arg2 = nullstr;
    25522552
     
    30503050  if (command_line == 0)
    30513051    command_line = savestring (the_printed_command_except_trap);
    30523052
     3053#if defined (PROCESS_SUBSTITUTION)
     3054  if ((subshell_environment & SUBSHELL_COMSUB) && (simple_command->flags & CMD_NO_FORK) && fifos_pending() > 0)
     3055    simple_command->flags &= ~CMD_NO_FORK;
     3056#endif
     3057
    30533058  execute_disk_command (words, simple_command->redirects, command_line,
    30543059                        pipe_in, pipe_out, async, fds_to_close,
    30553060                        simple_command->flags);
  • findcmd.c

    diff -Naur bash-3.2.orig/findcmd.c bash-3.2/findcmd.c
    old new  
    308308  if (hashed_file && (posixly_correct || check_hashed_filenames))
    309309    {
    310310      st = file_status (hashed_file);
    311       if ((st ^ (FS_EXISTS | FS_EXECABLE)) != 0)
     311      if ((st & (FS_EXISTS|FS_EXECABLE)) != (FS_EXISTS|FS_EXECABLE))
    312312        {
    313313          phash_remove (pathname);
    314314          free (hashed_file);
  • bash-3.2

    diff -Naur bash-3.2.orig/jobs.c bash-3.2/jobs.c
    old new  
    984984  temp = jobs[job_index];
    985985  if (temp == 0)
    986986    return;
    987   if (job_index == js.j_current || job_index == js.j_previous)
    988     reset_current ();
    989987
    990988  if ((dflags & DEL_NOBGPID) == 0)
    991989    {
     
    10281026    js.j_firstj = js.j_lastj = 0;
    10291027  else if (jobs[js.j_firstj] == 0 || jobs[js.j_lastj] == 0)
    10301028    reset_job_indices ();
     1029
     1030  if (job_index == js.j_current || job_index == js.j_previous)
     1031    reset_current ();
    10311032}
    10321033
    10331034/* Must be called with SIGCHLD blocked. */
  • lib/readline/display.c

    diff -Naur bash-3.2.orig/lib/readline/display.c bash-3.2/lib/readline/display.c
    old new  
    561561      wrap_offset = prompt_invis_chars_first_line = 0;
    562562    }
    563563
     564#if defined (HANDLE_MULTIBYTE)
     565#define CHECK_INV_LBREAKS() \
     566      do { \
     567        if (newlines >= (inv_lbsize - 2)) \
     568          { \
     569            inv_lbsize *= 2; \
     570            inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
     571            _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
     572          } \
     573      } while (0)
     574#else
    564575#define CHECK_INV_LBREAKS() \
    565576      do { \
    566577        if (newlines >= (inv_lbsize - 2)) \
     
    569580            inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
    570581          } \
    571582      } while (0)
     583#endif /* HANDLE_MULTIBYTE */
    572584
    573585#if defined (HANDLE_MULTIBYTE)   
    574586#define CHECK_LPOS() \
     
    15861598          temp = nls - nfd;
    15871599          if (temp > 0)
    15881600            {
     1601              /* If nfd begins at the prompt, or before the invisible
     1602                 characters in the prompt, we need to adjust _rl_last_c_pos
     1603                 in a multibyte locale to account for the wrap offset and
     1604                 set cpos_adjusted accordingly. */
    15891605              _rl_output_some_chars (nfd, temp);
    1590               _rl_last_c_pos += _rl_col_width (nfd, 0, temp);;
     1606              if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
     1607                {
     1608                  _rl_last_c_pos += _rl_col_width (nfd, 0, temp);
     1609                  if (current_line == 0 && wrap_offset &&  ((nfd - new) <= prompt_last_invisible))
     1610                    {
     1611                      _rl_last_c_pos -= wrap_offset;
     1612                      cpos_adjusted = 1;
     1613                    }
     1614                }
     1615              else
     1616                _rl_last_c_pos += temp;
    15911617            }
    15921618        }
    15931619      /* Otherwise, print over the existing material. */
     
    15951621        {
    15961622          if (temp > 0)
    15971623            {
     1624              /* If nfd begins at the prompt, or before the invisible
     1625                 characters in the prompt, we need to adjust _rl_last_c_pos
     1626                 in a multibyte locale to account for the wrap offset and
     1627                 set cpos_adjusted accordingly. */
    15981628              _rl_output_some_chars (nfd, temp);
    15991629              _rl_last_c_pos += col_temp;               /* XXX */
     1630              if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
     1631                {
     1632                  if (current_line == 0 && wrap_offset &&  ((nfd - new) <= prompt_last_invisible))
     1633                    {
     1634                      _rl_last_c_pos -= wrap_offset;
     1635                      cpos_adjusted = 1;
     1636                    }
     1637                }
    16001638            }
    16011639          lendiff = (oe - old) - (ne - new);
    16021640          if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
     
    17321770  if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
    17331771    {
    17341772      dpos = _rl_col_width (data, 0, new);
    1735       if (dpos > prompt_last_invisible)         /* XXX - don't use woff here */
     1773      /* Use NEW when comparing against the last invisible character in the
     1774         prompt string, since they're both buffer indices and DPOS is a
     1775         desired display position. */
     1776      if (new > prompt_last_invisible)          /* XXX - don't use woff here */
    17361777        {
    17371778          dpos -= woff;
    17381779          /* Since this will be assigned to _rl_last_c_pos at the end (more
     
    23802421
    23812422  if (end <= start)
    23822423    return 0;
     2424  if (MB_CUR_MAX == 1 || rl_byte_oriented)
     2425    return (end - start);
    23832426
    23842427  memset (&ps, 0, sizeof (mbstate_t));
    23852428
  • lib/sh/snprintf.c

    diff -Naur bash-3.2.orig/lib/sh/snprintf.c bash-3.2/lib/sh/snprintf.c
    old new  
    471471          10^x ~= r
    472472 * log_10(200) = 2;
    473473 * log_10(250) = 2;
     474 *
     475 * NOTE: do not call this with r == 0 -- an infinite loop results.
    474476 */
    475477static int
    476478log_10(r)
     
    576578    {
    577579      integral_part[0] = '0';
    578580      integral_part[1] = '\0';
    579       fraction_part[0] = '0';
    580       fraction_part[1] = '\0';
     581      /* The fractional part has to take the precision into account */
     582      for (ch = 0; ch < precision-1; ch++)
     583        fraction_part[ch] = '0';
     584      fraction_part[ch] = '0';
     585      fraction_part[ch+1] = '\0';
    581586      if (fract)
    582587        *fract = fraction_part;
    583588      return integral_part;
     
    663668    p->flags &= ~PF_ZEROPAD;
    664669
    665670  sd = d;       /* signed for ' ' padding in base 10 */
    666   flags = (*p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0;
     671  flags = 0;
     672  flags = (*p->pf == 'x' || *p->pf == 'X' || *p->pf == 'o' || *p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0;
    667673  if (*p->pf == 'X')
    668674    flags |= FL_HEXUPPER;
    669675
     
    733739    p->flags &= ~PF_ZEROPAD;
    734740
    735741  sd = d;       /* signed for ' ' padding in base 10 */
    736   flags = (*p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0;
     742  flags = (*p->pf == 'x' || *p->pf == 'X' || *p->pf == 'o' || *p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0;
    737743  if (*p->pf == 'X')
    738744    flags |= FL_HEXUPPER;
    739745
     
    805811      PUT_CHAR(*tmp, p);
    806812      tmp++;
    807813    }
     814
    808815  PAD_LEFT(p);
    809816}
    810817
     
    972979  if ((p->flags & PF_THOUSANDS) && grouping && (t = groupnum (tmp)))
    973980    tmp = t;
    974981
     982  if ((*p->pf == 'g' || *p->pf == 'G') && (p->flags & PF_ALTFORM) == 0)
     983    {
     984      /* smash the trailing zeros unless altform */
     985      for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--)
     986        tmp2[i] = '\0';
     987      if (tmp2[0] == '\0')
     988        p->precision = 0;
     989    }
     990
    975991  /* calculate the padding. 1 for the dot */
    976992  p->width = p->width -
    977993            ((d > 0. && p->justify == RIGHT) ? 1:0) -
    978994            ((p->flags & PF_SPACE) ? 1:0) -
    979             strlen(tmp) - p->precision - 1;
     995            strlen(tmp) - p->precision -
     996            ((p->precision != 0 || (p->flags & PF_ALTFORM)) ? 1 : 0);   /* radix char */
    980997  PAD_RIGHT(p); 
    981998  PUT_PLUS(d, p, 0.);
    982999  PUT_SPACE(d, p, 0.);
     
    9911008  if (p->precision != 0 || (p->flags & PF_ALTFORM))
    9921009    PUT_CHAR(decpoint, p);  /* put the '.' */
    9931010
    994   if ((*p->pf == 'g' || *p->pf == 'G') && (p->flags & PF_ALTFORM) == 0)
    995     /* smash the trailing zeros unless altform */
    996     for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--)
    997       tmp2[i] = '\0';
    998 
    9991011  for (; *tmp2; tmp2++)
    10001012    PUT_CHAR(*tmp2, p); /* the fraction */
    10011013 
     
    10111023  char *tmp, *tmp2;
    10121024  int j, i;
    10131025
    1014   if (chkinfnan(p, d, 1) || chkinfnan(p, d, 2))
     1026  if (d != 0 && (chkinfnan(p, d, 1) || chkinfnan(p, d, 2)))
    10151027    return;     /* already printed nan or inf */
    10161028
    10171029  GETLOCALEDATA(decpoint, thoussep, grouping);
    10181030  DEF_PREC(p);
    1019   j = log_10(d);
    1020   d = d / pow_10(j);  /* get the Mantissa */
    1021   d = ROUND(d, p);               
     1031  if (d == 0.)
     1032    j = 0;
     1033  else
     1034    {
     1035      j = log_10(d);
     1036      d = d / pow_10(j);  /* get the Mantissa */
     1037      d = ROUND(d, p);           
     1038    }
    10221039  tmp = dtoa(d, p->precision, &tmp2);
    10231040
    10241041  /* 1 for unit, 1 for the '.', 1 for 'e|E',
     
    10761093       PUT_CHAR(*tmp, p);
    10771094       tmp++;
    10781095     }
     1096
    10791097   PAD_LEFT(p);
    10801098}
    10811099#endif
     
    13581376                STAR_ARGS(data);
    13591377                DEF_PREC(data);
    13601378                d = GETDOUBLE(data);
    1361                 i = log_10(d);
     1379                i = (d != 0.) ? log_10(d) : -1;
    13621380                /*
    13631381                 * for '%g|%G' ANSI: use f if exponent
    13641382                 * is in the range or [-4,p] exclusively
  • parse.y

    diff -Naur bash-3.2.orig/parse.y bash-3.2/parse.y
    old new  
    10291029#define PST_CMDTOKEN    0x1000          /* command token OK - unused */
    10301030#define PST_COMPASSIGN  0x2000          /* parsing x=(...) compound assignment */
    10311031#define PST_ASSIGNOK    0x4000          /* assignment statement ok in this context */
     1032#define PST_REGEXP      0x8000          /* parsing an ERE/BRE as a single word */
    10321033
    10331034/* Initial size to allocate for tokens, and the
    10341035   amount to grow them by. */
     
    25912592      return (character);
    25922593    }
    25932594
     2595  if (parser_state & PST_REGEXP)
     2596    goto tokword;
     2597
    25942598  /* Shell meta-characters. */
    25952599  if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0))
    25962600    {
     
    26982702  if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND))
    26992703    return (character);
    27002704
     2705tokword:
    27012706  /* Okay, if we got this far, we have to read a word.  Read one,
    27022707     and then check it against the known ones. */
    27032708  result = read_token_word (character);
     
    27352740/* itrace("parse_matched_pair: open = %c close = %c", open, close); */
    27362741  count = 1;
    27372742  pass_next_character = backq_backslash = was_dollar = in_comment = 0;
    2738   check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
     2743  check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
    27392744
    27402745  /* RFLAGS is the set of flags we want to pass to recursive calls. */
    27412746  rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE);
     
    32023207      if (tok == WORD && test_binop (yylval.word->word))
    32033208        op = yylval.word;
    32043209#if defined (COND_REGEXP)
    3205       else if (tok == WORD && STREQ (yylval.word->word,"=~"))
    3206         op = yylval.word;
     3210      else if (tok == WORD && STREQ (yylval.word->word, "=~"))
     3211        {
     3212          op = yylval.word;
     3213          parser_state |= PST_REGEXP;
     3214        }
    32073215#endif
    32083216      else if (tok == '<' || tok == '>')
    32093217        op = make_word_from_token (tok);  /* ( */
     
    32343242
    32353243      /* rhs */
    32363244      tok = read_token (READ);
     3245      parser_state &= ~PST_REGEXP;
    32373246      if (tok == WORD)
    32383247        {
    32393248          tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
     
    34193428          goto next_character;
    34203429        }
    34213430
     3431#ifdef COND_REGEXP
     3432      /* When parsing a regexp as a single word inside a conditional command,
     3433         we need to special-case characters special to both the shell and
     3434         regular expressions.  Right now, that is only '(' and '|'. */ /*)*/
     3435      if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|'))          /*)*/
     3436        {
     3437          if (character == '|')
     3438            goto got_character;
     3439
     3440          push_delimiter (dstack, character);
     3441          ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
     3442          pop_delimiter (dstack);
     3443          if (ttok == &matched_pair_error)
     3444            return -1;          /* Bail immediately. */
     3445          RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
     3446                                  token_buffer_size, TOKEN_DEFAULT_GROW_SIZE);
     3447          token[token_index++] = character;
     3448          strcpy (token + token_index, ttok);
     3449          token_index += ttoklen;
     3450          FREE (ttok);
     3451          dollar_present = all_digit_token = 0;
     3452          goto next_character;
     3453        }
     3454#endif /* COND_REGEXP */
     3455
    34223456#ifdef EXTENDED_GLOB
    34233457      /* Parse a ksh-style extended pattern matching specification. */
    3424       if (extended_glob && PATTERN_CHAR (character))
     3458      if MBTEST(extended_glob && PATTERN_CHAR (character))
    34253459        {
    34263460          peek_char = shell_getc (1);
    34273461          if MBTEST(peek_char == '(')           /* ) */
  • patchlevel.h

    diff -Naur bash-3.2.orig/patchlevel.h bash-3.2/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 17
    2929
    3030#endif /* _PATCHLEVEL_H_ */
  • pathexp.c

    diff -Naur bash-3.2.orig/pathexp.c bash-3.2/pathexp.c
    old new  
    11/* pathexp.c -- The shell interface to the globbing library. */
    22
    3 /* Copyright (C) 1995-2002 Free Software Foundation, Inc.
     3/* Copyright (C) 1995-2007 Free Software Foundation, Inc.
    44
    55   This file is part of GNU Bash, the Bourne Again SHell.
    66
     
    110110  return (0);
    111111}
    112112
     113/* Return 1 if C is a character that is `special' in a POSIX ERE and needs to
     114   be quoted to match itself. */
     115static inline int
     116ere_char (c)
     117     int c;
     118{
     119  switch (c)
     120    {
     121    case '.':
     122    case '[':
     123    case '\\':
     124    case '(':
     125    case ')':
     126    case '*':
     127    case '+':
     128    case '?':
     129    case '{':
     130    case '|':
     131    case '^':
     132    case '$':
     133      return 1;
     134    default:
     135      return 0;
     136    }
     137  return (0);
     138}
     139
    113140/* PATHNAME can contain characters prefixed by CTLESC; this indicates
    114141   that the character is to be quoted.  We quote it here in the style
    115142   that the glob library recognizes.  If flags includes QGLOB_CVTNULL,
     
    142169        {
    143170          if ((qflags & QGLOB_FILENAME) && pathname[i+1] == '/')
    144171            continue;
     172          if ((qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0)
     173            continue;
    145174          temp[j++] = '\\';
    146175          i++;
    147176          if (pathname[i] == '\0')
  • pathexp.h

    diff -Naur bash-3.2.orig/pathexp.h bash-3.2/pathexp.h
    old new  
    11/* pathexp.h -- The shell interface to the globbing library. */
    22
    3 /* Copyright (C) 1987-2005 Free Software Foundation, Inc.
     3/* Copyright (C) 1987-2007 Free Software Foundation, Inc.
    44
    55   This file is part of GNU Bash, the Bourne Again SHell.
    66
     
    3232/* Flag values for quote_string_for_globbing */
    3333#define QGLOB_CVTNULL   0x01    /* convert QUOTED_NULL strings to '\0' */
    3434#define QGLOB_FILENAME  0x02    /* do correct quoting for matching filenames */
     35#define QGLOB_REGEXP    0x04    /* quote an ERE for regcomp/regexec */
    3536
    3637#if defined (EXTENDED_GLOB)
    3738/* Flags to OR with other flag args to strmatch() to enabled the extended
  • po/ru.po

    diff -Naur bash-3.2.orig/po/ru.po bash-3.2/po/ru.po
    old new  
    1212"Last-Translator: Evgeniy Dushistov <dushistov@mail.ru>\n"
    1313"Language-Team: Russian <ru@li.org>\n"
    1414"MIME-Version: 1.0\n"
    15 "Content-Type: text/plain; charset=UTF-8\n"
     15"Content-Type: text/plain; charset=KOI8-R\n"
    1616"Content-Transfer-Encoding: 8bit\n"
    1717"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
    1818
  • subst.c

    diff -Naur bash-3.2.orig/subst.c bash-3.2/subst.c
    old new  
    44/* ``Have a little faith, there's magic in the night.  You ain't a
    55     beauty, but, hey, you're alright.'' */
    66
    7 /* Copyright (C) 1987-2006 Free Software Foundation, Inc.
     7/* Copyright (C) 1987-2007 Free Software Foundation, Inc.
    88
    99   This file is part of GNU Bash, the Bourne Again SHell.
    1010
     
    18871887  sep[1] = '\0';
    18881888#endif
    18891889
     1890  /* XXX -- why call quote_list if ifs == 0?  we can get away without doing
     1891     it now that quote_escapes quotes spaces */
     1892#if 0
    18901893  tlist = ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (ifs && *ifs == 0))
     1894#else
     1895  tlist = (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
     1896#endif
    18911897                ? quote_list (list)
    18921898                : list_quote_escapes (list);
    18931899
     
    26462652
    26472653/* This needs better error handling. */
    26482654/* Expand W for use as an argument to a unary or binary operator in a
    2649    [[...]] expression.  If SPECIAL is nonzero, this is the rhs argument
     2655   [[...]] expression.  If SPECIAL is 1, this is the rhs argument
    26502656   to the != or == operator, and should be treated as a pattern.  In
    2651    this case, we quote the string specially for the globbing code.  The
    2652    caller is responsible for removing the backslashes if the unquoted
    2653    words is needed later. */   
     2657   this case, we quote the string specially for the globbing code.  If
     2658   SPECIAL is 2, this is an rhs argument for the =~ operator, and should
     2659   be quoted appropriately for regcomp/regexec.  The caller is responsible
     2660   for removing the backslashes if the unquoted word is needed later. */   
    26542661char *
    26552662cond_expand_word (w, special)
    26562663     WORD_DESC *w;
     
    26582665{
    26592666  char *r, *p;
    26602667  WORD_LIST *l;
     2668  int qflags;
    26612669
    26622670  if (w->word == 0 || w->word[0] == '\0')
    26632671    return ((char *)NULL);
     
    26722680        }
    26732681      else
    26742682        {
     2683          qflags = QGLOB_CVTNULL;
     2684          if (special == 2)
     2685            qflags |= QGLOB_REGEXP;
    26752686          p = string_list (l);
    2676           r = quote_string_for_globbing (p, QGLOB_CVTNULL);
     2687          r = quote_string_for_globbing (p, qflags);
    26772688          free (p);
    26782689        }
    26792690      dispose_words (l);
     
    29162927
    29172928/* Quote escape characters in string s, but no other characters.  This is
    29182929   used to protect CTLESC and CTLNUL in variable values from the rest of
    2919    the word expansion process after the variable is expanded. */
     2930   the word expansion process after the variable is expanded.  If IFS is
     2931   null, we quote spaces as well, just in case we split on spaces later
     2932   (in the case of unquoted $@, we will eventually attempt to split the
     2933   entire word on spaces).  Corresponding code exists in dequote_escapes.
     2934   Even if we don't end up splitting on spaces, quoting spaces is not a
     2935   problem. */
    29202936char *
    29212937quote_escapes (string)
    29222938     char *string;
     
    29242940  register char *s, *t;
    29252941  size_t slen;
    29262942  char *result, *send;
     2943  int quote_spaces;
    29272944  DECLARE_MBSTATE;
    29282945
    29292946  slen = strlen (string);
    29302947  send = string + slen;
    29312948
     2949  quote_spaces = (ifs_value && *ifs_value == 0);
    29322950  t = result = (char *)xmalloc ((slen * 2) + 1);
    29332951  s = string;
    29342952
    29352953  while (*s)
    29362954    {
    2937       if (*s == CTLESC || *s == CTLNUL)
     2955      if (*s == CTLESC || *s == CTLNUL || (quote_spaces && *s == ' '))
    29382956        *t++ = CTLESC;
    29392957      COPY_CHAR_P (t, s, send);
    29402958    }
     
    29762994  register char *s, *t;
    29772995  size_t slen;
    29782996  char *result, *send;
     2997  int quote_spaces;
    29792998  DECLARE_MBSTATE;
    29802999
    29813000  if (string == 0)
     
    29903009  if (strchr (string, CTLESC) == 0)
    29913010    return (strcpy (result, s));
    29923011
     3012  quote_spaces = (ifs_value && *ifs_value == 0);
    29933013  while (*s)
    29943014    {
    2995       if (*s == CTLESC && (s[1] == CTLESC || s[1] == CTLNUL))
     3015      if (*s == CTLESC && (s[1] == CTLESC || s[1] == CTLNUL || (quote_spaces && s[1] == ' ')))
    29963016        {
    29973017          s++;
    29983018          if (*s == '\0')
     
    41234143    nfifo = 0;
    41244144}
    41254145
     4146int
     4147fifos_pending ()
     4148{
     4149  return nfifo;
     4150}
     4151
    41264152static char *
    41274153make_named_pipe ()
    41284154{
     
    41724198  nfds++;
    41734199}
    41744200
     4201int
     4202fifos_pending ()
     4203{
     4204  return 0;     /* used for cleanup; not needed with /dev/fd */
     4205}
     4206
    41754207void
    41764208unlink_fifo_list ()
    41774209{
     
    44564488      /* Add the character to ISTRING, possibly after resizing it. */
    44574489      RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE);
    44584490
    4459       if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || c == CTLESC || c == CTLNUL)
     4491      /* This is essentially quote_string inline */
     4492      if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) /* || c == CTLESC || c == CTLNUL */)
     4493        istring[istring_index++] = CTLESC;
     4494      /* Escape CTLESC and CTLNUL in the output to protect those characters
     4495         from the rest of the word expansions (word splitting and globbing.)
     4496         This is essentially quote_escapes inline. */
     4497      else if (c == CTLESC)
     4498        istring[istring_index++] = CTLESC;
     4499      else if (c == CTLNUL || (c == ' ' && (ifs_value && *ifs_value == 0)))
    44604500        istring[istring_index++] = CTLESC;
    44614501
    44624502      istring[istring_index++] = c;
     
    46654705
    46664706      last_command_exit_value = rc;
    46674707      rc = run_exit_trap ();
     4708#if defined (PROCESS_SUBSTITUTION)
     4709      unlink_fifo_list ();
     4710#endif
    46684711      exit (rc);
    46694712    }
    46704713  else
     
    55465589         so verify_substring_values just returns the numbers specified and we
    55475590         rely on array_subrange to understand how to deal with them). */
    55485591      tt = array_subrange (array_cell (v), e1, e2, starsub, quoted);
     5592#if 0
     5593      /* array_subrange now calls array_quote_escapes as appropriate, so the
     5594         caller no longer needs to. */
    55495595      if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) == 0)
    55505596        {
    55515597          temp = tt ? quote_escapes (tt) : (char *)NULL;
    55525598          FREE (tt);
    55535599        }
    55545600      else
     5601#endif
    55555602        temp = tt;
    55565603      break;
    55575604#endif
     
    57075754  vtype &= ~VT_STARSUB;
    57085755
    57095756  mflags = 0;
     5757  if (patsub && *patsub == '/')
     5758    {
     5759      mflags |= MATCH_GLOBREP;
     5760      patsub++;
     5761    }
    57105762
    57115763  /* Malloc this because expand_string_if_necessary or one of the expansion
    57125764     functions in its call chain may free it on a substitution error. */
     
    57415793    }
    57425794
    57435795  /* ksh93 doesn't allow the match specifier to be a part of the expanded
    5744      pattern.  This is an extension. */
     5796     pattern.  This is an extension.  Make sure we don't anchor the pattern
     5797     at the beginning or end of the string if we're doing global replacement,
     5798     though. */
    57455799  p = pat;
    5746   if (pat && pat[0] == '/')
    5747     {
    5748       mflags |= MATCH_GLOBREP|MATCH_ANY;
    5749       p++;
    5750     }
     5800  if (mflags & MATCH_GLOBREP)
     5801    mflags |= MATCH_ANY;
    57515802  else if (pat && pat[0] == '#')
    57525803    {
    57535804      mflags |= MATCH_BEG;
     
    57985849#if defined (ARRAY_VARS)
    57995850    case VT_ARRAYVAR:
    58005851      temp = array_patsub (array_cell (v), p, rep, mflags);
     5852#if 0
     5853      /* Don't need to do this anymore; array_patsub calls array_quote_escapes
     5854         as appropriate before adding the space separators. */
    58015855      if (temp && (mflags & MATCH_QUOTED) == 0)
    58025856        {
    58035857          tt = quote_escapes (temp);
    58045858          free (temp);
    58055859          temp = tt;
    58065860        }
     5861#endif
    58075862      break;
    58085863#endif
    58095864    }
  • subst.h

    diff -Naur bash-3.2.orig/subst.h bash-3.2/subst.h
    old new  
    222222extern char *command_substitute __P((char *, int));
    223223extern char *pat_subst __P((char *, char *, char *, int));
    224224
     225extern int fifos_pending __P((void));
    225226extern void unlink_fifo_list __P((void));
    226227
    227228extern WORD_LIST *list_string_with_quotes __P((char *));
  • tests/new-exp.right

    diff -Naur bash-3.2.orig/tests/new-exp.right bash-3.2/tests/new-exp.right
    old new  
    430430Case06---1---A B C::---
    431431Case07---3---A:B:C---
    432432Case08---3---A:B:C---
    433 ./new-exp.tests: line 506: /${$(($#-1))}: bad substitution
     433./new-exp.tests: line 506: ${$(($#-1))}: bad substitution
    434434argv[1] = <a>
    435435argv[2] = <b>
    436436argv[3] = <c>
Note: See TracBrowser for help on using the repository browser.