This commit is contained in:
parent
c3843e8035
commit
af602458c8
309
dev-fd.diff
309
dev-fd.diff
@ -1,309 +0,0 @@
|
|||||||
From nobody Tue Jul 4 10:54:31 2006
|
|
||||||
From: Aharon Robbins <arnold@skeeve.com>
|
|
||||||
Subject: Re: /dev/fd/n bug in gawk 3.1.5
|
|
||||||
To: aschorr@telemetry-investments.com
|
|
||||||
Cc: Juergen.Kahrs@vr-web.de, bug-gawk@gnu.org, spcecdt@armory.com
|
|
||||||
Date: Tue, 04 Jul 2006 07:40:10 +0300
|
|
||||||
|
|
||||||
> Date: Mon, 03 Jul 2006 16:54:19 -0400
|
|
||||||
> From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
|
|
||||||
> Subject: Re: /dev/fd/n bug in gawk 3.1.5
|
|
||||||
> To: Aharon Robbins <arnold@skeeve.com>
|
|
||||||
>
|
|
||||||
> Hi,
|
|
||||||
>
|
|
||||||
> Note that the pid test was failing silently: "make check" was
|
|
||||||
> reporting "ALL TESTS PASSED" even though gawk was SEGV'ing
|
|
||||||
> in the pid test.
|
|
||||||
|
|
||||||
I noticed this on RHEL 4 system at work where the test failed
|
|
||||||
noisily. I'm guessing a difference in versions of bash...
|
|
||||||
|
|
||||||
> Attached is a patch to the pid test
|
|
||||||
> that fixes this problem (i.e. the test will now fail noisily).
|
|
||||||
> The problem was that the SEGV was aborting the script
|
|
||||||
> prematurely, and leaving a zero-length output file, which was
|
|
||||||
> precisely correct. The fix was to make sure that test/pid.awk
|
|
||||||
> produces some output. That way we get a comparison failure
|
|
||||||
> if the output file is empty.
|
|
||||||
|
|
||||||
Actually, the correct fix is to keep gawk from SEGV-ing in the
|
|
||||||
first place. Below is full diff of io.c relative to 3.1.5.
|
|
||||||
|
|
||||||
I will probably incorporate your changes also as extra insurance.
|
|
||||||
|
|
||||||
Thanks,
|
|
||||||
|
|
||||||
Arnold
|
|
||||||
-----------------------------------------------------
|
|
||||||
Mon Jul 3 00:27:59 2006 Arnold D. Robbins <arnold@skeeve.com>
|
|
||||||
|
|
||||||
* io.c (INTERNAL_HANDLE): New constant for use by `iop_alloc'
|
|
||||||
when allocating an internal IOBUF.
|
|
||||||
(pidopen, useropen): Use it.
|
|
||||||
(iop_alloc): Add check for it and just return iop.
|
|
||||||
|
|
||||||
Sun Jun 18 22:27:25 2006 Arnold D. Robbins <arnold@skeeve.com>
|
|
||||||
|
|
||||||
Repair internal names like /dev/user, /dev/pid, as well as /dev/fd/N,
|
|
||||||
which have been broken for a long time but noone noticed.
|
|
||||||
|
|
||||||
* io.c (is_internal): new macro to check for internal file like `/dev/user'.
|
|
||||||
(spec_setup): Reduce to two parameters, allocate logic is always true.
|
|
||||||
Add IOP_NO_FREE to flag.
|
|
||||||
(pidopen, useropen): Return `IOBUF *' instead of int. Fix
|
|
||||||
logic to test if `iop' parameter is NULL and if so to allocate it.
|
|
||||||
(specfdopen,): Return `IOBUF *' instead of int. Fix
|
|
||||||
logic to test if `iop' parameter is NULL and if so to allocate it.
|
|
||||||
Don't set IOP_NO_FREE in flag.
|
|
||||||
(iop_open): Remove `IOBUF iob' field from `struct internal' and its use
|
|
||||||
and the use of `spec_setup' from the code here. Change the check in the
|
|
||||||
call to the open function to look for NULL.
|
|
||||||
(get_a_record): Use `is_internal' in initial check for filling the
|
|
||||||
buffer to not try to call `read' on internal files. If true, set
|
|
||||||
the IOP_AT_EOF in the flag and return EOF.
|
|
||||||
|
|
||||||
Fri Aug 12 13:10:33 2005 Arnold D. Robbins <arnold@skeeve.com>
|
|
||||||
|
|
||||||
* io.c (iop_alloc): Only free `iop' if it was malloc'ed in
|
|
||||||
the first place.
|
|
||||||
|
|
||||||
--- ../gawk-3.1.5/io.c 2005-07-26 21:07:43.000000000 +0300
|
|
||||||
+++ io.c 2006-07-03 00:27:51.000000000 +0300
|
|
||||||
@@ -103,6 +103,9 @@
|
|
||||||
|
|
||||||
typedef enum { CLOSE_ALL, CLOSE_TO, CLOSE_FROM } two_way_close_type;
|
|
||||||
|
|
||||||
+/* For internal files, /dev/pid, etc. */
|
|
||||||
+#define INTERNAL_HANDLE (-42)
|
|
||||||
+
|
|
||||||
/* Several macros make the code a bit clearer: */
|
|
||||||
/* */
|
|
||||||
/* */
|
|
||||||
@@ -110,6 +113,7 @@
|
|
||||||
#define at_eof(iop) ((iop->flag & IOP_AT_EOF) != 0)
|
|
||||||
#define has_no_data(iop) (iop->dataend == NULL)
|
|
||||||
#define no_data_left(iop) (iop->off >= iop->dataend)
|
|
||||||
+#define is_internal(iop) ((iop->flag & IOP_IS_INTERNAL) != 0)
|
|
||||||
/* The key point to the design is to split out the code that searches through */
|
|
||||||
/* a buffer looking for the record and the terminator into separate routines, */
|
|
||||||
/* with a higher-level routine doing the reading of data and buffer management. */
|
|
||||||
@@ -163,10 +167,10 @@
|
|
||||||
static int gawk_pclose P((struct redirect *rp));
|
|
||||||
static int do_pathopen P((const char *file));
|
|
||||||
static int str2mode P((const char *mode));
|
|
||||||
-static void spec_setup P((IOBUF *iop, int len, int allocate));
|
|
||||||
-static int specfdopen P((IOBUF *iop, const char *name, const char *mode));
|
|
||||||
-static int pidopen P((IOBUF *iop, const char *name, const char *mode));
|
|
||||||
-static int useropen P((IOBUF *iop, const char *name, const char *mode));
|
|
||||||
+static void spec_setup P((IOBUF *iop, int len));
|
|
||||||
+static IOBUF *specfdopen P((IOBUF *iop, const char *name, const char *mode));
|
|
||||||
+static IOBUF *pidopen P((IOBUF *iop, const char *name, const char *mode));
|
|
||||||
+static IOBUF *useropen P((IOBUF *iop, const char *name, const char *mode));
|
|
||||||
static int two_way_open P((const char *str, struct redirect *rp));
|
|
||||||
static int pty_vs_pipe P((const char *command));
|
|
||||||
|
|
||||||
@@ -1422,30 +1426,24 @@
|
|
||||||
/* spec_setup --- setup an IOBUF for a special internal file */
|
|
||||||
|
|
||||||
static void
|
|
||||||
-spec_setup(IOBUF *iop, int len, int allocate)
|
|
||||||
+spec_setup(IOBUF *iop, int len)
|
|
||||||
{
|
|
||||||
char *cp;
|
|
||||||
|
|
||||||
- if (allocate) {
|
|
||||||
- emalloc(cp, char *, len+2, "spec_setup");
|
|
||||||
- iop->buf = cp;
|
|
||||||
- } else {
|
|
||||||
- len = strlen(iop->buf);
|
|
||||||
- iop->buf[len++] = '\n'; /* get_a_record clobbered it */
|
|
||||||
- iop->buf[len] = '\0'; /* just in case */
|
|
||||||
- }
|
|
||||||
+ emalloc(cp, char *, len+2, "spec_setup");
|
|
||||||
+ iop->buf = cp;
|
|
||||||
iop->off = iop->buf;
|
|
||||||
iop->count = 0;
|
|
||||||
iop->size = len;
|
|
||||||
iop->end = iop->buf + len;
|
|
||||||
iop->dataend = iop->end;
|
|
||||||
iop->fd = -1;
|
|
||||||
- iop->flag = IOP_IS_INTERNAL | IOP_AT_START;
|
|
||||||
+ iop->flag = IOP_IS_INTERNAL | IOP_AT_START | IOP_NO_FREE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* specfdopen --- open an fd special file */
|
|
||||||
|
|
||||||
-static int
|
|
||||||
+static IOBUF *
|
|
||||||
specfdopen(IOBUF *iop, const char *name, const char *mode)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
@@ -1453,17 +1451,14 @@
|
|
||||||
|
|
||||||
fd = devopen(name, mode);
|
|
||||||
if (fd == INVALID_HANDLE)
|
|
||||||
- return INVALID_HANDLE;
|
|
||||||
- tp = iop_alloc(fd, name, NULL);
|
|
||||||
+ return NULL;
|
|
||||||
+ tp = iop_alloc(fd, name, iop);
|
|
||||||
if (tp == NULL) {
|
|
||||||
/* don't leak fd's */
|
|
||||||
close(fd);
|
|
||||||
- return INVALID_HANDLE;
|
|
||||||
+ return NULL;
|
|
||||||
}
|
|
||||||
- *iop = *tp;
|
|
||||||
- iop->flag |= IOP_NO_FREE;
|
|
||||||
- free(tp);
|
|
||||||
- return 0;
|
|
||||||
+ return tp;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef GETPGRP_VOID
|
|
||||||
@@ -1474,7 +1469,7 @@
|
|
||||||
|
|
||||||
/* pidopen --- "open" /dev/pid, /dev/ppid, and /dev/pgrpid */
|
|
||||||
|
|
||||||
-static int
|
|
||||||
+static IOBUF *
|
|
||||||
pidopen(IOBUF *iop, const char *name, const char *mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
|
||||||
char tbuf[BUFSIZ];
|
|
||||||
@@ -1483,6 +1478,12 @@
|
|
||||||
|
|
||||||
warning(_("use `PROCINFO[\"%s\"]' instead of `%s'"), cp, name);
|
|
||||||
|
|
||||||
+ if (iop == NULL) {
|
|
||||||
+ iop = iop_alloc(INTERNAL_HANDLE, name, iop);
|
|
||||||
+ if (iop == NULL)
|
|
||||||
+ return NULL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (name[6] == 'g')
|
|
||||||
sprintf(tbuf, "%d\n", (int) getpgrp(getpgrp_arg()));
|
|
||||||
else if (name[6] == 'i')
|
|
||||||
@@ -1490,9 +1491,9 @@
|
|
||||||
else
|
|
||||||
sprintf(tbuf, "%d\n", (int) getppid());
|
|
||||||
i = strlen(tbuf);
|
|
||||||
- spec_setup(iop, i, TRUE);
|
|
||||||
+ spec_setup(iop, i);
|
|
||||||
strcpy(iop->buf, tbuf);
|
|
||||||
- return 0;
|
|
||||||
+ return iop;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* useropen --- "open" /dev/user */
|
|
||||||
@@ -1507,7 +1508,7 @@
|
|
||||||
* supplementary group set.
|
|
||||||
*/
|
|
||||||
|
|
||||||
-static int
|
|
||||||
+static IOBUF *
|
|
||||||
useropen(IOBUF *iop, const char *name ATTRIBUTE_UNUSED, const char *mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
|
||||||
char tbuf[BUFSIZ], *cp;
|
|
||||||
@@ -1515,6 +1516,12 @@
|
|
||||||
|
|
||||||
warning(_("use `PROCINFO[...]' instead of `/dev/user'"));
|
|
||||||
|
|
||||||
+ if (iop == NULL) {
|
|
||||||
+ iop = iop_alloc(INTERNAL_HANDLE, name, iop);
|
|
||||||
+ if (iop == NULL)
|
|
||||||
+ return NULL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
sprintf(tbuf, "%d %d %d %d", (int) getuid(), (int) geteuid(), (int) getgid(), (int) getegid());
|
|
||||||
|
|
||||||
cp = tbuf + strlen(tbuf);
|
|
||||||
@@ -1529,9 +1536,9 @@
|
|
||||||
*cp++ = '\0';
|
|
||||||
|
|
||||||
i = strlen(tbuf);
|
|
||||||
- spec_setup(iop, i, TRUE);
|
|
||||||
+ spec_setup(iop, i);
|
|
||||||
strcpy(iop->buf, tbuf);
|
|
||||||
- return 0;
|
|
||||||
+ return iop;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* iop_open --- handle special and regular files for input */
|
|
||||||
@@ -1544,8 +1551,7 @@
|
|
||||||
static struct internal {
|
|
||||||
const char *name;
|
|
||||||
int compare;
|
|
||||||
- int (*fp) P((IOBUF *, const char *, const char *));
|
|
||||||
- IOBUF iob;
|
|
||||||
+ IOBUF *(*fp) P((IOBUF *, const char *, const char *));
|
|
||||||
} table[] = {
|
|
||||||
{ "/dev/fd/", 8, specfdopen },
|
|
||||||
{ "/dev/stdin", 10, specfdopen },
|
|
||||||
@@ -1570,12 +1576,7 @@
|
|
||||||
|
|
||||||
for (i = 0; i < devcount; i++) {
|
|
||||||
if (STREQN(name, table[i].name, table[i].compare)) {
|
|
||||||
- iop = & table[i].iob;
|
|
||||||
-
|
|
||||||
- if (iop->buf != NULL) {
|
|
||||||
- spec_setup(iop, 0, FALSE);
|
|
||||||
- return iop;
|
|
||||||
- } else if ((*table[i].fp)(iop, name, mode) == 0)
|
|
||||||
+ if ((iop = (*table[i].fp)(iop, name, mode)) != NULL)
|
|
||||||
return iop;
|
|
||||||
else {
|
|
||||||
warning(_("could not open `%s', mode `%s'"),
|
|
||||||
@@ -2480,9 +2481,12 @@
|
|
||||||
{
|
|
||||||
struct stat sbuf;
|
|
||||||
struct open_hook *oh;
|
|
||||||
+ int iop_malloced = FALSE;
|
|
||||||
|
|
||||||
- if (iop == NULL)
|
|
||||||
+ if (iop == NULL) {
|
|
||||||
emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
|
|
||||||
+ iop_malloced = TRUE;
|
|
||||||
+ }
|
|
||||||
memset(iop, '\0', sizeof(IOBUF));
|
|
||||||
iop->flag = 0;
|
|
||||||
iop->fd = fd;
|
|
||||||
@@ -2494,8 +2498,12 @@
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (iop->fd == INTERNAL_HANDLE)
|
|
||||||
+ return iop;
|
|
||||||
+
|
|
||||||
if (iop->fd == INVALID_HANDLE) {
|
|
||||||
- free(iop);
|
|
||||||
+ if (iop_malloced)
|
|
||||||
+ free(iop);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (isatty(iop->fd))
|
|
||||||
@@ -2503,7 +2511,7 @@
|
|
||||||
iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf);
|
|
||||||
iop->sbuf = sbuf;
|
|
||||||
if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0)
|
|
||||||
- lintwarn(_("data file `%s' is empty"), name);
|
|
||||||
+ lintwarn(_("data file `%s' is empty"), name);
|
|
||||||
errno = 0;
|
|
||||||
iop->count = iop->scanoff = 0;
|
|
||||||
emalloc(iop->buf, char *, iop->size += 2, "iop_alloc");
|
|
||||||
@@ -2906,6 +2914,10 @@
|
|
||||||
|
|
||||||
/* <fill initial buffer>= */
|
|
||||||
if (has_no_data(iop) || no_data_left(iop)) {
|
|
||||||
+ if (is_internal(iop)) {
|
|
||||||
+ iop->flag |= IOP_AT_EOF;
|
|
||||||
+ return EOF;
|
|
||||||
+ }
|
|
||||||
iop->count = read(iop->fd, iop->buf, iop->readsize);
|
|
||||||
if (iop->count == 0) {
|
|
||||||
iop->flag |= IOP_AT_EOF;
|
|
||||||
|
|
||||||
|
|
||||||
_______________________________________________
|
|
||||||
bug-gnu-utils@gnu.org
|
|
||||||
http://lists.gnu.org/mailman/listinfo/bug-gnu-utils
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
|||||||
--- dfa.c
|
|
||||||
+++ dfa.c
|
|
||||||
@@ -1373,7 +1373,14 @@
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < ntokens; ++i)
|
|
||||||
- addtok(dfa->tokens[tindex + i]);
|
|
||||||
+ {
|
|
||||||
+ addtok(dfa->tokens[tindex + i]);
|
|
||||||
+#ifdef MBS_SUPPORT
|
|
||||||
+ /* Update index into multibyte csets. */
|
|
||||||
+ if (MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
|
|
||||||
+ dfa->multibyte_prop[dfa->tindex - 1] = dfa->multibyte_prop[tindex + i];
|
|
||||||
+#endif
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
@ -1,47 +0,0 @@
|
|||||||
From nobody Wed Nov 30 23:49:26 2005
|
|
||||||
From: Paul Eggert <eggert@CS.UCLA.EDU>
|
|
||||||
Subject: Re: gawk: length return incorrect value when MB_CUR_MAX > 1
|
|
||||||
To: Hirofumi Saito <hi_saito@yk.rim.or.jp>
|
|
||||||
Cc: bug-gawk@gnu.org, KIMURA Koichi <kimura.koichi@canon.co.jp>
|
|
||||||
Date: Wed, 30 Nov 2005 13:39:56 -0800
|
|
||||||
|
|
||||||
Hirofumi Saito <hi_saito@yk.rim.or.jp> writes:
|
|
||||||
|
|
||||||
> And then, I tried to use gawk 3.1.5 which I build with sarge.
|
|
||||||
>
|
|
||||||
> $ LANG=ja_JP.utf8 gawk 'BEGIN {print length("abc\0def")}'
|
|
||||||
> 7
|
|
||||||
> $ LANG=ja_JP.eucJP gawk 'BEGIN {print length("abc\0def")}'
|
|
||||||
> 3
|
|
||||||
|
|
||||||
Very strange. I don't get this result with Debian sarge x86; instead,
|
|
||||||
I get 3 in both cases. And that is what I would expect to get, given
|
|
||||||
the source code. Perhaps your locales weren't all built? (Also, I
|
|
||||||
set LC_ALL rather than LANG; that's safer.)
|
|
||||||
|
|
||||||
> By the way, I patched Kimura's patch, then:
|
|
||||||
|
|
||||||
Yes, his patch should work.
|
|
||||||
|
|
||||||
Here's a slightly more-efficient patch:
|
|
||||||
|
|
||||||
--- node.c-bak 2005-07-26 11:07:43.000000000 -0700
|
|
||||||
+++ node.c 2005-11-30 13:33:44.000000000 -0800
|
|
||||||
@@ -749,9 +749,10 @@ str2wstr(NODE *n, size_t **ptr)
|
|
||||||
switch (count) {
|
|
||||||
case (size_t) -2:
|
|
||||||
case (size_t) -1:
|
|
||||||
- case 0:
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
+ case 0:
|
|
||||||
+ count = 1;
|
|
||||||
default:
|
|
||||||
*wsp++ = wc;
|
|
||||||
src_count -= count;
|
|
||||||
|
|
||||||
|
|
||||||
_______________________________________________
|
|
||||||
bug-gnu-utils@gnu.org
|
|
||||||
http://lists.gnu.org/mailman/listinfo/bug-gnu-utils
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
|||||||
From nobody Fri Oct 7 13:31:33 2005
|
|
||||||
From: Aharon Robbins <arnold@skeeve.com>
|
|
||||||
Subject: Re: gawk 3.1.5 FIELDWIDTHS bug - 1 off
|
|
||||||
To: jeff93@silk.corp.fedex.com
|
|
||||||
Cc: bug-gnu-utils@gnu.org
|
|
||||||
Date: Fri, 07 Oct 2005 12:26:28 +0200
|
|
||||||
|
|
||||||
Greetings. Re this:
|
|
||||||
|
|
||||||
> Date: Fri, 30 Sep 2005 21:00:12 +0800 (SGT)
|
|
||||||
> From: Jeff Chua <jeff93@silk.corp.fedex.com>
|
|
||||||
> Subject: gawk 3.1.5 FIELDWIDTHS bug - 1 off
|
|
||||||
> To: Awk Bug <bug-gawk@gnu.org>
|
|
||||||
>
|
|
||||||
> echo "a b b" | awk 'BEGIN {FIELDWIDTHS = "1 1 1 "} {print NF}'
|
|
||||||
>
|
|
||||||
> 3.1.5 returns 2
|
|
||||||
> 3.1.4 returns 3
|
|
||||||
> 3.1.3 returns 3
|
|
||||||
>
|
|
||||||
> Is this a new feature or a bug?
|
|
||||||
>
|
|
||||||
> Thanks,
|
|
||||||
> Jeff.
|
|
||||||
|
|
||||||
This is a bug. I'm adding a test to the test suite for it.
|
|
||||||
Here is the fix.
|
|
||||||
|
|
||||||
Thanks for reporting it.
|
|
||||||
|
|
||||||
Arnold
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
Fri Oct 7 13:23:29 2005 Arnold D. Robbins <arnold@skeeve.com>
|
|
||||||
|
|
||||||
* field.c (set_FIELDWIDTHS): Fix off-by-one error in assignment
|
|
||||||
of sentinel value at end of FIELDWIDTHS array.
|
|
||||||
|
|
||||||
--- ../gawk-3.1.5/field.c 2005-05-11 18:28:15.000000000 +0300
|
|
||||||
+++ field.c 2005-10-07 12:22:05.566125547 +0200
|
|
||||||
@@ -916,7 +916,7 @@
|
|
||||||
|
|
||||||
parse_field = fw_parse_field;
|
|
||||||
scan = force_string(FIELDWIDTHS_node->var_value)->stptr;
|
|
||||||
- end = scan + 1;
|
|
||||||
+
|
|
||||||
if (FIELDWIDTHS == NULL)
|
|
||||||
emalloc(FIELDWIDTHS, int *, fw_alloc * sizeof(int), "set_FIELDWIDTHS");
|
|
||||||
FIELDWIDTHS[0] = 0;
|
|
||||||
@@ -941,7 +941,7 @@
|
|
||||||
errno = 0;
|
|
||||||
tmp = strtoul(scan, &end, 10);
|
|
||||||
if (errno != 0
|
|
||||||
- || !(*end == '\0' || is_blank(*end))
|
|
||||||
+ || (*end != '\0' && ! is_blank(*end))
|
|
||||||
|| !(0 < tmp && tmp <= INT_MAX))
|
|
||||||
fatal(_("invalid FIELDWIDTHS value, near `%s'"),
|
|
||||||
scan);
|
|
||||||
@@ -954,7 +954,7 @@
|
|
||||||
if (*scan == '\0')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
- FIELDWIDTHS[i] = -1;
|
|
||||||
+ FIELDWIDTHS[i+1] = -1;
|
|
||||||
|
|
||||||
update_PROCINFO("FS", "FIELDWIDTHS");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_______________________________________________
|
|
||||||
bug-gnu-utils@gnu.org
|
|
||||||
http://lists.gnu.org/mailman/listinfo/bug-gnu-utils
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:35ca06720396e25e2f4fd0ebf063c5ed55d4c0a93096960316f9f62e72a1f40d
|
|
||||||
size 1756783
|
|
3
gawk-3.1.5g.tar.bz2
Normal file
3
gawk-3.1.5g.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:f079944a1e9db372d2f1b3ed9eb8847156dc96f31e714da586fb2960c7432c89
|
||||||
|
size 1865288
|
46
gawk.changes
46
gawk.changes
@ -1,3 +1,49 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri May 25 15:00:37 CEST 2007 - schwab@suse.de
|
||||||
|
|
||||||
|
- Update to gawk 3.1.5g.
|
||||||
|
1. `gawk 'program' /non/existant/file' no longer core dumps.
|
||||||
|
2. Too many people the world over have complained about gawk's use of the
|
||||||
|
locale's decimal point for parsing input data instead of the traditional
|
||||||
|
period. So, even though gawk was being nicely standards-compliant, in
|
||||||
|
a Triumph For The Users, gawk now only uses the locale's decimal point
|
||||||
|
if --posix is supplied or if POSIXLY_CORRECT is set. It is the sincere
|
||||||
|
hope that this change will eliminate this FAQ from being asked.
|
||||||
|
3. `gawk -v BINMODE=1 ...' works again.
|
||||||
|
4. Internal file names like `/dev/user' now work again.
|
||||||
|
5. Problems with wide strings on non "C" locales have been straightened
|
||||||
|
out everywhere. (At least, we think so.)
|
||||||
|
6. Use of `ansi2knr' is no longer supported. Please use an ANSI C compiler.
|
||||||
|
7. Updated to Autoconf 2.61, Automake 1.10, and Gettext 0.16.1.
|
||||||
|
8. The getopt* and regex* files were synchronized with current GLIBC CVS.
|
||||||
|
See the ChangeLog for the versions and minor edits made.
|
||||||
|
9. There are additional --lint-old warnings.
|
||||||
|
10. Gawk now uses getaddrinfo(3) to look up names and IP addresses. This
|
||||||
|
allows the use of an IPv6 format address and paves the way for
|
||||||
|
eventual addition of `/inet6/...' and `/inet4/...' hostnames.
|
||||||
|
11. We believe gawk to now be valgrind clean. At least when run against
|
||||||
|
the test suite.
|
||||||
|
12. A number of issues dealing with the formatting and printing of very
|
||||||
|
large numbers in integer formats have been dealt with and fixed.
|
||||||
|
13. Gawk now converts "+inf", "-inf", "+nan" and "-nan" into the corresponding
|
||||||
|
magic IEEE floating point values. Only those strings (case independent)
|
||||||
|
work. With --posix, gawk calls the system strtod directly. You asked
|
||||||
|
for it, you got it, you deal with it.
|
||||||
|
14. Defining YYDEBUG enables the -D command line option.
|
||||||
|
15. Gawk should now work out of the box on Tandem NSK/OSS systems.
|
||||||
|
16. Lint messages rationalized: many more of the messages are now printed
|
||||||
|
only once, instead of every time they are encountered.
|
||||||
|
17. The strftime() function now accepts an optional third argument, which
|
||||||
|
if non-zero or non-null, indicates that the time should be formatted
|
||||||
|
as UTC instead of as local time.
|
||||||
|
18. The precedence of concatenation and `| getline' (in something like
|
||||||
|
"echo " "date" | getline stuff) has been reverted to earlier the
|
||||||
|
behavior and now once again matches Unix awk.
|
||||||
|
19. New configure time flag --disable-directories-fatal which causes
|
||||||
|
gawk to silently skip directories on the command line. This behavior
|
||||||
|
is also enabled for --traditional, since it's what Unix awk does.
|
||||||
|
xx. Various bugs fixed, see the ChangeLog for details.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Sep 1 13:02:34 CEST 2006 - schwab@suse.de
|
Fri Sep 1 13:02:34 CEST 2006 - schwab@suse.de
|
||||||
|
|
||||||
|
77
gawk.spec
77
gawk.spec
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package gawk (Version 3.1.5)
|
# spec file for package gawk (Version 3.1.5g)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
# This file and all modifications and additions to the pristine
|
# This file and all modifications and additions to the pristine
|
||||||
# package are under the same license as the package itself.
|
# package are under the same license as the package itself.
|
||||||
#
|
#
|
||||||
@ -12,24 +12,17 @@
|
|||||||
|
|
||||||
Name: gawk
|
Name: gawk
|
||||||
URL: http://www.gnu.org/software/gawk/
|
URL: http://www.gnu.org/software/gawk/
|
||||||
License: GPL, Other License(s), see package
|
License: GNU General Public License (GPL)
|
||||||
Group: Productivity/Text/Utilities
|
Group: Productivity/Text/Utilities
|
||||||
Provides: awk
|
Provides: awk
|
||||||
Autoreqprov: on
|
Autoreqprov: on
|
||||||
PreReq: %{install_info_prereq}
|
PreReq: %{install_info_prereq}
|
||||||
Version: 3.1.5
|
Version: 3.1.5g
|
||||||
Release: 24
|
Release: 1
|
||||||
Summary: GNU awk
|
Summary: GNU awk
|
||||||
Source: gawk-%{version}.tar.bz2
|
Source: gawk-%{version}.tar.bz2
|
||||||
Patch: gawk-%{version}.diff
|
Patch: gawk-%{version}.diff
|
||||||
Patch1: multibyte.diff
|
Patch1: parallel-make.diff
|
||||||
Patch2: fieldwidths.diff
|
|
||||||
Patch3: embedded-nul.diff
|
|
||||||
Patch4: parallel-make.diff
|
|
||||||
Patch5: dfa-mbcset.diff
|
|
||||||
Patch8: sub-common.diff
|
|
||||||
Patch9: dev-fd.diff
|
|
||||||
Patch10: numeric-conversion.diff
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -52,18 +45,11 @@ Authors:
|
|||||||
%setup -q
|
%setup -q
|
||||||
%patch
|
%patch
|
||||||
%patch1
|
%patch1
|
||||||
%patch2
|
|
||||||
%patch3
|
|
||||||
%patch4
|
|
||||||
%patch5
|
|
||||||
%patch8
|
|
||||||
%patch9
|
|
||||||
%patch10
|
|
||||||
rm -f regex.[ch]
|
rm -f regex.[ch]
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{suse_update_config -f}
|
%{suse_update_config -f}
|
||||||
autoreconf --force --install
|
AUTOPOINT=true autoreconf --force --install
|
||||||
export CFLAGS=$RPM_OPT_FLAGS
|
export CFLAGS=$RPM_OPT_FLAGS
|
||||||
./configure --prefix=/usr --libexecdir=%{_libdir} \
|
./configure --prefix=/usr --libexecdir=%{_libdir} \
|
||||||
--mandir=%{_mandir} --infodir=%{_infodir}
|
--mandir=%{_mandir} --infodir=%{_infodir}
|
||||||
@ -85,6 +71,7 @@ mv -f $RPM_BUILD_ROOT/usr/bin/awk $RPM_BUILD_ROOT/usr/bin/gawk \
|
|||||||
ln -sf ../../bin/awk ../../bin/gawk $RPM_BUILD_ROOT/usr/bin
|
ln -sf ../../bin/awk ../../bin/gawk $RPM_BUILD_ROOT/usr/bin
|
||||||
ln -sf gawk.1 $RPM_BUILD_ROOT%{_mandir}/man1/awk.1
|
ln -sf gawk.1 $RPM_BUILD_ROOT%{_mandir}/man1/awk.1
|
||||||
rm -f $RPM_BUILD_ROOT/usr/bin/*-%{version}
|
rm -f $RPM_BUILD_ROOT/usr/bin/*-%{version}
|
||||||
|
%find_lang %name
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
@ -97,7 +84,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%install_info_delete --info-dir=%{_infodir} %{_infodir}/gawk.info.gz
|
%install_info_delete --info-dir=%{_infodir} %{_infodir}/gawk.info.gz
|
||||||
%install_info_delete --info-dir=%{_infodir} %{_infodir}/gawkinet.info.gz
|
%install_info_delete --info-dir=%{_infodir} %{_infodir}/gawkinet.info.gz
|
||||||
|
|
||||||
%files
|
%files -f %name.lang
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%doc AUTHORS COPYING FUTURES LIMITATIONS NEWS POSIX.STD PROBLEMS
|
%doc AUTHORS COPYING FUTURES LIMITATIONS NEWS POSIX.STD PROBLEMS
|
||||||
%doc README README_d
|
%doc README README_d
|
||||||
@ -112,11 +99,53 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_libdir}/awk/pwcat
|
%{_libdir}/awk/pwcat
|
||||||
%dir /usr/share/awk
|
%dir /usr/share/awk
|
||||||
/usr/share/awk/*.awk
|
/usr/share/awk/*.awk
|
||||||
/usr/share/locale/*/LC_MESSAGES/*.mo
|
|
||||||
%doc %{_infodir}/*.info.gz
|
%doc %{_infodir}/*.info.gz
|
||||||
%doc %{_mandir}/man1/*.1.gz
|
%doc %{_mandir}/man1/*.1.gz
|
||||||
|
|
||||||
%changelog -n gawk
|
%changelog
|
||||||
|
* Fri May 25 2007 - schwab@suse.de
|
||||||
|
- Update to gawk 3.1.5g.
|
||||||
|
1. `gawk 'program' /non/existant/file' no longer core dumps.
|
||||||
|
2. Too many people the world over have complained about gawk's use of the
|
||||||
|
locale's decimal point for parsing input data instead of the traditional
|
||||||
|
period. So, even though gawk was being nicely standards-compliant, in
|
||||||
|
a Triumph For The Users, gawk now only uses the locale's decimal point
|
||||||
|
if --posix is supplied or if POSIXLY_CORRECT is set. It is the sincere
|
||||||
|
hope that this change will eliminate this FAQ from being asked.
|
||||||
|
3. `gawk -v BINMODE=1 ...' works again.
|
||||||
|
4. Internal file names like `/dev/user' now work again.
|
||||||
|
5. Problems with wide strings on non "C" locales have been straightened
|
||||||
|
out everywhere. (At least, we think so.)
|
||||||
|
6. Use of `ansi2knr' is no longer supported. Please use an ANSI C compiler.
|
||||||
|
7. Updated to Autoconf 2.61, Automake 1.10, and Gettext 0.16.1.
|
||||||
|
8. The getopt* and regex* files were synchronized with current GLIBC CVS.
|
||||||
|
See the ChangeLog for the versions and minor edits made.
|
||||||
|
9. There are additional --lint-old warnings.
|
||||||
|
10. Gawk now uses getaddrinfo(3) to look up names and IP addresses. This
|
||||||
|
allows the use of an IPv6 format address and paves the way for
|
||||||
|
eventual addition of `/inet6/...' and `/inet4/...' hostnames.
|
||||||
|
11. We believe gawk to now be valgrind clean. At least when run against
|
||||||
|
the test suite.
|
||||||
|
12. A number of issues dealing with the formatting and printing of very
|
||||||
|
large numbers in integer formats have been dealt with and fixed.
|
||||||
|
13. Gawk now converts "+inf", "-inf", "+nan" and "-nan" into the corresponding
|
||||||
|
magic IEEE floating point values. Only those strings (case independent)
|
||||||
|
work. With --posix, gawk calls the system strtod directly. You asked
|
||||||
|
for it, you got it, you deal with it.
|
||||||
|
14. Defining YYDEBUG enables the -D command line option.
|
||||||
|
15. Gawk should now work out of the box on Tandem NSK/OSS systems.
|
||||||
|
16. Lint messages rationalized: many more of the messages are now printed
|
||||||
|
only once, instead of every time they are encountered.
|
||||||
|
17. The strftime() function now accepts an optional third argument, which
|
||||||
|
if non-zero or non-null, indicates that the time should be formatted
|
||||||
|
as UTC instead of as local time.
|
||||||
|
18. The precedence of concatenation and `| getline' (in something like
|
||||||
|
"echo " "date" | getline stuff) has been reverted to earlier the
|
||||||
|
behavior and now once again matches Unix awk.
|
||||||
|
19. New configure time flag --disable-directories-fatal which causes
|
||||||
|
gawk to silently skip directories on the command line. This behavior
|
||||||
|
is also enabled for --traditional, since it's what Unix awk does.
|
||||||
|
xx. Various bugs fixed, see the ChangeLog for details.
|
||||||
* Fri Sep 01 2006 - schwab@suse.de
|
* Fri Sep 01 2006 - schwab@suse.de
|
||||||
- Drop doc subpackage.
|
- Drop doc subpackage.
|
||||||
* Mon Jul 24 2006 - schwab@suse.de
|
* Mon Jul 24 2006 - schwab@suse.de
|
||||||
|
200
multibyte.diff
200
multibyte.diff
@ -1,200 +0,0 @@
|
|||||||
From nobody Mon Jul 24 10:25:07 2006
|
|
||||||
From: Aharon Robbins <arnold@skeeve.com>
|
|
||||||
Subject: gawk 3.1.5, patch for multibyte locales
|
|
||||||
To: bug-gnu-utils@gnu.org
|
|
||||||
Date: Sun, 23 Jul 2006 22:30:56 +0300
|
|
||||||
|
|
||||||
Greetings all.
|
|
||||||
|
|
||||||
The problem with gawk and multibyte locales has come up enough that it's
|
|
||||||
time to post a patch. This is extracted from my current code base.
|
|
||||||
It is untested but should do the trick.
|
|
||||||
|
|
||||||
At least now it'll be in the mailing list archives.
|
|
||||||
|
|
||||||
Arnold
|
|
||||||
-------------------------------
|
|
||||||
Fri Mar 10 06:28:23 2006 Arnold D. Robbins <arnold@skeeve.com>
|
|
||||||
|
|
||||||
* awk.h (free_wstr): New declaration if MBS_SUPPORT, empty macro
|
|
||||||
otherwise.
|
|
||||||
* node.c (free_wstr): New function, inside MBS_SUPPORT. Frees the wide
|
|
||||||
string part of a node. Provided so that it can be used consistently
|
|
||||||
everywhere.
|
|
||||||
(format_val, r_dupnode, mk_number, make_str_node, unref): Use it.
|
|
||||||
* builtin.c (sub_common): Call `free_wstr' instead of doing it manually.
|
|
||||||
* eval.c (r_tree_eval): Same in Node_assign_concat case.
|
|
||||||
* field.c (set_field, rebuild_record, set_record): Add calls to `free_wstr'.
|
|
||||||
|
|
||||||
Mon Feb 13 22:45:34 2006 Arnold D. Robbins <arnold@skeeve.com>
|
|
||||||
|
|
||||||
* eval.c (r_tree_eval): Node_assign_concat. Release any
|
|
||||||
wide string value and reset the WSTRCUR flag. Based on
|
|
||||||
bug report by Karal Zak.
|
|
||||||
|
|
||||||
diff -u ../gawk-3.1.5/awk.h ./awk.h
|
|
||||||
--- ../gawk-3.1.5/awk.h 2005-07-26 21:07:43.000000000 +0300
|
|
||||||
+++ ./awk.h 2006-03-10 06:35:14.000000000 +0200
|
|
||||||
@@ -1166,6 +1166,9 @@
|
|
||||||
#define force_wstring(n) str2wstr(n, NULL)
|
|
||||||
extern const wchar_t *wstrstr P((const wchar_t *haystack, size_t hs_len, const wchar_t *needle, size_t needle_len));
|
|
||||||
extern const wchar_t *wcasestrstr P((const wchar_t *haystack, size_t hs_len, const wchar_t *needle, size_t needle_len));
|
|
||||||
+extern void free_wstr P((NODE *n));
|
|
||||||
+#else
|
|
||||||
+#define free_wstr(NODE) /* empty */
|
|
||||||
#endif
|
|
||||||
/* re.c */
|
|
||||||
extern Regexp *make_regexp P((const char *s, size_t len, int ignorecase, int dfa));
|
|
||||||
diff -u ../gawk-3.1.5/builtin.c ./builtin.c
|
|
||||||
--- ../gawk-3.1.5/builtin.c 2005-07-26 21:07:43.000000000 +0300
|
|
||||||
+++ ./builtin.c 2006-03-10 06:55:00.000000000 +0200
|
|
||||||
@@ -2462,6 +2462,7 @@
|
|
||||||
free(t->stptr);
|
|
||||||
t->stptr = buf;
|
|
||||||
t->stlen = textlen;
|
|
||||||
+ free_wstr(t);
|
|
||||||
|
|
||||||
free_temp(s);
|
|
||||||
if (matches > 0 && lhs) {
|
|
||||||
diff -u ../gawk-3.1.5/eval.c ./eval.c
|
|
||||||
--- ../gawk-3.1.5/eval.c 2005-07-26 21:07:43.000000000 +0300
|
|
||||||
+++ ./eval.c 2006-07-04 22:41:25.000000000 +0300
|
|
||||||
@@ -1176,6 +1176,7 @@
|
|
||||||
memcpy(l->stptr + l->stlen, r->stptr, r->stlen);
|
|
||||||
l->stlen += r->stlen;
|
|
||||||
l->stptr[l->stlen] = '\0';
|
|
||||||
+ free_wstr(l);
|
|
||||||
} else {
|
|
||||||
char *nval;
|
|
||||||
size_t nlen = l->stlen + r->stlen + 2;
|
|
||||||
diff -u ../gawk-3.1.5/field.c ./field.c
|
|
||||||
--- ../gawk-3.1.5/field.c 2005-05-11 18:28:15.000000000 +0300
|
|
||||||
+++ ./field.c 2006-03-10 06:48:22.000000000 +0200
|
|
||||||
@@ -129,6 +129,7 @@
|
|
||||||
n->stptr = str;
|
|
||||||
n->stlen = len;
|
|
||||||
n->flags = (STRCUR|STRING|MAYBE_NUM|FIELD);
|
|
||||||
+ free_wstr(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* rebuild_record --- Someone assigned a value to $(something).
|
|
||||||
@@ -210,6 +211,7 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
n->stptr = cops;
|
|
||||||
+ free_wstr(n);
|
|
||||||
unref(fields_arr[i]);
|
|
||||||
fields_arr[i] = n;
|
|
||||||
}
|
|
||||||
@@ -273,6 +275,7 @@
|
|
||||||
n->type = Node_val;
|
|
||||||
n->stfmt = -1;
|
|
||||||
n->flags = (STRING|STRCUR|MAYBE_NUM|FIELD);
|
|
||||||
+ free_wstr(n);
|
|
||||||
fields_arr[0] = n;
|
|
||||||
|
|
||||||
#undef INITIAL_SIZE
|
|
||||||
diff -u ../gawk-3.1.5/node.c ./node.c
|
|
||||||
--- ../gawk-3.1.5/node.c 2005-07-26 21:07:43.000000000 +0300
|
|
||||||
+++ ./node.c 2006-03-10 07:04:25.000000000 +0200
|
|
||||||
@@ -216,15 +218,7 @@
|
|
||||||
no_malloc:
|
|
||||||
s->stref = 1;
|
|
||||||
s->flags |= STRCUR;
|
|
||||||
-#if defined MBS_SUPPORT
|
|
||||||
- if ((s->flags & WSTRCUR) != 0) {
|
|
||||||
- assert(s->wstptr != NULL);
|
|
||||||
- free(s->wstptr);
|
|
||||||
- s->wstptr = NULL;
|
|
||||||
- s->wstlen = 0;
|
|
||||||
- s->flags &= ~WSTRCUR;
|
|
||||||
- }
|
|
||||||
-#endif
|
|
||||||
+ free_wstr(s);
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -287,7 +281,12 @@
|
|
||||||
*r = *n;
|
|
||||||
r->flags &= ~(PERM|TEMP|FIELD);
|
|
||||||
r->flags |= MALLOC;
|
|
||||||
-#if defined MBS_SUPPORT
|
|
||||||
+#ifdef MBS_SUPPORT
|
|
||||||
+ /*
|
|
||||||
+ * DON'T call free_wstr(r) here!
|
|
||||||
+ * r->wstptr still points at n->wstptr's value, and we
|
|
||||||
+ * don't want to free it!
|
|
||||||
+ */
|
|
||||||
r->wstptr = NULL;
|
|
||||||
#endif /* defined MBS_SUPPORT */
|
|
||||||
if (n->type == Node_val && (n->flags & STRCUR) != 0) {
|
|
||||||
@@ -344,11 +343,7 @@
|
|
||||||
r->stref = 1;
|
|
||||||
r->stptr = NULL;
|
|
||||||
r->stlen = 0;
|
|
||||||
-#if defined MBS_SUPPORT
|
|
||||||
- r->wstptr = NULL;
|
|
||||||
- r->wstlen = 0;
|
|
||||||
- r->flags &= ~WSTRCUR;
|
|
||||||
-#endif /* MBS_SUPPORT */
|
|
||||||
+ free_wsptr(r);
|
|
||||||
#endif /* GAWKDEBUG */
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
@@ -363,10 +358,7 @@
|
|
||||||
getnode(r);
|
|
||||||
r->type = Node_val;
|
|
||||||
r->flags = (STRING|STRCUR|MALLOC);
|
|
||||||
-#if defined MBS_SUPPORT
|
|
||||||
- r->wstptr = NULL;
|
|
||||||
- r->wstlen = 0;
|
|
||||||
-#endif
|
|
||||||
+ free_wstr(r);
|
|
||||||
if (flags & ALREADY_MALLOCED)
|
|
||||||
r->stptr = s;
|
|
||||||
else {
|
|
||||||
@@ -510,15 +502,7 @@
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
free(tmp->stptr);
|
|
||||||
-#if defined MBS_SUPPORT
|
|
||||||
- if (tmp->wstptr != NULL) {
|
|
||||||
- assert((tmp->flags & WSTRCUR) != 0);
|
|
||||||
- free(tmp->wstptr);
|
|
||||||
- }
|
|
||||||
- tmp->flags &= ~WSTRCUR;
|
|
||||||
- tmp->wstptr = NULL;
|
|
||||||
- tmp->wstlen = 0;
|
|
||||||
-#endif
|
|
||||||
+ free_wstr(tmp);
|
|
||||||
}
|
|
||||||
freenode(tmp);
|
|
||||||
return;
|
|
||||||
@@ -775,6 +759,21 @@
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* free_wstr --- release the wide string part of a node */
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+free_wstr(NODE *n)
|
|
||||||
+{
|
|
||||||
+
|
|
||||||
+ if ((n->flags & WSTRCUR) != 0) {
|
|
||||||
+ assert(n->wstptr != NULL);
|
|
||||||
+ free(n->wstptr);
|
|
||||||
+ }
|
|
||||||
+ n->wstptr = NULL;
|
|
||||||
+ n->wstlen = 0;
|
|
||||||
+ n->flags &= ~WSTRCUR;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
dump_wstr(FILE *fp, const wchar_t *str, size_t len)
|
|
||||||
|
|
||||||
|
|
||||||
_______________________________________________
|
|
||||||
bug-gnu-utils@gnu.org
|
|
||||||
http://lists.gnu.org/mailman/listinfo/bug-gnu-utils
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
|||||||
From nobody Wed Jul 5 10:39:02 2006
|
|
||||||
From: Aharon Robbins <arnold@skeeve.com>
|
|
||||||
Subject: Re: conversion error
|
|
||||||
To: bug-gawk@gnu.org, Heiner.Marxen@DrB.Insel.DE
|
|
||||||
Cc:
|
|
||||||
Date: Tue, 04 Jul 2006 22:46:47 +0300
|
|
||||||
|
|
||||||
Greetings. Re this:
|
|
||||||
|
|
||||||
> Date: Tue, 04 Jul 2006 21:06:14 +0200 (MEST)
|
|
||||||
> From: Heiner Marxen <Heiner.Marxen@DrB.Insel.DE>
|
|
||||||
> Subject: conversion error
|
|
||||||
> To: bug-gawk@gnu.org
|
|
||||||
>
|
|
||||||
> Hello,
|
|
||||||
>
|
|
||||||
> The following awk script fails for gawk 3.1.4 and 3.1.5.
|
|
||||||
> Older versions did not do this, but I cannot say, how old they were.
|
|
||||||
>
|
|
||||||
> BEGIN {
|
|
||||||
> if( 0 ) { #ok
|
|
||||||
> t = "8"
|
|
||||||
> }else { #fails
|
|
||||||
> t = ""
|
|
||||||
> t = t "8"
|
|
||||||
> }
|
|
||||||
> printf("8 = %d\n", 0+t) # ok without this line
|
|
||||||
> t = t "8" # does not invalidate numeric interpretation
|
|
||||||
> printf("88 = %s\n", 0+t)
|
|
||||||
> ## The above prints "88 = 8" with gawk 3.1.4 and 3.1.5
|
|
||||||
> }
|
|
||||||
>
|
|
||||||
> The following one-liner already exhibits the bug:
|
|
||||||
>
|
|
||||||
> gawk 'BEGIN{t=""; t=t "8";printf("8=%d\n", 0+t);t=t "8";printf("88=%s\n", 0+t)}'
|
|
||||||
>
|
|
||||||
>
|
|
||||||
> Preliminary observation: under somewhat strange conditions a variable
|
|
||||||
> does retain its numeric interpretation although something is appended to it.
|
|
||||||
> --
|
|
||||||
> Heiner Marxen http://www.drb.insel.de/~heiner/
|
|
||||||
|
|
||||||
This is an excellent bug report and test case. Much thanks. The following
|
|
||||||
patch fixes the problem.
|
|
||||||
|
|
||||||
Arnold
|
|
||||||
----------------------------------------------------
|
|
||||||
Tue Jul 4 22:43:05 2006 Arnold D. Robbins <arnold@skeeve.com>
|
|
||||||
|
|
||||||
* eval.c (interpret): Node_assign_concat case: Turn off NUMBER and NUMCUR
|
|
||||||
flags in result. Sheesh. Thanks to <Heiner.Marxen@DrB.Insel.DE> for finding
|
|
||||||
the problem.
|
|
||||||
|
|
||||||
--- ../gawk-3.1.5/eval.c 2005-07-26 21:07:43.000000000 +0300
|
|
||||||
+++ eval.c 2006-07-04 22:41:25.000000000 +0300
|
|
||||||
@@ -1186,6 +1187,7 @@
|
|
||||||
unref(*lhs);
|
|
||||||
*lhs = make_str_node(nval, l->stlen + r->stlen, ALREADY_MALLOCED);
|
|
||||||
}
|
|
||||||
+ (*lhs)->flags &= ~(NUMCUR|NUMBER);
|
|
||||||
free_temp(r);
|
|
||||||
|
|
||||||
if (after_assign)
|
|
||||||
|
|
||||||
|
|
||||||
_______________________________________________
|
|
||||||
bug-gnu-utils@gnu.org
|
|
||||||
http://lists.gnu.org/mailman/listinfo/bug-gnu-utils
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
|||||||
--- awklib/Makefile.am
|
--- awklib/Makefile.am
|
||||||
+++ awklib/Makefile.am
|
+++ awklib/Makefile.am
|
||||||
@@ -59,6 +59,8 @@
|
@@ -75,6 +75,9 @@
|
||||||
$(AWK) -f $(srcdir)/extract.awk $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi
|
mv eg.old/prog/CVS eg/prog ; \
|
||||||
@echo 'some makes are stupid and will not check a directory' > stamp-eg
|
rm -fr eg.old ; fi
|
||||||
@echo 'against a file, so this file is a place holder. gack.' >> stamp-eg
|
|
||||||
+$(srcdir)/eg/lib/pwcat.c $(srcdir)/eg/lib/grcat.c $(srcdir)/eg/prog/igawk.sh \
|
+$(srcdir)/eg/lib/pwcat.c $(srcdir)/eg/lib/grcat.c $(srcdir)/eg/prog/igawk.sh \
|
||||||
+$(srcdir)/eg/lib/passwdawk.in $(srcdir)/eg/lib/groupawk.in: stamp-eg; @:
|
+$(srcdir)/eg/lib/passwdawk.in $(srcdir)/eg/lib/groupawk.in: stamp-eg; @:
|
||||||
|
+
|
||||||
pwcat$(EXEEXT): $(srcdir)/eg/lib/pwcat.c
|
pwcat$(EXEEXT): $(srcdir)/eg/lib/pwcat.c
|
||||||
$(COMPILE) $(srcdir)/eg/lib/pwcat.c $(LDFLAGS) -o $@
|
$(COMPILE) $(srcdir)/eg/lib/pwcat.c $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
From nobody Sat Mar 4 22:53:59 2006
|
|
||||||
From: KIMURA Koichi <kimura.koichi@canon.co.jp>
|
|
||||||
Subject: gawk: sub_common has multi-byte aware bug
|
|
||||||
To: bug-gawk@gnu.org
|
|
||||||
Cc:
|
|
||||||
Date: Mon, 27 Feb 2006 12:35:30 +0900
|
|
||||||
|
|
||||||
Hi,
|
|
||||||
|
|
||||||
A certain user faced bug of sub builtin function and report to me.
|
|
||||||
Then I investigated the bug.
|
|
||||||
|
|
||||||
reproduce script is here.
|
|
||||||
|
|
||||||
BEGIN {
|
|
||||||
str = "type=\"directory\" version=\"1.0\""
|
|
||||||
#print "BEGIN:", str
|
|
||||||
|
|
||||||
while (str) {
|
|
||||||
sub(/^[^=]*/, "", str);
|
|
||||||
s = substr(str, 2)
|
|
||||||
print s
|
|
||||||
sub(/^="[^"]*"/, "", str)
|
|
||||||
sub(/^[ \t]*/, "", str)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
and sample result is here (on GNU/Linux Fedora core 3)
|
|
||||||
|
|
||||||
[kbk@skuld gawk-3.1.5]$ LC_ALL=C ./gawk -f subbug.awk
|
|
||||||
"directory" version="1.0"
|
|
||||||
"1.0"
|
|
||||||
[kbk@skuld gawk-3.1.5]$ LC_ALL=en_US.UTF-8 ./gawk -f subbug.awk
|
|
||||||
"directory" version="1.0"
|
|
||||||
"dire
|
|
||||||
[kbk@skuld gawk-3.1.5]$
|
|
||||||
|
|
||||||
In my investigation, this bug is cause by don't release wide-string when
|
|
||||||
sub is executed.
|
|
||||||
|
|
||||||
patch is here.
|
|
||||||
|
|
||||||
--- builtin.c.orig 2005-07-27 03:07:43.000000000 +0900
|
|
||||||
+++ builtin.c 2006-02-26 02:07:52.000000000 +0900
|
|
||||||
@@ -2463,6 +2468,15 @@ sub_common(NODE *tree, long how_many, in
|
|
||||||
t->stptr = buf;
|
|
||||||
t->stlen = textlen;
|
|
||||||
|
|
||||||
+#ifdef MBS_SUPPORT
|
|
||||||
+ if (t->flags & WSTRCUR) {
|
|
||||||
+ if (t->wstptr != NULL)
|
|
||||||
+ free(t->wstptr);
|
|
||||||
+ t->wstptr = NULL;
|
|
||||||
+ t->wstlen = 0;
|
|
||||||
+ t->flags &= ~WSTRCUR;
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
free_temp(s);
|
|
||||||
if (matches > 0 && lhs) {
|
|
||||||
if (priv) {
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
KIMURA Koichi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_______________________________________________
|
|
||||||
bug-gnu-utils@gnu.org
|
|
||||||
http://lists.gnu.org/mailman/listinfo/bug-gnu-utils
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user