gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4376-g938afb4d


From: Andrew J. Schorr
Subject: [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4376-g938afb4d
Date: Thu, 10 Feb 2022 15:01:26 -0500 (EST)

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-5.1-stable has been updated
       via  938afb4d7acb9974d5789dfe4e322c0ccce0541e (commit)
      from  438e6e6e6deb8f4831e84ffd17205dc14d3a2ebb (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=938afb4d7acb9974d5789dfe4e322c0ccce0541e

commit 938afb4d7acb9974d5789dfe4e322c0ccce0541e
Author: Andrew J. Schorr <aschorr@telemetry-investments.com>
Date:   Thu Feb 10 15:00:24 2022 -0500

    Fix bug in exit status returned by close for a previously exited process.

diff --git a/ChangeLog b/ChangeLog
index 65c902a8..ce603e94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-12-10         Andrew J. Schorr      <aschorr@telemetry-investments.com>
+
+       * io.c (wait_any): When saving a saved exit status returned by
+       _cwait or waitpid or wait in struct redirect's status field, we
+       should actually save the valued returned by sanitize_exit_status
+       instead of the raw status. This fixes a bug whereby a saved status
+       for a previously exited process was being returned by gawk_pclose
+       without first being sanitized. Thanks to Jakub Martisko
+       <jamartis@redhat.com> for reporting the bug.
+
 2022-02-10         Arnold D. Robbins     <arnold@skeeve.com>
 
        * builtin.c (sanitize_exit_status): Fix formatting.
diff --git a/io.c b/io.c
index 1d440c1e..07d83689 100644
--- a/io.c
+++ b/io.c
@@ -2599,7 +2599,7 @@ wait_any(int interesting) /* pid of interest, if any */
                for (redp = red_head; redp != NULL; redp = redp->next)
                        if (interesting == redp->pid) {
                                redp->pid = -1;
-                               redp->status = status;
+                               redp->status = sanitize_exit_status(status);
                                break;
                        }
        }
@@ -2629,7 +2629,7 @@ wait_any(int interesting) /* pid of interest, if any */
                        for (redp = red_head; redp != NULL; redp = redp->next)
                                if (pid == redp->pid) {
                                        redp->pid = -1;
-                                       redp->status = status;
+                                       redp->status = 
sanitize_exit_status(status);
                                        break;
                                }
                }
diff --git a/pc/ChangeLog b/pc/ChangeLog
index e75df278..c5043baf 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2022-12-10         Andrew J. Schorr      <aschorr@telemetry-investments.com>
+
+       * Makefile.tst: Regenerated.
+
 2022-02-09         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index f25e887b..4b3fb0a5 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -147,7 +147,8 @@ BASIC_TESTS = \
        aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 aryprm8 aryprm9 \
        arysubnm aryunasgn asgext awkpath assignnumfield assignnumfield2 \
        back89 backgsub badassign1 badbuild callparam childin clobber \
-       closebad clsflnam compare compare2 concat1 concat2 concat3 concat4 \
+       closebad close_status clsflnam compare compare2 concat1 concat2 \
+       concat3 concat4 \
        concat5 convfmt datanonl defref delargv delarpm2 delarprm delfunc \
        dfacheck2 dfamb1 dfastress dynlj escapebrace eofsplit eofsrc1 \
        exit2 exitval1 exitval2 exitval3 fcall_exit fcall_exit2 fldchg \
@@ -1430,6 +1431,11 @@ closebad:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+close_status:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 clsflnam:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
diff --git a/test/ChangeLog b/test/ChangeLog
index c45b2f43..ddae26ea 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2022-02-10         Andrew J. Schorr      <aschorr@telemetry-investments.com>
+
+       * Makefile.am (EXTRA_DIST): close_status, new test.
+       * close_status.awk, close_status.ok: New files.
+
 2022-02-09         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.am (EXTRA_DIST): indirectbuiltin2, new test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 424aaa82..96dd3027 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -189,6 +189,8 @@ EXTRA_DIST = \
        clos1way6.ok \
        closebad.awk \
        closebad.ok \
