SOURCES: mawk-debian.patch (NEW) - debian patch 18

arekm arekm at pld-linux.org
Fri Feb 3 18:23:16 CET 2006


Author: arekm                        Date: Fri Feb  3 17:23:12 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- debian patch 18

---- Files affected:
SOURCES:
   mawk-debian.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/mawk-debian.patch
diff -u /dev/null SOURCES/mawk-debian.patch:1.1
--- /dev/null	Fri Feb  3 18:23:12 2006
+++ SOURCES/mawk-debian.patch	Fri Feb  3 18:23:07 2006
@@ -0,0 +1,1124 @@
+diff -urN mawk-1.3.3.org/array.c mawk-1.3.3/array.c
+--- mawk-1.3.3.org/array.c	1996-09-18 03:07:09.000000000 +0200
++++ mawk-1.3.3/array.c	2006-02-03 18:20:22.000000000 +0100
+@@ -112,8 +112,10 @@
+             Int ival = d_to_I(d) ;
+             if ((double)ival == d) {
+                                       if (A->type == AY_SPLIT)
++					{
+                                          if (ival >=1 && ival <= A->size) convert_split_array_to_table(A) ;
+                                          else return ; /* ival not in range */
++					}
+                                       ap = find_by_ival(A, ival, NO_CREATE) ;
+                                       if (ap) { /* remove from the front of the ilist */
+                                          DUAL_LINK *table = (DUAL_LINK*) A->ptr ;
+diff -urN mawk-1.3.3.org/bi_funct.c mawk-1.3.3/bi_funct.c
+--- mawk-1.3.3.org/bi_funct.c	1996-01-14 18:16:11.000000000 +0100
++++ mawk-1.3.3/bi_funct.c	2006-02-03 18:20:22.000000000 +0100
+@@ -74,37 +74,36 @@
+ #include "regexp.h"
+ #include "repl.h"
+ #include <math.h>
+-
++#include <unistd.h>
+ 
+ /* statics */
+ static STRING *PROTO(gsub, (PTR, CELL *, char *, int)) ;
+ static void PROTO(fplib_err, (char *, double, char *)) ;
+ 
+-
+ /* global for the disassembler */
+ BI_REC bi_funct[] =
+ {				/* info to load builtins */
+ 
+-   "length", bi_length, 0, 1,	/* special must come first */
+-   "index", bi_index, 2, 2,
+-   "substr", bi_substr, 2, 3,
+-   "sprintf", bi_sprintf, 1, 255,
+-   "sin", bi_sin, 1, 1,
+-   "cos", bi_cos, 1, 1,
+-   "atan2", bi_atan2, 2, 2,
+-   "exp", bi_exp, 1, 1,
+-   "log", bi_log, 1, 1,
+-   "int", bi_int, 1, 1,
+-   "sqrt", bi_sqrt, 1, 1,
+-   "rand", bi_rand, 0, 0,
+-   "srand", bi_srand, 0, 1,
+-   "close", bi_close, 1, 1,
+-   "system", bi_system, 1, 1,
+-   "toupper", bi_toupper, 1, 1,
+-   "tolower", bi_tolower, 1, 1,
+-   "fflush", bi_fflush, 0, 1,
++   {"length", bi_length, 0, 1},	/* special must come first */
++   {"index", bi_index, 2, 2},
++   {"substr", bi_substr, 2, 3},
++   {"sprintf", bi_sprintf, 1, 255},
++   {"sin", bi_sin, 1, 1},
++   {"cos", bi_cos, 1, 1},
++   {"atan2", bi_atan2, 2, 2},
++   {"exp", bi_exp, 1, 1},
++   {"log", bi_log, 1, 1},
++   {"int", bi_int, 1, 1},
++   {"sqrt", bi_sqrt, 1, 1},
++   {"rand", bi_rand, 0, 0},
++   {"srand", bi_srand, 0, 1},
++   {"close", bi_close, 1, 1},
++   {"system", bi_system, 1, 1},
++   {"toupper", bi_toupper, 1, 1},
++   {"tolower", bi_tolower, 1, 1},
++   {"fflush", bi_fflush, 0, 1},
+ 
+-   (char *) 0, (PF_CP) 0, 0, 0} ;
++   {(char *) 0, (PF_CP) 0, 0, 0}} ;
+ 
+ 
+ /* load built-in functions in symbol table */
+@@ -175,7 +174,7 @@
+       case 2:
+ 	 {
+ 	    int k1 = key[1] ;
+-	    while (target = strchr(target, k))
++	    while ((target = strchr(target, k)))
+ 	       if (target[1] == k1)  return target ;
+ 	       else  target++ ;
+ 	    /*failed*/
+@@ -184,7 +183,7 @@
+    }
+ 
+    key_len-- ;
+-   while (target = strchr(target, k))
++   while ((target = strchr(target, k)))
+    {
+       if (strncmp(target + 1, key + 1, key_len) == 0)  return target ;
+       else  target++ ;
+@@ -206,7 +205,7 @@
+    sp-- ;
+    if (TEST2(sp) != TWO_STRINGS)  cast2_to_s(sp) ;
+ 
+-   if (len = string(sp + 1)->len)
++   if ((len = string(sp + 1)->len))
+       idx = (p = str_str(string(sp)->str, string(sp + 1)->str, len))
+ 	 ? p - string(sp)->str + 1 : 0 ;
+ 
+@@ -240,7 +239,7 @@
+ 
+    if ((len = sval->len) == 0)	/* substr on null string */
+    {
+-      if (n_args == 3)	cell_destroy(sp + 2) ;
++      if (n_args == 3) { cell_destroy(sp + 2) ; }
+       cell_destroy(sp + 1) ;
+       return sp ;
+    }
+@@ -831,7 +830,7 @@
+    if (sc.type < C_STRING)  cast1_to_s(&sc) ;
+    front = string(&sc)->str ;
+ 
+-   if (middle = REmatch(front, sp->ptr, &middle_len))
++   if ((middle = REmatch(front, sp->ptr, &middle_len)))
+    {
+       front_len = middle - front ;
+       back = middle + middle_len ;
+diff -urN mawk-1.3.3.org/configure mawk-1.3.3/configure
+--- mawk-1.3.3.org/configure	1996-09-05 01:43:01.000000000 +0200
++++ mawk-1.3.3/configure	2006-02-03 18:20:31.000000000 +0100
+@@ -532,6 +532,8 @@
+ log()
+ ; return 0; }
+ EOF
++XCFLAGS=$CFLAGS
++CFLAGS="-fno-builtin $CFLAGS"
+ if eval $ac_link; then
+   rm -rf conftest*
+   eval "ac_cv_lib_m=yes"
+@@ -540,6 +542,7 @@
+   eval "ac_cv_lib_m=no"
+ fi
+ rm -f conftest*
++CFLAGS=$XCFLAGS
+ LIBS="$ac_save_LIBS"
+ 
+ fi
+diff -urN mawk-1.3.3.org/da.c mawk-1.3.3/da.c
+--- mawk-1.3.3.org/da.c	1995-06-18 21:19:59.000000000 +0200
++++ mawk-1.3.3/da.c	2006-02-03 18:20:22.000000000 +0100
+@@ -68,65 +68,65 @@
+ } simple_code[] =
+ 
+ {
+-   _STOP, "stop",
+-   FE_PUSHA, "fe_pusha",
+-   FE_PUSHI, "fe_pushi",
+-   A_TEST, "a_test",
+-   A_DEL, "a_del",
+-   DEL_A, "del_a",
+-   POP_AL, "pop_al",
+-   _POP, "pop",
+-   _ADD, "add",
+-   _SUB, "sub",
+-   _MUL, "mul",
+-   _DIV, "div",
+-   _MOD, "mod",
+-   _POW, "pow",
+-   _NOT, "not",
+-   _UMINUS, "uminus",
+-   _UPLUS, "uplus",
+-   _TEST, "test",
+-   _CAT, "cat",
+-   _ASSIGN, "assign",
+-   _ADD_ASG, "add_asg",
+-   _SUB_ASG, "sub_asg",
+-   _MUL_ASG, "mul_asg",
+-   _DIV_ASG, "div_asg",
+-   _MOD_ASG, "mod_asg",
+-   _POW_ASG, "pow_asg",
+-   NF_PUSHI, "nf_pushi",
+-   F_ASSIGN, "f_assign",
+-   F_ADD_ASG, "f_add_asg",
+-   F_SUB_ASG, "f_sub_asg",
+-   F_MUL_ASG, "f_mul_asg",
+-   F_DIV_ASG, "f_div_asg",
+-   F_MOD_ASG, "f_mod_asg",
+-   F_POW_ASG, "f_pow_asg",
+-   _POST_INC, "post_inc",
+-   _POST_DEC, "post_dec",
+-   _PRE_INC, "pre_inc",
+-   _PRE_DEC, "pre_dec",
+-   F_POST_INC, "f_post_inc",
+-   F_POST_DEC, "f_post_dec",
+-   F_PRE_INC, "f_pre_inc",
+-   F_PRE_DEC, "f_pre_dec",
+-   _EQ, "eq",
+-   _NEQ, "neq",
+-   _LT, "lt",
+-   _LTE, "lte",
+-   _GT, "gt",
+-   _GTE, "gte",
+-   _MATCH2, "match2",
+-   _EXIT, "exit",
+-   _EXIT0, "exit0",
+-   _NEXT, "next",
+-   _RET, "ret",
+-   _RET0, "ret0",
+-   _OMAIN, "omain",
+-   _JMAIN, "jmain",
+-   OL_GL, "ol_gl",
+-   OL_GL_NR, "ol_gl_nr",
+-   _HALT, (char *) 0
++   {_STOP, "stop"},
++   {FE_PUSHA, "fe_pusha"},
++   {FE_PUSHI, "fe_pushi"},
++   {A_TEST, "a_test"},
++   {A_DEL, "a_del"},
++   {DEL_A, "del_a"},
++   {POP_AL, "pop_al"},
++   {_POP, "pop"},
++   {_ADD, "add"},
++   {_SUB, "sub"},
++   {_MUL, "mul"},
++   {_DIV, "div"},
++   {_MOD, "mod"},
++   {_POW, "pow"},
++   {_NOT, "not"},
++   {_UMINUS, "uminus"},
++   {_UPLUS, "uplus"},
++   {_TEST, "test"},
++   {_CAT, "cat"},
++   {_ASSIGN, "assign"},
++   {_ADD_ASG, "add_asg"},
++   {_SUB_ASG, "sub_asg"},
++   {_MUL_ASG, "mul_asg"},
++   {_DIV_ASG, "div_asg"},
++   {_MOD_ASG, "mod_asg"},
++   {_POW_ASG, "pow_asg"},
++   {NF_PUSHI, "nf_pushi"},
++   {F_ASSIGN, "f_assign"},
++   {F_ADD_ASG, "f_add_asg"},
++   {F_SUB_ASG, "f_sub_asg"},
++   {F_MUL_ASG, "f_mul_asg"},
++   {F_DIV_ASG, "f_div_asg"},
++   {F_MOD_ASG, "f_mod_asg"},
++   {F_POW_ASG, "f_pow_asg"},
++   {_POST_INC, "post_inc"},
++   {_POST_DEC, "post_dec"},
++   {_PRE_INC, "pre_inc"},
++   {_PRE_DEC, "pre_dec"},
++   {F_POST_INC, "f_post_inc"},
++   {F_POST_DEC, "f_post_dec"},
++   {F_PRE_INC, "f_pre_inc"},
++   {F_PRE_DEC, "f_pre_dec"},
++   {_EQ, "eq"},
++   {_NEQ, "neq"},
++   {_LT, "lt"},
++   {_LTE, "lte"},
++   {_GT, "gt"},
++   {_GTE, "gte"},
++   {_MATCH2, "match2"},
++   {_EXIT, "exit"},
++   {_EXIT0, "exit0"},
++   {_NEXT, "next"},
++   {_RET, "ret"},
++   {_RET0, "ret0"},
++   {_OMAIN, "omain"},
++   {_JMAIN, "jmain"},
++   {OL_GL, "ol_gl"},
++   {OL_GL_NR, "ol_gl_nr"},
++   {_HALT, (char *) 0}
+ } ;
+ 
+ static char *jfmt = "%s%s%03d\n" ; 
+@@ -367,12 +367,12 @@
+ }
+ special_cases[] =
+ {
+-   bi_split, "split",
+-   bi_match, "match",
+-   bi_getline, "getline",
+-   bi_sub, "sub",
+-   bi_gsub, "gsub",
+-   (PF_CP) 0, (char *) 0
++   {bi_split, "split"},
++   {bi_match, "match"},
++   {bi_getline, "getline"},
++   {bi_sub, "sub"},
++   {bi_gsub, "gsub"},
++   {(PF_CP) 0, (char *) 0}
+ } ;
+ 
+ static char *
+diff -urN mawk-1.3.3.org/error.c mawk-1.3.3/error.c
+--- mawk-1.3.3.org/error.c	1995-06-06 02:18:22.000000000 +0200
++++ mawk-1.3.3/error.c	2006-02-03 18:20:22.000000000 +0100
+@@ -68,54 +68,54 @@
+ static struct token_str  {
+ short token ;
+ char *str ; }  token_str[] = {
+-EOF , "end of file" ,
+-NL , "end of line",
+-SEMI_COLON , ";" ,
+-LBRACE , "{" ,
+-RBRACE , "}" ,
+-SC_FAKE_SEMI_COLON, "}",
+-LPAREN , "(" ,
+-RPAREN , ")" ,
+-LBOX , "[",
+-RBOX , "]",
+-QMARK , "?",
+-COLON , ":",
+-OR, "||",
+-AND, "&&",
+-ASSIGN , "=" ,
+-ADD_ASG, "+=",
+-SUB_ASG, "-=",
+-MUL_ASG, "*=",
+-DIV_ASG, "/=",
+-MOD_ASG, "%=",
+-POW_ASG, "^=",
+-EQ  , "==" ,
+-NEQ , "!=",
+-LT, "<" ,
+-LTE, "<=" ,
+-GT, ">",
+-GTE, ">=" ,
+-MATCH, string_buff,
+-PLUS , "+" ,
+-MINUS, "-" ,
+-MUL , "*" ,
+-DIV, "/"  , 
+-MOD, "%" ,
+-POW, "^" ,
+-NOT, "!" ,
+-COMMA, "," ,
+-INC_or_DEC , string_buff ,
+-DOUBLE  , string_buff ,
+-STRING_  , string_buff ,
+-ID  , string_buff ,
+-FUNCT_ID  , string_buff ,
+-BUILTIN  , string_buff ,
+-IO_OUT , string_buff ,
+-IO_IN, "<" ,
+-PIPE, "|" ,
+-DOLLAR, "$" ,
+-FIELD, "$" ,
+-0, (char *) 0 } ;
++{EOF , "end of file" },
++{NL , "end of line"},
++{SEMI_COLON , ";" },
++{LBRACE , "{" },
++{RBRACE , "}" },
++{SC_FAKE_SEMI_COLON, "}"},
++{LPAREN , "(" },
++{RPAREN , ")" },
++{LBOX , "["},
++{RBOX , "]"},
++{QMARK , "?"},
++{COLON , ":"},
++{OR, "||"},
++{AND, "&&"},
++{ASSIGN , "=" },
++{ADD_ASG, "+="},
++{SUB_ASG, "-="},
++{MUL_ASG, "*="},
++{DIV_ASG, "/="},
++{MOD_ASG, "%="},
++{POW_ASG, "^="},
++{EQ  , "==" },
++{NEQ , "!="},
++{LT, "<" },
++{LTE, "<=" },
++{GT, ">"},
++{GTE, ">=" },
++{MATCH, string_buff},
++{PLUS , "+" },
++{MINUS, "-" },
++{MUL , "*" },
++{DIV, "/"  },
++{MOD, "%" },
++{POW, "^" },
++{NOT, "!" },
++{COMMA, "," },
++{INC_or_DEC , string_buff },
++{DOUBLE  , string_buff },
++{STRING_  , string_buff },
++{ID  , string_buff },
++{FUNCT_ID  , string_buff },
++{BUILTIN  , string_buff },
++{IO_OUT , string_buff },
++{IO_IN, "<" },
++{PIPE, "|" },
++{DOLLAR, "$" },
++{FIELD, "$" },
++{0, (char *) 0 }} ;
+ 
+ /* if paren_cnt >0 and we see one of these, we are missing a ')' */
+ static int missing_rparen[] =
+diff -urN mawk-1.3.3.org/fcall.c mawk-1.3.3/fcall.c
+--- mawk-1.3.3.org/fcall.c	1995-08-27 17:46:47.000000000 +0200
++++ mawk-1.3.3/fcall.c	2006-02-03 18:20:22.000000000 +0100
+@@ -86,7 +86,7 @@
+        take q off entry_list
+        test it
+ 	   if OK  zfree(q)  else put on exit_list  */  
+-   while (q = entry_list)
++   while ((q = entry_list))
+    {
+       entry_list = q->link ;
+ 
+@@ -235,8 +235,8 @@
+       }
+       /* note p->arg_list starts with last argument */
+       else if (!p->arg_list /* nothing to do */	 ||
+-	       !p->arg_cnt_checked &&
+-	       !arg_cnt_ok(p->callee, p->arg_list, p->line_no))
++	       (!p->arg_cnt_checked &&
++		!arg_cnt_ok(p->callee, p->arg_list, p->line_no)))
+       {
+ 	 q->link = p->link ;	 /* delete p */
+ 	 /* the ! arg_list case is not an error so free memory */
+@@ -301,8 +301,8 @@
+       p = old_list ;
+       old_list = p->link ;
+ 
+-      if (p->arg_list = call_arg_check(p->callee, p->arg_list,
+-				       p->call_start, p->line_no))
++      if ((p->arg_list = call_arg_check(p->callee, p->arg_list,
++				       p->call_start, p->line_no)))
+       {
+ 	 /* still have work to do , put on new_list   */
+ 	 progress |= check_progress ;
+@@ -352,8 +352,8 @@
+       /* usually arg_list disappears here and all is well
+ 	 otherwise add to resolve list */
+ 
+-      if (arg_list = call_arg_check(callee, arg_list,
+-				    code_base, line_no))
++      if ((arg_list = call_arg_check(callee, arg_list,
++				    code_base, line_no)))
+       {
+ 	 p = ZMALLOC(FCALL_REC) ;
+ 	 p->callee = callee ;
+diff -urN mawk-1.3.3.org/field.c mawk-1.3.3/field.c
+--- mawk-1.3.3.org/field.c	1995-06-18 21:17:47.000000000 +0200
++++ mawk-1.3.3/field.c	2006-02-03 18:20:22.000000000 +0100
+@@ -109,13 +109,15 @@
+       scan_code['\n'] = SC_UNEXPECTED ;
+ 
+    if (rs_shadow.type == SEP_STR)
+-      free_STRING((STRING *) rs_shadow.ptr) ;
++     {
++       free_STRING((STRING *) rs_shadow.ptr) ;
++     }
+ 
+    cast_for_split(cellcpy(&c, RS)) ;
+    switch (c.type)
+    {
+       case C_RE:
+-	 if (s = is_string_split(c.ptr, &len))
++	 if ((s = is_string_split(c.ptr, &len)))
+ 	 {
+ 	    if (len == 1)
+ 	    {
+@@ -276,7 +278,7 @@
+       field[cnt--].type = C_MBSTRN ;
+    }
+ 
+-   if (cp == &c)  free_STRING(string(cp)) ;
++   if (cp == &c) { free_STRING(string(cp)) ; }
+ }
+ 
+ /*
+@@ -503,7 +505,7 @@
+ 	 memcpy(p, string(cp)->str, string(cp)->len) ;
+ 	 p += string(cp)->len ;
+ 	 /* if not really string, free temp use of ptr */
+-	 if (cp->type < C_STRING)  free_STRING(string(cp)) ;
++	 if (cp->type < C_STRING) { free_STRING(string(cp)) ; }
+ 	 if (++cp == cp_limit)
+ 	 {
+ 	    cp = *++fbp ;
+diff -urN mawk-1.3.3.org/files.c mawk-1.3.3/files.c
+--- mawk-1.3.3.org/files.c	1996-01-14 18:14:10.000000000 +0100
++++ mawk-1.3.3/files.c	2006-02-03 18:20:22.000000000 +0100
+@@ -61,17 +61,14 @@
+ #include "memory.h"
+ #include "fin.h"
+ 
+-static FILE *PROTO(tfopen, (char *, char *)) ;
+-static void PROTO(efflush, (FILE*)) ;
+-static void PROTO(add_to_child_list, (int, int)) ;
+-static struct child *PROTO(remove_from_child_list, (int)) ;
+-extern int PROTO(isatty, (int)) ;
++#include <sys/types.h>
++#include <sys/wait.h>
++#include <unistd.h>
+ 
+ #ifdef	V7
+ #include  <sgtty.h>		/* defines FIOCLEX */
+ #endif
+ 
+-
+ #ifndef	 NO_FCNTL_H
+ 
+ #include <fcntl.h>
+@@ -103,6 +100,14 @@
+ 
+ static FILE_NODE *file_list ;
+ 
++/* Prototypes for local functions */
++
++static FILE *PROTO(tfopen, (char *, char *)) ;
++static void PROTO(efflush, (FILE*)) ;
++static void PROTO(add_to_child_list, (int, int)) ;
++static struct child *PROTO(remove_from_child_list, (int)) ;
++extern int PROTO(isatty, (int)) ;
++static void PROTO(close_error, (FILE_NODE *p));
+ 
+ /* find a file on file_list */
+ PTR
+@@ -186,7 +191,7 @@
+       if (strcmp(name, p->name->str) == 0 &&
+ 	  (p->type == type ||
+       /* no distinction between F_APPEND and F_TRUNC here */
+-	   p->type >= F_APPEND && type >= F_APPEND))
++	   (p->type >= F_APPEND && type >= F_APPEND)))
+ 
+       {
+ 	 /* found */
+@@ -233,16 +238,28 @@
+       if (strcmp(name, p->name->str) == 0)
+       {
+ 	 /* found */
+-	 switch (p->type)
++
++         /* Remove it from the list first because we might be called 
++            again if an error occurs leading to an infinite loop. 
++
++            Note that we don't have to consider the list corruption 
++            caused by a recursive call because it will never return. */
++
++	 q->link = p->link ;
++         file_list = dummy.link ;   /* maybe it was the first file */
++         
++         switch (p->type)
+ 	 {
+ 	    case F_TRUNC:
+ 	    case F_APPEND:
+-	       fclose((FILE *) p->ptr) ;
++	       if( fclose((FILE *) p->ptr) != 0 )
++		  close_error(p) ;
+ 	       retval = 0 ;
+ 	       break ;
+ 
+ 	    case PIPE_OUT:
+-	       fclose((FILE *) p->ptr) ;
++	       if( fclose((FILE *) p->ptr) != 0 )
++	       	  close_error(p) ;
+ 
+ #if  HAVE_REAL_PIPES
+ 	       retval = wait_for(p->pid) ;
+@@ -274,8 +291,8 @@
+ 	 }
+ 
+ 	 free_STRING(p->name) ;
+-	 hold = p ;
+-	 q->link = p = p->link ;
++         hold = p ;
++	 p = p->link ;
+ 	 ZFREE(hold) ;
+       }
+       else
+@@ -284,7 +301,6 @@
+       }
+    }
+ 
+-   file_list = dummy.link ;
+    return retval ;
+ }
+ 
+@@ -364,7 +380,14 @@
+    {
+       if (IS_OUTPUT(p->type))
+       {
+-	 fclose((FILE *) p->ptr) ;   
++	 if( fclose((FILE *) p->ptr) != 0 )
++         {
++            /* if another error occurs we do not want to be called 
++               for the same file again */
++
++            file_list = p->link ;
++	    close_error(p) ;
++         }
+ 	 if (p->type == PIPE_OUT) wait_for(p->pid) ; 
+       }
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list