bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Second beta release of gawk 4.1.4


From: arnold
Subject: Re: [bug-gawk] Second beta release of gawk 4.1.4
Date: Mon, 30 May 2016 17:30:56 -0400
User-agent: s-nail v14.8.8

+ address@hidden

Hi Janis.

Re this:

> Subject: Re: Second beta release of gawk 4.1.4
> To: Aharon Robbins <address@hidden>
> From: Janis Papanagnou <address@hidden>
> Date: Mon, 30 May 2016 22:53:13 +0200
> 
> Hi Arnold!
> 
> In the past I had stumbled across this effect which looks strange to me
> and is still observable in the "second beta"...
> 
> $ ./gawk 'BEGIN { FS="\0" ; RS="" }'
> gawk: cmd. line:1: fatal: Invalid regular expression: /[/
> $ ./gawk --version
> GNU Awk 4.1.3g, API: 1.1 (GNU MPFR 3.1.0-p3, GNU MP 5.0.2)
> [...]

Thanks for the report.

Here is the fix. I will also add this as a test, including
some input.

Thanks,

Arnold
------------------------------------------------------------
diff --git a/field.c b/field.c
index abd08c0..5f5b2b6 100644
--- a/field.c
+++ b/field.c
@@ -1270,8 +1270,12 @@ choose_fs_function:
                        } else if (fs->stptr[0] == '\\') {
                                /* yet another special case */
                                strcpy(buf, "[\\\\\n]");
-                       } else if (fs->stptr[0] != '\n')
+                       } else if (fs->stptr[0] == '\0') {
+                               /* and yet another special case */
+                               strcpy(buf, "[\\000\n]");
+                       } else if (fs->stptr[0] != '\n') {
                                sprintf(buf, "[%c\n]", fs->stptr[0]);
+                       }
                }
        } else {
                if (do_posix)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]