From ba6d9c427ffa59b7cfc586ad7307f8350390e66c Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 14 Jan 2016 20:48:15 +0200 Subject: Fix for extra parameters going down the call chain. --- ChangeLog | 7 +++++++ eval.c | 2 +- test/ChangeLog | 5 +++++ test/Makefile.am | 4 +++- test/Makefile.in | 9 ++++++++- test/Maketests | 5 +++++ test/aryprm9.awk | 16 ++++++++++++++++ test/aryprm9.ok | 0 8 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 test/aryprm9.awk create mode 100644 test/aryprm9.ok diff --git a/ChangeLog b/ChangeLog index 10716022..93b91427 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2016-01-14 Arnold D. Robbins + + * eval.c (r_get_lhs): If original array was Node_var_new, + assign value that is dupnode of Nnull_string and not + Nnull_string directly. Fixes core dump reported by + ruyk . + 2016-01-02 Arnold D. Robbins * dfa.c (add_utf8_anychar): Minor change in declaration of diff --git a/eval.c b/eval.c index 05924cda..291d0846 100644 --- a/eval.c +++ b/eval.c @@ -1154,7 +1154,7 @@ r_get_lhs(NODE *n, bool reference) array_vname(n)); if (n->orig_array->type != Node_var) { n->orig_array->type = Node_var; - n->orig_array->var_value = Nnull_string; + n->orig_array->var_value = dupnode(Nnull_string); } /* fall through */ case Node_var_new: diff --git a/test/ChangeLog b/test/ChangeLog index 6bed9696..10e942b8 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2016-01-14 Arnold D. Robbins + + * Makefile.am (aryprm9): New test. + * aryprm9.awk, aryprm9.ok: New files. + 2015-12-27 Arnold D. Robbins * Makefile.am (profile8): New test. diff --git a/test/Makefile.am b/test/Makefile.am index 01c15233..540e8d99 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -93,6 +93,8 @@ EXTRA_DIST = \ aryprm7.ok \ aryprm8.awk \ aryprm8.ok \ + aryprm9.awk \ + aryprm9.ok \ arysubnm.awk \ arysubnm.ok \ asgext.awk \ @@ -1030,7 +1032,7 @@ BASIC_TESTS = \ addcomma anchgsub argarray arrayparm arrayprm2 arrayprm3 \ arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ - aryprm8 arysubnm asgext awkpath \ + aryprm8 aryprm9 arysubnm asgext awkpath \ back89 backgsub badassign1 badbuild \ callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 convfmt \ diff --git a/test/Makefile.in b/test/Makefile.in index a89fc862..723c39e1 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -350,6 +350,8 @@ EXTRA_DIST = \ aryprm7.ok \ aryprm8.awk \ aryprm8.ok \ + aryprm9.awk \ + aryprm9.ok \ arysubnm.awk \ arysubnm.ok \ asgext.awk \ @@ -1286,7 +1288,7 @@ BASIC_TESTS = \ addcomma anchgsub argarray arrayparm arrayprm2 arrayprm3 \ arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ - aryprm8 arysubnm asgext awkpath \ + aryprm8 aryprm9 arysubnm asgext awkpath \ back89 backgsub badassign1 badbuild \ callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 convfmt \ @@ -2660,6 +2662,11 @@ aryprm8: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +aryprm9: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + arysubnm: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index bb5712d5..214f5ddb 100644 --- a/test/Maketests +++ b/test/Maketests @@ -100,6 +100,11 @@ aryprm8: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +aryprm9: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + arysubnm: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/aryprm9.awk b/test/aryprm9.awk new file mode 100644 index 00000000..004e3c34 --- /dev/null +++ b/test/aryprm9.awk @@ -0,0 +1,16 @@ +#!/usr/bin/gawk -f +BEGIN { + + for (i = 0; i < 100; i++) + func_exec() +} + +function func_exec(opaque) +{ + func_a(1, opaque) #set additional argument, not expected by fname +} + +function func_a(a, b, loc1, loc2) +{ + b = 0 #unref Nnull_string +} diff --git a/test/aryprm9.ok b/test/aryprm9.ok new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3 From fec67185e69458b550c5f8c8591176d715134e33 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 14 Jan 2016 20:52:34 +0200 Subject: Clean up whitespace in ChangeLogs. --- ChangeLog | 36 ++++++++++++++++++++---------------- doc/ChangeLog | 10 +++++++--- test/ChangeLog | 6 +++++- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 93b91427..c406b133 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ Nnull_string directly. Fixes core dump reported by ruyk . + Unrelated: + + * ChangeLog: Cleanup spurious extra whitespace. + 2016-01-02 Arnold D. Robbins * dfa.c (add_utf8_anychar): Minor change in declaration of @@ -51,7 +55,7 @@ is false. Fixes a problem reported by Hanno Boeck . Unrelated: - + * dfa.c: Sync with GNU grep. 2015-10-16 Arnold D. Robbins @@ -302,7 +306,7 @@ add check that time_t is > 0 --- means we're assigning a negative value to an unsigned time_t. Thanks again to Glaudiston Gomes da Silva . - + If localtime() or gmtime() return NULL, return a null string. Thanks to Andrew Schorr. @@ -945,7 +949,7 @@ * builtin.c (format_tree): Don't need to check return value of wctombr for -2. Thanks to Eli Zaretskii for pointing this out. - + Unrelated: * gawkapi.h: Fix doc for API get_record - errcode needs to @@ -2292,7 +2296,7 @@ * awk.h (SRCFILE): New field fini_func. * ext.c (load_ext): Takes an additional argument to look up and - save the clean up routine in SRCFILE struct. + save the clean up routine in SRCFILE struct. (INIT_FUNC, FINI_FUNC): Defines for default init and fini routine names. (do_ext): Use default for the name of the init or fini routine if @@ -2307,8 +2311,8 @@ Unrelated: - * interpret.h (Op_arrayfor_init): Use assoc_length for array size. - + * interpret.h (Op_arrayfor_init): Use assoc_length for array size. + 2012-04-19 John Haque Enhanced array interface to support transparent implementation @@ -2334,7 +2338,7 @@ (null_array_func): Add length and store routine entries. * str_array.c (str_array_func): Same. * cint_array.c (cint_array_func): Same. - * int_array.c (int_array_func): Same. + * int_array.c (int_array_func): Same. * eval.c (optypetab): Add Op_subscript_assign. * profile.c (pprint): Add case Op_subscript_assign. * interpret.h (set_array, set_idx): New variables to keep track @@ -3517,7 +3521,7 @@ * main.c: Change --arbitrary-precision to --bignum. 2012-04-02 John Haque - + Add support for arbitrary-precision arithmetic. * mpfr.c: New file. @@ -3548,7 +3552,7 @@ * eval.c (register_exec_hook): New function to manage interpreter hooks. (num_exec_hook, pre_execute, post_execute): New and adjusted definitions. (h_interpret): Renamed from debug_interpret. - (init_interpret): Changed to use the new name. + (init_interpret): Changed to use the new name. (flags2str): New entries for MPFN and MPZN. (cmp_nodes): Reworked to use seperate routine for numeric comparisons. (set_IGNORECASE, set_BINMODE, set_LINT, update_NR, update_FNR, @@ -3694,7 +3698,7 @@ 2012-01-13 Arnold D. Robbins - * dfa.c [is_valid_unibtye_character]: Fix from GNU grep to + * dfa.c [is_valid_unibtye_character]: Fix from GNU grep to bug reported by me from Scott Deifik for DJGPP. 2012-01-03 Arnold D. Robbins @@ -4038,7 +4042,7 @@ (do_traditional, do_posix, do_intervals, do_intl, do_non_decimal_data, do_profiling, do_dump_vars, do_tidy_mem, do_sandbox, do_lint, - do_lint_old): Defined as macros. + do_lint_old): Defined as macros. * main.c: Remove definitions of the do_XX variables. Add do_flags definition. * debug.c (execute_code, do_eval, parse_condition): Save @@ -4070,7 +4074,7 @@ (Node_ahash, NUMIND): Nuked. * eval.c (r_interpret): Adjust cases Op_subscript, Op_subscript_lhs, Op_store_var and Op_arrayfor_incr. - * node.c (dupnode, unref): Removed code related to Node_ahash. + * node.c (dupnode, unref): Removed code related to Node_ahash. * str_array.c: New file to handle array with string indices. * int_array.c: New file to handle array with integer indices. * cint_array.c: New file. Special handling of arrays with @@ -4123,7 +4127,7 @@ cases Op_K_getline, Op_after_beginfile, Op_after_endfile, Op_newfile and Op_K_exit. * io.c (after_beginfile): When skipping a file using nextfile, - return zero in case there was an error opening the file. + return zero in case there was an error opening the file. (has_endfile): Nuke global variable. (inrec): Add a second argument to pass errno to the calling routine. @@ -4204,7 +4208,7 @@ 2011-07-15 John Haque * awk.h (Op_sub_builtin): New opcode. - (GSUB, GENSUB, AFTER_ASSIGN, LITERAL): New flags for + (GSUB, GENSUB, AFTER_ASSIGN, LITERAL): New flags for Op_sub_builtin. * awkgram.y (struct tokentab): Change opcode to Op_sub_builtin for sub, gsub and gensub. @@ -4212,7 +4216,7 @@ * builtin.c (do_sub, do_gsub, do_gensub): Nuke. (sub_common): Renamed to do_sub. Relocate gensub argument handling code from do_gensub to here; Simplify the code a - little bit. + little bit. * eval.c (r_interpret): Handle Op_sub_builtin. Avoid field re-splitting or $0 rebuilding if (g)sub target string is a field and no substitutions were done. @@ -4235,7 +4239,7 @@ 2011-07-15 Arnold D. Robbins * awk.h: Typo fix: "loner" --> longer. Thanks to Nelson Beebe. - * builtin.c (efwrite): Fix flushing test back to what it was + * builtin.c (efwrite): Fix flushing test back to what it was in 3.1.8. Thanks to Strefil for the problem report. * configure.ac: Bump version to 4.0.0a for stable branch. diff --git a/doc/ChangeLog b/doc/ChangeLog index b0eb67ed..43594dd6 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2016-01-14 Arnold D. Robbins + + * ChangeLog: Remove spurious whitespace. + 2016-01-13 Arnold D. Robbins * gawktexi.in (Array Sorting Functions): Add an example of @@ -87,7 +91,7 @@ 2015-06-13 Arnold D. Robbins * gawktexi.in: Comment out exercise 10.3, since the answer - is included in the text. Thanks to Antonio Colombo + is included in the text. Thanks to Antonio Colombo for pointing this out. 2015-06-12 Arnold D. Robbins @@ -610,7 +614,7 @@ 2014-05-29 Arnold D. Robbins - * gawktexi.in: Remove some obsolete bits, fix up some other + * gawktexi.in: Remove some obsolete bits, fix up some other minor stuff. 2014-05-27 Arnold D. Robbins @@ -1342,7 +1346,7 @@ * gawk.texi, gawk.1: Replace references to dlload with dl_load. But much more work needs to be done on the docs. - + 2012-05-19 Andrew J. Schorr * gawk.texi, gawk.1: Document new -i option, and describe new default diff --git a/test/ChangeLog b/test/ChangeLog index 10e942b8..56edb8f2 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -3,6 +3,10 @@ * Makefile.am (aryprm9): New test. * aryprm9.awk, aryprm9.ok: New files. + Unrelated: + + * ChangeLog: Remove spurious whitespace. + 2015-12-27 Arnold D. Robbins * Makefile.am (profile8): New test. @@ -74,7 +78,7 @@ 2015-05-21 Arnold D. Robbins - * fts.awk: Really remove atime from the output. + * fts.awk: Really remove atime from the output. This avoids spurious failures on heavily loaded systems. * Makefile.am: Add list of needed locales to "inadequate locale -- cgit v1.2.3 From 89debf61f879b626438f818b08abda4d2874c50f Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 14 Jan 2016 20:55:09 +0200 Subject: Man page fixes. --- doc/ChangeLog | 6 ++++++ doc/gawk.1 | 33 ++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index c4d35b33..7bffb2ab 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,6 +2,12 @@ * ChangeLog: Remove spurious whitespace. + Unrelated: + + * gawk.1: Restore test on PROCINFO["RETRY"] and fix up the + formatting while we're at it. Thanks to Andrew Schorr for + pointing out the problem. + 2016-01-13 Arnold D. Robbins * gawktexi.in (Array Sorting Functions): Add an example of diff --git a/doc/gawk.1 b/doc/gawk.1 index b5dc9067..34c9f418 100644 --- a/doc/gawk.1 +++ b/doc/gawk.1 @@ -13,7 +13,7 @@ . if \w'\(rq' .ds rq "\(rq . \} .\} -.TH GAWK 1 "Dec 20 2015" "Free Software Foundation" "Utility Commands" +.TH GAWK 1 "Jan 14 2016" "Free Software Foundation" "Utility Commands" .SH NAME gawk \- pattern scanning and processing language .SH SYNOPSIS @@ -1138,7 +1138,7 @@ knows about the identifiers after it has finished parsing the program; they are updated while the program runs. For each identifier, the value of the element is one of the following: .RS -.TP +.TP \w'\fB"extension"\fR'u+1n \fB"array"\fR The identifier is an array. .TP @@ -1223,12 +1223,12 @@ behavior: .TP \fBPROCINFO["NONFATAL"]\fR If this exists, then I/O errors for all output redirections become nonfatal. +.TP +\fBPROCINFO["\fIoutput_command\fB", "NONFATAL"]\fR Make output errors for .I output_name be nonfatal. .TP -\fBPROCINFO["\fIoutput_command\fB", "NONFATAL"]\fR -.TP \fBPROCINFO["\fIcommand\fB", "pty"]\fR Use a pseudo-tty for two-way communication with .I command @@ -1242,6 +1242,23 @@ where is a redirection string or a filename. A value of zero or less than zero means no timeout. .TP +\fBPROCINFO["\fIinput\^\fB", "RETRY"]\fR +If an I/O error that may be retried occurs when reading data from +.IR input , +and this array entry exists, then +.B getline +will return \-2 instead of following the default behavior of returning \-1 +and configuring +.IR input +to return no further data. +An I/O error that may be retried is one where +.IR errno (3) +has the value EAGAIN, EWOULDBLOCK, EINTR, or ETIMEDOUT. +This may be useful in conjunction with +\fBPROCINFO["\fIinput\^\fB", "READ_TIMEOUT"]\fR +or situations where a file descriptor has been configured to behave in a +non-blocking fashion. +.TP \fBPROCINFO["sorted_in"]\fP If this element exists in .BR PROCINFO , @@ -1262,7 +1279,9 @@ Supported values are \fB"@val_num_desc"\fR, and \fB"@unsorted"\fR. -The value can also be the name of any comparison function defined +The value can also be the name (as a +.IR string ) +of any comparison function defined as follows: .sp .in +5m @@ -2315,7 +2334,7 @@ command returns 1 on success, 0 on end of file, and \-1 on an error. If the .IR errno (3) value indicates that the I/O operation may be retried, -and \fBPROCINFO["input", "RETRY"]\fP +and \fBPROCINFO["\fIinput\^\fP", "RETRY"]\fR is set, then \-2 will be returned instead of \-1, and further calls to .B getline may be attempted. @@ -4032,7 +4051,7 @@ We thank him. .SH COPYING PERMISSIONS Copyright \(co 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2007, 2009, -2010, 2011, 2012, 2013, 2014 +2010, 2011, 2012, 2013, 2014, 2015, 2016 Free Software Foundation, Inc. .PP Permission is granted to make and distribute verbatim copies of -- cgit v1.2.3