Code and comments in runtest.exp that do not match

Jacob Bachmeyer <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <[email protected]>
While adding --{loc,glob}al_init options to runtest, I ran across this code:

= at line 865 in master:runtest.exp
    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"
    }
=

The comment explains that an error will be raised if DEJAGNU is defined 
but $DEJAGNU cannot be loaded.  The code then proceeds to merely report 
a warning and continue.  Either the code should raise an error and exit 
or the comment should be removed.

Git traces the entire block back to 2001 when the code was imported into 
whatever became the DejaGnu Git repository.  A search of the ancient 
ChangeLog for "DEJAGNU" turns up this:

= near line 3937 in ChangeLog-1992
Tue Mar 21 09:18:15 1995  Doug Evans  <[email protected]>

[...unrelated ChangeLog entries elided...]

	* runtest.exp: Treat $DEJAGNU as a global config file (which it is).
	Don't exit if there isn't a global config file, just warn the user.
	Error if $DEJAGNU is defined but file doesn't exist.
=

Which behavior is correct?  The behavior described in the comments?  
What the current code actually does?

If the comments are correct, I can roll a fix into the 
--{loc,glob}al_init patch or write it separately.  Which is preferred?  
(If the code is correct, the fix is obvious:  delete the comment.)


-- Jacob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.