!25 update to 5.2.0

From: @dillon_chen 
Reviewed-by: @overweight 
Signed-off-by: @overweight
This commit is contained in:
openeuler-ci-bot 2022-11-07 01:44:38 +00:00 committed by Gitee
commit f182f31dc6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 74 additions and 164 deletions

View File

@ -0,0 +1,22 @@
diff -urN gawk-5.2.0.new/test/Makefile.am gawk-5.2.0/test/Makefile.am
--- gawk-5.2.0.new/test/Makefile.am 2022-09-04 20:01:27.000000000 +0800
+++ gawk-5.2.0/test/Makefile.am 2022-10-18 16:08:49.184074404 +0800
@@ -1671,7 +1671,6 @@
charset-tests-all \
shlib-msg-start shlib-tests shlib-msg-end \
mpfr-msg-start mpfr-tests mpfr-msg-end \
- pma-msg-start pma-tests pma-msg-end \
machine-msg-start machine-tests machine-msg-end
@$(MAKE) pass-fail || { $(MAKE) diffout; exit 1; }
diff -urN gawk-5.2.0.new/test/Makefile.in gawk-5.2.0/test/Makefile.in
--- gawk-5.2.0.new/test/Makefile.in 2022-09-04 20:12:05.000000000 +0800
+++ gawk-5.2.0/test/Makefile.in 2022-10-18 16:09:04.857137344 +0800
@@ -2127,7 +2127,6 @@
charset-tests-all \
shlib-msg-start shlib-tests shlib-msg-end \
mpfr-msg-start mpfr-tests mpfr-msg-end \
- pma-msg-start pma-tests pma-msg-end \
machine-msg-start machine-tests machine-msg-end
@$(MAKE) pass-fail || { $(MAKE) diffout; exit 1; }

View File

