From 17542067274a4455af43a2d8f5a876e26bec43000e6122d4ae9c32e763b1a584 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 27 Sep 2011 12:34:28 +0000 Subject: [PATCH] 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 --- gawk-revert-gsub-gawk3.patch | 101 +++++++++++++++++++++++++++++++++++ gawk.changes | 6 +++ gawk.spec | 7 ++- 3 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 gawk-revert-gsub-gawk3.patch diff --git a/gawk-revert-gsub-gawk3.patch b/gawk-revert-gsub-gawk3.patch new file mode 100644 index 0000000..3af0574 --- /dev/null +++ b/gawk-revert-gsub-gawk3.patch @@ -0,0 +1,101 @@ +commit 16de770359370224129f23df745178efe518c02c +Author: Arnold D. Robbins +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) { ++ /* \\& --> \ */ ++ 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) { ++ /* \\& --> \ */ ++ *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 diff --git a/gawk.changes b/gawk.changes index d9f3356..ead1b03 100644 --- a/gawk.changes +++ b/gawk.changes @@ -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 diff --git a/gawk.spec b/gawk.spec index 6ce7c30..be05f8d 100644 --- a/gawk.spec +++ b/gawk.spec @@ -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