This makes it work correctly for me on Linux. Not sure about 9awk.
I have corresponded with BWK about this, including sending him this
proposed patch.
Arnold
----------------
--- run.c.orig 2012-12-10 22:50:40.403115427 +0200
+++ run.c 2012-12-10 22:50:15.450991568 +0200
@@ -1216,6 +1216,7 @@
int n, tempstat, arg3type;
y = execute(a[0]); /* source string */
+ y->tval |= DONTFREE;
s = getsval(y);
arg3type = ptoi(a[3]);
if (a[2] == 0) /* fs string */
@@ -1335,6 +1336,7 @@
}
}
tempfree(ap);
+ y->tval &= ~DONTFREE;
tempfree(y);
if (a[2] != 0 && arg3type == STRING) {
tempfree(x);