gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-1727-g43a645


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-1727-g43a645f
Date: Wed, 06 Apr 2016 02:58:34 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, master has been updated
       via  43a645fe05c57576d9d41a7f3b18bb55b1dbdc3e (commit)
       via  cfb773bb093dadfa715816c75d438f97e387e71a (commit)
      from  db6e8faca70e60d2fa80e0affda3d9bef1e82eae (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=43a645fe05c57576d9d41a7f3b18bb55b1dbdc3e

commit 43a645fe05c57576d9d41a7f3b18bb55b1dbdc3e
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Apr 6 05:58:03 2016 +0300

    Test case for nonfatal close one end of two way pipe.

diff --git a/test/ChangeLog b/test/ChangeLog
index eaeed87..bfb05de 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2016-04-06         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (clos1way6): New test.
+       * clos1way6.awk, clos1way6.ok: New files.
+
 2016-04-04         Arnold D. Robbins     <address@hidden>
 
        * Makefile.am (clos1way2, clos1way3, clos1way4, clos1way5):
diff --git a/test/Makefile.am b/test/Makefile.am
index 8e5d0c8..fdb163d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -156,6 +156,8 @@ EXTRA_DIST = \
        clos1way4.ok \
        clos1way5.awk \
        clos1way5.ok \
+       clos1way6.awk \
+       clos1way6.ok \
        closebad.awk \
        closebad.ok \
        clsflnam.awk \
@@ -1130,7 +1132,7 @@ UNIX_TESTS = \
 GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
        backw badargs beginfile1 beginfile2 binmode1 charasbytes \
-       colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
+       colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 clos1way6 \
        crlf dbugeval dbugeval2 dbugtypedre1 dbugtypedre2 delsub \
        devfd devfd1 devfd2 dumpvars errno exit \
        fieldwdth fpat1 fpat2 fpat3 fpat4 fpat5 fpatnull fsfwfs funlen \
diff --git a/test/Makefile.in b/test/Makefile.in
index 9fec312..3fa8fbc 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -413,6 +413,8 @@ EXTRA_DIST = \
        clos1way4.ok \
        clos1way5.awk \
        clos1way5.ok \
+       clos1way6.awk \
+       clos1way6.ok \
        closebad.awk \
        closebad.ok \
        clsflnam.awk \
@@ -1386,7 +1388,7 @@ UNIX_TESTS = \
 GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
        backw badargs beginfile1 beginfile2 binmode1 charasbytes \
-       colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
+       colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 clos1way6 \
        crlf dbugeval dbugeval2 dbugtypedre1 dbugtypedre2 delsub \
        devfd devfd1 devfd2 dumpvars errno exit \
        fieldwdth fpat1 fpat2 fpat3 fpat4 fpat5 fpatnull fsfwfs funlen \
@@ -3678,6 +3680,11 @@ clos1way5:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+clos1way6:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 crlf:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index e39f6c3..3b4691d 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1017,6 +1017,11 @@ clos1way5:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+clos1way6:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 crlf:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
diff --git a/test/clos1way6.awk b/test/clos1way6.awk
new file mode 100644
index 0000000..19779d7
--- /dev/null
+++ b/test/clos1way6.awk
@@ -0,0 +1,7 @@
+BEGIN {
+       cmd = "cat - 1>&2; sleep 2"
+       PROCINFO[cmd, "NONFATAL"] = 1
+       print "test1" |& cmd; close(cmd, "to")
+       fflush(cmd)
+       print "test2" |& cmd; print ERRNO
+}
diff --git a/test/clos1way6.ok b/test/clos1way6.ok
new file mode 100644
index 0000000..5768617
--- /dev/null
+++ b/test/clos1way6.ok
@@ -0,0 +1,3 @@
+gawk: clos1way6.awk:5: warning: fflush: cannot flush: two-way pipe `cat - 
1>&2; sleep 2' has closed write end
+test1
+Bad file descriptor

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=cfb773bb093dadfa715816c75d438f97e387e71a

commit cfb773bb093dadfa715816c75d438f97e387e71a
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Apr 6 05:54:19 2016 +0300

    Allow r/w for a partially closed two-way pipe to be nonfatal.

diff --git a/ChangeLog b/ChangeLog
index 025f88e..a96375c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-04-06         Arnold D. Robbins     <address@hidden>
+
+       * builtin.c (do_printf): Allow a write to the closed write-end of
+       a two-way pipe to be nonfatal if NONFATAL is set for it.
+       (do_print): Ditto.
+       (do_print_rec): Ditto.
+       * io.c (do_getline_redir): Same thing for reading from a closed
+       read end of a two-way pipe. Fatal error.
+
 2016-04-04         Arnold D. Robbins     <address@hidden>
 
        * builtin.c (do_fflush): Add warning for flush to two-way
diff --git a/builtin.c b/builtin.c
index b3756eb..e07bdb5 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1679,6 +1679,10 @@ do_printf(int nargs, int redirtype)
                rp = redirect(redir_exp, redirtype, & errflg, true);
                if (rp != NULL) {
                        if ((rp->flag & RED_TWOWAY) != 0 && rp->output.fp == 
NULL) {
+                               if (is_non_fatal_redirect(redir_exp->stptr)) {
+                                       update_ERRNO_int(EBADF);
+                                       return;
+                               }
                                fatal(_("printf: attempt to write to closed 
write end of two-way pipe"));
                        }
                        fp = rp->output.fp;
@@ -2159,6 +2163,10 @@ do_print(int nargs, int redirtype)
                rp = redirect(redir_exp, redirtype, & errflg, true);
                if (rp != NULL) {
                        if ((rp->flag & RED_TWOWAY) != 0 && rp->output.fp == 
NULL) {
+                               if (is_non_fatal_redirect(redir_exp->stptr)) {
+                                       update_ERRNO_int(EBADF);
+                                       return;
+                               }
                                fatal(_("print: attempt to write to closed 
write end of two-way pipe"));
                        }
                        fp = rp->output.fp;
@@ -2233,6 +2241,10 @@ do_print_rec(int nargs, int redirtype)
                rp = redirect(redir_exp, redirtype, & errflg, true);
                if (rp != NULL) {
                        if ((rp->flag & RED_TWOWAY) != 0 && rp->output.fp == 
NULL) {
+                               if (is_non_fatal_redirect(redir_exp->stptr)) {
+                                       update_ERRNO_int(EBADF);
+                                       return;
+                               }
                                fatal(_("print: attempt to write to closed 
write end of two-way pipe"));
                        }
                        fp = rp->output.fp;
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 7f78937..7ea2afe 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,9 @@
+2016-04-06         Arnold D. Robbins     <address@hidden>
+
+       * gawktexi.in (Two-way I/O): Document that writing to the closed
+       write end of a two way pipe or reading from the closed read end
+       can be made nonfatal.
+
 2016-04-04         Arnold D. Robbins     <address@hidden>
 
        * gawktexi.in, gawkinet.texi: Enable use of braces in
diff --git a/doc/gawk.info b/doc/gawk.info
index c60bf42..16f06d4 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -19943,9 +19943,15 @@ case 'gawk' waits for the child process to exit, which 
may cause your
 program to hang.  (Thus, this particular feature is of much less use in
 practice than being able to close the '"to"' end.)
 
-     CAUTION: It is a fatal error to write to the '"to"' end of a
-     two-way pipe which has been closed.  It is also a fatal error to
-     read from the '"from"' end of a two-way pipe that has been closed.
+     CAUTION: Normally, it is a fatal error to write to the '"to"' end
+     of a two-way pipe which has been closed, and it is also a fatal
+     error to read from the '"from"' end of a two-way pipe that has been
+     closed.
+
+     You may set 'PROCINFO["COMMAND", "NONFATAL"]' to make such
+     operations become nonfatal, in which case you then need to check
+     'ERRNO' after each 'print', 'printf', or 'getline'.  *Note
+     Nonfatal::, for more information.
 
    You may also use pseudo-ttys (ptys) for two-way communication instead
 of pipes, if your system supports them.  This is done on a per-command
@@ -33747,7 +33753,7 @@ Index
 * gawk, predefined variables and:        Built-in Variables.  (line  14)
 * gawk, PROCINFO array in:               Auto-set.            (line 148)
 * gawk, PROCINFO array in <1>:           Time Functions.      (line  47)
-* gawk, PROCINFO array in <2>:           Two-way I/O.         (line 108)
+* gawk, PROCINFO array in <2>:           Two-way I/O.         (line 114)
 * gawk, regexp constants and:            Using Constant Regexps.
                                                               (line  28)
 * gawk, regular expressions, case sensitivity: Case-sensitivity.
@@ -34525,7 +34531,7 @@ Index
 * PROCINFO array:                        Auto-set.            (line 148)
 * PROCINFO array <1>:                    Time Functions.      (line  47)
 * PROCINFO array <2>:                    Passwd Functions.    (line   6)
-* PROCINFO array, and communications via ptys: Two-way I/O.   (line 108)
+* PROCINFO array, and communications via ptys: Two-way I/O.   (line 114)
 * PROCINFO array, and group membership:  Group Functions.     (line   6)
 * PROCINFO array, and user and group ID numbers: Id Program.  (line  15)
 * PROCINFO array, testing the field splitting: Passwd Functions.
@@ -35594,218 +35600,218 @@ Ref: Controlling Array Traversal-Footnote-1801827
 Node: Array Sorting Functions801945
 Ref: Array Sorting Functions-Footnote-1807036
 Node: Two-way I/O807232
-Ref: Two-way I/O-Footnote-1813526
-Ref: Two-way I/O-Footnote-2813713
-Node: TCP/IP Networking813795
-Node: Profiling816913
-Ref: Profiling-Footnote-1825406
-Node: Advanced Features Summary825729
-Node: Internationalization827573
-Node: I18N and L10N829053
-Node: Explaining gettext829740
-Ref: Explaining gettext-Footnote-1834763
-Ref: Explaining gettext-Footnote-2834948
-Node: Programmer i18n835113
-Ref: Programmer i18n-Footnote-1839968
-Node: Translator i18n840017
-Node: String Extraction840811
-Ref: String Extraction-Footnote-1841943
-Node: Printf Ordering842029
-Ref: Printf Ordering-Footnote-1844815
-Node: I18N Portability844879
-Ref: I18N Portability-Footnote-1847335
-Node: I18N Example847398
-Ref: I18N Example-Footnote-1850204
-Node: Gawk I18N850277
-Node: I18N Summary850922
-Node: Debugger852263
-Node: Debugging853285
-Node: Debugging Concepts853726
-Node: Debugging Terms855535
-Node: Awk Debugging858110
-Node: Sample Debugging Session859016
-Node: Debugger Invocation859550
-Node: Finding The Bug860936
-Node: List of Debugger Commands867414
-Node: Breakpoint Control868747
-Node: Debugger Execution Control872441
-Node: Viewing And Changing Data875803
-Node: Execution Stack879177
-Node: Debugger Info880814
-Node: Miscellaneous Debugger Commands884885
-Node: Readline Support889973
-Node: Limitations890869
-Ref: Limitations-Footnote-1895100
-Node: Debugging Summary895151
-Node: Arbitrary Precision Arithmetic896430
-Node: Computer Arithmetic897846
-Ref: table-numeric-ranges901437
-Ref: Computer Arithmetic-Footnote-1902159
-Node: Math Definitions902216
-Ref: table-ieee-formats905530
-Ref: Math Definitions-Footnote-1906133
-Node: MPFR features906238
-Node: FP Math Caution907955
-Ref: FP Math Caution-Footnote-1909027
-Node: Inexactness of computations909396
-Node: Inexact representation910356
-Node: Comparing FP Values911716
-Node: Errors accumulate912798
-Node: Getting Accuracy914231
-Node: Try To Round916941
-Node: Setting precision917840
-Ref: table-predefined-precision-strings918537
-Node: Setting the rounding mode920367
-Ref: table-gawk-rounding-modes920741
-Ref: Setting the rounding mode-Footnote-1924149
-Node: Arbitrary Precision Integers924328
-Ref: Arbitrary Precision Integers-Footnote-1929245
-Node: POSIX Floating Point Problems929394
-Ref: POSIX Floating Point Problems-Footnote-1933276
-Node: Floating point summary933314
-Node: Dynamic Extensions935504
-Node: Extension Intro937057
-Node: Plugin License938323
-Node: Extension Mechanism Outline939120
-Ref: figure-load-extension939559
-Ref: figure-register-new-function941124
-Ref: figure-call-new-function942216
-Node: Extension API Description944278
-Node: Extension API Functions Introduction945810
-Node: General Data Types950669
-Ref: General Data Types-Footnote-1956624
-Node: Memory Allocation Functions956923
-Ref: Memory Allocation Functions-Footnote-1959768
-Node: Constructor Functions959867
-Node: Registration Functions961612
-Node: Extension Functions962297
-Node: Exit Callback Functions964596
-Node: Extension Version String965846
-Node: Input Parsers966509
-Node: Output Wrappers976394
-Node: Two-way processors980906
-Node: Printing Messages983170
-Ref: Printing Messages-Footnote-1984244
-Node: Updating ERRNO984397
-Node: Requesting Values985136
-Ref: table-value-types-returned985873
-Node: Accessing Parameters986756
-Node: Symbol Table Access987991
-Node: Symbol table by name988503
-Node: Symbol table by cookie990524
-Ref: Symbol table by cookie-Footnote-1994673
-Node: Cached values994737
-Ref: Cached values-Footnote-1998238
-Node: Array Manipulation998329
-Ref: Array Manipulation-Footnote-1999420
-Node: Array Data Types999457
-Ref: Array Data Types-Footnote-11002115
-Node: Array Functions1002207
-Node: Flattening Arrays1006065
-Node: Creating Arrays1012973
-Node: Redirection API1017744
-Node: Extension API Variables1020575
-Node: Extension Versioning1021208
-Node: Extension API Informational Variables1023099
-Node: Extension API Boilerplate1024163
-Node: Finding Extensions1027977
-Node: Extension Example1028536
-Node: Internal File Description1029334
-Node: Internal File Ops1033414
-Ref: Internal File Ops-Footnote-11045176
-Node: Using Internal File Ops1045316
-Ref: Using Internal File Ops-Footnote-11047699
-Node: Extension Samples1047973
-Node: Extension Sample File Functions1049502
-Node: Extension Sample Fnmatch1057151
-Node: Extension Sample Fork1058638
-Node: Extension Sample Inplace1059856
-Node: Extension Sample Ord1063066
-Node: Extension Sample Readdir1063902
-Ref: table-readdir-file-types1064791
-Node: Extension Sample Revout1065596
-Node: Extension Sample Rev2way1066185
-Node: Extension Sample Read write array1066925
-Node: Extension Sample Readfile1068867
-Node: Extension Sample Time1069962
-Node: Extension Sample API Tests1071310
-Node: gawkextlib1071802
-Node: Extension summary1074249
-Node: Extension Exercises1077941
-Node: Language History1079438
-Node: V7/SVR3.11081094
-Node: SVR41083246
-Node: POSIX1084680
-Node: BTL1086059
-Node: POSIX/GNU1086788
-Node: Feature History1092650
-Node: Common Extensions1107020
-Node: Ranges and Locales1108303
-Ref: Ranges and Locales-Footnote-11112919
-Ref: Ranges and Locales-Footnote-21112946
-Ref: Ranges and Locales-Footnote-31113181
-Node: Contributors1113402
-Node: History summary1118971
-Node: Installation1120351
-Node: Gawk Distribution1121295
-Node: Getting1121779
-Node: Extracting1122740
-Node: Distribution contents1124378
-Node: Unix Installation1130472
-Node: Quick Installation1131154
-Node: Shell Startup Files1133568
-Node: Additional Configuration Options1134646
-Node: Configuration Philosophy1136451
-Node: Non-Unix Installation1138820
-Node: PC Installation1139278
-Node: PC Binary Installation1140598
-Node: PC Compiling1142450
-Ref: PC Compiling-Footnote-11145474
-Node: PC Testing1145583
-Node: PC Using1146763
-Node: Cygwin1150877
-Node: MSYS1151647
-Node: VMS Installation1152148
-Node: VMS Compilation1152939
-Ref: VMS Compilation-Footnote-11154168
-Node: VMS Dynamic Extensions1154226
-Node: VMS Installation Details1155911
-Node: VMS Running1158164
-Node: VMS GNV1162443
-Node: VMS Old Gawk1163178
-Node: Bugs1163649
-Node: Other Versions1167846
-Node: Installation summary1174430
-Node: Notes1175488
-Node: Compatibility Mode1176353
-Node: Additions1177135
-Node: Accessing The Source1178060
-Node: Adding Code1179495
-Node: New Ports1185714
-Node: Derived Files1190202
-Ref: Derived Files-Footnote-11195687
-Ref: Derived Files-Footnote-21195722
-Ref: Derived Files-Footnote-31196320
-Node: Future Extensions1196434
-Node: Implementation Limitations1197092
-Node: Extension Design1198275
-Node: Old Extension Problems1199429
-Ref: Old Extension Problems-Footnote-11200947
-Node: Extension New Mechanism Goals1201004
-Ref: Extension New Mechanism Goals-Footnote-11204368
-Node: Extension Other Design Decisions1204557
-Node: Extension Future Growth1206670
-Node: Old Extension Mechanism1207506
-Node: Notes summary1209269
-Node: Basic Concepts1210451
-Node: Basic High Level1211132
-Ref: figure-general-flow1211414
-Ref: figure-process-flow1212099
-Ref: Basic High Level-Footnote-11215400
-Node: Basic Data Typing1215585
-Node: Glossary1218913
-Node: Copying1250859
-Node: GNU Free Documentation License1288398
-Node: Index1313516
+Ref: Two-way I/O-Footnote-1813782
+Ref: Two-way I/O-Footnote-2813969
+Node: TCP/IP Networking814051
+Node: Profiling817169
+Ref: Profiling-Footnote-1825662
+Node: Advanced Features Summary825985
+Node: Internationalization827829
+Node: I18N and L10N829309
+Node: Explaining gettext829996
+Ref: Explaining gettext-Footnote-1835019
+Ref: Explaining gettext-Footnote-2835204
+Node: Programmer i18n835369
+Ref: Programmer i18n-Footnote-1840224
+Node: Translator i18n840273
+Node: String Extraction841067
+Ref: String Extraction-Footnote-1842199
+Node: Printf Ordering842285
+Ref: Printf Ordering-Footnote-1845071
+Node: I18N Portability845135
+Ref: I18N Portability-Footnote-1847591
+Node: I18N Example847654
+Ref: I18N Example-Footnote-1850460
+Node: Gawk I18N850533
+Node: I18N Summary851178
+Node: Debugger852519
+Node: Debugging853541
+Node: Debugging Concepts853982
+Node: Debugging Terms855791
+Node: Awk Debugging858366
+Node: Sample Debugging Session859272
+Node: Debugger Invocation859806
+Node: Finding The Bug861192
+Node: List of Debugger Commands867670
+Node: Breakpoint Control869003
+Node: Debugger Execution Control872697
+Node: Viewing And Changing Data876059
+Node: Execution Stack879433
+Node: Debugger Info881070
+Node: Miscellaneous Debugger Commands885141
+Node: Readline Support890229
+Node: Limitations891125
+Ref: Limitations-Footnote-1895356
+Node: Debugging Summary895407
+Node: Arbitrary Precision Arithmetic896686
+Node: Computer Arithmetic898102
+Ref: table-numeric-ranges901693
+Ref: Computer Arithmetic-Footnote-1902415
+Node: Math Definitions902472
+Ref: table-ieee-formats905786
+Ref: Math Definitions-Footnote-1906389
+Node: MPFR features906494
+Node: FP Math Caution908211
+Ref: FP Math Caution-Footnote-1909283
+Node: Inexactness of computations909652
+Node: Inexact representation910612
+Node: Comparing FP Values911972
+Node: Errors accumulate913054
+Node: Getting Accuracy914487
+Node: Try To Round917197
+Node: Setting precision918096
+Ref: table-predefined-precision-strings918793
+Node: Setting the rounding mode920623
+Ref: table-gawk-rounding-modes920997
+Ref: Setting the rounding mode-Footnote-1924405
+Node: Arbitrary Precision Integers924584
+Ref: Arbitrary Precision Integers-Footnote-1929501
+Node: POSIX Floating Point Problems929650
+Ref: POSIX Floating Point Problems-Footnote-1933532
+Node: Floating point summary933570
+Node: Dynamic Extensions935760
+Node: Extension Intro937313
+Node: Plugin License938579
+Node: Extension Mechanism Outline939376
+Ref: figure-load-extension939815
+Ref: figure-register-new-function941380
+Ref: figure-call-new-function942472
+Node: Extension API Description944534
+Node: Extension API Functions Introduction946066
+Node: General Data Types950925
+Ref: General Data Types-Footnote-1956880
+Node: Memory Allocation Functions957179
+Ref: Memory Allocation Functions-Footnote-1960024
+Node: Constructor Functions960123
+Node: Registration Functions961868
+Node: Extension Functions962553
+Node: Exit Callback Functions964852
+Node: Extension Version String966102
+Node: Input Parsers966765
+Node: Output Wrappers976650
+Node: Two-way processors981162
+Node: Printing Messages983426
+Ref: Printing Messages-Footnote-1984500
+Node: Updating ERRNO984653
+Node: Requesting Values985392
+Ref: table-value-types-returned986129
+Node: Accessing Parameters987012
+Node: Symbol Table Access988247
+Node: Symbol table by name988759
+Node: Symbol table by cookie990780
+Ref: Symbol table by cookie-Footnote-1994929
+Node: Cached values994993
+Ref: Cached values-Footnote-1998494
+Node: Array Manipulation998585
+Ref: Array Manipulation-Footnote-1999676
+Node: Array Data Types999713
+Ref: Array Data Types-Footnote-11002371
+Node: Array Functions1002463
+Node: Flattening Arrays1006321
+Node: Creating Arrays1013229
+Node: Redirection API1018000
+Node: Extension API Variables1020831
+Node: Extension Versioning1021464
+Node: Extension API Informational Variables1023355
+Node: Extension API Boilerplate1024419
+Node: Finding Extensions1028233
+Node: Extension Example1028792
+Node: Internal File Description1029590
+Node: Internal File Ops1033670
+Ref: Internal File Ops-Footnote-11045432
+Node: Using Internal File Ops1045572
+Ref: Using Internal File Ops-Footnote-11047955
+Node: Extension Samples1048229
+Node: Extension Sample File Functions1049758
+Node: Extension Sample Fnmatch1057407
+Node: Extension Sample Fork1058894
+Node: Extension Sample Inplace1060112
+Node: Extension Sample Ord1063322
+Node: Extension Sample Readdir1064158
+Ref: table-readdir-file-types1065047
+Node: Extension Sample Revout1065852
+Node: Extension Sample Rev2way1066441
+Node: Extension Sample Read write array1067181
+Node: Extension Sample Readfile1069123
+Node: Extension Sample Time1070218
+Node: Extension Sample API Tests1071566
+Node: gawkextlib1072058
+Node: Extension summary1074505
+Node: Extension Exercises1078197
+Node: Language History1079694
+Node: V7/SVR3.11081350
+Node: SVR41083502
+Node: POSIX1084936
+Node: BTL1086315
+Node: POSIX/GNU1087044
+Node: Feature History1092906
+Node: Common Extensions1107276
+Node: Ranges and Locales1108559
+Ref: Ranges and Locales-Footnote-11113175
+Ref: Ranges and Locales-Footnote-21113202
+Ref: Ranges and Locales-Footnote-31113437
+Node: Contributors1113658
+Node: History summary1119227
+Node: Installation1120607
+Node: Gawk Distribution1121551
+Node: Getting1122035
+Node: Extracting1122996
+Node: Distribution contents1124634
+Node: Unix Installation1130728
+Node: Quick Installation1131410
+Node: Shell Startup Files1133824
+Node: Additional Configuration Options1134902
+Node: Configuration Philosophy1136707
+Node: Non-Unix Installation1139076
+Node: PC Installation1139534
+Node: PC Binary Installation1140854
+Node: PC Compiling1142706
+Ref: PC Compiling-Footnote-11145730
+Node: PC Testing1145839
+Node: PC Using1147019
+Node: Cygwin1151133
+Node: MSYS1151903
+Node: VMS Installation1152404
+Node: VMS Compilation1153195
+Ref: VMS Compilation-Footnote-11154424
+Node: VMS Dynamic Extensions1154482
+Node: VMS Installation Details1156167
+Node: VMS Running1158420
+Node: VMS GNV1162699
+Node: VMS Old Gawk1163434
+Node: Bugs1163905
+Node: Other Versions1168102
+Node: Installation summary1174686
+Node: Notes1175744
+Node: Compatibility Mode1176609
+Node: Additions1177391
+Node: Accessing The Source1178316
+Node: Adding Code1179751
+Node: New Ports1185970
+Node: Derived Files1190458
+Ref: Derived Files-Footnote-11195943
+Ref: Derived Files-Footnote-21195978
+Ref: Derived Files-Footnote-31196576
+Node: Future Extensions1196690
+Node: Implementation Limitations1197348
+Node: Extension Design1198531
+Node: Old Extension Problems1199685
+Ref: Old Extension Problems-Footnote-11201203
+Node: Extension New Mechanism Goals1201260
+Ref: Extension New Mechanism Goals-Footnote-11204624
+Node: Extension Other Design Decisions1204813
+Node: Extension Future Growth1206926
+Node: Old Extension Mechanism1207762
+Node: Notes summary1209525
+Node: Basic Concepts1210707
+Node: Basic High Level1211388
+Ref: figure-general-flow1211670
+Ref: figure-process-flow1212355
+Ref: Basic High Level-Footnote-11215656
+Node: Basic Data Typing1215841
+Node: Glossary1219169
+Node: Copying1251115
+Node: GNU Free Documentation License1288654
+Node: Index1313772
 
 End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 77bec7d..fd71dbc 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -27859,9 +27859,16 @@ your program to hang.  (Thus, this particular feature 
is of much less
 use in practice than being able to close the @code{"to"} end.)
 
 @quotation CAUTION
-It is a fatal error to write to the @code{"to"} end of a two-way
-pipe which has been closed. It is also a fatal error to read
+Normally,
+it is a fatal error to write to the @code{"to"} end of a two-way
+pipe which has been closed, and it is also a fatal error to read
 from the @code{"from"} end of a two-way pipe that has been closed.
+
+You may set @code{PROCINFO["@var{command}", "NONFATAL"]} to
+make such operations become nonfatal, in which case you then need
+to check @code{ERRNO} after each @code{print}, @code{printf},
+or @code{getline}.
address@hidden, for more information.
 @end quotation
 
 @cindex @command{gawk}, @code{PROCINFO} array in
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 75381dc..f47c845 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -26950,9 +26950,16 @@ your program to hang.  (Thus, this particular feature 
is of much less
 use in practice than being able to close the @code{"to"} end.)
 
 @quotation CAUTION
-It is a fatal error to write to the @code{"to"} end of a two-way
-pipe which has been closed. It is also a fatal error to read
+Normally,
+it is a fatal error to write to the @code{"to"} end of a two-way
+pipe which has been closed, and it is also a fatal error to read
 from the @code{"from"} end of a two-way pipe that has been closed.
+
+You may set @code{PROCINFO["@var{command}", "NONFATAL"]} to
+make such operations become nonfatal, in which case you then need
+to check @code{ERRNO} after each @code{print}, @code{printf},
+or @code{getline}.
address@hidden, for more information.
 @end quotation
 
 @cindex @command{gawk}, @code{PROCINFO} array in
diff --git a/io.c b/io.c
index 719601c..fafc100 100644
--- a/io.c
+++ b/io.c
@@ -2604,6 +2604,10 @@ do_getline_redir(int into_variable, enum redirval 
redirtype)
                }
                return make_number((AWKNUM) -1.0);
        } else if ((rp->flag & RED_TWOWAY) != 0 && rp->iop == NULL) {
+               if (is_non_fatal_redirect(redir_exp->stptr)) {
+                       update_ERRNO_int(EBADF);
+                       return make_number((AWKNUM) -1.0);
+               }
                fatal(_("getline: attempt to read from closed read end of 
two-way pipe"));
        }
        iop = rp->iop;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |    9 +
 builtin.c          |   12 ++
 doc/ChangeLog      |    6 +
 doc/gawk.info      |  442 ++++++++++++++++++++++++++--------------------------
 doc/gawk.texi      |   11 +-
 doc/gawktexi.in    |   11 +-
 io.c               |    4 +
 test/ChangeLog     |    5 +
 test/Makefile.am   |    4 +-
 test/Makefile.in   |    9 +-
 test/Maketests     |    5 +
 test/clos1way6.awk |    7 +
 test/clos1way6.ok  |    3 +
 13 files changed, 304 insertions(+), 224 deletions(-)
 create mode 100644 test/clos1way6.awk
 create mode 100644 test/clos1way6.ok


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]