source:
patches/bash-3.2-fixes-3.patch@
623ce3c
Last change on this file since 623ce3c was 9717098, checked in by , 18 years ago | |
---|---|
|
|
File size: 9.9 KB |
-
builtins/printf.def
Submitted By: Jim Gifford (jim at linuxfromscratch dot org) Date: 2006-11-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-005 from upstream diff -Naur bash-3.2.orig/builtins/printf.def bash-3.2/builtins/printf.def
old new 49 49 # define INT_MIN (-2147483647-1) 50 50 #endif 51 51 52 #if defined (PREFER_STDARG) 53 # include <stdarg.h> 54 #else 55 # include <varargs.h> 56 #endif 57 52 58 #include <stdio.h> 53 59 #include <chartypes.h> 54 60 … … 151 157 #define SKIP1 "#'-+ 0" 152 158 #define LENMODS "hjlLtz" 153 159 160 #ifndef HAVE_ASPRINTF 161 extern int asprintf __P((char **, const char *, ...)) __attribute__((__format__ (printf, 2, 3))); 162 #endif 163 154 164 static void printf_erange __P((char *)); 155 165 static int printstr __P((char *, char *, int, int, int)); 156 166 static int tescape __P((char *, char *, int *)); -
lib/sh/snprintf.c
diff -Naur bash-3.2.orig/lib/sh/snprintf.c bash-3.2/lib/sh/snprintf.c
old new 471 471 10^x ~= r 472 472 * log_10(200) = 2; 473 473 * log_10(250) = 2; 474 * 475 * NOTE: do not call this with r == 0 -- an infinite loop results. 474 476 */ 475 477 static int 476 478 log_10(r) … … 576 578 { 577 579 integral_part[0] = '0'; 578 580 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'; 581 586 if (fract) 582 587 *fract = fraction_part; 583 588 return integral_part; … … 805 810 PUT_CHAR(*tmp, p); 806 811 tmp++; 807 812 } 813 808 814 PAD_LEFT(p); 809 815 } 810 816 … … 972 978 if ((p->flags & PF_THOUSANDS) && grouping && (t = groupnum (tmp))) 973 979 tmp = t; 974 980 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 975 990 /* calculate the padding. 1 for the dot */ 976 991 p->width = p->width - 977 992 ((d > 0. && p->justify == RIGHT) ? 1:0) - 978 993 ((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 */ 980 996 PAD_RIGHT(p); 981 997 PUT_PLUS(d, p, 0.); 982 998 PUT_SPACE(d, p, 0.); … … 991 1007 if (p->precision != 0 || (p->flags & PF_ALTFORM)) 992 1008 PUT_CHAR(decpoint, p); /* put the '.' */ 993 1009 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 999 1010 for (; *tmp2; tmp2++) 1000 1011 PUT_CHAR(*tmp2, p); /* the fraction */ 1001 1012 … … 1011 1022 char *tmp, *tmp2; 1012 1023 int j, i; 1013 1024 1014 if ( chkinfnan(p, d, 1) || chkinfnan(p, d, 2))1025 if (d != 0 && (chkinfnan(p, d, 1) || chkinfnan(p, d, 2))) 1015 1026 return; /* already printed nan or inf */ 1016 1027 1017 1028 GETLOCALEDATA(decpoint, thoussep, grouping); 1018 1029 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 } 1022 1038 tmp = dtoa(d, p->precision, &tmp2); 1023 1039 1024 1040 /* 1 for unit, 1 for the '.', 1 for 'e|E', … … 1076 1092 PUT_CHAR(*tmp, p); 1077 1093 tmp++; 1078 1094 } 1095 1079 1096 PAD_LEFT(p); 1080 1097 } 1081 1098 #endif … … 1358 1375 STAR_ARGS(data); 1359 1376 DEF_PREC(data); 1360 1377 d = GETDOUBLE(data); 1361 i = log_10(d);1378 i = (d != 0.) ? log_10(d) : -1; 1362 1379 /* 1363 1380 * for '%g|%G' ANSI: use f if exponent 1364 1381 * 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 1029 1029 #define PST_CMDTOKEN 0x1000 /* command token OK - unused */ 1030 1030 #define PST_COMPASSIGN 0x2000 /* parsing x=(...) compound assignment */ 1031 1031 #define PST_ASSIGNOK 0x4000 /* assignment statement ok in this context */ 1032 #define PST_REGEXP 0x8000 /* parsing an ERE/BRE as a single word */ 1032 1033 1033 1034 /* Initial size to allocate for tokens, and the 1034 1035 amount to grow them by. */ … … 2591 2592 return (character); 2592 2593 } 2593 2594 2595 if (parser_state & PST_REGEXP) 2596 goto tokword; 2597 2594 2598 /* Shell meta-characters. */ 2595 2599 if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0)) 2596 2600 { … … 2698 2702 if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND)) 2699 2703 return (character); 2700 2704 2705 tokword: 2701 2706 /* Okay, if we got this far, we have to read a word. Read one, 2702 2707 and then check it against the known ones. */ 2703 2708 result = read_token_word (character); … … 2735 2740 /* itrace("parse_matched_pair: open = %c close = %c", open, close); */ 2736 2741 count = 1; 2737 2742 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; 2739 2744 2740 2745 /* RFLAGS is the set of flags we want to pass to recursive calls. */ 2741 2746 rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE); … … 3202 3207 if (tok == WORD && test_binop (yylval.word->word)) 3203 3208 op = yylval.word; 3204 3209 #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 } 3207 3215 #endif 3208 3216 else if (tok == '<' || tok == '>') 3209 3217 op = make_word_from_token (tok); /* ( */ … … 3234 3242 3235 3243 /* rhs */ 3236 3244 tok = read_token (READ); 3245 parser_state &= ~PST_REGEXP; 3237 3246 if (tok == WORD) 3238 3247 { 3239 3248 tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL); … … 3419 3428 goto next_character; 3420 3429 } 3421 3430 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 3422 3456 #ifdef EXTENDED_GLOB 3423 3457 /* Parse a ksh-style extended pattern matching specification. */ 3424 if (extended_glob && PATTERN_CHAR (character))3458 if MBTEST(extended_glob && PATTERN_CHAR (character)) 3425 3459 { 3426 3460 peek_char = shell_getc (1); 3427 3461 if MBTEST(peek_char == '(') /* ) */ -
patchlevel.h
diff -Naur bash-3.2.orig/patchlevel.h bash-3.2/patchlevel.h
old new 25 25 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh 26 26 looks for to find the patch level (for the sccs version string). */ 27 27 28 #define PATCHLEVEL 028 #define PATCHLEVEL 5 29 29 30 30 #endif /* _PATCHLEVEL_H_ */ -
po/ru.po
diff -Naur bash-3.2.orig/po/ru.po bash-3.2/po/ru.po
old new 12 12 "Last-Translator: Evgeniy Dushistov <dushistov@mail.ru>\n" 13 13 "Language-Team: Russian <ru@li.org>\n" 14 14 "MIME-Version: 1.0\n" 15 "Content-Type: text/plain; charset= UTF-8\n"15 "Content-Type: text/plain; charset=KOI8-R\n" 16 16 "Content-Transfer-Encoding: 8bit\n" 17 17 "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" 18 18 -
subst.c
diff -Naur bash-3.2.orig/subst.c bash-3.2/subst.c
old new 5707 5707 vtype &= ~VT_STARSUB; 5708 5708 5709 5709 mflags = 0; 5710 if (patsub && *patsub == '/') 5711 { 5712 mflags |= MATCH_GLOBREP; 5713 patsub++; 5714 } 5710 5715 5711 5716 /* Malloc this because expand_string_if_necessary or one of the expansion 5712 5717 functions in its call chain may free it on a substitution error. */ … … 5741 5746 } 5742 5747 5743 5748 /* 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. */ 5745 5752 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; 5751 5755 else if (pat && pat[0] == '#') 5752 5756 { 5753 5757 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 430 430 Case06---1---A B C::--- 431 431 Case07---3---A:B:C--- 432 432 Case08---3---A:B:C--- 433 ./new-exp.tests: line 506: /${$(($#-1))}: bad substitution433 ./new-exp.tests: line 506: ${$(($#-1))}: bad substitution 434 434 argv[1] = <a> 435 435 argv[2] = <b> 436 436 argv[3] = <c>
Note:
See TracBrowser
for help on using the repository browser.