diff options
Diffstat (limited to 'package/busybox/busybox-1.15.2-awk.patch')
-rw-r--r-- | package/busybox/busybox-1.15.2-awk.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/package/busybox/busybox-1.15.2-awk.patch b/package/busybox/busybox-1.15.2-awk.patch new file mode 100644 index 000000000..05a830ec9 --- /dev/null +++ b/package/busybox/busybox-1.15.2-awk.patch @@ -0,0 +1,48 @@ +diff -urpN busybox-1.15.2/editors/awk.c busybox-1.15.2-awk/editors/awk.c +--- busybox-1.15.2/editors/awk.c 2009-10-08 02:59:09.000000000 +0200 ++++ busybox-1.15.2-awk/editors/awk.c 2009-11-30 02:05:12.000000000 +0100 +@@ -2393,12 +2393,14 @@ static var *evaluate(node *op, var *res) + + case XC( OC_MOVE ): + /* if source is a temporary string, jusk relink it to dest */ +- if (R.v == v1+1 && R.v->string) { +- res = setvar_p(L.v, R.v->string); +- R.v->string = NULL; +- } else { ++//Disabled: if R.v is numeric but happens to have cached R.v->string, ++//then L.v ends up being a string, which is wrong ++// if (R.v == v1+1 && R.v->string) { ++// res = setvar_p(L.v, R.v->string); ++// R.v->string = NULL; ++// } else { + res = copyvar(L.v, R.v); +- } ++// } + break; + + case XC( OC_TERNARY ): +diff -urpN busybox-1.15.2/testsuite/awk.tests busybox-1.15.2-awk/testsuite/awk.tests +--- busybox-1.15.2/testsuite/awk.tests 2009-09-26 15:14:57.000000000 +0200 ++++ busybox-1.15.2-awk/testsuite/awk.tests 2009-11-30 02:05:12.000000000 +0100 +@@ -47,4 +47,21 @@ testing "awk NF in BEGIN" \ + ":0::::\n" \ + "" "" + ++prg=' ++function b(tmp) { ++ tmp = 0; ++ print "" tmp; #this line causes the bug ++ return tmp; ++} ++function c(tmpc) { ++ tmpc = b(); return tmpc; ++} ++BEGIN { ++ print (c() ? "string" : "number"); ++}' ++testing "awk string cast (bug 725)" \ ++ "awk '$prg'" \ ++ "0\nnumber\n" \ ++ "" "" ++ + exit $FAILCOUNT |