@ -1,55 +0,0 @@
From 0ed67a4f4f043acc08e3982a2648e3082e1f245a Mon Sep 17 00:00:00 2001
From: "Arnold D. Robbins" <arnold@skeeve.com>
Date: Sun, 14 Nov 2021 09:33:44 +0200
Subject: [PATCH] Disable racy test in test/iolint.awk.
---
test/iolint.awk | 13 ++++++++-----
test/iolint.ok | 6 +-----
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/test/iolint.awk b/test/iolint.awk
index 257678e..58fd746 100644
--- a/test/iolint.awk
+++ b/test/iolint.awk
@@ -55,12 +55,15 @@ BEGIN {
print close("cat")
fflush()
+ # 11/2021: Disable this test since it's a race condition
+ # and fails intermittently on some systems.
+ #
# `%.*s' used for input pipe and output pipe
- "echo hello" | getline junk
- print "hello" | "echo hello"
- print close("echo hello")
- print close("echo hello")
- fflush()
+ # "echo hello" | getline junk
+ # print "hello" | "echo hello"
+ # print close("echo hello")
+ # print close("echo hello")
+ # fflush()
# `%.*s' used for output file and output pipe"
BINMODE = 2
diff --git a/test/iolint.ok b/test/iolint.ok
index fbf514c..620a70f 100644
--- a/test/iolint.ok
+++ b/test/iolint.ok
@@ -23,11 +23,7 @@ gawk: iolint.awk:53: warning: `cat' used for output file and output pipe
0
hello
0
-gawk: iolint.awk:60: warning: `echo hello' used for input pipe and output pipe
-hello
-0
-0
-gawk: iolint.awk:68: warning: `cksum' used for output file and output pipe
+gawk: iolint.awk:71: warning: `cksum' used for output file and output pipe
3015617425 6
0
0
--
1.8.3.1

View File

@ -1,43 +0,0 @@
From e03c8822c48bedfe6cc7fbd5a9382d9630de6494 Mon Sep 17 00:00:00 2001
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
Date: Tue, 7 Dec 2021 12:00:22 -0500
Subject: [PATCH] Reorder statements in iolint to try to eliminate a race
condition.
---
test/iolint.awk | 2 +-
test/iolint.ok | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/iolint.awk b/test/iolint.awk
index 042f743..3ebaf43 100644
--- a/test/iolint.awk
+++ b/test/iolint.awk
@@ -49,8 +49,8 @@ BEGIN {
# `%.*s' used for output pipe and two-way pipe
# Not doing |& due to race condition and signals. sigh
cat = "cat"
- print "hello" | "cat"
print "/bin/cat \"$@\"" > "cat"
+ print "hello" | "cat"
print close("cat")
print close("cat")
fflush()
diff --git a/test/iolint.ok b/test/iolint.ok
index 7a165aa..860bcfb 100644
--- a/test/iolint.ok
+++ b/test/iolint.ok
@@ -20,9 +20,9 @@ gawk: iolint.awk:42: warning: `echo hello' used for input pipe and output file
0
0
gawk: iolint.awk:53: warning: `cat' used for output file and output pipe
-0
hello
0
+0
gawk: iolint.awk:67: warning: `eval $CMD_TO_RUN' used for input pipe and output pipe
0
0
--
1.8.3.1

View File

@ -1,61 +0,0 @@
From dc2613b0af11a8cf97232d55c322d40eda35c224 Mon Sep 17 00:00:00 2001
From: "Arnold D. Robbins" <arnold@skeeve.com>
Date: Thu, 18 Nov 2021 21:04:25 +0200
Subject: [PATCH] Restore removed test in test/iolint.awk.
---
test/iolint.awk | 19 ++++++++++++-------
test/iolint.ok | 5 ++++-
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/test/iolint.awk b/test/iolint.awk
index 58fd746..042f743 100644
--- a/test/iolint.awk
+++ b/test/iolint.awk
@@ -55,15 +55,20 @@ BEGIN {
print close("cat")
fflush()
- # 11/2021: Disable this test since it's a race condition
- # and fails intermittently on some systems.
+ # 11/2021: Use a nice trick to avoid race conditions in
+ # child processes. Thanks to Miguel Pineiro Jr. <mpj@pineiro.cc>.
#
# `%.*s' used for input pipe and output pipe
- # "echo hello" | getline junk
- # print "hello" | "echo hello"
- # print close("echo hello")
- # print close("echo hello")
- # fflush()
+ pipecmd = "eval $CMD_TO_RUN"
+
+ ENVIRON["CMD_TO_RUN"] = "echo hello"
+ pipecmd | getline junk
+ ENVIRON["CMD_TO_RUN"] = "read junk"
+ print "hello" | pipecmd
+
+ print close(pipecmd)
+ print close(pipecmd)
+ fflush()
# `%.*s' used for output file and output pipe"
BINMODE = 2
diff --git a/test/iolint.ok b/test/iolint.ok
index 620a70f..7a165aa 100644
--- a/test/iolint.ok
+++ b/test/iolint.ok
@@ -23,7 +23,10 @@ gawk: iolint.awk:53: warning: `cat' used for output file and output pipe
0
hello
0
-gawk: iolint.awk:71: warning: `cksum' used for output file and output pipe
+gawk: iolint.awk:67: warning: `eval $CMD_TO_RUN' used for input pipe and output pipe
+0
+0
+gawk: iolint.awk:76: warning: `cksum' used for output file and output pipe
3015617425 6
0
0
--
1.8.3.1

Binary file not shown.

BIN
gawk-5.2.0.tar.xz Normal file

Binary file not shown.

View File

@ -3,16 +3,18 @@
%global gawk_api_minor %%(tar -xf %{name}-%{version}.tar.xz %{name}-%{version}/gawkapi.h --to-stdout |\
egrep -i "gawk_api_minor.*[0-9]+" | egrep -o "[0-9]")
Name: gawk
Version: 5.1.1
Release: 3
Version: 5.2.0
Release: 1
License: GPLv3+ and GPLv2+ and LGPLv2+ and BSD
Summary: The GNU version of the AWK text processing utility
URL: https://www.gnu.org/software/gawk/
Source0: https://ftp.gnu.org/gnu/gawk/gawk-%{version}.tar.xz
Patch1: Disable-racy-test-in-test-iolint.awk.patch
Patch2: Restore-removed-test-in-test-iolint.awk.patch
Patch3: Reorder-statements-in-iolint-to-try-to-eliminate-a-r.patch
#Patch1: Disable-racy-test-in-test-iolint.awk.patch
#Patch2: Restore-removed-test-in-test-iolint.awk.patch
#Patch3: Reorder-statements-in-iolint-to-try-to-eliminate-a-r.patch
Patch4: pma.patch
Patch5: Disable-pma-test.awk.patch
BuildRequires: gcc automake grep
BuildRequires: bison texinfo texinfo-tex ghostscript texlive-ec texlive-cm-super glibc-all-langpacks
@ -87,6 +89,7 @@ install -m 0644 -p doc/gawkinet.{pdf,ps} ${RPM_BUILD_ROOT}%{_docdir}/%{name}
%doc NEWS README POSIX.STD
%license COPYING
%{_bindir}/*awk
%{_bindir}/gawkbug
%{_libdir}/*awk
%{_datadir}/*awk
%{_libexecdir}/*awk
@ -107,6 +110,10 @@ install -m 0644 -p doc/gawkinet.{pdf,ps} ${RPM_BUILD_ROOT}%{_docdir}/%{name}
%{_datadir}/locale/*
%changelog
* Wed Oct 19 2022 dillon chen <dillon.chen@gmail.com> - 5.2.0-1
- update to 5.2.0
- Patch5: Disable pma tests when running in linux-user emulation
* Fri Sep 2 2022 zoulin <zoulin13@h-partners.com> - 5.1.1-3
- Type:enhancement
- ID:NA

40
pma.patch Normal file
View File

@ -0,0 +1,40 @@
Index: gawk-5.2.0/support/pma.c
===================================================================
--- gawk-5.2.0.orig/support/pma.c
+++ gawk-5.2.0/support/pma.c
@@ -340,16 +340,20 @@ static void flr(ao_t *p) { // remove ao
#define MMAP(N) mmap(NULL, (N), PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0)
#define MUNMAP(A, N) do { if (0 != munmap((A), (N))) { ERR("munmap()" ERN); SERN; } } while (0)
static void * addrgap(off_t n) { // find big gap in address space to map n bytes
- void *A, *Amax = NULL; size_t L = 0, U, Max = 0, N = (size_t)n; char *r;
+ void *A, *Amax = NULL; size_t L, U, Max = 0, N = (size_t)n; char *r;
FYI("addrgap(%jd)\n", (intmax_t)n); // TODO: better way to handle off_t
if (N < sizeof(pma_hdr_t) + 40960) { ERR("file size %zu too small\n", N); SERN; }
- for (U = 1; ; U *= 2) // double upper bound until failure
- if (MAP_FAILED == (A = MMAP(U))) break;
- else MUNMAP(A, U);
- while (1 + L < U) { // binary search between bounds
+ // Binary search to find max length of successfull mmap().
+ // Invariants:
+ // Larger max might lie in range [L,U] inclusive.
+ // If a previous max has been found, it must lie in [1,L-1].
+ // A larger max cannot lie in [U+1,UINT64_MAX].
+ L = 1; // mmap fails if length == 0 (SUSv3)
+ U = UINT64_MAX;
+ while (L <= U) {
size_t M = L + (U - L) / 2; // avoid overflow
- if (MAP_FAILED == (A = MMAP(M))) { U = M; }
- else { Amax = A; Max = M; MUNMAP(A, M); L = M; }
+ if (MAP_FAILED != (A = MMAP(M))) { assert(Max < M); Max = M; Amax = A; MUNMAP(A, M); if (UINT64_MAX == M) break; L = M + 1; }
+ else { assert(0 < M); U = M - 1; }
}
FYI("max gap: %zu bytes at %p\n", Max, Amax);
if (Max < N + (size_t)ALGN * 2) { // safety margin
@@ -392,6 +396,7 @@ int pma_init(int verbose, const char *fi
assert((himask | lomask) == ~((uintptr_t)0));
if (! (WDSZ == sizeof(void *) && // in C11 we'd static_assert()
WDSZ == sizeof(size_t) &&
+ WDSZ == sizeof(off_t) &&
WDSZ == sizeof(unsigned long))) { ERR("word size not 64 bits\n"); SERL; }
assert(0 == sizeof(pma_hdr_t) % WDSZ);
if (NULL == file) {