Subject: bug#21060: coreutils-8.24 - perl 5.22 warning on regular expression in "gmake check" output

From: Peter Bray <[email-masked]>
Date: Wed, 15 Jul 2015 17:58:52 +1000

Greetings,

While trying to prepare another bug report, I discovered that
perl-5.22 warnings of the form:

   Unescaped left brace in regexp is deprecated

are present in the coreutils Makefile. The complete output is:

gmake[4]: Leaving directory `/tmp/64-bit/coreutils-8.24'
   GEN      check-README
   GEN      check-duplicate-no-install
   GEN      sc-avoid-builtin
   GEN      sc-avoid-io
   GEN      sc-avoid-non-zero
   GEN      sc-avoid-path
   GEN      sc-avoid-timezone
   GEN      sc-avoid-zeroes
   GEN      sc-exponent-grouping
   GEN      sc-lower-case-var
Unescaped left brace in regex is deprecated, passed through in regex; 
marked by <-- HERE in m/\@var{ <-- HERE / at -e line 1.
Unescaped left brace in regex is deprecated, passed through in regex; 
marked by <-- HERE in m/\@var{ <-- HERE (.+?)}/ at -e line 1.
   GEN      check-texinfo
gmake[3]: Leaving directory `/tmp/64-bit/coreutils-8.24'
gmake[2]: Leaving directory `/tmp/64-bit/coreutils-8.24'
gmake[1]: Leaving directory `/tmp/64-bit/coreutils-8.24'

In "doc/local.mk", is the code fragment:

    112  # The quantity inside @var{...} should not contain upper case 
letters.
    113  # The leading backslash exemption is to permit in-macro uses like
    114  # @var{\varName\} where the upper case letter is part of a 
parameter name.
    115  find_upper_case_var =           \
    116    '/\@var{/ or next;            \
    117     while (/\@var{(.+?)}/g)      \
    118       {                          \
    119         $$v = $$1;               \
    120         $$v =~ /[A-Z]/ && $$v !~ /^\\/ and (print 
"$$ARGV:$$.:$$_"), $$m = 1 \
    121       }                          \
    122     END {$$m and (warn "$@: do not use upper case in 
\@var{...}\n"), exit 1}'
    123  sc-lower-case-var:
    124          $(AM_V_GEN)$(PERL) -e 1 || { echo $@: skipping test; 
exit 0; }; \
    125            $(PERL) -lne $(find_upper_case_var) $(texi_files)
    126
    127  check-local: check-texinfo

There are two instances of this warning, which match the two instances
in the code on line numbers 116 and 117 respectively. If the two
instances of '{' are escaped with '\' in the actual Makefile, the
warning is avoided.

Again (see coreutils-BUG-21059) these systems do not have autotools,
so the change has only been developed and tested on the generated
Makefile, and not by changing "doc/local.mk".

Regards,

Peter Bray
Sydney, Australia

Backup  : ./Makefile.orig
Editted : ./Makefile

Command : gdiff -u

--- ./Makefile.orig     2015-07-15 07:02:26.181339000 +0000
+++ ./Makefile  2015-07-15 07:46:22.589468666 +0000
@@ -4984,8 +4984,8 @@
  # The leading backslash exemption is to permit in-macro uses like
  # @var{\varName\} where the upper case letter is part of a parameter name.
  find_upper_case_var = \
-  '/\@var{/ or next;           \
-   while (/\@var{(.+?)}/g)     \
+  '/\@var\{/ or next;          \
+   while (/\@var\{(.+?)}/g)    \
       {                         \
         $$v = $$1;              \
         $$v =~ /[A-Z]/ && $$v !~ /^\\/ and (print "$$ARGV:$$.:$$_"), 
$$m = 1 \