Open smu-sc-gj opened 4 months ago
I've tried to replicate the issue using the following code:
void main() {
if (evt.keysym.sym == 'lmb') {
}
}
JPlag was able to process this without any problem, so I guess it depends on the surrounding code.
Do you have the option of sending the entire file or can you create a short example that encounters the error?
While the original code is only a few files, there were some really big dependencies. The relevant one here being Ogre (the evt.keysym.sym
comes from OgreBites. I've managed to re-create the issue with the following code:
#include <iostream>
#include <stdlib.h>
typedef int Keycode;
struct Keysym {
Keycode sym;
unsigned short mod;
};
struct KeyboardEvent {
int type;
Keysym keysym;
unsigned char repeat;
};
bool keyProcessing(const KeyboardEvent& evt)
{
std::cout << "Processing Key" << std::endl;
if(evt.keysym.sym == 'w')
{
std::cout << "W" << std::endl;
}
/* I know this doesn't make sense ... but it's
what they original code was trying to do. */
if(evt.keysym.sym == 'lmb')
{
std::cout << "Left Mouse Button" << std::endl;
}
return true;
}
int main(int argc, char** argv)
{
KeyboardEvent test;
test.keysym.sym = 'w';
keyProcessing(test);
exit(EXIT_SUCCESS);
}
I created three copies of this file as a sample.
cpp
, I have a note that says this only works if the code is C++14 compatible throughout, the samples are but I'm not sure the student submission are.
java -jar ~/Applications/JPlag/jplag-5.1.0-jar-with-dependencies.jar -l cpp .
Loading Submissions 100% [=========================] 3/3 (0:00:00 / 0:00:00)
Parsing Submissions 100% [=========================] 3/3 (0:00:00 / 0:00:00)
Comparing Submissions 100% [=========================] 3/3 (0:00:00 / 0:00:00)
2024-07-04-10:04:23_440 [INFO] JPlag - Total time for comparing submissions: 0h 00min 00s 024ms
2024-07-04-10:04:23_442 [INFO] ClusteringFactory - Calculating clusters via spectral clustering with cumulative distribution function pre-processing...
Finding clusters < <+> > 0:00:00
2024-07-04-10:04:24_006 [INFO] ReportObjectFactory - Start writing report...
2024-07-04-10:04:24_007 [INFO] ReportObjectFactory - Start to export results...
2024-07-04-10:04:24_100 [INFO] ReportObjectFactory - Total Comparisons: 3. Comparisons in Report: 3. Omitted Comparisons: 0.
2024-07-04-10:04:24_153 [INFO] OutputFileGenerator - Successfully written the result: results.zip
2024-07-04-10:04:24_154 [INFO] OutputFileGenerator - View the result using --mode or at: https://jplag.github.io/JPlag/
c
:
java -jar ~/Applications/JPlag/jplag-5.1.0-jar-with-dependencies.jar -l c .
Loading Submissions 100% [=========================] 4/4 (0:00:00 / 0:00:00)
Parsing Submissions 0% [ ] 0/4 (0:00:00 / ?)
2024-07-04-10:04:53_285 [WARN] Submission - Failed to parse submission three.cpp:
failed to parse 'three.cpp'Lexical error at line 29, column 28. Encountered: "m" (109), after : "\'l"
2024-07-04-10:04:53_287 [WARN] Submission - Failed to parse submission two.cpp:
failed to parse 'two.cpp'Lexical error at line 29, column 28. Encountered: "m" (109), after : "\'l"
2024-07-04-10:04:53_288 [WARN] Submission - Failed to parse submission one.cpp:
failed to parse 'one.cpp'Lexical error at line 29, column 28. Encountered: "m" Parsing Submissions 100% [=========================] 4/4 (0:00:00 / 0:00:00)
2024-07-04-10:04:53_296 [INFO] Submission - Summary of all errors:
2024-07-04-10:04:53_271 [ERROR] Submission - ERROR: nothing to parse for submission "results.zip"
2024-07-04-10:04:53_310 [INFO] SubmissionSetBuilder - Summary of all errors:
2024-07-04-10:04:53_227 [ERROR] SubmissionSetBuilder - Ignore submission with invalid suffix: results.zip
2024-07-04-10:04:53_310 [INFO] Scanner - Summary of all errors:
2024-07-04-10:04:53_285 [ERROR] Scanner - Scanning Error in 'three.cpp': Lexical error at line 29, column 28. Encountered: "m" (109), after : "\'l"
2024-07-04-10:04:53_287 [ERROR] Scanner - Scanning Error in 'two.cpp': Lexical error at line 29, column 28. Encountered: "m" (109), after : "\'l"
2024-07-04-10:04:53_288 [ERROR] Scanner - Scanning Error in 'one.cpp': Lexical error at line 29, column 28. Encountered: "m" (109), after : "\'l"
2024-07-04-10:04:53_310 [INFO] CLI - Summary of all errors:
2024-07-04-10:04:53_296 [ERROR] CLI - Not enough valid submissions! (found 0 valid submissions)
2024-07-04-10:04:53_310 [INFO] SubmissionSet - Summary of all errors:
2024-07-04-10:04:53_271 [ERROR] SubmissionSet - ERROR -> Submission results.zip removed
2024-07-04-10:04:53_286 [ERROR] SubmissionSet - ERROR -> Submission three.cpp removed
2024-07-04-10:04:53_287 [ERROR] SubmissionSet - ERROR -> Submission two.cpp removed
2024-07-04-10:04:53_288 [ERROR] SubmissionSet - ERROR -> Submission one.cpp removed
c/c++
java -jar ~/Applications/JPlag/jplag-2.12.1-SNAPSHOT-jar-with-dependencies.jar -l c/c++ .
Language accepted: C/C++ Scanner [basic markup]
Command line: -l c/c++ .
initialize ok
3 submissions
Scanning Error in 'one.cpp':
Lexical error at line 29, column 28. Encountered: "m" (109), after : "\'l"
Scanning Error in 'three.cpp':
Lexical error at line 29, column 28. Encountered: "m" (109), after : "\'l"
Scanning Error in 'two.cpp':
Lexical error at line 29, column 28. Encountered: "m" (109), after : "\'l"
0 submissions parsed successfully! 3 parser errors!
Error: Not enough valid submissions! (only 0 are valid): [one.cpp] Scanning Error in 'one.cpp': Lexical error at line 29, column 28. Encountered: "m" (109), after : "\'l"
[three.cpp] Scanning Error in 'three.cpp': Lexical error at line 29, column 28. Encountered: "m" (109), after : "\'l"
[two.cpp] Scanning Error in 'two.cpp': Lexical error at line 29, column 28. Encountered: "m" (109), after : "\'l"
I hope this helps!
* Latest version (5.1.0) language set to `cpp`, I have a note that says this only works if the code is C++14 compatible throughout, the samples are but I'm not sure the student submission are.
Seems to work with the cpp language module.
* Latest version (5.1.0) with language set to `c`:
This language module is the former c/c++ module from the JPlag legacy version. We still provide it with JPlag, however we are not actively working on it. If anyone wants to provide a fix here, feel free to create a PR.
Hi all,
A group of students suspected of working together produced code which compiles, but crashes 5.0 and causes errors on 2.12.1 (which I happened to still have on my machine).
The offending code:
The error on 5.0 is:
The error on 2.12.1 is:
I used this error message to modify the line so it would parse and I now have reports from both. The error message from the older version is much easier to read and allows for exploration, the 5.0 error message less so.
I appreciate this needs further investigation with the latest version etc. I'll try to create a MWE for this when I have more time.