source: patches/bash-3.2-fixes-4.patch@ 3997220

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 3997220 was 8d87eba, checked in by Jim Gifford <clfs@…>, 18 years ago

Update Bash Upstream Patch

  • Property mode set to 100644
File size: 11.4 KB
  • builtins/printf.def

    Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
    Date: 2006-12-12
    Initial Package Version: 3.2
    Origin: ftp://ftp.cwru.edu/pub/bash/bash-3.2-patches/
    Upstream Status: From Upstream
    Description: Contains patches 001-009 from upstream
    
    diff -Naur bash-3.2.orig/builtins/printf.def bash-3.2/builtins/printf.def
    old new  
    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
     
    151157#define SKIP1 "#'-+ 0"
    152158#define LENMODS "hjlLtz"
    153159
     160#ifndef HAVE_ASPRINTF
     161extern int asprintf __P((char **, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
     162#endif
     163
    154164static void printf_erange __P((char *));
    155165static int printstr __P((char *, char *, int, int, int));
    156166static int tescape __P((char *, char *, int *));
  • 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  
    23802380
    23812381  if (end <= start)
    23822382    return 0;
     2383  if (MB_CUR_MAX == 1 || rl_byte_oriented)
     2384    return (end - start);
    23832385
    23842386  memset (&ps, 0, sizeof (mbstate_t));
    23852387
  • 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;
     
    805810      PUT_CHAR(*tmp, p);
    806811      tmp++;
    807812    }
     813
    808814  PAD_LEFT(p);
    809815}
    810816
     
    972978  if ((p->flags & PF_THOUSANDS) && grouping && (t = groupnum (tmp)))
    973979    tmp = t;
    974980
     981  if ((*p->pf == 'g' || *p->pf == 'G') && (p->flags & PF_ALTFORM) == 0)
     982    {
     983      /* smash the trailing zeros unless altform */
     984      for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--)
     985        tmp2[i] = '\0';
     986      if (tmp2[0] == '\0')
     987        p->precision = 0;
     988    }
     989
    975990  /* calculate the padding. 1 for the dot */
    976991  p->width = p->width -
    977992            ((d > 0. && p->justify == RIGHT) ? 1:0) -
    978993            ((p->flags & PF_SPACE) ? 1:0) -
    979             strlen(tmp) - p->precision - 1;
     994            strlen(tmp) - p->precision -
     995            ((p->precision != 0 || (p->flags & PF_ALTFORM)) ? 1 : 0);   /* radix char */
    980996  PAD_RIGHT(p); 
    981997  PUT_PLUS(d, p, 0.);
    982998  PUT_SPACE(d, p, 0.);
     
    9911007  if (p->precision != 0 || (p->flags & PF_ALTFORM))
    9921008    PUT_CHAR(decpoint, p);  /* put the '.' */
    9931009
    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 
    9991010  for (; *tmp2; tmp2++)
    10001011    PUT_CHAR(*tmp2, p); /* the fraction */
    10011012 
     
    10111022  char *tmp, *tmp2;
    10121023  int j, i;
    10131024
    1014   if (chkinfnan(p, d, 1) || chkinfnan(p, d, 2))
     1025  if (d != 0 && (chkinfnan(p, d, 1) || chkinfnan(p, d, 2)))
    10151026    return;     /* already printed nan or inf */
    10161027
    10171028  GETLOCALEDATA(decpoint, thoussep, grouping);
    10181029  DEF_PREC(p);
    1019   j = log_10(d);
    1020   d = d / pow_10(j);  /* get the Mantissa */
    1021   d = ROUND(d, p);               
     1030  if (d == 0.)
     1031    j = 0;
     1032  else
     1033    {
     1034      j = log_10(d);
     1035      d = d / pow_10(j);  /* get the Mantissa */
     1036      d = ROUND(d, p);           
     1037    }
    10221038  tmp = dtoa(d, p->precision, &tmp2);
    10231039
    10241040  /* 1 for unit, 1 for the '.', 1 for 'e|E',
     
    10761092       PUT_CHAR(*tmp, p);
    10771093       tmp++;
    10781094     }
     1095
    10791096   PAD_LEFT(p);
    10801097}
    10811098#endif
     
    13581375                STAR_ARGS(data);
    13591376                DEF_PREC(data);
    13601377                d = GETDOUBLE(data);
    1361                 i = log_10(d);
     1378                i = (d != 0.) ? log_10(d) : -1;
    13621379                /*
    13631380                 * for '%g|%G' ANSI: use f if exponent
    13641381                 * 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 8
    2929
    3030#endif /* _PATCHLEVEL_H_ */
  • 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  
    57075707  vtype &= ~VT_STARSUB;
    57085708
    57095709  mflags = 0;
     5710  if (patsub && *patsub == '/')
     5711    {
     5712      mflags |= MATCH_GLOBREP;
     5713      patsub++;
     5714    }
    57105715
    57115716  /* Malloc this because expand_string_if_necessary or one of the expansion
    57125717     functions in its call chain may free it on a substitution error. */
     
    57415746    }
    57425747
    57435748  /* ksh93 doesn't allow the match specifier to be a part of the expanded
    5744      pattern.  This is an extension. */
     5749     pattern.  This is an extension.  Make sure we don't anchor the pattern
     5750     at the beginning or end of the string if we're doing global replacement,
     5751     though. */
    57455752  p = pat;
    5746   if (pat && pat[0] == '/')
    5747     {
    5748       mflags |= MATCH_GLOBREP|MATCH_ANY;
    5749       p++;
    5750     }
     5753  if (mflags & MATCH_GLOBREP)
     5754    mflags |= MATCH_ANY;
    57515755  else if (pat && pat[0] == '#')
    57525756    {
    57535757      mflags |= MATCH_BEG;
  • 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.