Hi all - is there a way to make runtime errors visible to competitors? I'd like our competitors to see that they are getting exceptions (ArrayIndexOutOfBoundsException, etc) and at what line of code (for java). Is this something that can be enabled?
Thanks, Matt Fahrenbacher Niles West High School Skokie, Illinois
Hi Matthew,
On 22-10-15 01:38, Matthew Fahrenbacher wrote:
Hi all - is there a way to make runtime errors visible to competitors? I'd like our competitors to see that they are getting exceptions (ArrayIndexOutOfBoundsException, etc) and at what line of code (for java). Is this something that can be enabled?
No, this is not possible with the current code. We only have the option to show teams the compiler output, currently.
That said, it should not be too hard to try to do the same for runtime errors, see www/team/submission_details.php for how the compile output is displayed. Basically, you'd want to display the contents of the DB field judging_run.output_error.
A couple of remarks: - I suppose you're using DOMjudge in a teaching environment where information leakage is not a real problem. But be aware that this error output contains stderr from the team solution, so students could potentially output secret testdata, etc. - Although Java nicely reports a stack trace when it crashes, not all languages do, and the different way they flag errors makes it impossible to properly determine the precise cause of the crash (segment fault, division by zero, etc...) Therefore we've not tried to detect these subcases of "run-error".
Let us know if you're interested in implementing this: we might be able to help out and see if we can include it in the main code.
Jaap
For anyone who is interested, here is the code I added to submission_details.php to get this to work:
//start attempt of determining any runtime errors
$test = $DB->q('MAYBETUPLE SELECT judgingid, output_error, runresult FROM judging_run WHERE judgingid = %i AND runresult = "run-error"',$row['judgingid']);
if($test) { echo "Runtime Error: "; foreach($test as $key => $value) { if($key == "output_error") { echo "$value<br>"; } } }
On Thu, Oct 22, 2015 at 6:30 AM, Jaap Eldering jaap@jaapeldering.nl wrote:
Hi Matthew,
On 22-10-15 01:38, Matthew Fahrenbacher wrote:
Hi all - is there a way to make runtime errors visible to competitors? I'd like our competitors to see that they are getting exceptions (ArrayIndexOutOfBoundsException, etc) and at what line of code (for java). Is this something that can be enabled?
No, this is not possible with the current code. We only have the option to show teams the compiler output, currently.
That said, it should not be too hard to try to do the same for runtime errors, see www/team/submission_details.php for how the compile output is displayed. Basically, you'd want to display the contents of the DB field judging_run.output_error.
A couple of remarks:
- I suppose you're using DOMjudge in a teaching environment where
information leakage is not a real problem. But be aware that this error output contains stderr from the team solution, so students could potentially output secret testdata, etc.
- Although Java nicely reports a stack trace when it crashes, not all
languages do, and the different way they flag errors makes it impossible to properly determine the precise cause of the crash (segment fault, division by zero, etc...) Therefore we've not tried to detect these subcases of "run-error".
Let us know if you're interested in implementing this: we might be able to help out and see if we can include it in the main code.
Jaap
DOMjudge-devel mailing list DOMjudge-devel@domjudge.org https://www.domjudge.org/mailman/listinfo/domjudge-devel
Hi Matthew,
On Tue, December 15, 2015 16:36, Matthew Fahrenbacher wrote:
For anyone who is interested, here is the code I added to submission_details.php to get this to work:
//start attempt of determining any runtime errors
$test = $DB->q('MAYBETUPLE SELECT judgingid, output_error, runresult FROM judging_run WHERE judgingid = %i AND runresult = "run-error"',$row['judgingid']);
if($test) { echo "Runtime Error: "; foreach($test as $key => $value) { if($key == "output_error") { echo "$value<br>"; } } }
Strictly speaking you should add htmlspecialchars() (or specialchars() in DOMjudge 5.1 and up) around the $value you output, otherwise any < will mess up the display and there's a potential for XSS (not highly critical I guess, since the team can only see its own output).
I'm not sure if we'd add this to DOMjudge proper, since such functionality makes it trivial to know what the testdata is (just cat it all to STDERR from your program and then terminate with a non-zero exit code). But for situations where the testdata is not secret, this could definitely work.
Cheers, Thijs