diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2021-01-09 22:32:45 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2021-01-09 22:32:45 +0200 |
commit | d3a1acac12673875b21ad2a95ffd7be0fb220ae5 (patch) | |
tree | 84aedd316fb0ff4d302b403d8d6977b6834777ce | |
parent | 32a9f7f24000827da433b89de7c24c5d95a561c6 (diff) | |
parent | 073460dda1b24bcb872186a0818859a6ccba727d (diff) | |
download | egawk-d3a1acac12673875b21ad2a95ffd7be0fb220ae5.tar.gz egawk-d3a1acac12673875b21ad2a95ffd7be0fb220ae5.tar.bz2 egawk-d3a1acac12673875b21ad2a95ffd7be0fb220ae5.zip |
Merge branch 'gawk-5.1-stable'
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | array.c | 2 | ||||
-rw-r--r-- | awk.h | 2 | ||||
-rw-r--r-- | awkgram.y | 2 | ||||
-rw-r--r-- | builtin.c | 6 | ||||
-rw-r--r-- | cmd.h | 2 | ||||
-rw-r--r-- | command.y | 2 | ||||
-rw-r--r-- | debug.c | 2 | ||||
-rw-r--r-- | eval.c | 3 | ||||
-rw-r--r-- | gawkapi.c | 2 | ||||
-rw-r--r-- | gawkapi.h | 2 | ||||
-rw-r--r-- | interpret.h | 2 | ||||
-rw-r--r-- | io.c | 2 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | mpfr.c | 4 | ||||
-rw-r--r-- | node.c | 2 | ||||
-rw-r--r-- | pc/ChangeLog | 4 | ||||
-rw-r--r-- | pc/Makefile.tst | 6 | ||||
-rw-r--r-- | profile.c | 2 | ||||
-rw-r--r-- | re.c | 2 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 3 | ||||
-rw-r--r-- | test/Makefile.in | 8 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/octdec.awk | 1 | ||||
-rw-r--r-- | test/octdec.ok | 2 |
26 files changed, 72 insertions, 19 deletions
@@ -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 @@ -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 @@ -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. @@ -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. @@ -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; @@ -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 @@ -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 @@ -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. @@ -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. @@ -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. @@ -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 @@ -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 @@ -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 @@ -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': @@ -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: $$? >>_$@ @@ -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. @@ -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 |