aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am5
-rw-r--r--test/Makefile.in10
-rw-r--r--test/Maketests5
-rw-r--r--test/pty1.awk54
-rw-r--r--test/pty1.ok2
6 files changed, 79 insertions, 2 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 3706630b..d6079e17 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-09 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (pty1): New test.
+ * pty1.awk, pty1.ok: New files.
+
2011-07-29 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (next): Redirect output to output file!
diff --git a/test/Makefile.am b/test/Makefile.am
index a640c14f..f5cec9ce 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -576,6 +576,8 @@ EXTRA_DIST = \
prt1eval.ok \
prtoeval.awk \
prtoeval.ok \
+ pty1.awk \
+ pty1.ok \
rand.awk \
rand.ok \
range1.awk \
@@ -807,7 +809,8 @@ GAWK_EXT_TESTS = \
icasefs icasers igncdym igncfs ignrcas2 ignrcase indirectcall lint \
lintold lintwarn manyfiles match1 match2 match3 mbstr1 nastyparm \
next nondec nondec2 patsplit posix printfbad1 printfbad2 procinfs \
- profile1 profile2 profile3 rebuf regx8bit reint reint2 rsstart1 \
+ profile1 profile2 profile3 pty1 \
+ rebuf regx8bit reint reint2 rsstart1 \
rsstart2 rsstart3 rstest6 shadow sortfor sortu splitarg4 strftime \
strtonum switch2
diff --git a/test/Makefile.in b/test/Makefile.in
index 4410670e..e7e920f9 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -761,6 +761,8 @@ EXTRA_DIST = \
prt1eval.ok \
prtoeval.awk \
prtoeval.ok \
+ pty1.awk \
+ pty1.ok \
rand.awk \
rand.ok \
range1.awk \
@@ -992,7 +994,8 @@ GAWK_EXT_TESTS = \
icasefs icasers igncdym igncfs ignrcas2 ignrcase indirectcall lint \
lintold lintwarn manyfiles match1 match2 match3 mbstr1 nastyparm \
next nondec nondec2 patsplit posix printfbad1 printfbad2 procinfs \
- profile1 profile2 profile3 rebuf regx8bit reint reint2 rsstart1 \
+ profile1 profile2 profile3 pty1 \
+ rebuf regx8bit reint reint2 rsstart1 \
rsstart2 rsstart3 rstest6 shadow sortfor sortu splitarg4 strftime \
strtonum switch2
@@ -2818,6 +2821,11 @@ procinfs:
@AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+pty1:
+ @echo pty1
+ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
rebuf:
@echo rebuf
@AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 1de0dbca..0ea96731 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1075,6 +1075,11 @@ procinfs:
@AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+pty1:
+ @echo pty1
+ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
rebuf:
@echo rebuf
@AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/pty1.awk b/test/pty1.awk
new file mode 100644
index 00000000..77178d61
--- /dev/null
+++ b/test/pty1.awk
@@ -0,0 +1,54 @@
+# Message-ID: <1312419482.36133.YahooMailNeo@web110416.mail.gq1.yahoo.com>
+# Date: Wed, 3 Aug 2011 17:58:02 -0700 (PDT)
+# From: "T. X. G." <leopardie333@yahoo.com>
+# To: "bug-gawk@gnu.org" <bug-gawk@gnu.org>
+# Subject: [bug-gawk] two bugs in gawk 4.0.0 with FPAT and pty
+#
+# $ gawk --version
+# GNU Awk 4.0.0
+# Copyright (C) 1989, 1991-2011 Free Software Foundation.
+#
+# # bug due to trying to make field splitting more efficient by not parse all fields
+# $ echo a,b,,c |gawk '{for(i=1;i<=4;++i)print i, $i}' FPAT='[^,]*'
+# 1 a
+# 2
+# 3 b
+# 4
+#
+# # work around
+# $ echo a,b,,c |gawk '{NF;for(i=1;i<=4;++i)print i, $i}' FPAT='[^,]*'
+# 1 a
+# 2 b
+# 3
+# 4 c
+#
+# This bug, as you commented in function fpat_parse_field, is subtle. The null matches of previous call should be remembered across calls. You could make the auto variable non_empty static, but then any calls to patsplit between references of fields will cause it to be wrong. I guess you can either forgo the field splitting optimization by always parse all field in the case of FPAT or make a separate function for splitting $0 only (or pass an extra arg to it?) I am sure you will find the best fix.
+#
+#
+# The next bug is with pty:
+#
+# $ gawk 'BEGIN{
+# c = "echo 123 > /dev/tty; read x < /dev/tty; echo \"x is $x\""
+# PROCINFO[c, "pty"] = 1
+# c |& getline;print
+# print "abc" |& c
+# c |& getline;print
+# }'
+# 123
+# ^C
+#
+# Adding a call to setsid() in the function two_way_open right after fork in the child process seems to fix it.
+#
+# One request for feature:
+# Currently the format for mktime is not configurable. Could you please make it configurable just like strftime through PROCINFO["mktime"]? In fact I have already done it myself. But I don't think you would like my style. It should be pretty simple for you to implement.
+#
+# Thank you, Arnold. Again as I have said before, I enjoy your writings and appreciate your contributions to the FSF.
+# W. G.
+#
+BEGIN {
+ c = "echo 123 > /dev/tty; read x < /dev/tty; echo \"x is $x\""
+ PROCINFO[c, "pty"] = 1
+ c |& getline; print
+ print "abc" |& c
+ c |& getline; print
+}
diff --git a/test/pty1.ok b/test/pty1.ok
new file mode 100644
index 00000000..f06833f5
--- /dev/null
+++ b/test/pty1.ok
@@ -0,0 +1,2 @@
+123
+x is abc