[Bug 240571] m4 divert( X-with-spaces ) -> argument is invalid

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 23 May 2025 12:35:49 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240571

eblake@redhat.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eblake@redhat.com

--- Comment #1 from eblake@redhat.com ---
divert( -1 ) is the same as divert(`-1 ').

POSIX says:

It shall be an error to specify an argument containing any non-numeric
characters.

The leading space is eaten (divert never sees it), but the trailing space is
non-numeric, so the code is correct that you have supplied invalid input, and
it can therefore do whatever it wants.  However, whether "whatever it wants"
means ignoring the trailing space, printing an error, or anything else is a
matter of quality of implementation; and if that behavior has changed over time
you can certainly complain about regressions.  And in this case, `m4 -g'
exiting on invalid input is not the same as GNU m4's behavior of printing the
warning but then proceeding without changing the current diversion number.

-- 
You are receiving this mail because:
You are the assignee for the bug.