gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, gawk-5.0-stable, updated. gawk-4.1.0-375


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-5.0-stable, updated. gawk-4.1.0-3751-g8ff0d3a
Date: Wed, 26 Jun 2019 14:45:21 -0400 (EDT)

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.0-stable has been updated
       via  8ff0d3a5a55237f78a8c3076a07c38f7e1c1c5e9 (commit)
       via  076eb06c0c714ca6ee95ca512d114bf9f41038e0 (commit)
       via  8f2b0b9128f4d2dc50ae52c304237c8e9d4b85f9 (commit)
      from  1ed524af04eac4e709f43cda8a564734d733ae12 (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=8ff0d3a5a55237f78a8c3076a07c38f7e1c1c5e9

commit 8ff0d3a5a55237f78a8c3076a07c38f7e1c1c5e9
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Jun 26 21:44:37 2019 +0300

    Add backwards compatibility to inplace extension, update doc and tests.

diff --git a/awklib/eg/lib/inplace.awk b/awklib/eg/lib/inplace.awk
index 68dad92..0d40d16 100644
--- a/awklib/eg/lib/inplace.awk
+++ b/awklib/eg/lib/inplace.awk
@@ -1,6 +1,6 @@
 # inplace --- load and invoke the inplace extension.
 # 
-# Copyright (C) 2013, 2017 the Free Software Foundation, Inc.
+# Copyright (C) 2013, 2017, 2019 the Free Software Foundation, Inc.
 # 
 # This file is part of GAWK, the GNU implementation of the
 # AWK Programming Language.
@@ -25,16 +25,21 @@
 # Revised for namespaces
 # Arnold Robbins, address@hidden
 # July 2017
+# June 2019, add backwards compatibility
 
 @load "inplace"
 
 # Please set inplace::suffix to make a backup copy.  For example, you may
 # want to set inplace::suffix to .bak on the command line or in a BEGIN rule.
 
+# Before there were namespaces in gawk, this extension used
+# INPLACE_SUFFIX as the variable for making backup copies. We allow this
+# too, so that any code that used the previous version continues to work.
+
 # By default, each filename on the command line will be edited inplace.
-# But you can selectively disable this by adding an inplace=0 argument
+# But you can selectively disable this by adding an inplace::enable=0 argument
 # prior to files that you do not want to process this way.  You can then
-# reenable it later on the commandline by putting inplace=1 before files
+# reenable it later on the commandline by putting inplace::enable=1 before 
files
 # that you wish to be subject to inplace editing.
 
 # N.B. We call inplace::end() in the BEGINFILE and END rules so that any
@@ -47,15 +52,16 @@ BEGIN {
 }
 
 BEGINFILE {
+    sfx = (suffix ? suffix : awk::INPLACE_SUFFIX)
     if (filename != "")
-        end(filename, suffix)
+        end(filename, sfx)
     if (enable)
-        begin(filename = FILENAME, suffix)
+        begin(filename = FILENAME, sfx)
     else
         filename = ""
 }
 
 END {
     if (filename != "")
-        end(filename, suffix)
+        end(filename, (suffix ? suffix : awk::INPLACE_SUFFIX))
 }
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 5ea91aa..6a1a5ae 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-26         Arnold D. Robbins     <address@hidden>
+
+       * gawktexi.in (Extension Sample Inplace): Fix backwards
+       compatibility. Thanks to Andrew Schorr for most of the change.
+
 2019-06-21         Arnold D. Robbins     <address@hidden>
 
        * gawktexi.in (Input Exercises): Remove exercise that is
diff --git a/doc/gawk.info b/doc/gawk.info
index e5a5270..4e46df9 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -27693,10 +27693,14 @@ and functions in the 'inplace' namespace (*note 
Namespaces::):
      # Please set inplace::suffix to make a backup copy.  For example, you may
      # want to set inplace::suffix to .bak on the command line or in a BEGIN 
rule.
 
+     # Before there were namespaces in gawk, this extension used
+     # INPLACE_SUFFIX as the variable for making backup copies. We allow this
+     # too, so that any code that used the previous version continues to work.
+
      # By default, each filename on the command line will be edited inplace.
-     # But you can selectively disable this by adding an inplace=0 argument
+     # But you can selectively disable this by adding an inplace::enable=0 
argument
      # prior to files that you do not want to process this way.  You can then
-     # reenable it later on the commandline by putting inplace=1 before files
+     # reenable it later on the commandline by putting inplace::enable=1 
before files
      # that you wish to be subject to inplace editing.
 
      # N.B. We call inplace::end() in the BEGINFILE and END rules so that any
@@ -27709,17 +27713,18 @@ and functions in the 'inplace' namespace (*note 
Namespaces::):
      }
 
      BEGINFILE {
+         sfx = (suffix ? suffix : awk::INPLACE_SUFFIX)
          if (filename != "")
-             end(filename, suffix)
+             end(filename, sfx)
          if (enable)
-             begin(filename = FILENAME, suffix)
+             begin(filename = FILENAME, sfx)
          else
              filename = ""
      }
 
      END {
          if (filename != "")
-             end(filename, suffix)
+             end(filename, (suffix ? suffix : awk::INPLACE_SUFFIX))
      }
 
    For each regular file that is processed, the extension redirects
