RE: Handling references to invalid variables

2023-02-20 Thread rsbecker
On Monday, February 20, 2023 2:50 PM, Paul Smith wrote:
>On Mon, 2023-02-20 at 14:20 -0500, rsbec...@nexbridge.com wrote:
>> I think you need to be able to return to a compatible mode for some
>> users. Having an option like --undefined-variables=warn or --
>> undefined-variables=error (the default) or --undefined-
>> variables=ignore would be prudent.
>
>Hm.  I'm not sure about the "ignore" option.  I'm not a fan of adding lots of 
>options, it
>just makes things that much more complicated to use and test.  Is it important 
>to
>allow these checks to be completely ignored?  If the default is to leave them 
>as
>warnings they won't cause make to fail or change what it will build.

I added =ignore as an afterthought. But build engineers tend to like things to 
stay they way they are for presentation purposes. If new messages show up in 
build streams, there will be questions and inquiries for centuries (cryptic Q 
reference). =ignore would allow the output to stay the same as it is now.




Re: Handling references to invalid variables

2023-02-20 Thread Paul Smith
On Mon, 2023-02-20 at 14:20 -0500, rsbec...@nexbridge.com wrote:
> I think you need to be able to return to a compatible mode for some
> users. Having an option like --undefined-variables=warn or --
> undefined-variables=error (the default) or --undefined-
> variables=ignore would be prudent.

Hm.  I'm not sure about the "ignore" option.  I'm not a fan of adding
lots of options, it just makes things that much more complicated to use
and test.  Is it important to allow these checks to be completely
ignored?  If the default is to leave them as warnings they won't cause
make to fail or change what it will build.



RE: Handling references to invalid variables

2023-02-20 Thread rsbecker
On February 20, 2023 2:11 PM, Paul Smith wrote:
>In the next major release (not the upcoming 4.4.1 release but the one after 
>that) I
>plan to implement notifying users of invalid variable references; for example
>variable names containing whitespace.
>
>So, a makefile like this for example:
>
>  all: ; echo $(cat foo)
>
>will notify the user about the illegal variable reference "cat foo", instead 
>if silently
>expanding to the empty string.
>
>My intent is that this is always enabled, not requiring an extra option like 
>--warn-
>undefined-variables, since it's never legal to have a variable name containing
>whitespace.
>
>The question is, should this notification be a warning?  Or should it be a 
>fatal error?
>Originally I thought it should be fatal but now I'm leaning towards making it a
>warning, at least for a release or two, because I worry about makefiles that 
>might
>have these references that are silently and innocuously expanding to empty 
>strings,
>suddenly stop working completely.

Having worked on (insert large number) of build engines, there are likely users 
who depend on bad or empty strings behaving in a particular way (prior to this 
feature). I like your idea of turning this detection on by default from a 
personal standpoint; however, I think you need to be able to return to a 
compatible mode for some users. Having an option like 
--undefined-variables=warn or --undefined-variables=error (the default) or 
--undefined-variables=ignore would be prudent.

Just my $0.02
--Randall

--
Brief whoami: NonStop developer since approximately
UNIX(421664400)
NonStop(2112884442)
-- In real life, I talk too much.






Re: Handling references to invalid variables

2023-02-20 Thread David A. Wheeler



> On Feb 20, 2023, at 2:11 PM, Paul Smith  wrote:
> 
> In the next major release (not the upcoming 4.4.1 release but the one
> after that) I plan to implement notifying users of invalid variable
> references; for example variable names containing whitespace.
> ...
> 
> The question is, should this notification be a warning?  Or should it
> be a fatal error?

Definitely start by making it a warning. I have no idea how common they are,
but they're probably more common than we'd like, so people will need time
to fix the problems it reveals.

--- David A. Wheeler




Handling references to invalid variables

2023-02-20 Thread Paul Smith
In the next major release (not the upcoming 4.4.1 release but the one
after that) I plan to implement notifying users of invalid variable
references; for example variable names containing whitespace.

So, a makefile like this for example:

  all: ; echo $(cat foo)

will notify the user about the illegal variable reference "cat foo",
instead if silently expanding to the empty string.

My intent is that this is always enabled, not requiring an extra option
like --warn-undefined-variables, since it's never legal to have a
variable name containing whitespace.

The question is, should this notification be a warning?  Or should it
be a fatal error?  Originally I thought it should be fatal but now I'm
leaning towards making it a warning, at least for a release or two,
because I worry about makefiles that might have these references that
are silently and innocuously expanding to empty strings, suddenly stop
working completely.