gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-851


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-851-g1b5d1b8
Date: Tue, 05 Apr 2016 18:07:36 +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, gawk-4.1-stable has been updated
       via  1b5d1b8870cb0ac1c4b99f6cf67e3277427df864 (commit)
       via  fae30f292fc0e2e67de188f8129d043f9909bd0b (commit)
       via  02e319635b2323361a5898e868e91058768bd39c (commit)
       via  6d22cdfde8a2136080efba406d980ecac537b07d (commit)
       via  b332053a160357e6c30c22f9ca90af9129e4550b (commit)
       via  464aa113b70b30ab9b1b00d1de5ccf4b0230b720 (commit)
       via  1662deffd0ced2464647ebff013be4d5ad398594 (commit)
       via  124c3594cb65748ce858dcc55eadd7c831cee041 (commit)
      from  7a1dafd29d4ec5d8868f5ea376a99422a9282cdb (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=1b5d1b8870cb0ac1c4b99f6cf67e3277427df864

commit 1b5d1b8870cb0ac1c4b99f6cf67e3277427df864
Author: Arnold D. Robbins <address@hidden>
Date:   Mon Apr 4 23:11:19 2016 +0300

    Add warning for fflush of closed write end on 2-way pipe.

diff --git a/ChangeLog b/ChangeLog
index 7ba50e8..d34c136 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-04-04         Arnold D. Robbins     <address@hidden>
+
+       * builtin.c (do_fflush): Add warning for flush to two-way
+       pipe where write end was closed.
+       * io.c (flush_io): Add some braces for the for loop.
+
 2016-04-02         Arnold D. Robbins     <address@hidden>
 
        * builtin.c (do_printf): If the redirection is two way but the
diff --git a/builtin.c b/builtin.c
index c4d3d3a..a1c09d5 100644
--- a/builtin.c
+++ b/builtin.c
@@ -237,6 +237,9 @@ do_fflush(int nargs)
                fp = rp->output.fp;
                if (fp != NULL)
                        status = rp->output.gawk_fflush(fp, rp->output.opaque);
+               else if ((rp->flag & RED_TWOWAY) != 0)
+                               warning(_("fflush: cannot flush: two-way pipe 
`%s' has closed write end"),
+                                       file);
        } else if ((fp = stdfile(tmp->stptr, tmp->stlen)) != NULL) {
                status = fflush(fp);
        } else {
diff --git a/io.c b/io.c
index de75397..fe1261a 100644
--- a/io.c
+++ b/io.c
@@ -1328,7 +1328,7 @@ flush_io()
                        warning(_("error writing standard error (%s)"), 
strerror(errno));
                status++;
        }
-       for (rp = red_head; rp != NULL; rp = rp->next)
+       for (rp = red_head; rp != NULL; rp = rp->next) {
                /* flush both files and pipes, what the heck */
                if ((rp->flag & RED_WRITE) != 0 && rp->output.fp != NULL) {
                        if (rp->output.gawk_fflush(rp->output.fp, 
rp->output.opaque)) {
@@ -1344,6 +1344,7 @@ flush_io()
                                status++;
                        }
                }
+       }
        if (status != 0)
                status = -1;    /* canonicalize it */
        return status;
diff --git a/test/ChangeLog b/test/ChangeLog
index 80b2c23..2867f6c 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -5,6 +5,8 @@
        * clos1way2.awk, clos1way2.in, clos1way2.ok, clos1way3.awk,
        clos1way3.ok, clos1way4.awk, clos1way4.ok, clos1way5.awk,
        clos1way5.ok: New files.
+       * clos1way2.awk: Add call to fflush() to test it too.
+       * clos1way2.ok: Updated after code change.
 
 2016-02-18         Arnold D. Robbins     <address@hidden>
 
diff --git a/test/clos1way2.awk b/test/clos1way2.awk
index 7dab6a6..5794bec 100644
--- a/test/clos1way2.awk
+++ b/test/clos1way2.awk
@@ -1,5 +1,6 @@
 {
        cmd = "cat - 1>&2; sleep 2"
        print |& cmd; close(cmd, "to")
+       fflush(cmd)
        print |& cmd; print ERRNO
 }
diff --git a/test/clos1way2.ok b/test/clos1way2.ok
index 22bd3e1..063c421 100644
--- a/test/clos1way2.ok
+++ b/test/clos1way2.ok
@@ -1,3 +1,4 @@
-gawk: clos1way2.awk:4: (FILENAME=- FNR=1) fatal: print: attempt to write to 
closed write end of two-way pipe
+gawk: clos1way2.awk:4: (FILENAME=- FNR=1) warning: fflush: cannot flush: 
two-way pipe `cat - 1>&2; sleep 2' has closed write end
+gawk: clos1way2.awk:5: (FILENAME=- FNR=1) fatal: print: attempt to write to 
closed write end of two-way pipe
 test
 CODE: 2

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

commit fae30f292fc0e2e67de188f8129d043f9909bd0b
Author: Arnold D. Robbins <address@hidden>
Date:   Mon Apr 4 22:59:36 2016 +0300

    Braino fix in doc/ChangeLog.

diff --git a/doc/ChangeLog b/doc/ChangeLog
index 0da0e7c..d21d9af 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -5,7 +5,7 @@
 
 2016-04-02         Arnold D. Robbins     <address@hidden>
 
-       * gawktexi.in (Two-way I/O): Document that closing the "to"
+       * gawktexi.in (Two-way I/O): Document that closing the "from"
        end waits for the process to exit, so it's not such a great idea.
 
 2016-03-21         Arnold D. Robbins     <address@hidden>

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

commit 02e319635b2323361a5898e868e91058768bd39c
Author: Arnold D. Robbins <address@hidden>
Date:   Mon Apr 4 06:49:59 2016 +0300

    Add new tests for read/write closed end of 2 way pipe.

diff --git a/test/ChangeLog b/test/ChangeLog
index 05f8e93..80b2c23 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,11 @@
+2016-04-04         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (clos1way2, clos1way3, clos1way4, clos1way5):
+       New tests.
+       * clos1way2.awk, clos1way2.in, clos1way2.ok, clos1way3.awk,
+       clos1way3.ok, clos1way4.awk, clos1way4.ok, clos1way5.awk,
+       clos1way5.ok: New files.
+
 2016-02-18         Arnold D. Robbins     <address@hidden>
 
        * profile2.ok, profile5.ok: Adjust after code changes.
diff --git a/test/Makefile.am b/test/Makefile.am
index 540e8d9..7be8d97 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -147,6 +147,15 @@ EXTRA_DIST = \
        clobber.ok \
        clos1way.awk \
        clos1way.ok \
+       clos1way2.awk \
+       clos1way2.in \
+       clos1way2.ok \
+       clos1way3.awk \
+       clos1way3.ok \
+       clos1way4.awk \
+       clos1way4.ok \
+       clos1way5.awk \
+       clos1way5.ok \
        closebad.awk \
        closebad.ok \
        clsflnam.awk \
@@ -1075,7 +1084,8 @@ UNIX_TESTS = \
 GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
        backw badargs beginfile1 beginfile2 binmode1 charasbytes \
-       colonwarn clos1way crlf dbugeval delsub devfd devfd1 devfd2 dumpvars 
exit \
+       colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
+       crlf dbugeval delsub devfd devfd1 devfd2 dumpvars exit \
        fieldwdth fpat1 fpat2 fpat3 fpat4 fpat5 fpatnull fsfwfs funlen \
        functab1 functab2 functab3 fwtest fwtest2 fwtest3 \
        genpot gensub gensub2 getlndir gnuops2 gnuops3 gnureops \
diff --git a/test/Makefile.in b/test/Makefile.in
index 723c39e..b9b97de 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -404,6 +404,15 @@ EXTRA_DIST = \
        clobber.ok \
        clos1way.awk \
        clos1way.ok \
+       clos1way2.awk \
+       clos1way2.in \
+       clos1way2.ok \
+       clos1way3.awk \
+       clos1way3.ok \
+       clos1way4.awk \
+       clos1way4.ok \
+       clos1way5.awk \
+       clos1way5.ok \
        closebad.awk \
        closebad.ok \
        clsflnam.awk \
@@ -1331,7 +1340,8 @@ UNIX_TESTS = \
 GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
        backw badargs beginfile1 beginfile2 binmode1 charasbytes \
-       colonwarn clos1way crlf dbugeval delsub devfd devfd1 devfd2 dumpvars 
exit \
+       colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
+       crlf dbugeval delsub devfd devfd1 devfd2 dumpvars exit \
        fieldwdth fpat1 fpat2 fpat3 fpat4 fpat5 fpatnull fsfwfs funlen \
        functab1 functab2 functab3 fwtest fwtest2 fwtest3 \
        genpot gensub gensub2 getlndir gnuops2 gnuops3 gnureops \
@@ -3559,6 +3569,26 @@ backw:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+clos1way2:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+clos1way3:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+clos1way4:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+clos1way5:
+       @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 214f5dd..08d0595 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -997,6 +997,26 @@ backw:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+clos1way2:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+clos1way3:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+clos1way4:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+clos1way5:
+       @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/clos1way2.awk b/test/clos1way2.awk
new file mode 100644
index 0000000..7dab6a6
--- /dev/null
+++ b/test/clos1way2.awk
@@ -0,0 +1,5 @@
+{
+       cmd = "cat - 1>&2; sleep 2"
+       print |& cmd; close(cmd, "to")
+       print |& cmd; print ERRNO
+}
diff --git a/test/clos1way2.in b/test/clos1way2.in
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/test/clos1way2.in
@@ -0,0 +1 @@
+test
diff --git a/test/clos1way2.ok b/test/clos1way2.ok
new file mode 100644
index 0000000..22bd3e1
--- /dev/null
+++ b/test/clos1way2.ok
@@ -0,0 +1,3 @@
+gawk: clos1way2.awk:4: (FILENAME=- FNR=1) fatal: print: attempt to write to 
closed write end of two-way pipe
+test
+CODE: 2
diff --git a/test/clos1way3.awk b/test/clos1way3.awk
new file mode 100644
index 0000000..f69f667
--- /dev/null
+++ b/test/clos1way3.awk
@@ -0,0 +1,7 @@
+BEGIN {
+       cmd = "cat - 1>&2; sleep 2"
+       print "test1" |& cmd
+       close(cmd, "to")
+       print "test2" |& cmd
+       print ERRNO
+}
diff --git a/test/clos1way3.ok b/test/clos1way3.ok
new file mode 100644
index 0000000..74f6773
--- /dev/null
+++ b/test/clos1way3.ok
@@ -0,0 +1,3 @@
+gawk: clos1way3.awk:5: fatal: print: attempt to write to closed write end of 
two-way pipe
+test1
+ODE: 2
diff --git a/test/clos1way4.awk b/test/clos1way4.awk
new file mode 100644
index 0000000..6c68c5c
--- /dev/null
+++ b/test/clos1way4.awk
@@ -0,0 +1,7 @@
+BEGIN {
+       cmd = "cat - 1>&2; sleep 2"
+       printf "%s\n", "test1" |& cmd
+       close(cmd, "to")
+       printf "%s\n", "test2" |& cmd
+       print ERRNO
+}
diff --git a/test/clos1way4.ok b/test/clos1way4.ok
new file mode 100644
index 0000000..707f981
--- /dev/null
+++ b/test/clos1way4.ok
@@ -0,0 +1,3 @@
+gawk: clos1way4.awk:5: fatal: printf: attempt to write to closed write end of 
two-way pipe
+test1
+ODE: 2
diff --git a/test/clos1way5.awk b/test/clos1way5.awk
new file mode 100644
index 0000000..ca1bd94
--- /dev/null
+++ b/test/clos1way5.awk
@@ -0,0 +1,9 @@
+BEGIN {
+       cmd = "echo test1; echo test2; sleep 2"
+       cmd |& getline x
+       print x
+       close(cmd, "from")
+       cmd |& getline x
+       print x
+       print ERRNO
+}
diff --git a/test/clos1way5.ok b/test/clos1way5.ok
new file mode 100644
index 0000000..1ff1540
--- /dev/null
+++ b/test/clos1way5.ok
@@ -0,0 +1,3 @@
+test1
+gawk: clos1way5.awk:6: fatal: getline: attempt to read from closed read end of 
two-way pipe
+EXIT CODE: 2

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

commit 6d22cdfde8a2136080efba406d980ecac537b07d
Author: Arnold D. Robbins <address@hidden>
Date:   Sat Apr 2 22:56:52 2016 +0300

    Further doc on closing one end of a two-way pipe.

diff --git a/doc/gawk.info b/doc/gawk.info
index c3cb089..c773fb9 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -19673,6 +19673,10 @@ 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.
+
    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
 basis, by setting a special element in the 'PROCINFO' array (*note
@@ -33175,7 +33179,7 @@ Index
 * gawk, predefined variables and:        Built-in Variables.  (line  14)
 * gawk, PROCINFO array in:               Auto-set.            (line 129)
 * gawk, PROCINFO array in <1>:           Time Functions.      (line  47)
-* gawk, PROCINFO array in <2>:           Two-way I/O.         (line 104)
+* gawk, PROCINFO array in <2>:           Two-way I/O.         (line 108)
 * gawk, regexp constants and:            Using Constant Regexps.
                                                               (line  28)
 * gawk, regular expressions, case sensitivity: Case-sensitivity.
@@ -33949,7 +33953,7 @@ Index
 * PROCINFO array:                        Auto-set.            (line 129)
 * 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 104)
+* PROCINFO array, and communications via ptys: Two-way I/O.   (line 108)
 * 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.
@@ -35014,214 +35018,214 @@ Ref: Controlling Array Traversal-Footnote-1790219
 Node: Array Sorting Functions790337
 Ref: Array Sorting Functions-Footnote-1795428
 Node: Two-way I/O795624
-Ref: Two-way I/O-Footnote-1801709
-Ref: Two-way I/O-Footnote-2801896
-Node: TCP/IP Networking801978
-Node: Profiling805096
-Node: Advanced Features Summary812635
-Node: Internationalization814571
-Node: I18N and L10N816051
-Node: Explaining gettext816738
-Ref: Explaining gettext-Footnote-1821761
-Ref: Explaining gettext-Footnote-2821946
-Node: Programmer i18n822111
-Ref: Programmer i18n-Footnote-1826966
-Node: Translator i18n827015
-Node: String Extraction827809
-Ref: String Extraction-Footnote-1828941
-Node: Printf Ordering829027
-Ref: Printf Ordering-Footnote-1831813
-Node: I18N Portability831877
-Ref: I18N Portability-Footnote-1834333
-Node: I18N Example834396
-Ref: I18N Example-Footnote-1837202
-Node: Gawk I18N837275
-Node: I18N Summary837920
-Node: Debugger839261
-Node: Debugging840283
-Node: Debugging Concepts840724
-Node: Debugging Terms842533
-Node: Awk Debugging845108
-Node: Sample Debugging Session846014
-Node: Debugger Invocation846548
-Node: Finding The Bug847934
-Node: List of Debugger Commands854412
-Node: Breakpoint Control855745
-Node: Debugger Execution Control859439
-Node: Viewing And Changing Data862801
-Node: Execution Stack866175
-Node: Debugger Info867812
-Node: Miscellaneous Debugger Commands871883
-Node: Readline Support876971
-Node: Limitations877867
-Node: Debugging Summary879976
-Node: Arbitrary Precision Arithmetic881149
-Node: Computer Arithmetic882565
-Ref: table-numeric-ranges886156
-Ref: Computer Arithmetic-Footnote-1886878
-Node: Math Definitions886935
-Ref: table-ieee-formats890249
-Ref: Math Definitions-Footnote-1890852
-Node: MPFR features890957
-Node: FP Math Caution892674
-Ref: FP Math Caution-Footnote-1893746
-Node: Inexactness of computations894115
-Node: Inexact representation895075
-Node: Comparing FP Values896435
-Node: Errors accumulate897517
-Node: Getting Accuracy898950
-Node: Try To Round901660
-Node: Setting precision902559
-Ref: table-predefined-precision-strings903256
-Node: Setting the rounding mode905086
-Ref: table-gawk-rounding-modes905460
-Ref: Setting the rounding mode-Footnote-1908868
-Node: Arbitrary Precision Integers909047
-Ref: Arbitrary Precision Integers-Footnote-1912031
-Node: POSIX Floating Point Problems912180
-Ref: POSIX Floating Point Problems-Footnote-1916062
-Node: Floating point summary916100
-Node: Dynamic Extensions918290
-Node: Extension Intro919843
-Node: Plugin License921109
-Node: Extension Mechanism Outline921906
-Ref: figure-load-extension922345
-Ref: figure-register-new-function923910
-Ref: figure-call-new-function925002
-Node: Extension API Description927064
-Node: Extension API Functions Introduction928512
-Node: General Data Types933324
-Ref: General Data Types-Footnote-1939279
-Node: Memory Allocation Functions939578
-Ref: Memory Allocation Functions-Footnote-1942423
-Node: Constructor Functions942522
-Node: Registration Functions944267
-Node: Extension Functions944952
-Node: Exit Callback Functions947251
-Node: Extension Version String948501
-Node: Input Parsers949164
-Node: Output Wrappers959049
-Node: Two-way processors963561
-Node: Printing Messages965825
-Ref: Printing Messages-Footnote-1966899
-Node: Updating ERRNO967052
-Node: Requesting Values967791
-Ref: table-value-types-returned968528
-Node: Accessing Parameters969411
-Node: Symbol Table Access970646
-Node: Symbol table by name971158
-Node: Symbol table by cookie973179
-Ref: Symbol table by cookie-Footnote-1977328
-Node: Cached values977392
-Ref: Cached values-Footnote-1980893
-Node: Array Manipulation980984
-Ref: Array Manipulation-Footnote-1982083
-Node: Array Data Types982120
-Ref: Array Data Types-Footnote-1984778
-Node: Array Functions984870
-Node: Flattening Arrays988728
-Node: Creating Arrays995636
-Node: Extension API Variables1000407
-Node: Extension Versioning1001043
-Node: Extension API Informational Variables1002934
-Node: Extension API Boilerplate1003998
-Node: Finding Extensions1007812
-Node: Extension Example1008371
-Node: Internal File Description1009169
-Node: Internal File Ops1013249
-Ref: Internal File Ops-Footnote-11025011
-Node: Using Internal File Ops1025151
-Ref: Using Internal File Ops-Footnote-11027534
-Node: Extension Samples1027808
-Node: Extension Sample File Functions1029337
-Node: Extension Sample Fnmatch1036986
-Node: Extension Sample Fork1038473
-Node: Extension Sample Inplace1039691
-Node: Extension Sample Ord1042901
-Node: Extension Sample Readdir1043737
-Ref: table-readdir-file-types1044626
-Node: Extension Sample Revout1045431
-Node: Extension Sample Rev2way1046020
-Node: Extension Sample Read write array1046760
-Node: Extension Sample Readfile1048702
-Node: Extension Sample Time1049797
-Node: Extension Sample API Tests1051145
-Node: gawkextlib1051637
-Node: Extension summary1054061
-Node: Extension Exercises1057753
-Node: Language History1059250
-Node: V7/SVR3.11060906
-Node: SVR41063058
-Node: POSIX1064492
-Node: BTL1065871
-Node: POSIX/GNU1066600
-Node: Feature History1072121
-Node: Common Extensions1085450
-Node: Ranges and Locales1086733
-Ref: Ranges and Locales-Footnote-11091349
-Ref: Ranges and Locales-Footnote-21091376
-Ref: Ranges and Locales-Footnote-31091611
-Node: Contributors1091832
-Node: History summary1097401
-Node: Installation1098781
-Node: Gawk Distribution1099725
-Node: Getting1100209
-Node: Extracting1101170
-Node: Distribution contents1102808
-Node: Unix Installation1108559
-Node: Quick Installation1109175
-Node: Additional Configuration Options1111602
-Node: Configuration Philosophy1113406
-Node: Non-Unix Installation1115775
-Node: PC Installation1116233
-Node: PC Binary Installation1117553
-Node: PC Compiling1119405
-Ref: PC Compiling-Footnote-11122429
-Node: PC Testing1122538
-Node: PC Using1123718
-Node: Cygwin1127832
-Node: MSYS1128602
-Node: VMS Installation1129103
-Node: VMS Compilation1129894
-Ref: VMS Compilation-Footnote-11131123
-Node: VMS Dynamic Extensions1131181
-Node: VMS Installation Details1132866
-Node: VMS Running1135119
-Node: VMS GNV1139398
-Node: VMS Old Gawk1140133
-Node: Bugs1140604
-Node: Other Versions1144801
-Node: Installation summary1151385
-Node: Notes1152443
-Node: Compatibility Mode1153308
-Node: Additions1154090
-Node: Accessing The Source1155015
-Node: Adding Code1156450
-Node: New Ports1162669
-Node: Derived Files1167157
-Ref: Derived Files-Footnote-11172642
-Ref: Derived Files-Footnote-21172677
-Ref: Derived Files-Footnote-31173275
-Node: Future Extensions1173389
-Node: Implementation Limitations1174047
-Node: Extension Design1175230
-Node: Old Extension Problems1176384
-Ref: Old Extension Problems-Footnote-11177902
-Node: Extension New Mechanism Goals1177959
-Ref: Extension New Mechanism Goals-Footnote-11181323
-Node: Extension Other Design Decisions1181512
-Node: Extension Future Growth1183625
-Node: Old Extension Mechanism1184461
-Node: Notes summary1186224
-Node: Basic Concepts1187406
-Node: Basic High Level1188087
-Ref: figure-general-flow1188369
-Ref: figure-process-flow1189054
-Ref: Basic High Level-Footnote-11192355
-Node: Basic Data Typing1192540
-Node: Glossary1195868
-Node: Copying1227814
-Node: GNU Free Documentation License1265353
-Node: Index1290471
+Ref: Two-way I/O-Footnote-1801918
+Ref: Two-way I/O-Footnote-2802105
+Node: TCP/IP Networking802187
+Node: Profiling805305
+Node: Advanced Features Summary812844
+Node: Internationalization814780
+Node: I18N and L10N816260
+Node: Explaining gettext816947
+Ref: Explaining gettext-Footnote-1821970
+Ref: Explaining gettext-Footnote-2822155
+Node: Programmer i18n822320
+Ref: Programmer i18n-Footnote-1827175
+Node: Translator i18n827224
+Node: String Extraction828018
+Ref: String Extraction-Footnote-1829150
+Node: Printf Ordering829236
+Ref: Printf Ordering-Footnote-1832022
+Node: I18N Portability832086
+Ref: I18N Portability-Footnote-1834542
+Node: I18N Example834605
+Ref: I18N Example-Footnote-1837411
+Node: Gawk I18N837484
+Node: I18N Summary838129
+Node: Debugger839470
+Node: Debugging840492
+Node: Debugging Concepts840933
+Node: Debugging Terms842742
+Node: Awk Debugging845317
+Node: Sample Debugging Session846223
+Node: Debugger Invocation846757
+Node: Finding The Bug848143
+Node: List of Debugger Commands854621
+Node: Breakpoint Control855954
+Node: Debugger Execution Control859648
+Node: Viewing And Changing Data863010
+Node: Execution Stack866384
+Node: Debugger Info868021
+Node: Miscellaneous Debugger Commands872092
+Node: Readline Support877180
+Node: Limitations878076
+Node: Debugging Summary880185
+Node: Arbitrary Precision Arithmetic881358
+Node: Computer Arithmetic882774
+Ref: table-numeric-ranges886365
+Ref: Computer Arithmetic-Footnote-1887087
+Node: Math Definitions887144
+Ref: table-ieee-formats890458
+Ref: Math Definitions-Footnote-1891061
+Node: MPFR features891166
+Node: FP Math Caution892883
+Ref: FP Math Caution-Footnote-1893955
+Node: Inexactness of computations894324
+Node: Inexact representation895284
+Node: Comparing FP Values896644
+Node: Errors accumulate897726
+Node: Getting Accuracy899159
+Node: Try To Round901869
+Node: Setting precision902768
+Ref: table-predefined-precision-strings903465
+Node: Setting the rounding mode905295
+Ref: table-gawk-rounding-modes905669
+Ref: Setting the rounding mode-Footnote-1909077
+Node: Arbitrary Precision Integers909256
+Ref: Arbitrary Precision Integers-Footnote-1912240
+Node: POSIX Floating Point Problems912389
+Ref: POSIX Floating Point Problems-Footnote-1916271
+Node: Floating point summary916309
+Node: Dynamic Extensions918499
+Node: Extension Intro920052
+Node: Plugin License921318
+Node: Extension Mechanism Outline922115
+Ref: figure-load-extension922554
+Ref: figure-register-new-function924119
+Ref: figure-call-new-function925211
+Node: Extension API Description927273
+Node: Extension API Functions Introduction928721
+Node: General Data Types933533
+Ref: General Data Types-Footnote-1939488
+Node: Memory Allocation Functions939787
+Ref: Memory Allocation Functions-Footnote-1942632
+Node: Constructor Functions942731
+Node: Registration Functions944476
+Node: Extension Functions945161
+Node: Exit Callback Functions947460
+Node: Extension Version String948710
+Node: Input Parsers949373
+Node: Output Wrappers959258
+Node: Two-way processors963770
+Node: Printing Messages966034
+Ref: Printing Messages-Footnote-1967108
+Node: Updating ERRNO967261
+Node: Requesting Values968000
+Ref: table-value-types-returned968737
+Node: Accessing Parameters969620
+Node: Symbol Table Access970855
+Node: Symbol table by name971367
+Node: Symbol table by cookie973388
+Ref: Symbol table by cookie-Footnote-1977537
+Node: Cached values977601
+Ref: Cached values-Footnote-1981102
+Node: Array Manipulation981193
+Ref: Array Manipulation-Footnote-1982292
+Node: Array Data Types982329
+Ref: Array Data Types-Footnote-1984987
+Node: Array Functions985079
+Node: Flattening Arrays988937
+Node: Creating Arrays995845
+Node: Extension API Variables1000616
+Node: Extension Versioning1001252
+Node: Extension API Informational Variables1003143
+Node: Extension API Boilerplate1004207
+Node: Finding Extensions1008021
+Node: Extension Example1008580
+Node: Internal File Description1009378
+Node: Internal File Ops1013458
+Ref: Internal File Ops-Footnote-11025220
+Node: Using Internal File Ops1025360
+Ref: Using Internal File Ops-Footnote-11027743
+Node: Extension Samples1028017
+Node: Extension Sample File Functions1029546
+Node: Extension Sample Fnmatch1037195
+Node: Extension Sample Fork1038682
+Node: Extension Sample Inplace1039900
+Node: Extension Sample Ord1043110
+Node: Extension Sample Readdir1043946
+Ref: table-readdir-file-types1044835
+Node: Extension Sample Revout1045640
+Node: Extension Sample Rev2way1046229
+Node: Extension Sample Read write array1046969
+Node: Extension Sample Readfile1048911
+Node: Extension Sample Time1050006
+Node: Extension Sample API Tests1051354
+Node: gawkextlib1051846
+Node: Extension summary1054270
+Node: Extension Exercises1057962
+Node: Language History1059459
+Node: V7/SVR3.11061115
+Node: SVR41063267
+Node: POSIX1064701
+Node: BTL1066080
+Node: POSIX/GNU1066809
+Node: Feature History1072330
+Node: Common Extensions1085659
+Node: Ranges and Locales1086942
+Ref: Ranges and Locales-Footnote-11091558
+Ref: Ranges and Locales-Footnote-21091585
+Ref: Ranges and Locales-Footnote-31091820
+Node: Contributors1092041
+Node: History summary1097610
+Node: Installation1098990
+Node: Gawk Distribution1099934
+Node: Getting1100418
+Node: Extracting1101379
+Node: Distribution contents1103017
+Node: Unix Installation1108768
+Node: Quick Installation1109384
+Node: Additional Configuration Options1111811
+Node: Configuration Philosophy1113615
+Node: Non-Unix Installation1115984
+Node: PC Installation1116442
+Node: PC Binary Installation1117762
+Node: PC Compiling1119614
+Ref: PC Compiling-Footnote-11122638
+Node: PC Testing1122747
+Node: PC Using1123927
+Node: Cygwin1128041
+Node: MSYS1128811
+Node: VMS Installation1129312
+Node: VMS Compilation1130103
+Ref: VMS Compilation-Footnote-11131332
+Node: VMS Dynamic Extensions1131390
+Node: VMS Installation Details1133075
+Node: VMS Running1135328
+Node: VMS GNV1139607
+Node: VMS Old Gawk1140342
+Node: Bugs1140813
+Node: Other Versions1145010
+Node: Installation summary1151594
+Node: Notes1152652
+Node: Compatibility Mode1153517
+Node: Additions1154299
+Node: Accessing The Source1155224
+Node: Adding Code1156659
+Node: New Ports1162878
+Node: Derived Files1167366
+Ref: Derived Files-Footnote-11172851
+Ref: Derived Files-Footnote-21172886
+Ref: Derived Files-Footnote-31173484
+Node: Future Extensions1173598
+Node: Implementation Limitations1174256
+Node: Extension Design1175439
+Node: Old Extension Problems1176593
+Ref: Old Extension Problems-Footnote-11178111
+Node: Extension New Mechanism Goals1178168
+Ref: Extension New Mechanism Goals-Footnote-11181532
+Node: Extension Other Design Decisions1181721
+Node: Extension Future Growth1183834
+Node: Old Extension Mechanism1184670
+Node: Notes summary1186433
+Node: Basic Concepts1187615
+Node: Basic High Level1188296
+Ref: figure-general-flow1188578
+Ref: figure-process-flow1189263
+Ref: Basic High Level-Footnote-11192564
+Node: Basic Data Typing1192749
+Node: Glossary1196077
+Node: Copying1228023
+Node: GNU Free Documentation License1265562
+Node: Index1290680
 
 End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 4b0ea40..d1b085f 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -27512,6 +27512,12 @@ case @command{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 @code{"to"} end.)
 
address@hidden 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
+from the @code{"from"} end of a two-way pipe that has been closed.
address@hidden quotation
+
 @cindex @command{gawk}, @code{PROCINFO} array in
 @cindex @code{PROCINFO} array, and communications via ptys
 You may also use pseudo-ttys (ptys) for
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 4d2a76f..e233a38 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -26603,6 +26603,12 @@ case @command{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 @code{"to"} end.)
 
address@hidden 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
+from the @code{"from"} end of a two-way pipe that has been closed.
address@hidden quotation
+
 @cindex @command{gawk}, @code{PROCINFO} array in
 @cindex @code{PROCINFO} array, and communications via ptys
 You may also use pseudo-ttys (ptys) for

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

commit b332053a160357e6c30c22f9ca90af9129e4550b
Author: Arnold D. Robbins <address@hidden>
Date:   Sat Apr 2 22:52:11 2016 +0300

    Document about using closed end of two-way pipes.

diff --git a/ChangeLog b/ChangeLog
index fe98ed8..7ba50e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
        (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.
+       * NEWS: Updated.
 
 2016-03-14         Arnold D. Robbins     <address@hidden>
 
diff --git a/NEWS b/NEWS
index 31c8471..472b05e 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,10 @@ Changes from 4.1.3 to 4.1.x
 8. The return value of system() has been enhanced to convey more information.
    See the doc.
 
+9. Attempting to write to the "to" end of a two-way pipe that has been
+   closed is now a fatal error. Similarly, so is reading from the "from"
+   end that has been closed.
+
 Changes from 4.1.2 to 4.1.3
 ---------------------------
 
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 9380d24..0da0e7c 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -3,6 +3,11 @@
        * gawktexi.in, gawkinet.texi: Enable use of braces in
        indexes. Requires Texinfo 6.0 or later.
 
+2016-04-02         Arnold D. Robbins     <address@hidden>
+
+       * gawktexi.in (Two-way I/O): Document that closing the "to"
+       end waits for the process to exit, so it's not such a great idea.
+
 2016-03-21         Arnold D. Robbins     <address@hidden>
 
        * gawkinet.texi: Update UDP client and discussion, update
diff --git a/doc/gawk.info b/doc/gawk.info
index c0b5859..c3cb089 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -19668,6 +19668,11 @@ the coprocess and exits.
 ensures traditional Unix (ASCII) sorting from 'sort'.  This is not
 strictly necessary here, but it's good to know how to do this.
 
+   Be careful when closing the '"from"' end of a two-way pipe; in this
+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.)
+
    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
 basis, by setting a special element in the 'PROCINFO' array (*note
@@ -33170,7 +33175,7 @@ Index
 * gawk, predefined variables and:        Built-in Variables.  (line  14)
 * gawk, PROCINFO array in:               Auto-set.            (line 129)
 * gawk, PROCINFO array in <1>:           Time Functions.      (line  47)
-* gawk, PROCINFO array in <2>:           Two-way I/O.         (line  99)
+* gawk, PROCINFO array in <2>:           Two-way I/O.         (line 104)
 * gawk, regexp constants and:            Using Constant Regexps.
                                                               (line  28)
 * gawk, regular expressions, case sensitivity: Case-sensitivity.
@@ -33944,7 +33949,7 @@ Index
 * PROCINFO array:                        Auto-set.            (line 129)
 * 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  99)
+* PROCINFO array, and communications via ptys: Two-way I/O.   (line 104)
 * 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.
@@ -35009,214 +35014,214 @@ Ref: Controlling Array Traversal-Footnote-1790219
 Node: Array Sorting Functions790337
 Ref: Array Sorting Functions-Footnote-1795428
 Node: Two-way I/O795624
-Ref: Two-way I/O-Footnote-1801444
-Ref: Two-way I/O-Footnote-2801631
-Node: TCP/IP Networking801713
-Node: Profiling804831
-Node: Advanced Features Summary812370
-Node: Internationalization814306
-Node: I18N and L10N815786
-Node: Explaining gettext816473
-Ref: Explaining gettext-Footnote-1821496
-Ref: Explaining gettext-Footnote-2821681
-Node: Programmer i18n821846
-Ref: Programmer i18n-Footnote-1826701
-Node: Translator i18n826750
-Node: String Extraction827544
-Ref: String Extraction-Footnote-1828676
-Node: Printf Ordering828762
-Ref: Printf Ordering-Footnote-1831548
-Node: I18N Portability831612
-Ref: I18N Portability-Footnote-1834068
-Node: I18N Example834131
-Ref: I18N Example-Footnote-1836937
-Node: Gawk I18N837010
-Node: I18N Summary837655
-Node: Debugger838996
-Node: Debugging840018
-Node: Debugging Concepts840459
-Node: Debugging Terms842268
-Node: Awk Debugging844843
-Node: Sample Debugging Session845749
-Node: Debugger Invocation846283
-Node: Finding The Bug847669
-Node: List of Debugger Commands854147
-Node: Breakpoint Control855480
-Node: Debugger Execution Control859174
-Node: Viewing And Changing Data862536
-Node: Execution Stack865910
-Node: Debugger Info867547
-Node: Miscellaneous Debugger Commands871618
-Node: Readline Support876706
-Node: Limitations877602
-Node: Debugging Summary879711
-Node: Arbitrary Precision Arithmetic880884
-Node: Computer Arithmetic882300
-Ref: table-numeric-ranges885891
-Ref: Computer Arithmetic-Footnote-1886613
-Node: Math Definitions886670
-Ref: table-ieee-formats889984
-Ref: Math Definitions-Footnote-1890587
-Node: MPFR features890692
-Node: FP Math Caution892409
-Ref: FP Math Caution-Footnote-1893481
-Node: Inexactness of computations893850
-Node: Inexact representation894810
-Node: Comparing FP Values896170
-Node: Errors accumulate897252
-Node: Getting Accuracy898685
-Node: Try To Round901395
-Node: Setting precision902294
-Ref: table-predefined-precision-strings902991
-Node: Setting the rounding mode904821
-Ref: table-gawk-rounding-modes905195
-Ref: Setting the rounding mode-Footnote-1908603
-Node: Arbitrary Precision Integers908782
-Ref: Arbitrary Precision Integers-Footnote-1911766
-Node: POSIX Floating Point Problems911915
-Ref: POSIX Floating Point Problems-Footnote-1915797
-Node: Floating point summary915835
-Node: Dynamic Extensions918025
-Node: Extension Intro919578
-Node: Plugin License920844
-Node: Extension Mechanism Outline921641
-Ref: figure-load-extension922080
-Ref: figure-register-new-function923645
-Ref: figure-call-new-function924737
-Node: Extension API Description926799
-Node: Extension API Functions Introduction928247
-Node: General Data Types933059
-Ref: General Data Types-Footnote-1939014
-Node: Memory Allocation Functions939313
-Ref: Memory Allocation Functions-Footnote-1942158
-Node: Constructor Functions942257
-Node: Registration Functions944002
-Node: Extension Functions944687
-Node: Exit Callback Functions946986
-Node: Extension Version String948236
-Node: Input Parsers948899
-Node: Output Wrappers958784
-Node: Two-way processors963296
-Node: Printing Messages965560
-Ref: Printing Messages-Footnote-1966634
-Node: Updating ERRNO966787
-Node: Requesting Values967526
-Ref: table-value-types-returned968263
-Node: Accessing Parameters969146
-Node: Symbol Table Access970381
-Node: Symbol table by name970893
-Node: Symbol table by cookie972914
-Ref: Symbol table by cookie-Footnote-1977063
-Node: Cached values977127
-Ref: Cached values-Footnote-1980628
-Node: Array Manipulation980719
-Ref: Array Manipulation-Footnote-1981818
-Node: Array Data Types981855
-Ref: Array Data Types-Footnote-1984513
-Node: Array Functions984605
-Node: Flattening Arrays988463
-Node: Creating Arrays995371
-Node: Extension API Variables1000142
-Node: Extension Versioning1000778
-Node: Extension API Informational Variables1002669
-Node: Extension API Boilerplate1003733
-Node: Finding Extensions1007547
-Node: Extension Example1008106
-Node: Internal File Description1008904
-Node: Internal File Ops1012984
-Ref: Internal File Ops-Footnote-11024746
-Node: Using Internal File Ops1024886
-Ref: Using Internal File Ops-Footnote-11027269
-Node: Extension Samples1027543
-Node: Extension Sample File Functions1029072
-Node: Extension Sample Fnmatch1036721
-Node: Extension Sample Fork1038208
-Node: Extension Sample Inplace1039426
-Node: Extension Sample Ord1042636
-Node: Extension Sample Readdir1043472
-Ref: table-readdir-file-types1044361
-Node: Extension Sample Revout1045166
-Node: Extension Sample Rev2way1045755
-Node: Extension Sample Read write array1046495
-Node: Extension Sample Readfile1048437
-Node: Extension Sample Time1049532
-Node: Extension Sample API Tests1050880
-Node: gawkextlib1051372
-Node: Extension summary1053796
-Node: Extension Exercises1057488
-Node: Language History1058985
-Node: V7/SVR3.11060641
-Node: SVR41062793
-Node: POSIX1064227
-Node: BTL1065606
-Node: POSIX/GNU1066335
-Node: Feature History1071856
-Node: Common Extensions1085185
-Node: Ranges and Locales1086468
-Ref: Ranges and Locales-Footnote-11091084
-Ref: Ranges and Locales-Footnote-21091111
-Ref: Ranges and Locales-Footnote-31091346
-Node: Contributors1091567
-Node: History summary1097136
-Node: Installation1098516
-Node: Gawk Distribution1099460
-Node: Getting1099944
-Node: Extracting1100905
-Node: Distribution contents1102543
-Node: Unix Installation1108294
-Node: Quick Installation1108910
-Node: Additional Configuration Options1111337
-Node: Configuration Philosophy1113141
-Node: Non-Unix Installation1115510
-Node: PC Installation1115968
-Node: PC Binary Installation1117288
-Node: PC Compiling1119140
-Ref: PC Compiling-Footnote-11122164
-Node: PC Testing1122273
-Node: PC Using1123453
-Node: Cygwin1127567
-Node: MSYS1128337
-Node: VMS Installation1128838
-Node: VMS Compilation1129629
-Ref: VMS Compilation-Footnote-11130858
-Node: VMS Dynamic Extensions1130916
-Node: VMS Installation Details1132601
-Node: VMS Running1134854
-Node: VMS GNV1139133
-Node: VMS Old Gawk1139868
-Node: Bugs1140339
-Node: Other Versions1144536
-Node: Installation summary1151120
-Node: Notes1152178
-Node: Compatibility Mode1153043
-Node: Additions1153825
-Node: Accessing The Source1154750
-Node: Adding Code1156185
-Node: New Ports1162404
-Node: Derived Files1166892
-Ref: Derived Files-Footnote-11172377
-Ref: Derived Files-Footnote-21172412
-Ref: Derived Files-Footnote-31173010
-Node: Future Extensions1173124
-Node: Implementation Limitations1173782
-Node: Extension Design1174965
-Node: Old Extension Problems1176119
-Ref: Old Extension Problems-Footnote-11177637
-Node: Extension New Mechanism Goals1177694
-Ref: Extension New Mechanism Goals-Footnote-11181058
-Node: Extension Other Design Decisions1181247
-Node: Extension Future Growth1183360
-Node: Old Extension Mechanism1184196
-Node: Notes summary1185959
-Node: Basic Concepts1187141
-Node: Basic High Level1187822
-Ref: figure-general-flow1188104
-Ref: figure-process-flow1188789
-Ref: Basic High Level-Footnote-11192090
-Node: Basic Data Typing1192275
-Node: Glossary1195603
-Node: Copying1227549
-Node: GNU Free Documentation License1265088
-Node: Index1290206
+Ref: Two-way I/O-Footnote-1801709
+Ref: Two-way I/O-Footnote-2801896
+Node: TCP/IP Networking801978
+Node: Profiling805096
+Node: Advanced Features Summary812635
+Node: Internationalization814571
+Node: I18N and L10N816051
+Node: Explaining gettext816738
+Ref: Explaining gettext-Footnote-1821761
+Ref: Explaining gettext-Footnote-2821946
+Node: Programmer i18n822111
+Ref: Programmer i18n-Footnote-1826966
+Node: Translator i18n827015
+Node: String Extraction827809
+Ref: String Extraction-Footnote-1828941
+Node: Printf Ordering829027
+Ref: Printf Ordering-Footnote-1831813
+Node: I18N Portability831877
+Ref: I18N Portability-Footnote-1834333
+Node: I18N Example834396
+Ref: I18N Example-Footnote-1837202
+Node: Gawk I18N837275
+Node: I18N Summary837920
+Node: Debugger839261
+Node: Debugging840283
+Node: Debugging Concepts840724
+Node: Debugging Terms842533
+Node: Awk Debugging845108
+Node: Sample Debugging Session846014
+Node: Debugger Invocation846548
+Node: Finding The Bug847934
+Node: List of Debugger Commands854412
+Node: Breakpoint Control855745
+Node: Debugger Execution Control859439
+Node: Viewing And Changing Data862801
+Node: Execution Stack866175
+Node: Debugger Info867812
+Node: Miscellaneous Debugger Commands871883
+Node: Readline Support876971
+Node: Limitations877867
+Node: Debugging Summary879976
+Node: Arbitrary Precision Arithmetic881149
+Node: Computer Arithmetic882565
+Ref: table-numeric-ranges886156
+Ref: Computer Arithmetic-Footnote-1886878
+Node: Math Definitions886935
+Ref: table-ieee-formats890249
+Ref: Math Definitions-Footnote-1890852
+Node: MPFR features890957
+Node: FP Math Caution892674
+Ref: FP Math Caution-Footnote-1893746
+Node: Inexactness of computations894115
+Node: Inexact representation895075
+Node: Comparing FP Values896435
+Node: Errors accumulate897517
+Node: Getting Accuracy898950
+Node: Try To Round901660
+Node: Setting precision902559
+Ref: table-predefined-precision-strings903256
+Node: Setting the rounding mode905086
+Ref: table-gawk-rounding-modes905460
+Ref: Setting the rounding mode-Footnote-1908868
+Node: Arbitrary Precision Integers909047
+Ref: Arbitrary Precision Integers-Footnote-1912031
+Node: POSIX Floating Point Problems912180
+Ref: POSIX Floating Point Problems-Footnote-1916062
+Node: Floating point summary916100
+Node: Dynamic Extensions918290
+Node: Extension Intro919843
+Node: Plugin License921109
+Node: Extension Mechanism Outline921906
+Ref: figure-load-extension922345
+Ref: figure-register-new-function923910
+Ref: figure-call-new-function925002
+Node: Extension API Description927064
+Node: Extension API Functions Introduction928512
+Node: General Data Types933324
+Ref: General Data Types-Footnote-1939279
+Node: Memory Allocation Functions939578
+Ref: Memory Allocation Functions-Footnote-1942423
+Node: Constructor Functions942522
+Node: Registration Functions944267
+Node: Extension Functions944952
+Node: Exit Callback Functions947251
+Node: Extension Version String948501
+Node: Input Parsers949164
+Node: Output Wrappers959049
+Node: Two-way processors963561
+Node: Printing Messages965825
+Ref: Printing Messages-Footnote-1966899
+Node: Updating ERRNO967052
+Node: Requesting Values967791
+Ref: table-value-types-returned968528
+Node: Accessing Parameters969411
+Node: Symbol Table Access970646
+Node: Symbol table by name971158
+Node: Symbol table by cookie973179
+Ref: Symbol table by cookie-Footnote-1977328
+Node: Cached values977392
+Ref: Cached values-Footnote-1980893
+Node: Array Manipulation980984
+Ref: Array Manipulation-Footnote-1982083
+Node: Array Data Types982120
+Ref: Array Data Types-Footnote-1984778
+Node: Array Functions984870
+Node: Flattening Arrays988728
+Node: Creating Arrays995636
+Node: Extension API Variables1000407
+Node: Extension Versioning1001043
+Node: Extension API Informational Variables1002934
+Node: Extension API Boilerplate1003998
+Node: Finding Extensions1007812
+Node: Extension Example1008371
+Node: Internal File Description1009169
+Node: Internal File Ops1013249
+Ref: Internal File Ops-Footnote-11025011
+Node: Using Internal File Ops1025151
+Ref: Using Internal File Ops-Footnote-11027534
+Node: Extension Samples1027808
+Node: Extension Sample File Functions1029337
+Node: Extension Sample Fnmatch1036986
+Node: Extension Sample Fork1038473
+Node: Extension Sample Inplace1039691
+Node: Extension Sample Ord1042901
+Node: Extension Sample Readdir1043737
+Ref: table-readdir-file-types1044626
+Node: Extension Sample Revout1045431
+Node: Extension Sample Rev2way1046020
+Node: Extension Sample Read write array1046760
+Node: Extension Sample Readfile1048702
+Node: Extension Sample Time1049797
+Node: Extension Sample API Tests1051145
+Node: gawkextlib1051637
+Node: Extension summary1054061
+Node: Extension Exercises1057753
+Node: Language History1059250
+Node: V7/SVR3.11060906
+Node: SVR41063058
+Node: POSIX1064492
+Node: BTL1065871
+Node: POSIX/GNU1066600
+Node: Feature History1072121
+Node: Common Extensions1085450
+Node: Ranges and Locales1086733
+Ref: Ranges and Locales-Footnote-11091349
+Ref: Ranges and Locales-Footnote-21091376
+Ref: Ranges and Locales-Footnote-31091611
+Node: Contributors1091832
+Node: History summary1097401
+Node: Installation1098781
+Node: Gawk Distribution1099725
+Node: Getting1100209
+Node: Extracting1101170
+Node: Distribution contents1102808
+Node: Unix Installation1108559
+Node: Quick Installation1109175
+Node: Additional Configuration Options1111602
+Node: Configuration Philosophy1113406
+Node: Non-Unix Installation1115775
+Node: PC Installation1116233
+Node: PC Binary Installation1117553
+Node: PC Compiling1119405
+Ref: PC Compiling-Footnote-11122429
+Node: PC Testing1122538
+Node: PC Using1123718
+Node: Cygwin1127832
+Node: MSYS1128602
+Node: VMS Installation1129103
+Node: VMS Compilation1129894
+Ref: VMS Compilation-Footnote-11131123
+Node: VMS Dynamic Extensions1131181
+Node: VMS Installation Details1132866
+Node: VMS Running1135119
+Node: VMS GNV1139398
+Node: VMS Old Gawk1140133
+Node: Bugs1140604
+Node: Other Versions1144801
+Node: Installation summary1151385
+Node: Notes1152443
+Node: Compatibility Mode1153308
+Node: Additions1154090
+Node: Accessing The Source1155015
+Node: Adding Code1156450
+Node: New Ports1162669
+Node: Derived Files1167157
+Ref: Derived Files-Footnote-11172642
+Ref: Derived Files-Footnote-21172677
+Ref: Derived Files-Footnote-31173275
+Node: Future Extensions1173389
+Node: Implementation Limitations1174047
+Node: Extension Design1175230
+Node: Old Extension Problems1176384
+Ref: Old Extension Problems-Footnote-11177902
+Node: Extension New Mechanism Goals1177959
+Ref: Extension New Mechanism Goals-Footnote-11181323
+Node: Extension Other Design Decisions1181512
+Node: Extension Future Growth1183625
+Node: Old Extension Mechanism1184461
+Node: Notes summary1186224
+Node: Basic Concepts1187406
+Node: Basic High Level1188087
+Ref: figure-general-flow1188369
+Ref: figure-process-flow1189054
+Ref: Basic High Level-Footnote-11192355
+Node: Basic Data Typing1192540
+Node: Glossary1195868
+Node: Copying1227814
+Node: GNU Free Documentation License1265353
+Node: Index1290471
 
 End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 59e06a0..4b0ea40 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -27507,6 +27507,11 @@ As a side note, the assignment @samp{LC_ALL=C} in the 
@command{sort}
 command ensures traditional Unix (ASCII) sorting from @command{sort}.
 This is not strictly necessary here, but it's good to know how to do this.
 
+Be careful when closing the @code{"from"} end of a two-way pipe; in this
+case @command{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 @code{"to"} end.)
+
 @cindex @command{gawk}, @code{PROCINFO} array in
 @cindex @code{PROCINFO} array, and communications via ptys
 You may also use pseudo-ttys (ptys) for
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index cd240a4..4d2a76f 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -26598,6 +26598,11 @@ As a side note, the assignment @samp{LC_ALL=C} in the 
@command{sort}
 command ensures traditional Unix (ASCII) sorting from @command{sort}.
 This is not strictly necessary here, but it's good to know how to do this.
 
+Be careful when closing the @code{"from"} end of a two-way pipe; in this
+case @command{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 @code{"to"} end.)
+
 @cindex @command{gawk}, @code{PROCINFO} array in
 @cindex @code{PROCINFO} array, and communications via ptys
 You may also use pseudo-ttys (ptys) for

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

commit 464aa113b70b30ab9b1b00d1de5ccf4b0230b720
Author: Arnold D. Robbins <address@hidden>
Date:   Sat Apr 2 22:45:42 2016 +0300

    ChangeLog entries for errors on partially closed two-way pipes.

diff --git a/ChangeLog b/ChangeLog
index 7160c86..fe98ed8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2016-04-02         Arnold D. Robbins     <address@hidden>
+
+       * builtin.c (do_printf): If the redirection is two way but the
+       fp is NULL, it means we're writing to the closed write-end of
+       a two-way pipe. Issue a fatal error message.
+       (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-03-14         Arnold D. Robbins     <address@hidden>
 
        * io.c (socketopen): For SOCK_DGRAM, set read_len to sizeof

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

commit 1662deffd0ced2464647ebff013be4d5ad398594
Author: Arnold D. Robbins <address@hidden>
Date:   Tue Mar 22 07:53:46 2016 +0200

    Add fatal error for print if 2 way pipe write end closed.

diff --git a/builtin.c b/builtin.c
index 784c819..c4d3d3a 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2208,8 +2208,12 @@ do_print_rec(int nargs, int redirtype)
        if (redirtype != 0) {
                redir_exp = TOP();
                rp = redirect(redir_exp, redirtype, & errflg);
-               if (rp != NULL)
+               if (rp != NULL) {
+                       if ((rp->flag & RED_TWOWAY) != 0 && rp->output.fp == 
NULL) {
+                               fatal(_("print: attempt to write to closed 
write end of two-way pipe"));
+                       }
                        fp = rp->output.fp;
+               }
                DEREF(redir_exp);
                decr_sp();
        } else

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

commit 124c3594cb65748ce858dcc55eadd7c831cee041
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Mar 13 20:21:00 2016 +0200

    Initial fix for use of closed end of two-way connection.

diff --git a/builtin.c b/builtin.c
index c3a3bb2..784c819 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1664,8 +1664,12 @@ do_printf(int nargs, int redirtype)
                if (redir_exp->type != Node_val)
                        fatal(_("attempt to use array `%s' in a scalar 
context"), array_vname(redir_exp));
                rp = redirect(redir_exp, redirtype, & errflg);
-               if (rp != NULL)
+               if (rp != NULL) {
+                       if ((rp->flag & RED_TWOWAY) != 0 && rp->output.fp == 
NULL) {
+                               fatal(_("printf: attempt to write to closed 
write end of two-way pipe"));
+                       }
                        fp = rp->output.fp;
+               }
        } else if (do_debug)    /* only the debugger can change the default 
output */
                fp = output_fp;
        else
@@ -2136,8 +2140,12 @@ do_print(int nargs, int redirtype)
                if (redir_exp->type != Node_val)
                        fatal(_("attempt to use array `%s' in a scalar 
context"), array_vname(redir_exp));
                rp = redirect(redir_exp, redirtype, & errflg);
-               if (rp != NULL)
+               if (rp != NULL) {
+                       if ((rp->flag & RED_TWOWAY) != 0 && rp->output.fp == 
NULL) {
+                               fatal(_("print: attempt to write to closed 
write end of two-way pipe"));
+                       }
                        fp = rp->output.fp;
+               }
        } else if (do_debug)    /* only the debugger can change the default 
output */
                fp = output_fp;
        else
diff --git a/io.c b/io.c
index d443568..de75397 100644
--- a/io.c
+++ b/io.c
@@ -2473,6 +2473,8 @@ do_getline_redir(int into_variable, enum redirval 
redirtype)
                                update_ERRNO_int(redir_error);
                }
                return make_number((AWKNUM) -1.0);
+       } else if ((rp->flag & RED_TWOWAY) != 0 && rp->iop == NULL) {
+               fatal(_("getline: attempt to read from closed read end of 
two-way pipe"));
        }
        iop = rp->iop;
        if (iop == NULL)                /* end of input */

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

Summary of changes:
 ChangeLog                         |   17 ++
 NEWS                              |    4 +
 builtin.c                         |   21 ++-
 doc/ChangeLog                     |    5 +
 doc/gawk.info                     |  431 +++++++++++++++++++------------------
 doc/gawk.texi                     |   11 +
 doc/gawktexi.in                   |   11 +
 io.c                              |    5 +-
 test/ChangeLog                    |   10 +
 test/Makefile.am                  |   12 +-
 test/Makefile.in                  |   32 +++-
 test/Maketests                    |   20 ++
 test/clos1way2.awk                |    6 +
 test/{symtab8.in => clos1way2.in} |    0
 test/clos1way2.ok                 |    4 +
 test/clos1way3.awk                |    7 +
 test/clos1way3.ok                 |    3 +
 test/clos1way4.awk                |    7 +
 test/clos1way4.ok                 |    3 +
 test/clos1way5.awk                |    9 +
 test/clos1way5.ok                 |    3 +
 21 files changed, 404 insertions(+), 217 deletions(-)
 create mode 100644 test/clos1way2.awk
 copy test/{symtab8.in => clos1way2.in} (100%)
 create mode 100644 test/clos1way2.ok
 create mode 100644 test/clos1way3.awk
 create mode 100644 test/clos1way3.ok
 create mode 100644 test/clos1way4.awk
 create mode 100644 test/clos1way4.ok
 create mode 100644 test/clos1way5.awk
 create mode 100644 test/clos1way5.ok


hooks/post-receive
-- 
gawk



reply via email to

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