@@ -37415,92 +37420,92 @@ Node: Extension Sample File Functions1111351
 Node: Extension Sample Fnmatch1119000
 Node: Extension Sample Fork1120487
 Node: Extension Sample Inplace1121705
-Node: Extension Sample Ord1125009
-Node: Extension Sample Readdir1125845
-Ref: table-readdir-file-types1126734
-Node: Extension Sample Revout1127539
-Node: Extension Sample Rev2way1128128
-Node: Extension Sample Read write array1128868
-Node: Extension Sample Readfile1130810
-Node: Extension Sample Time1131905
-Node: Extension Sample API Tests1133253
-Node: gawkextlib1133745
-Node: Extension summary1136663
-Node: Extension Exercises1140365
-Node: Language History1141607
-Node: V7/SVR3.11143263
-Node: SVR41145415
-Node: POSIX1146849
-Node: BTL1148229
-Node: POSIX/GNU1148958
-Node: Feature History1154736
-Node: Common Extensions1170782
-Node: Ranges and Locales1172065
-Ref: Ranges and Locales-Footnote-11176681
-Ref: Ranges and Locales-Footnote-21176708
-Ref: Ranges and Locales-Footnote-31176943
-Node: Contributors1177164
-Node: History summary1183117
-Node: Installation1184497
-Node: Gawk Distribution1185441
-Node: Getting1185925
-Node: Extracting1186888
-Node: Distribution contents1188526
-Node: Unix Installation1195006
-Node: Quick Installation1195688
-Node: Shell Startup Files1198102
-Node: Additional Configuration Options1199191
-Node: Configuration Philosophy1201506
-Node: Non-Unix Installation1203875
-Node: PC Installation1204335
-Node: PC Binary Installation1205173
-Node: PC Compiling1205608
-Node: PC Using1206725
-Node: Cygwin1210278
-Node: MSYS1211377
-Node: VMS Installation1211878
-Node: VMS Compilation1212669
-Ref: VMS Compilation-Footnote-11213898
-Node: VMS Dynamic Extensions1213956
-Node: VMS Installation Details1215641
-Node: VMS Running1217894
-Node: VMS GNV1222173
-Node: VMS Old Gawk1222908
-Node: Bugs1223379
-Node: Bug address1224042
-Node: Usenet1227024
-Node: Maintainers1228028
-Node: Other Versions1229289
-Node: Installation summary1236377
-Node: Notes1237579
-Node: Compatibility Mode1238373
-Node: Additions1239155
-Node: Accessing The Source1240080
-Node: Adding Code1241517
-Node: New Ports1247736
-Node: Derived Files1252111
-Ref: Derived Files-Footnote-11257771
-Ref: Derived Files-Footnote-21257806
-Ref: Derived Files-Footnote-31258404
-Node: Future Extensions1258518
-Node: Implementation Limitations1259176
-Node: Extension Design1260359
-Node: Old Extension Problems1261503
-Ref: Old Extension Problems-Footnote-11263021
-Node: Extension New Mechanism Goals1263078
-Ref: Extension New Mechanism Goals-Footnote-11266442
-Node: Extension Other Design Decisions1266631
-Node: Extension Future Growth1268744
-Node: Notes summary1269580
-Node: Basic Concepts1270738
-Node: Basic High Level1271419
-Ref: figure-general-flow1271701
-Ref: figure-process-flow1272386
-Ref: Basic High Level-Footnote-11275687
-Node: Basic Data Typing1275872
-Node: Glossary1279200
-Node: Copying1311038
-Node: GNU Free Documentation License1348581
-Node: Index1373701
+Node: Extension Sample Ord1125330
+Node: Extension Sample Readdir1126166
+Ref: table-readdir-file-types1127055
+Node: Extension Sample Revout1127860
+Node: Extension Sample Rev2way1128449
+Node: Extension Sample Read write array1129189
+Node: Extension Sample Readfile1131131
+Node: Extension Sample Time1132226
+Node: Extension Sample API Tests1133574
+Node: gawkextlib1134066
+Node: Extension summary1136984
+Node: Extension Exercises1140686
+Node: Language History1141928
+Node: V7/SVR3.11143584
+Node: SVR41145736
+Node: POSIX1147170
+Node: BTL1148550
+Node: POSIX/GNU1149279
+Node: Feature History1155057
+Node: Common Extensions1171103
+Node: Ranges and Locales1172386
+Ref: Ranges and Locales-Footnote-11177002
+Ref: Ranges and Locales-Footnote-21177029
+Ref: Ranges and Locales-Footnote-31177264
+Node: Contributors1177485
+Node: History summary1183438
+Node: Installation1184818
+Node: Gawk Distribution1185762
+Node: Getting1186246
+Node: Extracting1187209
+Node: Distribution contents1188847
+Node: Unix Installation1195327
+Node: Quick Installation1196009
+Node: Shell Startup Files1198423
+Node: Additional Configuration Options1199512
+Node: Configuration Philosophy1201827
+Node: Non-Unix Installation1204196
+Node: PC Installation1204656
+Node: PC Binary Installation1205494
+Node: PC Compiling1205929
+Node: PC Using1207046
+Node: Cygwin1210599
+Node: MSYS1211698
+Node: VMS Installation1212199
+Node: VMS Compilation1212990
+Ref: VMS Compilation-Footnote-11214219
+Node: VMS Dynamic Extensions1214277
+Node: VMS Installation Details1215962
+Node: VMS Running1218215
+Node: VMS GNV1222494
+Node: VMS Old Gawk1223229
+Node: Bugs1223700
+Node: Bug address1224363
+Node: Usenet1227345
+Node: Maintainers1228349
+Node: Other Versions1229610
+Node: Installation summary1236698
+Node: Notes1237900
+Node: Compatibility Mode1238694
+Node: Additions1239476
+Node: Accessing The Source1240401
+Node: Adding Code1241838
+Node: New Ports1248057
+Node: Derived Files1252432
+Ref: Derived Files-Footnote-11258092
+Ref: Derived Files-Footnote-21258127
+Ref: Derived Files-Footnote-31258725
+Node: Future Extensions1258839
+Node: Implementation Limitations1259497
+Node: Extension Design1260680
+Node: Old Extension Problems1261824
+Ref: Old Extension Problems-Footnote-11263342
+Node: Extension New Mechanism Goals1263399
+Ref: Extension New Mechanism Goals-Footnote-11266763
+Node: Extension Other Design Decisions1266952
+Node: Extension Future Growth1269065
+Node: Notes summary1269901
+Node: Basic Concepts1271059
+Node: Basic High Level1271740
+Ref: figure-general-flow1272022
+Ref: figure-process-flow1272707
+Ref: Basic High Level-Footnote-11276008
+Node: Basic Data Typing1276193
+Node: Glossary1279521
+Node: Copying1311359
+Node: GNU Free Documentation License1348902
+Node: Index1374022
 
 End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 25fb348..94ff298 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -37601,7 +37601,7 @@ all the variables and functions in the @code{inplace} 
