Package init
This commit is contained in:
parent
5832e8244e
commit
066e0ffc9a
298
0040-Fix-core-dump-upon-syntax-error.patch
Normal file
298
0040-Fix-core-dump-upon-syntax-error.patch
Normal file
@ -0,0 +1,298 @@
|
|||||||
|
From e0da6e47c9d1eaafcbe2b26c2ac9c5304b755efd Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Arnold D. Robbins" <arnold@skeeve.com>
|
||||||
|
Date: Thu, 18 Apr 2019 20:15:15 +0300
|
||||||
|
Subject: [PATCH] Fix core dump upon syntax error.
|
||||||
|
|
||||||
|
---
|
||||||
|
awk.h | 1 +
|
||||||
|
awkgram.c | 2 +-
|
||||||
|
awkgram.y | 2 +-
|
||||||
|
command.c | 14 +++++++-------
|
||||||
|
command.y | 14 +++++++-------
|
||||||
|
main.c | 6 ++++++
|
||||||
|
test/Makefile.am | 4 +++-
|
||||||
|
test/Makefile.in | 9 ++++++++-
|
||||||
|
test/Maketests | 5 +++++
|
||||||
|
test/synerr3.awk | 1 +
|
||||||
|
test/synerr3.ok | 5 +++++
|
||||||
|
11 files changed, 45 insertions(+), 18 deletions(-)
|
||||||
|
create mode 100644 test/synerr3.awk
|
||||||
|
create mode 100644 test/synerr3.ok
|
||||||
|
|
||||||
|
diff --git a/awk.h b/awk.h
|
||||||
|
index cdf683d1..679cbde5 100644
|
||||||
|
--- a/awk.h
|
||||||
|
+++ b/awk.h
|
||||||
|
@@ -1114,6 +1114,7 @@ extern NODE *Null_field;
|
||||||
|
extern NODE **fields_arr;
|
||||||
|
extern int sourceline;
|
||||||
|
extern char *source;
|
||||||
|
+extern int errcount;
|
||||||
|
extern int (*interpret)(INSTRUCTION *); /* interpreter routine */
|
||||||
|
extern NODE *(*make_number)(double); /* double instead of AWKNUM on purpose */
|
||||||
|
extern NODE *(*str2number)(NODE *);
|
||||||
|
diff --git a/awkgram.c b/awkgram.c
|
||||||
|
index d3c4e830..878a83a9 100644
|
||||||
|
--- a/awkgram.c
|
||||||
|
+++ b/awkgram.c
|
||||||
|
@@ -173,7 +173,7 @@ static int continue_allowed; /* kludge for continue */
|
||||||
|
static char *tokstart = NULL;
|
||||||
|
static char *tok = NULL;
|
||||||
|
static char *tokend;
|
||||||
|
-static int errcount = 0;
|
||||||
|
+int errcount = 0;
|
||||||
|
|
||||||
|
extern char *source;
|
||||||
|
extern int sourceline;
|
||||||
|
diff --git a/awkgram.y b/awkgram.y
|
||||||
|
index caed09e0..c16616f9 100644
|
||||||
|
--- a/awkgram.y
|
||||||
|
+++ b/awkgram.y
|
||||||
|
@@ -133,7 +133,7 @@ static int continue_allowed; /* kludge for continue */
|
||||||
|
static char *tokstart = NULL;
|
||||||
|
static char *tok = NULL;
|
||||||
|
static char *tokend;
|
||||||
|
-static int errcount = 0;
|
||||||
|
+int errcount = 0;
|
||||||
|
|
||||||
|
extern char *source;
|
||||||
|
extern int sourceline;
|
||||||
|
diff --git a/command.c b/command.c
|
||||||
|
index 0876f02f..90742dd7 100644
|
||||||
|
--- a/command.c
|
||||||
|
+++ b/command.c
|
||||||
|
@@ -90,7 +90,7 @@ static bool want_nodeval = false;
|
||||||
|
static int cmd_idx = -1; /* index of current command in cmd table */
|
||||||
|
static int repeat_idx = -1; /* index of last repeatable command in command table */
|
||||||
|
static CMDARG *arg_list = NULL; /* list of arguments */
|
||||||
|
-static long errcount = 0;
|
||||||
|
+static long dbg_errcount = 0;
|
||||||
|
static char *lexptr_begin = NULL;
|
||||||
|
static bool in_commands = false;
|
||||||
|
static int num_dim;
|
||||||
|
@@ -1548,7 +1548,7 @@ yyreduce:
|
||||||
|
case 5:
|
||||||
|
#line 130 "command.y" /* yacc.c:1646 */
|
||||||
|
{
|
||||||
|
- if (errcount == 0 && cmd_idx >= 0) {
|
||||||
|
+ if (dbg_errcount == 0 && cmd_idx >= 0) {
|
||||||
|
Func_cmd cmdfunc;
|
||||||
|
bool terminate = false;
|
||||||
|
CMDARG *args;
|
||||||
|
@@ -1616,7 +1616,7 @@ yyreduce:
|
||||||
|
case 23:
|
||||||
|
#line 219 "command.y" /* yacc.c:1646 */
|
||||||
|
{
|
||||||
|
- if (errcount == 0) {
|
||||||
|
+ if (dbg_errcount == 0) {
|
||||||
|
/* don't free arg_list; passed on to statement_list
|
||||||
|
* non-terminal (empty rule action). See below.
|
||||||
|
*/
|
||||||
|
@@ -1783,7 +1783,7 @@ yyreduce:
|
||||||
|
if ((yyvsp[0]) != NULL)
|
||||||
|
num = (yyvsp[0])->a_int;
|
||||||
|
|
||||||
|
- if (errcount != 0)
|
||||||
|
+ if (dbg_errcount != 0)
|
||||||
|
;
|
||||||
|
else if (in_commands)
|
||||||
|
yyerror(_("Can't use command `commands' for breakpoint/watchpoint commands"));
|
||||||
|
@@ -2766,7 +2766,7 @@ yyerror(const char *mesg, ...)
|
||||||
|
vfprintf(out_fp, mesg, args);
|
||||||
|
fprintf(out_fp, "\n");
|
||||||
|
va_end(args);
|
||||||
|
- errcount++;
|
||||||
|
+ dbg_errcount++;
|
||||||
|
repeat_idx = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2788,9 +2788,9 @@ yylex(void)
|
||||||
|
|
||||||
|
yylval = (CMDARG *) NULL;
|
||||||
|
|
||||||
|
- if (errcount > 0 && lexptr_begin == NULL) {
|
||||||
|
+ if (dbg_errcount > 0 && lexptr_begin == NULL) {
|
||||||
|
/* fake a new line */
|
||||||
|
- errcount = 0;
|
||||||
|
+ dbg_errcount = 0;
|
||||||
|
return '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/command.y b/command.y
|
||||||
|
index 58880dee..96148eff 100644
|
||||||
|
--- a/command.y
|
||||||
|
+++ b/command.y
|
||||||
|
@@ -44,7 +44,7 @@ static bool want_nodeval = false;
|
||||||
|
static int cmd_idx = -1; /* index of current command in cmd table */
|
||||||
|
static int repeat_idx = -1; /* index of last repeatable command in command table */
|
||||||
|
static CMDARG *arg_list = NULL; /* list of arguments */
|
||||||
|
-static long errcount = 0;
|
||||||
|
+static long dbg_errcount = 0;
|
||||||
|
static char *lexptr_begin = NULL;
|
||||||
|
static bool in_commands = false;
|
||||||
|
static int num_dim;
|
||||||
|
@@ -128,7 +128,7 @@ line
|
||||||
|
: nls
|
||||||
|
| command nls
|
||||||
|
{
|
||||||
|
- if (errcount == 0 && cmd_idx >= 0) {
|
||||||
|
+ if (dbg_errcount == 0 && cmd_idx >= 0) {
|
||||||
|
Func_cmd cmdfunc;
|
||||||
|
bool terminate = false;
|
||||||
|
CMDARG *args;
|
||||||
|
@@ -217,7 +217,7 @@ set_want_nodeval
|
||||||
|
eval_prologue
|
||||||
|
: D_EVAL set_want_nodeval opt_param_list nls
|
||||||
|
{
|
||||||
|
- if (errcount == 0) {
|
||||||
|
+ if (dbg_errcount == 0) {
|
||||||
|
/* don't free arg_list; passed on to statement_list
|
||||||
|
* non-terminal (empty rule action). See below.
|
||||||
|
*/
|
||||||
|
@@ -335,7 +335,7 @@ command
|
||||||
|
if ($2 != NULL)
|
||||||
|
num = $2->a_int;
|
||||||
|
|
||||||
|
- if (errcount != 0)
|
||||||
|
+ if (dbg_errcount != 0)
|
||||||
|
;
|
||||||
|
else if (in_commands)
|
||||||
|
yyerror(_("Can't use command `commands' for breakpoint/watchpoint commands"));
|
||||||
|
@@ -1017,7 +1017,7 @@ yyerror(const char *mesg, ...)
|
||||||
|
vfprintf(out_fp, mesg, args);
|
||||||
|
fprintf(out_fp, "\n");
|
||||||
|
va_end(args);
|
||||||
|
- errcount++;
|
||||||
|
+ dbg_errcount++;
|
||||||
|
repeat_idx = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1039,9 +1039,9 @@ yylex(void)
|
||||||
|
|
||||||
|
yylval = (CMDARG *) NULL;
|
||||||
|
|
||||||
|
- if (errcount > 0 && lexptr_begin == NULL) {
|
||||||
|
+ if (dbg_errcount > 0 && lexptr_begin == NULL) {
|
||||||
|
/* fake a new line */
|
||||||
|
- errcount = 0;
|
||||||
|
+ dbg_errcount = 0;
|
||||||
|
return '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/main.c b/main.c
|
||||||
|
index 25a628ba..754f2050 100644
|
||||||
|
--- a/main.c
|
||||||
|
+++ b/main.c
|
||||||
|
@@ -1223,6 +1223,9 @@ catchsig(int sig)
|
||||||
|
|| sig == SIGBUS
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
+ if (errcount > 0) // assume a syntax error corrupted our data structures
|
||||||
|
+ exit(EXIT_FATAL);
|
||||||
|
+
|
||||||
|
set_loc(__FILE__, __LINE__);
|
||||||
|
msg(_("fatal error: internal error"));
|
||||||
|
/* fatal won't abort() if not compiled for debugging */
|
||||||
|
@@ -1240,6 +1243,9 @@ catchsig(int sig)
|
||||||
|
static int
|
||||||
|
catchsegv(void *fault_address, int serious)
|
||||||
|
{
|
||||||
|
+ if (errcount > 0) // assume a syntax error corrupted our data structures
|
||||||
|
+ exit(EXIT_FATAL);
|
||||||
|
+
|
||||||
|
set_loc(__FILE__, __LINE__);
|
||||||
|
msg(_("fatal error: internal error: segfault"));
|
||||||
|
fflush(NULL);
|
||||||
|
diff --git a/test/Makefile.am b/test/Makefile.am
|
||||||
|
index 13f53f95..98d4d1d0 100644
|
||||||
|
--- a/test/Makefile.am
|
||||||
|
+++ b/test/Makefile.am
|
||||||
|
@@ -1141,6 +1141,8 @@ EXTRA_DIST = \
|
||||||
|
synerr1.ok \
|
||||||
|
synerr2.awk \
|
||||||
|
synerr2.ok \
|
||||||
|
+ synerr3.awk \
|
||||||
|
+ synerr3.ok \
|
||||||
|
tailrecurse.awk \
|
||||||
|
tailrecurse.ok \
|
||||||
|
testext.ok \
|
||||||
|
@@ -1261,7 +1263,7 @@ BASIC_TESTS = \
|
||||||
|
scalar sclforin sclifin setrec0 setrec1 \
|
||||||
|
sigpipe1 sortempty sortglos splitargv splitarr \
|
||||||
|
splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \
|
||||||
|
- subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 \
|
||||||
|
+ subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 synerr3 \
|
||||||
|
tailrecurse tradanch tweakfld \
|
||||||
|
uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \
|
||||||
|
wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \
|
||||||
|
diff --git a/test/Makefile.in b/test/Makefile.in
|
||||||
|
index b23bd8ea..5b348528 100644
|
||||||
|
--- a/test/Makefile.in
|
||||||
|
+++ b/test/Makefile.in
|
||||||
|
@@ -1399,6 +1399,8 @@ EXTRA_DIST = \
|
||||||
|
synerr1.ok \
|
||||||
|
synerr2.awk \
|
||||||
|
synerr2.ok \
|
||||||
|
+ synerr3.awk \
|
||||||
|
+ synerr3.ok \
|
||||||
|
tailrecurse.awk \
|
||||||
|
tailrecurse.ok \
|
||||||
|
testext.ok \
|
||||||
|
@@ -1518,7 +1520,7 @@ BASIC_TESTS = \
|
||||||
|
scalar sclforin sclifin setrec0 setrec1 \
|
||||||
|
sigpipe1 sortempty sortglos splitargv splitarr \
|
||||||
|
splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \
|
||||||
|
- subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 \
|
||||||
|
+ subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 synerr3 \
|
||||||
|
tailrecurse tradanch tweakfld \
|
||||||
|
uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \
|
||||||
|
wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \
|
||||||
|
@@ -3944,6 +3946,11 @@ synerr2:
|
||||||
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
||||||
|
|
||||||
|
+synerr3:
|
||||||
|
+ @echo $@
|
||||||
|
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
||||||
|
+
|
||||||
|
tailrecurse:
|
||||||
|
@echo $@
|
||||||
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
diff --git a/test/Maketests b/test/Maketests
|
||||||
|
index f5840e5f..314f0c0b 100644
|
||||||
|
--- a/test/Maketests
|
||||||
|
+++ b/test/Maketests
|
||||||
|
@@ -1007,6 +1007,11 @@ synerr2:
|
||||||
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
||||||
|
|
||||||
|
+synerr3:
|
||||||
|
+ @echo $@
|
||||||
|
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
||||||
|
+
|
||||||
|
tailrecurse:
|
||||||
|
@echo $@
|
||||||
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
diff --git a/test/synerr3.awk b/test/synerr3.awk
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..49b9e30a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/synerr3.awk
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+for (i = ) in foo bar baz
|
||||||
|
diff --git a/test/synerr3.ok b/test/synerr3.ok
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..b8b9dd89
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/synerr3.ok
|
||||||
|
@@ -0,0 +1,5 @@
|
||||||
|
+gawk: synerr3.awk:1: for (i = ) in foo bar baz
|
||||||
|
+gawk: synerr3.awk:1: ^ syntax error
|
||||||
|
+gawk: synerr3.awk:1: for (i = ) in foo bar baz
|
||||||
|
+gawk: synerr3.awk:1: ^ syntax error
|
||||||
|
+EXIT CODE: 2
|
||||||
|
--
|
||||||
|
2.19.1
|
||||||
|
|
||||||
135
0045-Fix-bug-with-in-FS.patch
Normal file
135
0045-Fix-bug-with-in-FS.patch
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
From 435c438649584eb00de06e07faf6827d4bb6f9fc Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Arnold D. Robbins" <arnold@skeeve.com>
|
||||||
|
Date: Sun, 21 Apr 2019 15:01:03 +0300
|
||||||
|
Subject: [PATCH] Fix bug with ^ in FS.
|
||||||
|
|
||||||
|
---
|
||||||
|
field.c | 1 +
|
||||||
|
test/Makefile.am | 5 ++++-
|
||||||
|
test/Makefile.in | 10 +++++++++-
|
||||||
|
test/Maketests | 5 +++++
|
||||||
|
test/fscaret.awk | 8 ++++++++
|
||||||
|
test/fscaret.in | 1 +
|
||||||
|
test/fscaret.ok | 1 +
|
||||||
|
7 files changed, 29 insertions(+), 2 deletions(-)
|
||||||
|
create mode 100644 test/fscaret.awk
|
||||||
|
create mode 100644 test/fscaret.in
|
||||||
|
create mode 100644 test/fscaret.ok
|
||||||
|
|
||||||
|
diff --git a/field.c b/field.c
|
||||||
|
index 52963249..f6a3241c 100644
|
||||||
|
--- a/field.c
|
||||||
|
+++ b/field.c
|
||||||
|
@@ -840,6 +840,7 @@ get_field(long requested, Func_ptr *assign)
|
||||||
|
if (! field0_valid) {
|
||||||
|
/* first, parse remainder of input record */
|
||||||
|
if (NF == -1) {
|
||||||
|
+ in_middle = (parse_high_water != 0);
|
||||||
|
NF = (*parse_field)(UNLIMITED - 1, &parse_extent,
|
||||||
|
fields_arr[0]->stlen -
|
||||||
|
(parse_extent - fields_arr[0]->stptr),
|
||||||
|
diff --git a/test/Makefile.am b/test/Makefile.am
|
||||||
|
index f5546067..13f53f95 100644
|
||||||
|
--- a/test/Makefile.am
|
||||||
|
+++ b/test/Makefile.am
|
||||||
|
@@ -350,6 +350,9 @@ EXTRA_DIST = \
|
||||||
|
fsbs.awk \
|
||||||
|
fsbs.in \
|
||||||
|
fsbs.ok \
|
||||||
|
+ fscaret.awk \
|
||||||
|
+ fscaret.in \
|
||||||
|
+ fscaret.ok \
|
||||||
|
fsfwfs.awk \
|
||||||
|
fsfwfs.in \
|
||||||
|
fsfwfs.ok \
|
||||||
|
@@ -1234,7 +1237,7 @@ BASIC_TESTS = \
|
||||||
|
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \
|
||||||
|
eofsplit exit2 exitval1 exitval2 exitval3 fcall_exit fcall_exit2 \
|
||||||
|
fldchg fldchgnf fldterm fnamedat fnarray fnarray2 fnaryscl fnasgnm fnmisc \
|
||||||
|
- fordel forref forsimp fsbs fsnul1 fsrs fsspcoln fstabplus funsemnl \
|
||||||
|
+ fordel forref forsimp fsbs fscaret fsnul1 fsrs fsspcoln fstabplus funsemnl \
|
||||||
|
funsmnam funstack \
|
||||||
|
getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \
|
||||||
|
gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 gsubtst7 \
|
||||||
|
diff --git a/test/Makefile.in b/test/Makefile.in
|
||||||
|
index 4133b58a..b23bd8ea 100644
|
||||||
|
--- a/test/Makefile.in
|
||||||
|
+++ b/test/Makefile.in
|
||||||
|
@@ -608,6 +608,9 @@ EXTRA_DIST = \
|
||||||
|
fsbs.awk \
|
||||||
|
fsbs.in \
|
||||||
|
fsbs.ok \
|
||||||
|
+ fscaret.awk \
|
||||||
|
+ fscaret.in \
|
||||||
|
+ fscaret.ok \
|
||||||
|
fsfwfs.awk \
|
||||||
|
fsfwfs.in \
|
||||||
|
fsfwfs.ok \
|
||||||
|
@@ -1491,7 +1494,7 @@ BASIC_TESTS = \
|
||||||
|
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \
|
||||||
|
eofsplit exit2 exitval1 exitval2 exitval3 fcall_exit fcall_exit2 \
|
||||||
|
fldchg fldchgnf fldterm fnamedat fnarray fnarray2 fnaryscl fnasgnm fnmisc \
|
||||||
|
- fordel forref forsimp fsbs fsnul1 fsrs fsspcoln fstabplus funsemnl \
|
||||||
|
+ fordel forref forsimp fsbs fscaret fsnul1 fsrs fsspcoln fstabplus funsemnl \
|
||||||
|
funsmnam funstack \
|
||||||
|
getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \
|
||||||
|
gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 gsubtst7 \
|
||||||
|
@@ -3279,6 +3282,11 @@ fsbs:
|
||||||
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
||||||
|
|
||||||
|
+fscaret:
|
||||||
|
+ @echo $@
|
||||||
|
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
||||||
|
+
|
||||||
|
fsnul1:
|
||||||
|
@echo $@
|
||||||
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
diff --git a/test/Maketests b/test/Maketests
|
||||||
|
index 4a90e3e9..f5840e5f 100644
|
||||||
|
--- a/test/Maketests
|
||||||
|
+++ b/test/Maketests
|
||||||
|
@@ -345,6 +345,11 @@ fsbs:
|
||||||
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
||||||
|
|
||||||
|
+fscaret:
|
||||||
|
+ @echo $@
|
||||||
|
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
||||||
|
+
|
||||||
|
fsnul1:
|
||||||
|
@echo $@
|
||||||
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
||||||
|
diff --git a/test/fscaret.awk b/test/fscaret.awk
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..134820d7
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/fscaret.awk
|
||||||
|
@@ -0,0 +1,8 @@
|
||||||
|
+BEGIN {
|
||||||
|
+ FS="^."
|
||||||
|
+ OFS="|"
|
||||||
|
+}
|
||||||
|
+{
|
||||||
|
+ $1 = $1
|
||||||
|
+}
|
||||||
|
+1
|
||||||
|
diff --git a/test/fscaret.in b/test/fscaret.in
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..257cc564
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/fscaret.in
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+foo
|
||||||
|
diff --git a/test/fscaret.ok b/test/fscaret.ok
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..38287d58
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/fscaret.ok
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+|oo
|
||||||
|
--
|
||||||
|
2.19.1
|
||||||
|
|
||||||
11
gawk.spec
11
gawk.spec
@ -4,7 +4,7 @@
|
|||||||
egrep -i "gawk_api_minor.*[0-9]+" | egrep -o "[0-9]")
|
egrep -i "gawk_api_minor.*[0-9]+" | egrep -o "[0-9]")
|
||||||
Name: gawk
|
Name: gawk
|
||||||
Version: 4.2.1
|
Version: 4.2.1
|
||||||
Release: 4
|
Release: 5
|
||||||
License: GPLv3+ and GPLv2+ and LGPLv2+ and BSD
|
License: GPLv3+ and GPLv2+ and LGPLv2+ and BSD
|
||||||
Summary: The GNU version of the AWK text processing utility
|
Summary: The GNU version of the AWK text processing utility
|
||||||
URL: https://www.gnu.org/software/gawk/
|
URL: https://www.gnu.org/software/gawk/
|
||||||
@ -23,6 +23,9 @@ Patch6004: Bug-fix-for-trailing-backslash-in-dynamic-regexp.patch
|
|||||||
Patch6005: Fix-problem-with-MPFR-conversion-to-int-from-hex-num.patch
|
Patch6005: Fix-problem-with-MPFR-conversion-to-int-from-hex-num.patch
|
||||||
Patch6006: Fix-small-potential-memory-leak-for-intdiv.patch
|
Patch6006: Fix-small-potential-memory-leak-for-intdiv.patch
|
||||||
Patch6007: Bug-fix-in-support-regexec.c.patch
|
Patch6007: Bug-fix-in-support-regexec.c.patch
|
||||||
|
Patch6008: 0040-Fix-core-dump-upon-syntax-error.patch
|
||||||
|
Patch6009: 0045-Fix-bug-with-in-FS.patch
|
||||||
|
Patch6010: refix-remove-the-tail-recursion-optimization.patch
|
||||||
|
|
||||||
BuildRequires: git gcc automake grep
|
BuildRequires: git gcc automake grep
|
||||||
BuildRequires: bison texinfo texinfo-tex ghostscript texlive-ec texlive-cm-super glibc-all-langpacks
|
BuildRequires: bison texinfo texinfo-tex ghostscript texlive-ec texlive-cm-super glibc-all-langpacks
|
||||||
@ -121,5 +124,11 @@ install -m 0644 -p doc/gawkinet.{pdf,ps} ${RPM_BUILD_ROOT}%{_docdir}/%{name}
|
|||||||
%{_datadir}/locale/*
|
%{_datadir}/locale/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Dec 16 2019 openEuler Buildteam <buildteam@openeuler.org> - 4.2.1-5
|
||||||
|
- Type:enhancement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:restart
|
||||||
|
- DESC:quality enhancement synchronization github patch
|
||||||
|
|
||||||
* Thu Aug 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 4.2.1-4
|
* Thu Aug 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 4.2.1-4
|
||||||
- Package Init
|
- Package Init
|
||||||
|
|||||||
58
refix-remove-the-tail-recursion-optimization.patch
Normal file
58
refix-remove-the-tail-recursion-optimization.patch
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
From 47316d294571673a8dbf1e9e435893e2660f46a8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Arnold D. Robbins" <arnold@skeeve.com>
|
||||||
|
Date: Mon, 26 Mar 2018 10:45:01 +0300
|
||||||
|
Subject: [PATCH] Remove the tail recursion optimization(refix).
|
||||||
|
|
||||||
|
---
|
||||||
|
awkgram.c | 27 ++-------------------------
|
||||||
|
1 file changed, 2 insertions(+), 25 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/awkgram.c b/awkgram.c
|
||||||
|
index 52821eab..d3c4e830 100644
|
||||||
|
--- a/awkgram.c
|
||||||
|
+++ b/awkgram.c
|
||||||
|
@@ -2820,20 +2820,9 @@ regular_loop:
|
||||||
|
(yyval) = list_create((yyvsp[-3]));
|
||||||
|
(void) list_prepend((yyval), instruction(Op_push_i));
|
||||||
|
(yyval)->nexti->memory = dupnode(Nnull_string);
|
||||||
|
- } else {
|
||||||
|
- if (do_optimize
|
||||||
|
- && (yyvsp[-1])->lasti->opcode == Op_func_call
|
||||||
|
- && strcmp((yyvsp[-1])->lasti->func_name, in_function) == 0
|
||||||
|
- ) {
|
||||||
|
- /* Do tail recursion optimization. Tail
|
||||||
|
- * call without a return value is recognized
|
||||||
|
- * in mk_function().
|
||||||
|
- */
|
||||||
|
- ((yyvsp[-1])->lasti + 1)->tail_call = true;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
+ } else
|
||||||
|
(yyval) = list_append((yyvsp[-1]), (yyvsp[-3]));
|
||||||
|
- }
|
||||||
|
+
|
||||||
|
(yyval) = add_pending_comment((yyval));
|
||||||
|
}
|
||||||
|
#line 2840 "awkgram.c" /* yacc.c:1646 */
|
||||||
|
@@ -7156,18 +7145,6 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def)
|
||||||
|
thisfunc = fi->func_body;
|
||||||
|
assert(thisfunc != NULL);
|
||||||
|
|
||||||
|
- if (do_optimize && def->lasti->opcode == Op_pop) {
|
||||||
|
- /* tail call which does not return any value. */
|
||||||
|
-
|
||||||
|
- INSTRUCTION *t;
|
||||||
|
-
|
||||||
|
- for (t = def->nexti; t->nexti != def->lasti; t = t->nexti)
|
||||||
|
- ;
|
||||||
|
- if (t->opcode == Op_func_call
|
||||||
|
- && strcmp(t->func_name, thisfunc->vname) == 0)
|
||||||
|
- (t + 1)->tail_call = true;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
/* add any pre-function comment to start of action for profile.c */
|
||||||
|
|
||||||
|
if (function_comment != NULL) {
|
||||||
|
--
|
||||||
|
2.19.1
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user