]> git.ipfire.org Git - thirdparty/automake.git/commit
automake: support embedded \# in variable appends
authorMike Frysinger <vapier@gentoo.org>
Sun, 20 Feb 2022 18:28:48 +0000 (13:28 -0500)
committerMike Frysinger <vapier@gentoo.org>
Thu, 24 Feb 2022 03:48:21 +0000 (22:48 -0500)
commit8abf08947ffd4b65bb9f1ae19c0129329eeafffc
treef0347e9b2757e38c3463655c807f959a524688b8
parent38da1d906a33dccb9372132a241f906e3dc2eba5
automake: support embedded \# in variable appends

Fixes automake bug https://bugs.gnu.org/7610.

Use of \# is not portable.  POSIX does not provide any way of retaining
the # marker in variables.  There is wide spread support for \# though
in GNU & BSD Make implementations.

Today, with plain variable assignments, Automake leaves the line alone:
  foo = blah\#blah
This will leave it to the implementation to decide what to do.  But if
you try to append to it, Automake follows POSIX and strips it:
  foo = blah\#blah
  foo += what
  -> foo = blah\ what

Instead, let's issue a portability warning whenever \# is used, even if
it isn't being appended, and do not strip the \# when appending.  Now:
  foo = blah\#blah
  foo += what
  -> warning: escaping \# comment markers is not portable
  -> foo = blah\#blah what

* NEWS: Mention change in \# handling.
* lib/Automake/VarDef.pm: Do not strip # if escaped.
* lib/Automake/Variable.pm: Warn if \# is used.
* t/comment12.sh: New test.
* t/comments-escaped-in-var.sh: New test.
* t/list-of-tests.mk: Add comment12.sh & comments-escaped-in-var.sh.
NEWS
lib/Automake/VarDef.pm
lib/Automake/Variable.pm
t/comment12.sh [new file with mode: 0644]
t/comments-escaped-in-var.sh [new file with mode: 0644]
t/list-of-tests.mk