Skip to content

Commit 8463938

Browse files
Do not escape $@ twice in validator run script generator.
This is not needed because it is within single quotes.
1 parent b499362 commit 8463938

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

judge/judgedaemon.main.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,15 @@ function fetch_executable_internal(
418418
// no main class detection here
419419
$buildscript .= "echo 'COMPARE_DIR=\$(dirname \"\$0\")' >> run\n";
420420
$mainClass = basename($unescapedSource, '.java');
421-
$buildscript .= "echo 'java -cp \"\$COMPARE_DIR\" $mainClass \"\\\$@\"' >> run\n";
421+
// Note: since the $@ is within single quotes, we do not need to double escape it.
422+
$buildscript .= "echo 'java -cp \"\$COMPARE_DIR\" $mainClass \"\$@\"' >> run\n";
422423
$buildscript .= "chmod +x run\n";
423424
break;
424425
case 'py':
425426
$buildscript .= "echo '#!/bin/sh' > run\n";
426427
$buildscript .= "echo 'COMPARE_DIR=\$(dirname \"\$0\")' >> run\n";
427-
$buildscript .= "echo 'python3 \$COMPARE_DIR/$source' \"\\\$@\" >> run\n";
428+
// Note: since the $@ is within single quotes, we do not need to double escape it.
429+
$buildscript .= "echo 'python3 \"\$COMPARE_DIR/$source\" \"\$@\"' >> run\n";
428430
$buildscript .= "chmod +x run\n";
429431
break;
430432
}

0 commit comments

Comments
 (0)