+       close_status.awk \
+       close_status.ok \
        clsflnam.awk \
        clsflnam.in \
        clsflnam.ok \
@@ -1402,7 +1404,8 @@ BASIC_TESTS = \
        aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 aryprm8 aryprm9 \
        arysubnm aryunasgn asgext awkpath assignnumfield assignnumfield2 \
        back89 backgsub badassign1 badbuild callparam childin clobber \
-       closebad clsflnam compare compare2 concat1 concat2 concat3 concat4 \
+       closebad close_status clsflnam compare compare2 concat1 concat2 \
+       concat3 concat4 \
        concat5 convfmt datanonl defref delargv delarpm2 delarprm delfunc \
        dfacheck2 dfamb1 dfastress dynlj escapebrace eofsplit eofsrc1 \
        exit2 exitval1 exitval2 exitval3 fcall_exit fcall_exit2 fldchg \
diff --git a/test/Makefile.in b/test/Makefile.in
index 82b60902..94699c32 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -455,6 +455,8 @@ EXTRA_DIST = \
        clos1way6.ok \
        closebad.awk \
        closebad.ok \
+       close_status.awk \
+       close_status.ok \
        clsflnam.awk \
        clsflnam.in \
        clsflnam.ok \
@@ -1668,7 +1670,8 @@ BASIC_TESTS = \
        aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 aryprm8 aryprm9 \
        arysubnm aryunasgn asgext awkpath assignnumfield assignnumfield2 \
        back89 backgsub badassign1 badbuild callparam childin clobber \
-       closebad clsflnam compare compare2 concat1 concat2 concat3 concat4 \
+       closebad close_status clsflnam compare compare2 concat1 concat2 \
+       concat3 concat4 \
        concat5 convfmt datanonl defref delargv delarpm2 delarprm delfunc \
        dfacheck2 dfamb1 dfastress dynlj escapebrace eofsplit eofsrc1 \
        exit2 exitval1 exitval2 exitval3 fcall_exit fcall_exit2 fldchg \
@@ -3134,6 +3137,11 @@ closebad:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+close_status:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 clsflnam:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 4c4cfa62..26831128 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -185,6 +185,11 @@ closebad:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+close_status:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 clsflnam:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
diff --git a/test/close_status.awk b/test/close_status.awk
new file mode 100644
index 00000000..12b48d63
--- /dev/null
+++ b/test/close_status.awk
@@ -0,0 +1,20 @@
+BEGIN {
+       exit9 = "echo red; exit 9"
+       while ((exit9 | getline x) > 0)
+               print x
+       printf "close(%s) returned %s\n", exit9, close(exit9)
+
+       # run it again, but don't reap the exit status
+       while ((exit9 | getline x) > 0)
+               print x
+
+       exit0 = "echo blue; exit 0"
+       while ((exit0 | getline x) > 0)
+               print x
+       # reap status out of order
+       printf "close(%s) returned %s\n", exit0, close(exit0)
+
+       # check that we got the correct status from the previously
+       # exited process
+       printf "close(%s) returned %s\n", exit9, close(exit9)
+}
diff --git a/test/close_status.ok b/test/close_status.ok
new file mode 100644
index 00000000..fbdebeb0
--- /dev/null
+++ b/test/close_status.ok
@@ -0,0 +1,6 @@
+red
+close(echo red; exit 9) returned 9
+red
+blue
+close(echo blue; exit 0) returned 0
+close(echo red; exit 9) returned 9

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

Summary of changes:
 ChangeLog             | 10 ++++++++++
 io.c                  |  4 ++--
 pc/ChangeLog          |  4 ++++
 pc/Makefile.tst       |  8 +++++++-
 test/ChangeLog        |  5 +++++
 test/Makefile.am      |  5 ++++-
 test/Makefile.in      | 10 +++++++++-
 test/Maketests        |  5 +++++
 test/close_status.awk | 20 ++++++++++++++++++++
 test/close_status.ok  |  6 ++++++
 10 files changed, 72 insertions(+), 5 deletions(-)
 create mode 100644 test/close_status.awk
 create mode 100644 test/close_status.ok


hooks/post-receive
-- 
gawk



reply via email to

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