aboutsummaryrefslogtreecommitdiff
path: root/testsuite/awk.tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'busybox' into mergeRon Yorston2023-06-161-0/+116
|\
| * awk: fix subst code to handle "start of word" pattern correctly (needs ↵Denys Vlasenko2023-06-081-13/+15
| | | | | | | | | | | | | | | | | | REG_STARTEND) function old new delta awk_sub 637 714 +77 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix backslash handling in sub() builtinsDenys Vlasenko2023-06-031-0/+47
| | | | | | | | | | | | | | function old new delta awk_sub 559 544 -15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix precedence of = relative to ==Denys Vlasenko2023-05-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Discovered while adding code to disallow assignments to non-lvalues function old new delta parse_expr 936 991 +55 .rodata 105243 105247 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 59/0) Total: 59 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix splitting with default FSDenys Vlasenko2023-05-271-0/+7
| | | | | | | | | | | | | | function old new delta awk_split 543 544 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix use-after-realloc (CVE-2021-42380), closes 15601Denys Vlasenko2023-05-261-0/+55
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | awk: CRLF handlingRon Yorston2023-01-301-0/+14
|/ | | | | | | | | | | | | | | | | | | | | | Previous efforts at handling DOS-style line endings in awk have included commits ee7e00dc5 and 1a3717342. The use of remove_cr() is unwise: - It's overzealous, removing all CRs, not just those in CRLF pairs. - Even if that were fixed awk reads input in chunks. There's a remote chance a CRLF might appear at a chunk boundary and be missed. remove_cr() will be fixed separately. In awk treat all data input as being in text mode. Skipping CRs in skip_spaces() is also flawed. Instead read scripts in text mode. Add a couple of test cases. One of these (awk backslash+CRLF eaten with no trace) fails without this patch.
* awk: fix use after free (CVE-2022-30065)Natanael Copa2022-07-111-0/+6
| | | | | | | | | | fixes https://bugs.busybox.net/show_bug.cgi?id=14781 function old new delta evaluate 3343 3357 +14 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: input numbers are never octal or hex (only program consts can be)Denys Vlasenko2022-01-081-1/+11
| | | | | | | | | | | | function old new delta next_token 825 930 +105 getvar_i 114 129 +15 nextchar 49 53 +4 my_strtod 138 - -138 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 3/0 up/down: 124/-138) Total: -14 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix printf %%Daniel Thau2021-09-051-0/+6
| | | | | | | | | | | | | | | | | A refactor of the awk printf code in e2e3802987266c98df0efdf40ad5da4b07df0113 appears to have broken the printf interpretation of two percent signs, which normally outputs only one percent sign. The patch below brings busybox awk printf behavior back into alignment with the pre-e2e380 behavior, the busybox printf util, and other common (awk and non-awk) printf implementations. function old new delta awk_printf 626 672 +46 Signed-off-by: Daniel Thau <danthau at bedrocklinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix testsuiteDenys Vlasenko2021-08-161-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: disallow break/continue outside of loopsDenys Vlasenko2021-07-141-7/+2
| | | | | | | | | | function old new delta .rodata 104139 104186 +47 chain_group 610 633 +23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 70/0) Total: 70 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix printf "%-10c", 0Denys Vlasenko2021-07-121-0/+8
| | | | | | | function old new delta awk_printf 596 626 +30 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: unbreak "cmd" | getlineDenys Vlasenko2021-07-111-0/+5
| | | | | | | function old new delta evaluate 3337 3343 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: undo TI_PRINT, it introduced a bug (print with any redirect acting as ↵Denys Vlasenko2021-07-111-0/+5
| | | | | | | | | | | printf) function old new delta evaluate 3329 3337 +8 Patch by Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix beavior of "exit" without parameterDenys Vlasenko2021-07-021-0/+5
| | | | | | | | | | | function old new delta evaluate 3336 3339 +3 awk_exit 93 94 +1 awk_main 829 827 -2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 4/-2) Total: 2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: evaluate all, even superfluous function argsDenys Vlasenko2021-06-301-1/+7
| | | | | | | function old new delta evaluate 3128 3135 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: allow empty fuinctions with no arguments, disallow function redefinitionsDenys Vlasenko2021-06-301-0/+10
| | | | | | | | | | | function old new delta .rodata 103681 103700 +19 parse_program 303 307 +4 evaluate 3145 3141 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 23/-4) Total: 19 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix parsing of expressions such as "v (a)"Denys Vlasenko2021-06-291-0/+11
| | | | | | | function old new delta next_token 812 825 +13 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: allow printf('%c') to output NUL, closes 13486Ron Yorston2021-02-021-0/+5
| | | | | | | | | | | | | | | | | Treat the output of printf as binary rather than a null-terminated string so that NUL characters can be output. This is considered to be a GNU extension, though it's also available in mawk and FreeBSD's awk. function old new delta evaluate 3487 3504 +17 awk_printf 504 519 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: add a test that $NF is emptyDenys Vlasenko2020-12-041-2/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: FS regex matches only non-empty separators (gawk compat)Denys Vlasenko2020-12-021-0/+7
| | | | | | | function old new delta awk_split 484 553 +69 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: disallow "str"++, closes bug 12981Denys Vlasenko2020-06-091-0/+8
| | | | | | | function old new delta parse_expr 887 896 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix more "length" cases, closes 12486Denys Vlasenko2020-02-021-1/+22
| | | | | | | function old new delta next_token 808 831 +23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix testsuiteDenys Vlasenko2019-06-081-0/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: Fix overly permissive func arg list parsingBrian Foley2019-01-211-0/+12
| | | | | | | | | | | | | | | It allows things like 'func f(a b)' and 'func f(a,)' which GNU awk forbids. function old new delta parse_program 327 367 +40 chain_expr 40 67 +27 parse_expr 891 915 +24 EMSG_TOO_FEW_ARGS 30 18 -12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 91/-12) Total: 79 bytes Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: Syntax error if delete isn't given an arg.Brian Foley2019-01-211-2/+5
| | | | | | | | Unlike exit and return, delete strictly requires an arg, and derefs a null pointer if executed without one. Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: Guard pointer chasing when parsing ternary expressions.Brian Foley2019-01-211-0/+3
| | | | | | | | | Avoids an uninit pointer deref for some malformed ternary exprs. Add a test that would crash in busybox before this fix. Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: do not allow $(-1)Denys Vlasenko2018-04-231-0/+6
| | | | | | | | | | function old new delta EMSG_NEGATIVE_FIELD - 25 +25 evaluate 3390 3403 +13 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 38/0) Total: 38 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix 'delete array[var--]' decrementing var twiceDenys Vlasenko2018-01-071-0/+19
| | | | | | | function old new delta evaluate 3395 3390 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix segfault on for loop syntax errorBrian Foley2016-10-241-0/+3
| | | | | | | Parsing "for()" segfaults as awk fails to find loop iteration expressions. Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: support "length" form of "length()". Closes 8371Denys Vlasenko2015-10-021-0/+5
| | | | | | | | function old new delta parse_expr 805 848 +43 tokenlist 447 448 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix handling of "if ... break ; else ..." - closes 7226Denys Vlasenko2014-06-261-0/+16
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fix failures found by randomconfig buildsDenys Vlasenko2013-12-311-1/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix a bug in argc counting in recent changeDenys Vlasenko2013-11-211-1/+13
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix length(array)Denys Vlasenko2013-10-121-0/+5
| | | | | | | function old new delta evaluate 3526 3548 +22 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: Fix handling of functions with empty bodyBernhard Reutner-Fischer2013-07-311-0/+28
| | | | | | | ammend b79a0fef99627c457548e804fcd6e162b116cbe8 to properly handle functions defined in another scope. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* awk.tests: add test for recent large integer fixDenys Vlasenko2013-07-221-3/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: Fix handling of functions with empty bodyBernhard Reutner-Fischer2013-03-131-0/+19
| | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* awk: fix FS assignment behavior. Closes 5108Denys Vlasenko2012-07-111-0/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: make -F STR interpret escape sequences. Closes 5126Denys Vlasenko2012-06-221-0/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* testsuite: some more awk tests related to conditionsTanguy Pruvot2012-06-111-0/+7
| | | | | Signed-off-by: Tanguy Pruvot <tanguy.pruvot@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix a SEGVDenys Vlasenko2011-09-111-0/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix segfault on closing non-opened fileDenys Vlasenko2010-10-231-0/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: 00.123 is not a octal constant; neither is 009.123. fixing thisDenys Vlasenko2010-10-051-0/+6
| | | | | | | function old new delta my_strtod 80 113 +33 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* *: make GNU licensing statement forms more regularDenys Vlasenko2010-08-161-1/+1
| | | | | | | This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomtest fixesDenys Vlasenko2010-05-111-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* more randomconfig testsuite fixesDenys Vlasenko2010-05-101-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig testsuite fixesDenys Vlasenko2010-05-101-2/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: add two tests we currently failDenys Vlasenko2010-03-111-16/+97
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>