#1401: misspelling ActiveThorns in parfiles results in unhelpful error message --------------------+------------------------------------------------------- Reporter: rhaas | Owner: Type: defect | Status: new Priority: minor | Milestone: Component: Cactus | Version: development version Keywords: | --------------------+------------------------------------------------------- the attached parfile (which misspells ActiveThorns as ActiveThrons) causes the error message: {{{ Activating thorn Cactus...Success -> active implementation Cactus ERROR IN PARAMETER FILE: In rule 'file::set::par' Line=1, Column=13 ActiveThrons = "Cactus" ^ Expected one of the following characters: [ \t\r\n#:] WARNING level 0 in thorn Cactus processor 0 host horizon.tapir.caltech.edu (line 167 of /mnt/data/rhaas/postdoc/gr/Zelmani/src/main/ProcessParameterDatabase.c): -> CCTKi_SetParameterSetMask: 1 parsing errors in parameter file WARNING level 0 in thorn Cactus processor 0 host horizon.tapir.caltech.edu (line 167 of /mnt/data/rhaas/postdoc/gr/Zelmani/src/main/ProcessParameterDatabase.c): -> CCTKi_SetParameterSetMask: 1 parsing errors in parameter file }}} which does not provide a hint for the cause of the error.
#1401: misspelling ActiveThorns in parfiles results in unhelpful error message ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: sbrandt Type: defect | Status: assigned Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------ Changes (by sbrandt):
* owner: => sbrandt * status: new => assigned
#1401: misspelling ActiveThorns in parfiles results in unhelpful error message ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: sbrandt Type: defect | Status: review Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------ Changes (by sbrandt):
* status: assigned => review
Comment:
I thought about a number of ways to solve this, most of them involved teaching the grammar to identify error patterns. These struck me as ugly solutions.
The attached fix suggests that we look at where the failure occurred in the parsing tree, and what the character was that was found, and use that information to provide an output message.
if(m2->inrule_max == "file::set::par" && m2->foundChar() =='=') { std::cout << "Invalid assignment." << std::endl; std::cout << "Valid assignments are: " << std::endl; std::cout << "ActiveThorns = "..."" << std::endl; std::cout << "Arrangement::Thorn = ..." << std::endl; }
This says that if we were part way parsing a parameter pattern and encountered an "=" (this corresponds to a c-identifier that is followed by an =) we print an error message describing what valid assignments are.
#1401: misspelling ActiveThorns in parfiles results in unhelpful error message ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: sbrandt Type: defect | Status: review Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------
Comment (by rhaas):
This is better, yes. Would it also be possible to output the part to the left of the "=" sign: {{{ std::cout << "But received: "" << leftofequal << ::std::end; }}}
These error messages should also all go to std::cerr, shouldn't they?
Aren't global parameters (discouraged, unused but still in Cactus) set as: {{{ MyGlobalParameter = somevalue }}} ? The user guide is not clear how they are supposed to be set. We can of course deprecate global parameters (and only allow ActiveThorns). Apparently they were never used, not even for something like a cctk_debug parameter.
#1401: misspelling ActiveThorns in parfiles results in unhelpful error message ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: sbrandt Type: defect | Status: review Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------
Comment (by sbrandt):
Neither Frank nor I knew global parameters existed. My guess is deprecating them is a good idea.
#1401: misspelling ActiveThorns in parfiles results in unhelpful error message ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: sbrandt Type: defect | Status: review Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------
Comment (by eschnett):
I think we could even just remove them.
#1401: misspelling ActiveThorns in parfiles results in unhelpful error message ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: sbrandt Type: defect | Status: review Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------
Comment (by rhaas):
Just removing them violates our policies for removing features. However testing this just now it seems that (using the Piraha parser) global parameters are currently broken so we can be relatively sure that no one was using them (they seem to work if I turn off piraha with piraha_active = 0 in ParseFile.c).
So, given that we de facto no longer support global parameters, we should remove them from the documentation and I am fine with changing the error message either as comment.2 or comment.3 indicate. I think that error messages should use CCTK_VWarn(1,...) rather than std::cout though so that they appear in the error stream and that registered callbacks can catch them.
#1401: misspelling ActiveThorns in parfiles results in unhelpful error message ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: sbrandt Type: defect | Status: review Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------
Comment (by sbrandt):
This updated patch does the things you ask, except I use CCTK_Warn(0,...) as this has to be fatal error.
A failed Piraha parse doesn't create a parse tree, which meant I didn't have the data you asked for. With this change, however, it's possible do a second pass with the matchesTo(pos) that will succeed of position pos is reached. When supplied with the maximum position reached by the failed parse, this obtains a successful parse and thus a tree.
#1401: misspelling ActiveThorns in parfiles results in unhelpful error message ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: sbrandt Type: defect | Status: reviewed_ok Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------ Changes (by knarf):
* status: review => reviewed_ok
Comment:
Ok pending small changes after in-person discussion.
#1401: misspelling ActiveThorns in parfiles results in unhelpful error message ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: sbrandt Type: defect | Status: reviewed_ok Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------
Comment (by sbrandt):
New error message is output instead of old. It includes the LHS from the parameter file:
if(m2->inrule_max == "file::set::par" && m2->foundChar() =='=') { msg << std::endl; msg << "Invalid assignment." << std::endl; msg << "Valid assignments are: " << std::endl; msg << "ActiveThorns = "..."" << std::endl; msg << "Arrangement::Thorn = ..." << std::endl; ... msg << "You wrote: " << gr->substring() << " = ..." << std::endl; } else { m2->showError(msg); // default error message }
#1401: misspelling ActiveThorns in parfiles results in unhelpful error message ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: sbrandt Type: defect | Status: closed Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: fixed | Keywords: ---------------------+------------------------------------------------------ Changes (by sbrandt):
* status: reviewed_ok => closed * resolution: => fixed
Comment:
Fixed in revision 5066
trac@lists.einsteintoolkit.org