aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--array.c2
-rw-r--r--awk.h2
-rw-r--r--awkgram.y2
-rw-r--r--builtin.c6
-rw-r--r--cmd.h2
-rw-r--r--command.y2
-rw-r--r--debug.c2
-rw-r--r--eval.c3
-rw-r--r--gawkapi.c2
-rw-r--r--gawkapi.h2
-rw-r--r--interpret.h2
-rw-r--r--io.c2
-rw-r--r--main.c2
-rw-r--r--mpfr.c4
-rw-r--r--node.c2
-rw-r--r--pc/ChangeLog4
-rw-r--r--pc/Makefile.tst6
-rw-r--r--profile.c2
-rw-r--r--re.c2
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am3
-rw-r--r--test/Makefile.in8
-rw-r--r--test/Maketests5
-rw-r--r--test/octdec.awk1
-rw-r--r--test/octdec.ok2
26 files changed, 72 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 2c8caa01..9089016b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2021-01-09 Arnold D. Robbins <arnold@skeeve.com>
+
+ Fix problems turning something like 018 into decimal.
+ Thanks to Arkadiusz Drabczyk <arkadiusz@drabczyk.org> and to
+ Jean-Philippe Guérard <jean-philippe.guerard@xn--tigreray-i1a.org>
+ for the reports.
+
+ * builtin.c (nondec2awknum): Use a copy of len, in case we detect
+ 8 or 9 and have to restart as decimal.
+ * mpfr.c (mpg_strtoui): For 8 or 9, set base to 10.
+
+ Unrelated:
+ * array.c, awk.h, awkgram., builtin.c, cmd.h, command.y, debug.c,
+ eval.c, gawk.api.c, gawkapi.h, interpret.h, io.c, main.c, mfpr.c,
+ node.c, profile.c, re.c: Update copyright year.
+
2021-01-08 Arnold D. Robbins <arnold@skeeve.com>
General tightening up use of const and types. Thanks to
diff --git a/array.c b/array.c
index 29c09753..50efddb2 100644
--- a/array.c
+++ b/array.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2014, 2016, 2018, 2019, 2020,
+ * Copyright (C) 1986, 1988, 1989, 1991-2014, 2016, 2018-2021,
* the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
diff --git a/awk.h b/awk.h
index 7fc623eb..c9eec663 100644
--- a/awk.h
+++ b/awk.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2020 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2021 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
diff --git a/awkgram.y b/awkgram.y
index 0495f233..6dfbe7e0 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2020 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2021 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
diff --git a/builtin.c b/builtin.c
index 867a07f9..1b612f4a 100644
--- a/builtin.c
+++ b/builtin.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2020,
+ * Copyright (C) 1986, 1988, 1989, 1991-2021,
* the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
@@ -3684,7 +3684,9 @@ nondec2awknum(char *str, size_t len, char **endptr)
if (endptr)
*endptr = str;
} else if (len >= 1 && *str == '0') {
- for (; len > 0; len--) {
+ int l;
+ // preserve len in case we go to decimal
+ for (l = len; l > 0; l--) {
if (! isdigit((unsigned char) *str)) {
if (endptr)
*endptr = str;
diff --git a/cmd.h b/cmd.h
index df6035fc..7f68e217 100644
--- a/cmd.h
+++ b/cmd.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2004, 2010, 2011, 2013, 2014, 2017,
+ * Copyright (C) 2004, 2010, 2011, 2013, 2014, 2017, 2021,
* the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
diff --git a/command.y b/command.y
index 8282cf68..9492e4f1 100644
--- a/command.y
+++ b/command.y
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2004, 2010, 2011, 2014, 2016, 2017, 2019, 2020,
+ * Copyright (C) 2004, 2010, 2011, 2014, 2016, 2017, 2019-2021,
* the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
diff --git a/debug.c b/debug.c
index 4fe83fd2..160996bd 100644
--- a/debug.c
+++ b/debug.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2004, 2010-2013, 2016-2020 the Free Software Foundation, Inc.
+ * Copyright (C) 2004, 2010-2013, 2016-2021 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
diff --git a/eval.c b/eval.c
index f2c5d0f5..640f939f 100644
--- a/eval.c
+++ b/eval.c
@@ -3,7 +3,8 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2019 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2019, 2021,
+ * the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
diff --git a/gawkapi.c b/gawkapi.c
index b764c56d..a60549dd 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2012-2019 the Free Software Foundation, Inc.
+ * Copyright (C) 2012-2019, 2021, the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
diff --git a/gawkapi.h b/gawkapi.h
index 4cbfc67c..54130b15 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2012-2019 the Free Software Foundation, Inc.
+ * Copyright (C) 2012-2019, 2021 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
diff --git a/interpret.h b/interpret.h
index 5df5d5ac..93a50f24 100644
--- a/interpret.h
+++ b/interpret.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2020,
+ * Copyright (C) 1986, 1988, 1989, 1991-2021,
* the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
diff --git a/io.c b/io.c
index c2bf5d04..c1007423 100644
--- a/io.c
+++ b/io.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2020,
+ * Copyright (C) 1986, 1988, 1989, 1991-2021,
* the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
diff --git a/main.c b/main.c
index 3fd091e9..ea3b3a59 100644
--- a/main.c
+++ b/main.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2020,
+ * Copyright (C) 1986, 1988, 1989, 1991-2021,
* the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
diff --git a/mpfr.c b/mpfr.c
index df5c46ba..6b8f9c93 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2012, 2013, 2015, 2017, 2018, 2019,
+ * Copyright (C) 2012, 2013, 2015, 2017, 2018, 2019, 2021
* the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
@@ -176,7 +176,7 @@ mpg_strtoui(mpz_ptr zi, char *str, size_t len, char **end, int base)
case '8':
case '9':
if (base == 8)
- goto done;
+ base = 10;
break;
case 'a':
case 'b':
diff --git a/node.c b/node.c
index f02086e0..c22c06ab 100644
--- a/node.c
+++ b/node.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2001, 2003-2015, 2017, 2018, 2019,
+ * Copyright (C) 1986, 1988, 1989, 1991-2001, 2003-2015, 2017-2019, 2021,
* the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 22870c9d..bdf1149c 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-09 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Rebuilt.
+
2021-01-08 Arnold D. Robbins <arnold@skeeve.com>
* gawkmisc.pc (quote): Make const char *.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 5dbfb658..24e92863 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -211,6 +211,7 @@ GAWK_EXT_TESTS = \
nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \
nsawk1a nsawk1b nsawk1c nsawk2a nsawk2b \
nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 nsindirect2 nsprof1 nsprof2 \
+ octdec \
patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \
procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
@@ -3064,6 +3065,11 @@ nsprof2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+octdec:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
patsplit:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/profile.c b/profile.c
index e4fd88d6..b61d29cf 100644
--- a/profile.c
+++ b/profile.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1999-2020 the Free Software Foundation, Inc.
+ * Copyright (C) 1999-2021 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
diff --git a/re.c b/re.c
index ee3a30aa..929c317e 100644
--- a/re.c
+++ b/re.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1991-2019 the Free Software Foundation, Inc.
+ * Copyright (C) 1991-2019, 2021 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
diff --git a/test/ChangeLog b/test/ChangeLog
index 456af38a..9cd3edb3 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2021-01-09 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): octdec, new test.
+ * octdec.awk, octdec.ok: New files.
+
2021-01-07 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): modifiers, new test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 09efe0eb..ce28345f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -865,6 +865,8 @@ EXTRA_DIST = \
numsubstr.awk \
numsubstr.in \
numsubstr.ok \
+ octdec.awk \
+ octdec.ok \
octsub.awk \
octsub.ok \
ofmt.awk \
@@ -1446,6 +1448,7 @@ GAWK_EXT_TESTS = \
nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \
nsawk1a nsawk1b nsawk1c nsawk2a nsawk2b \
nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 nsindirect2 nsprof1 nsprof2 \
+ octdec \
patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \
procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
diff --git a/test/Makefile.in b/test/Makefile.in
index 54d4a114..337a48fc 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1128,6 +1128,8 @@ EXTRA_DIST = \
numsubstr.awk \
numsubstr.in \
numsubstr.ok \
+ octdec.awk \
+ octdec.ok \
octsub.awk \
octsub.ok \
ofmt.awk \
@@ -1709,6 +1711,7 @@ GAWK_EXT_TESTS = \
nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \
nsawk1a nsawk1b nsawk1c nsawk2a nsawk2b \
nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 nsindirect2 nsprof1 nsprof2 \
+ octdec \
patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \
procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
@@ -4723,6 +4726,11 @@ nsprof2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+octdec:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
patsplit:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 87b141b4..20ed4a7f 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1799,6 +1799,11 @@ nsprof2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+octdec:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
patsplit:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/octdec.awk b/test/octdec.awk
new file mode 100644
index 00000000..cc14ddab
--- /dev/null
+++ b/test/octdec.awk
@@ -0,0 +1 @@
+BEGIN { print 021, 018; print 00021, 00018 }
diff --git a/test/octdec.ok b/test/octdec.ok
new file mode 100644
index 00000000..226c02ce
--- /dev/null
+++ b/test/octdec.ok
@@ -0,0 +1,2 @@
+17 18
+17 18