Re: WARNING: Couldn't find the global config file.
Jacob Bachmeyer <[email protected]> Thu, 03 Dec 2020 22:57:54 -0600
| Newsgroups | gmane.comp.sysutils.dejagnu.general |
|---|---|
| Message-ID | <[email protected]> |
Jonathan Wakely wrote:
> On 03/12/20 13:33 +0000, Jonathan Wakely wrote:
>> The manual says "If DEJAGNU is set, but the file cannot be located, an
>> error will be raised and runtest will abort." That makes sense, if I
>> name a file that doesn't exist, I'm doing something wrong.
>
> Despite the manual saying it's an error, and the comments in the code
> saying it's an error, actually that's just a warning too.
>
> # If $DEJAGNU isn't set either then there isn't any global config
> file.
> # Warn the user as there really should be one.
>
> Sooooo, not really optional then?
Thus the warning. This code goes back to earliest snapshot in Git, so I
am unsure why it is handled this way.
> if { ! [info exists env(DEJAGNU)] } {
> send_error "WARNING: Couldn't find the global config file.\n"
> }
>
>
> if { [load_file -- $env(DEJAGNU)] == 0 } {
> # It may seem odd to only issue a warning if there isn't a global
> # config file, but issue an error if $DEJAGNU is erroneously defined.
> # Since $DEJAGNU is set there is *supposed* to be a global config
> file,
> # so the current behaviour seems reasonable.
> send_error "WARNING: global config file $env(DEJAGNU) not found.\n"
> }
>
> That looks pretty similar to the case where $DEJAGNU isn't set at all.
>
> What's going on here?
The difference is that if $DEJAGNU *is* set but the file does not exist,
the user evidently intended to load a global configuration file, while
if $DEJAGNU is not set at all, the user presumably does not care. The
current master (as of commit 660af948c8fce93ad2781ab8e0527a5b8e216f14)
declares an "ERROR" and exits instead of emitting a pointless warning
and continuing in this case.
-- Jacob