Accepting request 85073 from home:namtrac:bugfix
- Revert sub/gsub behavior to that of gawk 3.x. Upstream commit 16de770359370224129f23df745178efe518c02c This fixes build of virtuoso in KDE:Distro:Factory and possibly many others. Please forward to Factory. OBS-URL: https://build.opensuse.org/request/show/85073 OBS-URL: https://build.opensuse.org/package/show/Base:System/gawk?expand=0&rev=14
This commit is contained in:
parent
090ef72840
commit
1754206727
101
gawk-revert-gsub-gawk3.patch
Normal file
101
gawk-revert-gsub-gawk3.patch
Normal file
@ -0,0 +1,101 @@
|
||||
commit 16de770359370224129f23df745178efe518c02c
|
||||
Author: Arnold D. Robbins <arnold@skeeve.com>
|
||||
Date: Thu Jul 28 22:12:48 2011 +0300
|
||||
|
||||
Revert sub/gsub behavior to that of gawk 3.x.
|
||||
|
||||
diff --git a/builtin.c b/builtin.c
|
||||
index 8685d29..4d87592 100644
|
||||
--- a/builtin.c
|
||||
+++ b/builtin.c
|
||||
@@ -2546,13 +2546,30 @@ set_how_many:
|
||||
repllen--;
|
||||
scan++;
|
||||
}
|
||||
- } else {
|
||||
+ } else if (do_posix) {
|
||||
/* \& --> &, \\ --> \ */
|
||||
if (scan[1] == '&' || scan[1] == '\\') {
|
||||
repllen--;
|
||||
scan++;
|
||||
} /* else
|
||||
leave alone, it goes into the output */
|
||||
+ } else {
|
||||
+ /* gawk default behavior since 1996 */
|
||||
+ if (strncmp(scan, "\\\\\\&", 4) == 0) {
|
||||
+ /* \\\& --> \& */
|
||||
+ repllen -= 2;
|
||||
+ scan += 3;
|
||||
+ } else if (strncmp(scan, "\\\\&", 3) == 0) {
|
||||
+ /* \\& --> \<string> */
|
||||
+ ampersands++;
|
||||
+ repllen--;
|
||||
+ scan += 2;
|
||||
+ } else if (scan[1] == '&') {
|
||||
+ /* \& --> & */
|
||||
+ repllen--;
|
||||
+ scan++;
|
||||
+ } /* else
|
||||
+ leave alone, it goes into the output */
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2630,11 +2647,30 @@ set_how_many:
|
||||
scan++;
|
||||
} else /* \q for any q --> q */
|
||||
*bp++ = *++scan;
|
||||
- } else {
|
||||
+ } else if (do_posix) {
|
||||
/* \& --> &, \\ --> \ */
|
||||
if (scan[1] == '&' || scan[1] == '\\')
|
||||
scan++;
|
||||
*bp++ = *scan;
|
||||
+ } else {
|
||||
+ /* gawk default behavior since 1996 */
|
||||
+ if (strncmp(scan, "\\\\\\&", 4) == 0) {
|
||||
+ /* \\\& --> \& */
|
||||
+ *bp++ = '\\';
|
||||
+ *bp++ = '&';
|
||||
+ scan += 3;
|
||||
+ } else if (strncmp(scan, "\\\\&", 3) == 0) {
|
||||
+ /* \\& --> \<string> */
|
||||
+ *bp++ = '\\';
|
||||
+ for (cp = matchstart; cp < matchend; cp++)
|
||||
+ *bp++ = *cp;
|
||||
+ scan += 2;
|
||||
+ } else if (scan[1] == '&') {
|
||||
+ /* \& --> & */
|
||||
+ *bp++ = '&';
|
||||
+ scan++;
|
||||
+ } else
|
||||
+ *bp++ = *scan;
|
||||
}
|
||||
} else
|
||||
*bp++ = *scan;
|
||||
diff --git a/test/Makefile.am b/test/Makefile.am
|
||||
index 82e0834..9780e79 100644
|
||||
--- a/test/Makefile.am
|
||||
+++ b/test/Makefile.am
|
||||
@@ -1376,9 +1376,14 @@ profile3:
|
||||
@sed 1,2d < awkprof.out > _$@; rm awkprof.out
|
||||
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
|
||||
|
||||
+posix2008sub:
|
||||
+ @echo $@
|
||||
+ @$(AWK) --posix -f $(srcdir)/$@.awk > _$@ 2>&1
|
||||
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
|
||||
+
|
||||
next:
|
||||
@echo $@
|
||||
- @-AWK="$(AWKPROG)" $(srcdir)/$@.sh > _$@ 2>&1
|
||||
+ @-AWK="$(AWKPROG)" $(srcdir)/$@.sh
|
||||
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
|
||||
|
||||
exit:
|
||||
diff --git a/test/backgsub.ok b/test/backgsub.ok
|
||||
index 2d3f17f..e2e265f 100644
|
||||
--- a/test/backgsub.ok
|
||||
+++ b/test/backgsub.ok
|
||||
@@ -1 +1 @@
|
||||
-\x\y\z
|
||||
+\\x\\y\\z
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 27 11:31:28 UTC 2011 - idonmez@suse.com
|
||||
|
||||
- Revert sub/gsub behavior to that of gawk 3.x. Upstream commit
|
||||
16de770359370224129f23df745178efe518c02c
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 10 03:58:24 UTC 2011 - crrodriguez@opensuse.org
|
||||
|
||||
|
@ -29,7 +29,8 @@ Version: 4.0.0
|
||||
Release: 1
|
||||
Summary: GNU awk
|
||||
Source: gawk-%{version}.tar.bz2
|
||||
Patch: gawk-3.1.8.diff
|
||||
Patch1: gawk-3.1.8.diff
|
||||
Patch2: gawk-revert-gsub-gawk3.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%description
|
||||
@ -50,7 +51,9 @@ Authors:
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch
|
||||
%patch1
|
||||
%patch2 -p1
|
||||
|
||||
rm -f regex.[ch]
|
||||
chmod -x COPYING
|
||||
# force rebuild with non-broken makeinfo
|
||||
|
Loading…
Reference in New Issue
Block a user