namespace
 @ignore
 @c file eg/lib/inplace.awk
 # 
-# Copyright (C) 2013, 2017 the Free Software Foundation, Inc.
+# Copyright (C) 2013, 2017, 2019 the Free Software Foundation, Inc.
 # 
 # This file is part of GAWK, the GNU implementation of the
 # AWK Programming Language.
@@ -37626,6 +37626,7 @@ all the variables and functions in the @code{inplace} 
namespace
 # Revised for namespaces
 # Arnold Robbins, arnold@@skeeve.com
 # July 2017
+# June 2019, add backwards compatibility
 @c endfile
 @end ignore
 @c file eg/lib/inplace.awk
@@ -37635,10 +37636,14 @@ all the variables and functions in the @code{inplace} 
namespace
 # Please set inplace::suffix to make a backup copy.  For example, you may
 # want to set inplace::suffix to .bak on the command line or in a BEGIN rule.
 
+# Before there were namespaces in gawk, this extension used
+# INPLACE_SUFFIX as the variable for making backup copies. We allow this
+# too, so that any code that used the previous version continues to work.
+
 # By default, each filename on the command line will be edited inplace.
-# But you can selectively disable this by adding an inplace=0 argument
+# But you can selectively disable this by adding an inplace::enable=0 argument
 # prior to files that you do not want to process this way.  You can then
