- removed comment
Unclear error message for parameter file error
I had this line in a parameter file
ML_BSSN_FH_Helper::ML_BSSN_FH_CalculateRHSInMoLPostStep
which is missing the = yes
at the end. This is a syntax error.
I receive the following error message:
^[[1mWARNING level 0 from host zwicky002 process 0
while executing schedule bin (none), routine (no thorn)::(no routine)
in thorn cactus, file mk-mclachlan-funhpc.par:1:
->^[[0m ERROR IN PARAMETER FILE:In rule 'file::set' Line=100, Column=95
# ML_BSSN_FH::block_size_i = 4
# ML_BSSN_FH::block_size_j = 4
# ML_BSSN_FH::block_size_k = 4
ML_BSSN_FH::ML_log_confac_bound = "none"
^
Expected one of the following characters: [\[ \t\r\n#=]
This error message is unclear because - it doesn't show the line that has the error; instead, it show only the lines that follow (and that are correct) - the set of "following characters" is correct, but I got confused by all the white space characters that are allowed; a description "expected [ or =" might have been more clear - the actual error is that there is a parameter, but this parameter is not followed by a value; this is not described, since the error message has a rather low level ("next character") instead of a high level ("value missing")
Keyword:
Comments (18)
-
-
- removed comment
For all the "expected one of the following character" message from piraha: I would not include the surrounding pair of "[]" since a literal reading of the text would imply that "[" and "]" are allowed characters at this position. Ie the user should not need to know that regular expressions are at all involved in piraha (since this is an implementation details best hidden from the user).
-
- removed comment
Replying to [comment:2 rhaas]:
For all the "expected one of the following character" message from piraha: I would not include the surrounding pair of "[]" since a literal reading of the text would imply that "[" and "]" are allowed characters at this position. Ie the user should not need to know that regular expressions are at all involved in piraha (since this is an implementation details best hidden from the user).
I agree in general, but the problem with that might be that these expressions aren't always as simple as a single [] construct, i.e., it is not always just a list of allowed (or not allowed) characters only.
-
- removed comment
Or in other words: I suspect Piraha "knows" at that moment only that some input didn't match a specific regular expression. It doesn't "know" that that particular regular expression might have been a quite simple one. We could add a check for that just for the sake of error messages, but would it be worth it? One also would need to remove the escape for "[", and possibly parse other stuff inside the regular expressions, e.g., a leading !^ (which, interestingly, I had to look up how to escape in this ticket).
-
- changed status to open
- removed comment
I propose to apply this change (as it improves things considerably), and discuss an even better, more general solution, during a call/meeting.
-
- removed comment
Patch updated with clearer error messages. Now you see this:
WARNING level 0 from host sbrand3-5.lsu.edu process 0 while executing schedule bin (none), routine (no thorn)::(no routine) in thorn cactus, file x.par:1: -> ERROR IN PARAMETER FILE:Parse Error Expected one of the following characters: '[', '=' # ML_BSSN_FH::block_size_k = 4 ML_BSSN_FH::ML_log_confac_bound = "none" ML_BSSN_FH_Helper::ML_BSSN_FH_CalculateRHSInMoLPostStep ^ application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
and if you add the = sign, you get this
WARNING level 0 from host sbrand3-5.lsu.edu process 0 while executing schedule bin (none), routine (no thorn)::(no routine) in thorn cactus, file x.par:1: -> ERROR IN PARAMETER FILE:Parse Error Expected one of the following characters: '[', '+', '-', '!', '(', '0' to '9',double quote, '.', '/', 'a' to 'z', 'A' to 'Z', '$' # ML_BSSN_FH::block_size_k = 4 ML_BSSN_FH::ML_log_confac_bound = "none" ML_BSSN_FH_Helper::ML_BSSN_FH_CalculateRHSInMoLPostStep = ^ application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
-
- removed comment
I like the example output that you provide. I am however loath to apply this very close to the release unless it is very clear it cannot make parsing abort. Unfortunately the patch introduces a rather large amount of what seems whitespace only changes making review quite hard. Would you be able to provide a patch with less whitespace changes so that it is easier to see what the "payload" changes are?
-
- removed comment
Whitespaces removed.
-
- removed comment
hmm, this will take a while I am afraid. The code is still very hard for me to read since it introduces many new lines of code and changes other lines above and below as well. It also seems to be completely uncommented, using very short variable names to give me no hint as to what they may mean, making this a very hard to maintain code I fear.
One question I have even before digging any deeper: why does the human readable range only include 'a' to 'y' and not 'a' to 'z' (and similar for digits and uppercase letters)? Should the underscore '_' be included in human readable (this would make human readable the class of characters allowed for C identifiers).
-
- removed comment
Possibly it's a suboptimal method name. The idea is that if we have two characters, a and b, and a+1 == b, and isHumanReadableRange(a) is true, then it can display as a range, i.e. with a dash between the characters. Thus, z, Z, 9, and _ should not be included.
-
- changed status to open
- assigned issue to
- removed comment
-
The patch no longer applies. It has also been 4 years since the ticket was created. @Steven R. Brandt which parts of the patch are still needed? If there are any, could you create a pull request please?
-
The patch no longer applies. It has also been 4 years since the ticket was created. @Steven R. Brandt , @Erik Schnetter which parts of the patch are still needed? If there are any, could you create a pull request please?
-
@Roland Haas I think the error messages are currently pretty close to what’s above.
-
Right now if I run Erik’s example I get:
WARNING level 0 from host 8992d193.ncsa.illinois.edu process 0 in thorn cactus, file qc0-mclachlan.par:1: -> ERROR IN PARAMETER FILE:Parse Error Expected one of the following characters: '[', '=' ML_BSSN_FH_Helper::ML_BSSN_FH_CalculateRHSInMoLPostStep ADMBase::evolution_method = "ML_BSSN" ^
which has no line number (or if “1” is supposed to be the line number, it;s wrong). The caret seems to point to the next line still. So most of the issues reported in the description seem to still be present to me.
-
The error message is still not optimal since it eg points to the wrong line (though at least it now shows the incorrect line). Since the parfile attachment seems to have vanished I tried with a simpler reproducer:
Cactus::cctk_itlast = 10 # this line is wrong Cactus::cctk_full_warnings # this line is ok Cactus::cctk_run_title = "lineno test"
which fails with:
Activating thorn Cactus...Success -> active implementation Cactus WARNING level 0 from host ekohaes8 process 0 in thorn cactus, file lineno.par:7: -> ERROR IN PARAMETER FILE:Parse Error Expected one of the following characters: '[', '=' Cactus::cctk_full_warnings # this line is ok Cactus::cctk_run_title = "lineno test" ^ WARNING level 0 from host ekohaes8 process 0 in thorn cactus, file lineno.par:7: -> ERROR IN PARAMETER FILE:Parse Error Expected one of the following characters: '[', '=' Cactus::cctk_full_warnings # this line is ok Cactus::cctk_run_title = "lineno test" ^ -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with errorcode 1.
maybe instead of pointing to the first wrong character, point to the last good one (not counting whitespace and comments) would be better in this case? Though it obviously comes with its own issues such as this file:
Cactus::cctk_itlast = 12 # now an incorrect line ::this_does_not_work = 42
which should point out that
:
is wrong, since the line above could be parsed correctly. Ie the error message would be state dependent (and will almost certainly violate a nice layered approach to the parser). -
The problem is, the grammar does not currently see the par file in terms of lines. It treats whitespace much the same as C does. We could revise it to make whitespace important, but this seems of dubious value at best.
-
reporter I think that a parameter file should be interpreted in terms of lines. Humans think in terms of lines, and ignoring lines is confusing.
- Log in to comment
I have a fix. Let's see if this agrees with what you expect. First, here's what I used for a par file.
Here is the error I now produce:
This shows the correct line and position in the line, and the set of characters that it expected. Is [[=] too cryptic?