Miod Vallat <m...@online.fr> writes:

>> So here's the same diff without the "negative 0.0" change.
>> Update which:
>> - marks some functions as __dead (instead of upstream
>>   __attribute__((__noreturn__)))
>> - fixes split(a[1], a).
>> 
>> ok?
>
> FIXES still lists the setfval change, which you did not include. It
> would make sense to omit this chunk from FIXES as well.

Tobias reminded me about this.  Same diff, with a note added to FIXES.
I can completely get rid of that entry if people feel it's necessary.
A previous diff that included the "negative zero" change from upstream
had been successfuly tested in a ports bulk build (thanks to Landry),
I don't think this diff needs another bulk but YMMV.

ok?

Index: FIXES
===================================================================
RCS file: /cvs/src/usr.bin/awk/FIXES,v
retrieving revision 1.16
diff -u -p -r1.16 FIXES
--- FIXES       28 Sep 2011 19:27:18 -0000      1.16
+++ FIXES       9 Jan 2014 12:46:35 -0000
@@ -26,6 +26,22 @@ THIS SOFTWARE.
 This file lists all bug fixes, changes, etc., made since the AWK book
 was sent to the printers in August, 1987.
 
+Dec 20, 2012:
+       fiddled makefile to get correct yacc and bison flags.  pick yacc
+       (linux) or bison (mac) as necessary.
+
+       added  __attribute__((__noreturn__)) to a couple of lines in
+       proto.h, to silence someone's enthusiastic checker.
+
+       fixed obscure call by value bug in split(a[1],a) reported on
+       9fans.  the management of temporary values is just a mess; i
+       took a shortcut by making an extra string copy.  thanks
+       to paul patience and arnold robbins for passing it on and for
+       proposed patches.
+
+       tiny fiddle in setfval to eliminate -0 results in T.expr, which
+       has irritated me for 20+ years.  (not present on OpenBSD)
+
 Aug 10, 2011:
        another fix to avoid core dump with delete(ARGV); again, many thanks
        to ruslan ermilov.
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/awk/main.c,v
retrieving revision 1.17
diff -u -p -r1.17 main.c
--- main.c      28 Sep 2011 19:27:18 -0000      1.17
+++ main.c      22 Jun 2013 21:52:59 -0000
@@ -23,7 +23,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE
 THIS SOFTWARE.
 ****************************************************************/
 
-const char     *version = "version 20110810";
+const char     *version = "version 20121220";
 
 #define DEBUG
 #include <stdio.h>
Index: proto.h
===================================================================
RCS file: /cvs/src/usr.bin/awk/proto.h,v
retrieving revision 1.9
diff -u -p -r1.9 proto.h
--- proto.h     28 Sep 2011 19:27:18 -0000      1.9
+++ proto.h     22 Jun 2013 21:36:31 -0000
@@ -47,7 +47,7 @@ extern        void    freetr(Node *);
 extern int     hexstr(uschar **);
 extern int     quoted(uschar **);
 extern char    *cclenter(const char *);
-extern void    overflo(const char *);
+extern void    overflo(const char *) __dead;
 extern void    cfoll(fa *, Node *);
 extern int     first(Node *);
 extern void    follow(Node *);
@@ -133,7 +133,7 @@ extern      void    fpecatch(int);
 extern void    bracecheck(void);
 extern void    bcheck2(int, int, int);
 extern void    SYNTAX(const char *, ...);
-extern void    FATAL(const char *, ...);
+extern void    FATAL(const char *, ...) __dead;
 extern void    WARNING(const char *, ...);
 extern void    error(void);
 extern void    eprint(void);
Index: run.c
===================================================================
RCS file: /cvs/src/usr.bin/awk/run.c,v
retrieving revision 1.34
diff -u -p -r1.34 run.c
--- run.c       29 Sep 2013 15:42:25 -0000      1.34
+++ run.c       21 Oct 2013 21:16:11 -0000
@@ -1218,13 +1218,13 @@ Cell *dopa2(Node **a, int n)    /* a[0], a[
 Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */
 {
        Cell *x = 0, *y, *ap;
-       char *s;
+       char *s, *origs;
        int sep;
        char *t, temp, num[50], *fs = 0;
        int n, tempstat, arg3type;
 
        y = execute(a[0]);      /* source string */
-       s = getsval(y);
+       origs = s = strdup(getsval(y));
        arg3type = ptoi(a[3]);
        if (a[2] == 0)          /* fs string */
                fs = *FS;
@@ -1344,6 +1344,7 @@ Cell *split(Node **a, int nnn)    /* split(
        }
        tempfree(ap);
        tempfree(y);
+       free(origs);
        if (a[2] != 0 && arg3type == STRING) {
                tempfree(x);
        }


-- 
jca | PGP: 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
(previous: 0x06A11494 / 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494)

Reply via email to