-# reenable it later on the commandline by putting inplace=1 before files
+# reenable it later on the commandline by putting inplace::enable=1 before 
files
 # that you wish to be subject to inplace editing.
 
 # N.B. We call inplace::end() in the BEGINFILE and END rules so that any
@@ -37655,10 +37660,11 @@ BEGIN @{
 
 @group
 BEGINFILE @{
+    sfx = (suffix ? suffix : awk::INPLACE_SUFFIX)
     if (filename != "")
-        end(filename, suffix)
+        end(filename, sfx)
     if (enable)
-        begin(filename = FILENAME, suffix)
+        begin(filename = FILENAME, sfx)
     else
         filename = ""
 @}
@@ -37667,7 +37673,7 @@ BEGINFILE @{
 @group
 END @{
     if (filename != "")
-        end(filename, suffix)
+        end(filename, (suffix ? suffix : awk::INPLACE_SUFFIX))
 @}
 @end group
 @c endfile
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index c60b023..55e485e 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -36574,7 +36574,7 @@ all the variables and functions in the @code{inplace} 
namespace
 @ignore
 @c file eg/lib/inplace.awk
 # 
-# Copyright (C) 2013, 2017 the Free Software Foundation, Inc.
+# Copyright (C) 2013, 2017, 2019 the Free Software Foundation, Inc.
 # 
 # This file is part of GAWK, the GNU implementation of the
 # AWK Programming Language.
@@ -36599,6 +36599,7 @@ all the variables and functions in the @code{inplace} 
namespace
 # Revised for namespaces
 # Arnold Robbins, arnold@@skeeve.com
 # July 2017
+# June 2019, add backwards compatibility
 @c endfile
 @end ignore
 @c file eg/lib/inplace.awk
@@ -36608,10 +36609,14 @@ all the variables and functions in the @code{inplace} 
namespace
 # Please set inplace::suffix to make a backup copy.  For example, you may
 # want to set inplace::suffix to .bak on the command line or in a BEGIN rule.
 
+# Before there were namespaces in gawk, this extension used
+# INPLACE_SUFFIX as the variable for making backup copies. We allow this
+# too, so that any code that used the previous version continues to work.
+
 # By default, each filename on the command line will be edited inplace.
-# But you can selectively disable this by adding an inplace=0 argument
+# But you can selectively disable this by adding an inplace::enable=0 argument
 # prior to files that you do not want to process this way.  You can then
-# reenable it later on the commandline by putting inplace=1 before files
+# reenable it later on the commandline by putting inplace::enable=1 before 
files
 # that you wish to be subject to inplace editing.
 
 # N.B. We call inplace::end() in the BEGINFILE and END rules so that any
@@ -36628,10 +36633,11 @@ BEGIN @{
 
 @group
 BEGINFILE @{
+    sfx = (suffix ? suffix : awk::INPLACE_SUFFIX)
     if (filename != "")
-        end(filename, suffix)
+        end(filename, sfx)
     if (enable)
-        begin(filename = FILENAME, suffix)
+        begin(filename = FILENAME, sfx)
     else
         filename = ""
 @}
@@ -36640,7 +36646,7 @@ BEGINFILE @{
 @group
 END @{
     if (filename != "")
-        end(filename, suffix)
+        end(filename, (suffix ? suffix : awk::INPLACE_SUFFIX))
 @}
 @end group
 @c endfile
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 3d83f77..22d73d0 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,7 @@
+2019-06-26         Arnold D. Robbins     <address@hidden>
+
+       * inplace.3am: Update to match current code's behavior.
+
 2019-06-18         Arnold D. Robbins     <address@hidden>
 
        * 5.0.1: Release tar ball made.
diff --git a/extension/inplace.3am b/extension/inplace.3am
index 48fac54..6604744 100644
--- a/extension/inplace.3am
+++ b/extension/inplace.3am
@@ -1,4 +1,4 @@
-.TH INPLACE 3am "Feb 02 2018" "Free Software Foundation" "GNU Awk Extension 
Modules"
+.TH INPLACE 3am "Jun 26 2018" "Free Software Foundation" "GNU Awk Extension 
Modules"
 .SH NAME
 inplace \- emulate sed/perl/ruby in-place editing
 .SH SYNOPSIS
@@ -24,7 +24,7 @@ By default, each named file on the command line is
 replaced with a new file of the same name whose contents
 are the results of running the AWK program.
 If the user supplies an AWK variable named
-.B INPLACE_SUFFIX
+.B inplace::suffix
 in a
 .B BEGIN
 rule or on the command line, then the
@@ -33,17 +33,27 @@ extension concatenates that suffix onto the original
 filename and uses the result as a filename for renaming
 the original.
 .PP
+For backwards compatibility, the variable will also check
+.B INPLACE_SUFFIX
+(in the
+.B awk
+namespace) for the suffix to use if
+.B inplace::suffix
+is not set.
+.PP
 One can disable inplace editing selectively by placing
-.B inplace=0
+.B inplace::enable=0
 on the command line prior to files that should be processed normally.
 One can reenable inplace editing by placing
-.B inplace=1
+.B inplace::enable=1
 prior to files that should be subject to inplace editing.
 .\" .SH NOTES
 .SH BUGS
-While the extension does attempt to preserve ownership and permissions, it 
makes no attempt to copy the ACLs from the original file.
+While the extension does attempt to preserve ownership and permissions,
+it makes no attempt to copy the ACLs from the original file.
 .PP
-If the program dies prematurely, as might happen if an unhandled signal is 
received, a temporary file may be left behind.
+If the program dies prematurely, as might happen if an unhandled signal
+is received, a temporary file may be left behind.
 .SH EXAMPLE
 .ft CW
 .nf
@@ -66,7 +76,7 @@ gawk -i inplace -f \f(CIscriptfile\fP files ...
 Andrew Schorr,
 .BR address@hidden .
 .SH COPYING PERMISSIONS
-Copyright \(co 2012, 2013, 2015, 2018,
+Copyright \(co 2012, 2013, 2015, 2018, 2019,
 Free Software Foundation, Inc.
 .PP
 Permission is granted to make and distribute verbatim copies of
diff --git a/test/ChangeLog b/test/ChangeLog
index 99391b0..a538c59 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -5,6 +5,10 @@
        nsawk2a.ok, nsawk2b.ok: New files.
        Tests courtesy of Michal Jaegermann.
 
+       Unrelated:
+
+       * inplace1.ok, inplace2.ok, inplace3.ok: Updated after code changes.
+
 2019-06-19         Arnold D. Robbins     <address@hidden>
 
        * Makefile.am (EXTRA_DIST): New test: escapebrace.
diff --git a/test/inplace1.ok b/test/inplace1.ok
index 753079b..f2e36d4 100644
--- a/test/inplace1.ok
+++ b/test/inplace1.ok
@@ -1,5 +1,5 @@
 before
-gawk: inplace:53: warning: inplace::begin: disabling in-place editing for 
invalid FILENAME `-'
+gawk: inplace:59: warning: inplace::begin: disabling in-place editing for 
invalid FILENAME `-'
 stdin start
 is bar replaced?
 stdin end
diff --git a/test/inplace2.ok b/test/inplace2.ok
index 753079b..f2e36d4 100644
--- a/test/inplace2.ok
+++ b/test/inplace2.ok
@@ -1,5 +1,5 @@
 before
-gawk: inplace:53: warning: inplace::begin: disabling in-place editing for 
invalid FILENAME `-'
+gawk: inplace:59: warning: inplace::begin: disabling in-place editing for 
invalid FILENAME `-'
 stdin start
 is bar replaced?
 stdin end
diff --git a/test/inplace3.ok b/test/inplace3.ok
index 7802a0c..b6f2650 100644
--- a/test/inplace3.ok
+++ b/test/inplace3.ok
@@ -1,11 +1,11 @@
 before
-gawk: inplace:53: warning: inplace::begin: disabling in-place editing for 
invalid FILENAME `-'
+gawk: inplace:59: warning: inplace::begin: disabling in-place editing for 
invalid FILENAME `-'
 stdin start
 is bar replaced?
 stdin end
 after
 Before
-gawk: inplace:53: warning: inplace::begin: disabling in-place editing for 
invalid FILENAME `-'
+gawk: inplace:59: warning: inplace::begin: disabling in-place editing for 
invalid FILENAME `-'
 stdin start
 is foo replaced?
 stdin end

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=076eb06c0c714ca6ee95ca512d114bf9f41038e0

commit 076eb06c0c714ca6ee95ca512d114bf9f41038e0
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Jun 26 21:40:31 2019 +0300

    Add tests for previous fix to namespaces.

diff --git a/test/nsawk1.awk b/test/nsawk1.awk
new file mode 100644
index 0000000..00715bc
--- /dev/null
+++ b/test/nsawk1.awk
@@ -0,0 +1,5 @@
+# Used to cause internal error
+BEGIN {
+    x = awk::I
+    x = awk::I
+}
diff --git a/test/nsawk1a.ok b/test/nsawk1a.ok
new file mode 100644
index 0000000..e69de29
diff --git a/test/nsawk1b.ok b/test/nsawk1b.ok
new file mode 100644
index 0000000..e69de29
diff --git a/test/nsawk1c.ok b/test/nsawk1c.ok
new file mode 100644
index 0000000..e69de29
diff --git a/test/nsawk2.awk b/test/nsawk2.awk
new file mode 100644
index 0000000..d275c12
--- /dev/null
+++ b/test/nsawk2.awk
@@ -0,0 +1,5 @@
+# Used to cause internal error
+BEGIN {
+    x = awk::I
+    print x
+}
diff --git a/test/nsawk2a.ok b/test/nsawk2a.ok
new file mode 100644
index 0000000..86815ca
--- /dev/null
+++ b/test/nsawk2a.ok
@@ -0,0 +1 @@
+fine
diff --git a/test/nsawk2b.ok b/test/nsawk2b.ok
new file mode 100644
index 0000000..86815ca
--- /dev/null
+++ b/test/nsawk2b.ok
@@ -0,0 +1 @@
+fine

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=8f2b0b9128f4d2dc50ae52c304237c8e9d4b85f9

commit 8f2b0b9128f4d2dc50ae52c304237c8e9d4b85f9
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Jun 26 21:34:29 2019 +0300

    Fix a problem when using awk::var kinds of names.

diff --git a/ChangeLog b/ChangeLog
index 44178ff..3aa5b12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-06-26         Arnold D. Robbins     <address@hidden>
+
+       * symbol.c (install): Strip off any leading `awk::' before
+       installing a symbol. Thanks to Andrew Schorr for the
+       report.
+
 2019-06-21         Arnold D. Robbins     <address@hidden>
 
        * config.guess, config.sub: Updated from GNULIB.
diff --git a/symbol.c b/symbol.c
index fe92811..e2e07c3 100644
--- a/symbol.c
+++ b/symbol.c
@@ -306,7 +306,10 @@ install(const char *name, NODE *parm, NODETYPE type)
        NODE *n_name;
        NODE *prev;
 
-       n_name = make_string(name, strlen(name));
+       if (strncmp(name, "awk::", 5) == 0)
+               n_name = make_string(name + 5, strlen(name) - 5);
+       else
+               n_name = make_string(name, strlen(name));
 
        table = symbol_table;
 
diff --git a/test/ChangeLog b/test/ChangeLog
index a53c2d1..99391b0 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,10 @@
+2019-06-26         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (EXTRA_DIST): New tests, nsawk1[abc] and nsawk2[ab].
+       * nsawk1.awk, nsawk1a.ok, nsawk1b.ok, nsawk1c.ok, nsawk2.awk,
+       nsawk2a.ok, nsawk2b.ok: New files.
+       Tests courtesy of Michal Jaegermann.
+
 2019-06-19         Arnold D. Robbins     <address@hidden>
 
        * Makefile.am (EXTRA_DIST): New test: escapebrace.
diff --git a/test/Makefile.am b/test/Makefile.am
index 58ee130..d7f6e01 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -782,6 +782,13 @@ EXTRA_DIST = \
        noparms.ok \
        nors.in \
        nors.ok \
+       nsawk1.awk \
+       nsawk1a.ok \
+       nsawk1b.ok \
+       nsawk1c.ok \
+       nsawk2.awk \
+       nsawk2a.ok \
+       nsawk2b.ok \
        nsbad.awk \
        nsbad.ok \
        nsbad_cmd.ok \
@@ -1353,6 +1360,7 @@ GAWK_EXT_TESTS = \
        lint lintexp lintindex lintint lintlength lintold lintset lintwarn \
        manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime muldimposix \
        nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \
+       nsawk1a nsawk1b nsawk1c nsawk2a nsawk2b \
        nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 nsindirect2 nsprof1 
nsprof2 \
        patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \
        procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 
\
@@ -2042,6 +2050,31 @@ readfile2::
        @$(AWK) -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.awk 
"$(srcdir)"/readdir.awk > _$@ || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+nsawk1a::
+       @echo $@
+       @$(AWK) -f "$(srcdir)"/nsawk1.awk > _$@ || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+nsawk1b::
+       @echo $@
+       @$(AWK) -v I=fine -f "$(srcdir)"/nsawk1.awk > _$@ || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+nsawk1c::
+       @echo $@
+       @$(AWK) -v awk::I=fine -f "$(srcdir)"/nsawk1.awk > _$@ || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+nsawk2a::
+       @echo $@
+       @$(AWK) -v I=fine -f "$(srcdir)"/nsawk2.awk > _$@ || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+nsawk2b::
+       @echo $@
+       @$(AWK) -v awk::I=fine -f "$(srcdir)"/nsawk2.awk > _$@ || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 include2::
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) --include inclib 'BEGIN {print 
sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Makefile.in b/test/Makefile.in
index ce5b2e2..5382751 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1041,6 +1041,13 @@ EXTRA_DIST = \
        noparms.ok \
        nors.in \
        nors.ok \
+       nsawk1.awk \
+       nsawk1a.ok \
+       nsawk1b.ok \
+       nsawk1c.ok \
+       nsawk2.awk \
+       nsawk2a.ok \
+       nsawk2b.ok \
        nsbad.awk \
        nsbad.ok \
        nsbad_cmd.ok \
@@ -1612,6 +1619,7 @@ GAWK_EXT_TESTS = \
        lint lintexp lintindex lintint lintlength lintold lintset lintwarn \
        manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime muldimposix \
        nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \
+       nsawk1a nsawk1b nsawk1c nsawk2a nsawk2b \
        nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 nsindirect2 nsprof1 
nsprof2 \
        patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \
        procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 
\
@@ -2491,6 +2499,31 @@ readfile2::
        @$(AWK) -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.awk 
"$(srcdir)"/readdir.awk > _$@ || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+nsawk1a::
+       @echo $@
+       @$(AWK) -f "$(srcdir)"/nsawk1.awk > _$@ || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+nsawk1b::
+       @echo $@
+       @$(AWK) -v I=fine -f "$(srcdir)"/nsawk1.awk > _$@ || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+nsawk1c::
+       @echo $@
+       @$(AWK) -v awk::I=fine -f "$(srcdir)"/nsawk1.awk > _$@ || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+nsawk2a::
+       @echo $@
+       @$(AWK) -v I=fine -f "$(srcdir)"/nsawk2.awk > _$@ || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+nsawk2b::
+       @echo $@
+       @$(AWK) -v awk::I=fine -f "$(srcdir)"/nsawk2.awk > _$@ || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 include2::
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) --include inclib 'BEGIN {print 
sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@

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

Summary of changes:
 ChangeLog                         |   6 ++
 awklib/eg/lib/inplace.awk         |  18 ++--
 doc/ChangeLog                     |   5 +
 doc/gawk.info                     | 189 +++++++++++++++++++-------------------
 doc/gawk.texi                     |  18 ++--
 doc/gawktexi.in                   |  18 ++--
 extension/ChangeLog               |   4 +
 extension/inplace.3am             |  24 +++--
 symbol.c                          |   5 +-
 test/ChangeLog                    |  11 +++
 test/Makefile.am                  |  33 +++++++
 test/Makefile.in                  |  33 +++++++
 test/inplace1.ok                  |   2 +-
 test/inplace2.ok                  |   2 +-
 test/inplace3.ok                  |   4 +-
 test/nsawk1.awk                   |   5 +
 test/{arrayprm2.ok => nsawk1a.ok} |   0
 test/{arrayprm2.ok => nsawk1b.ok} |   0
 test/{arrayprm2.ok => nsawk1c.ok} |   0
 test/nsawk2.awk                   |   5 +
 test/nsawk2a.ok                   |   1 +
 test/nsawk2b.ok                   |   1 +
 22 files changed, 262 insertions(+), 122 deletions(-)
 create mode 100644 test/nsawk1.awk
 copy test/{arrayprm2.ok => nsawk1a.ok} (100%)
 copy test/{arrayprm2.ok => nsawk1b.ok} (100%)
 copy test/{arrayprm2.ok => nsawk1c.ok} (100%)
 create mode 100644 test/nsawk2.awk
 create mode 100644 test/nsawk2a.ok
 create mode 100644 test/nsawk2b.ok


hooks/post-receive
-- 
gawk



reply via email to

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