diff options
| author | cassiopc <cassiopc@gmail.com> | 2012-08-08 17:52:19 +0000 |
|---|---|---|
| committer | cassiopc <cassiopc@gmail.com> | 2012-08-08 17:52:19 +0000 |
| commit | 5d4eca5257a60c5f1de043fdf3f67e0a9df011f4 (patch) | |
| tree | 6d4ec6ffe1b6490be4120c0f06ae6cdabca41dd8 /boca-1.5.0/doc/problemexamples | |
| parent | f8c7c32e3ea6417ccf04309ec521b39a0c20414d (diff) | |
| download | boca-5d4eca5257a60c5f1de043fdf3f67e0a9df011f4.tar.gz boca-5d4eca5257a60c5f1de043fdf3f67e0a9df011f4.zip | |
many small bug fixes
Diffstat (limited to 'boca-1.5.0/doc/problemexamples')
80 files changed, 199 insertions, 5155 deletions
diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/compare b/boca-1.5.0/doc/problemexamples/abacaxi/compare new file mode 120000 index 0000000..934e331 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/abacaxi/compare @@ -0,0 +1 @@ +../problemtemplate/compare
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/compare/c b/boca-1.5.0/doc/problemexamples/abacaxi/compare/c deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/compare/c +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/compare/cpp b/boca-1.5.0/doc/problemexamples/abacaxi/compare/cpp deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/compare/cpp +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/compare/java b/boca-1.5.0/doc/problemexamples/abacaxi/compare/java deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/compare/java +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/compile b/boca-1.5.0/doc/problemexamples/abacaxi/compile new file mode 120000 index 0000000..83641d6 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/abacaxi/compile @@ -0,0 +1 @@ +../problemtemplate/compile
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/compile/c b/boca-1.5.0/doc/problemexamples/abacaxi/compile/c deleted file mode 100644 index 04a08e9..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/compile/c +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.exe) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 - -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - name="*.c" -else - mv $name src -fi -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi -maxm=512000 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=${4}000 -fi - -# setting up the timelimit according to the problem -if [ "$3" == "" ]; then -time=5 -else -time=$3 -fi -let ttime=$time+30 - -if [ "$2" == "" ]; then - exe=run.exe -else - exe=$2 -fi - -rm -f ../$exe 2>/dev/null -cat <<EOF > compileit.sh -#!/bin/bash -cc=\`which gcc\` -[ -x "\$cc" ] || cc=/usr/bin/gcc -if [ ! -x "\$cc" ]; then - echo "\$cc not found or it's not executable" - exit 47 -fi -cd src -"\$cc" -static -O2 -lm -o ../$exe "$name" -echo \$? > compileit.retcode -exit 0 -EOF -chmod 755 compileit.sh - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" - $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/compile/cpp b/boca-1.5.0/doc/problemexamples/abacaxi/compile/cpp deleted file mode 100644 index 2ec55ac..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/compile/cpp +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.exe) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 - -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - name="*.c" -else - mv $name src -fi -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi -maxm=512000 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=${4}000 -fi - -# setting up the timelimit according to the problem -if [ "$3" == "" ]; then -time=5 -else -time=$3 -fi -let ttime=$time+30 - -if [ "$2" == "" ]; then - exe=run.exe -else - exe=$2 -fi - -rm -f ../$exe 2>/dev/null -cat <<EOF > compileit.sh -#!/bin/bash -cc=\`which g++\` -[ -x "\$cc" ] || cc=/usr/bin/g++ -if [ ! -x "\$cc" ]; then - echo "\$cc not found or it's not executable" - exit 47 -fi -cd src -"\$cc" -static -O2 -lm -o ../$exe "$name" -echo \$? > compileit.retcode -exit 0 -EOF -chmod 755 compileit.sh - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" - $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/compile/java b/boca-1.5.0/doc/problemexamples/abacaxi/compile/java deleted file mode 100644 index dae050e..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/compile/java +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.jar) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - if [ "${name##*.}" == "zip" ]; then - name=`basename $name .zip` - else - name=`basename $name .ZIP` - fi -else - mv $name src -fi - -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$4 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -maxm=512 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=$4 -fi - -if [ "$2" == "" ]; then - jarfile=run.jar -else - jarfile=$2 -fi - -cdir=`pwd` -echo "Current directory is $cdir" >&2 - -cat <<EOF > compileit.sh -#!/bin/bash -javac=`which javac` -[ -x "\$javac" ] || javac=/usr/bin/javac -if [ ! -x \$javac ]; then - echo "\$javac not found or it's not executable" - exit 47 -fi -jar=`which jar` -[ -x "\$jar" ] || jar=/usr/bin/jar -if [ ! -x \$jar ]; then - echo "\$jar not found or it's not executable" - exit 47 -fi -export CLASSPATH=.:\$CLASSPATH -cd src -if [ -r "$name" ]; then - \$javac -Xmx${maxm}M -Xms${maxm}M "$name" - echo \$? > compileit.retcode -fi -find . -name "*.java" | while read lin; do - \$javac -Xmx${maxm}M -Xms${maxm}M "\$lin" - echo \$? > compileit.retcode -done -rm -f ../$jarfile -\$jar cvf ../$jarfile * -EOF -chmod 755 compileit.sh - -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys - -$sf -r1 -t$time -T$ttime -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 ./compileit.sh - -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" -# $javac "$name" - $sf -r1 -t$time -T$ttime -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/limits b/boca-1.5.0/doc/problemexamples/abacaxi/limits new file mode 120000 index 0000000..3744764 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/abacaxi/limits @@ -0,0 +1 @@ +../problemtemplate/limits
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/limits/c b/boca-1.5.0/doc/problemexamples/abacaxi/limits/c deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/limits/c +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/limits/cpp b/boca-1.5.0/doc/problemexamples/abacaxi/limits/cpp deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/limits/cpp +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/limits/java b/boca-1.5.0/doc/problemexamples/abacaxi/limits/java deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/limits/java +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/run b/boca-1.5.0/doc/problemexamples/abacaxi/run new file mode 120000 index 0000000..fd7410f --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/abacaxi/run @@ -0,0 +1 @@ +../problemtemplate/run
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/run/c b/boca-1.5.0/doc/problemexamples/abacaxi/run/c deleted file mode 100755 index d65ed58..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/run/c +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 exe_file -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -name=`basename "$1"` -if [ ! -x "$name" ]; then - echo "$1 not found (or is not in the current dir) or it's not executable" - exit 44 -fi -if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then - echo "WARNING: executable file extension is not .exe" -fi -input=`basename "$2"` -if [ ! -r "$input" ]; then - echo "$2 not found (or is not in the current dir) or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512000 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5}000 -fi - -rm -f stdin0 2>/dev/null -mv "$input" stdin0 - -rm -f run.exe 2>/dev/null -mv "$name" run.exe -file run.exe | grep -iq "statically linked" -if [ "$?" != "0" ]; then - echo "Aborting because $name is not statically linked" - exit 47 -fi - -cdir=`pwd` -echo "Current directory is $cdir -- chrooting on it" >&2 -$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe -ret=$? -if [ $ret -gt 10 ]; then - ret=0 -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/run/cpp b/boca-1.5.0/doc/problemexamples/abacaxi/run/cpp deleted file mode 100755 index 9b2d092..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/run/cpp +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 exe_file -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -x "$1" ]; then - echo "$1 not found or it's not executable" - exit 44 -fi -name="$1" -if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then - echo "WARNING: executable file extension is not .exe" -fi -if [ ! -r "$2" ]; then - echo "$2 not found or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512000 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5}000 -fi - -rm -f stdin0 2>/dev/null -mv "$2" stdin0 - -rm -f run.exe 2>/dev/null -mv "$name" run.exe -file run.exe | grep -iq "statically linked" -if [ "$?" != "0" ]; then - echo "Aborting because $name is not statically linked" - exit 47 -fi - -cdir=`pwd` -echo "Current directory is $cdir -- chrooting on it" >&2 -$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe -ret=$? -if [ $ret -gt 10 ]; then - ret=0 -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/run/java b/boca-1.5.0/doc/problemexamples/abacaxi/run/java deleted file mode 100755 index 945f15d..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/run/java +++ /dev/null @@ -1,163 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 main_class -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r run.jar ]; then - echo "ERROR: file run.jar not found - possible error during compilation" - exit 1 -fi -name="$1" -if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then - echo "WARNING: removing .class file extension" -fi -if [ "${name##*.}" == "class" ]; then - name=`basename "$1" .class` -fi -if [ "${name##*.}" == "CLASS" ]; then - name=`basename "$1" .CLASS` -fi -input=`basename "$2"` -if [ ! -r "$input" ]; then - echo "$2 not found (or is not in the current dir) or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5} -fi - -rm -f stdin0 2>/dev/null -mv "$input" stdin0 - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -java=`which java` -[ -x "$java" ] || java=/usr/bin/java -if [ ! -x $java ]; then - echo "$java not found or it's not executable" - exit 47 -fi -export CLASSPATH=.:./run.jar:$CLASSPATH -cd $cdir -$sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- $java -Xmx${maxm}M -Xms${maxm}M "$name" -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail $cdir/runit.sh - ret=`cat runit.retcode` - if [ "$ret" == "" ]; then - echo "Execution error - check autojudging" - exit 49 - fi - if [ $ret -gt 10 ]; then - echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <" - exit 9 - fi - else - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 -# $java "$name" < stdin0 - $sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- $java -cp run.jar -Xmx${maxm}M -Xms${maxm}M "$name" - ret=$? - fi - if [ $ret -gt 10 ]; then - echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <" - ret=9 - fi -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/tests b/boca-1.5.0/doc/problemexamples/abacaxi/tests new file mode 120000 index 0000000..7ef2d62 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/abacaxi/tests @@ -0,0 +1 @@ +../problemtemplate/tests
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/tests/c b/boca-1.5.0/doc/problemexamples/abacaxi/tests/c deleted file mode 100755 index 1a0ca95..0000000 --- a/boca-1.5.0/doc/problemexamples/abacaxi/tests/c +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -cat > test.c <<EOF -int main() { - char s[100]; - scanf("%s", s); - printf("%s\n",s); - return 0; -} -EOF -cat > test.in <<EOF -inputdata -EOF - -TL=2 -REP=10 -../compile/c test.c test.exe TL -../run/c test.exe test.in TL REP -output=`cat stdout0` -if [ "$output" != "inputdata" ]; then - echo "ERROR" - exit 1 -fi -exit 0 diff --git a/boca-1.5.0/doc/problemexamples/bits/compare b/boca-1.5.0/doc/problemexamples/bits/compare new file mode 120000 index 0000000..934e331 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/bits/compare @@ -0,0 +1 @@ +../problemtemplate/compare
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/bits/compare/c b/boca-1.5.0/doc/problemexamples/bits/compare/c deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/compare/c +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/bits/compare/cpp b/boca-1.5.0/doc/problemexamples/bits/compare/cpp deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/compare/cpp +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/bits/compare/java b/boca-1.5.0/doc/problemexamples/bits/compare/java deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/compare/java +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/bits/compile b/boca-1.5.0/doc/problemexamples/bits/compile new file mode 120000 index 0000000..83641d6 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/bits/compile @@ -0,0 +1 @@ +../problemtemplate/compile
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/bits/compile/c b/boca-1.5.0/doc/problemexamples/bits/compile/c deleted file mode 100644 index 04a08e9..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/compile/c +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.exe) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 - -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - name="*.c" -else - mv $name src -fi -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi -maxm=512000 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=${4}000 -fi - -# setting up the timelimit according to the problem -if [ "$3" == "" ]; then -time=5 -else -time=$3 -fi -let ttime=$time+30 - -if [ "$2" == "" ]; then - exe=run.exe -else - exe=$2 -fi - -rm -f ../$exe 2>/dev/null -cat <<EOF > compileit.sh -#!/bin/bash -cc=\`which gcc\` -[ -x "\$cc" ] || cc=/usr/bin/gcc -if [ ! -x "\$cc" ]; then - echo "\$cc not found or it's not executable" - exit 47 -fi -cd src -"\$cc" -static -O2 -lm -o ../$exe "$name" -echo \$? > compileit.retcode -exit 0 -EOF -chmod 755 compileit.sh - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" - $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/bits/compile/cpp b/boca-1.5.0/doc/problemexamples/bits/compile/cpp deleted file mode 100644 index 2ec55ac..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/compile/cpp +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.exe) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 - -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - name="*.c" -else - mv $name src -fi -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi -maxm=512000 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=${4}000 -fi - -# setting up the timelimit according to the problem -if [ "$3" == "" ]; then -time=5 -else -time=$3 -fi -let ttime=$time+30 - -if [ "$2" == "" ]; then - exe=run.exe -else - exe=$2 -fi - -rm -f ../$exe 2>/dev/null -cat <<EOF > compileit.sh -#!/bin/bash -cc=\`which g++\` -[ -x "\$cc" ] || cc=/usr/bin/g++ -if [ ! -x "\$cc" ]; then - echo "\$cc not found or it's not executable" - exit 47 -fi -cd src -"\$cc" -static -O2 -lm -o ../$exe "$name" -echo \$? > compileit.retcode -exit 0 -EOF -chmod 755 compileit.sh - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" - $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/bits/compile/java b/boca-1.5.0/doc/problemexamples/bits/compile/java deleted file mode 100644 index dae050e..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/compile/java +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.jar) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - if [ "${name##*.}" == "zip" ]; then - name=`basename $name .zip` - else - name=`basename $name .ZIP` - fi -else - mv $name src -fi - -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$4 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -maxm=512 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=$4 -fi - -if [ "$2" == "" ]; then - jarfile=run.jar -else - jarfile=$2 -fi - -cdir=`pwd` -echo "Current directory is $cdir" >&2 - -cat <<EOF > compileit.sh -#!/bin/bash -javac=`which javac` -[ -x "\$javac" ] || javac=/usr/bin/javac -if [ ! -x \$javac ]; then - echo "\$javac not found or it's not executable" - exit 47 -fi -jar=`which jar` -[ -x "\$jar" ] || jar=/usr/bin/jar -if [ ! -x \$jar ]; then - echo "\$jar not found or it's not executable" - exit 47 -fi -export CLASSPATH=.:\$CLASSPATH -cd src -if [ -r "$name" ]; then - \$javac -Xmx${maxm}M -Xms${maxm}M "$name" - echo \$? > compileit.retcode -fi -find . -name "*.java" | while read lin; do - \$javac -Xmx${maxm}M -Xms${maxm}M "\$lin" - echo \$? > compileit.retcode -done -rm -f ../$jarfile -\$jar cvf ../$jarfile * -EOF -chmod 755 compileit.sh - -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys - -$sf -r1 -t$time -T$ttime -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 ./compileit.sh - -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" -# $javac "$name" - $sf -r1 -t$time -T$ttime -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/bits/limits b/boca-1.5.0/doc/problemexamples/bits/limits new file mode 120000 index 0000000..3744764 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/bits/limits @@ -0,0 +1 @@ +../problemtemplate/limits
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/bits/limits/c b/boca-1.5.0/doc/problemexamples/bits/limits/c deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/limits/c +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/bits/limits/cpp b/boca-1.5.0/doc/problemexamples/bits/limits/cpp deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/limits/cpp +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/bits/limits/java b/boca-1.5.0/doc/problemexamples/bits/limits/java deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/limits/java +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/bits/run b/boca-1.5.0/doc/problemexamples/bits/run new file mode 120000 index 0000000..fd7410f --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/bits/run @@ -0,0 +1 @@ +../problemtemplate/run
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/bits/run/c b/boca-1.5.0/doc/problemexamples/bits/run/c deleted file mode 100755 index d65ed58..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/run/c +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 exe_file -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -name=`basename "$1"` -if [ ! -x "$name" ]; then - echo "$1 not found (or is not in the current dir) or it's not executable" - exit 44 -fi -if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then - echo "WARNING: executable file extension is not .exe" -fi -input=`basename "$2"` -if [ ! -r "$input" ]; then - echo "$2 not found (or is not in the current dir) or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512000 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5}000 -fi - -rm -f stdin0 2>/dev/null -mv "$input" stdin0 - -rm -f run.exe 2>/dev/null -mv "$name" run.exe -file run.exe | grep -iq "statically linked" -if [ "$?" != "0" ]; then - echo "Aborting because $name is not statically linked" - exit 47 -fi - -cdir=`pwd` -echo "Current directory is $cdir -- chrooting on it" >&2 -$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe -ret=$? -if [ $ret -gt 10 ]; then - ret=0 -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/bits/run/cpp b/boca-1.5.0/doc/problemexamples/bits/run/cpp deleted file mode 100755 index 9b2d092..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/run/cpp +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 exe_file -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -x "$1" ]; then - echo "$1 not found or it's not executable" - exit 44 -fi -name="$1" -if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then - echo "WARNING: executable file extension is not .exe" -fi -if [ ! -r "$2" ]; then - echo "$2 not found or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512000 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5}000 -fi - -rm -f stdin0 2>/dev/null -mv "$2" stdin0 - -rm -f run.exe 2>/dev/null -mv "$name" run.exe -file run.exe | grep -iq "statically linked" -if [ "$?" != "0" ]; then - echo "Aborting because $name is not statically linked" - exit 47 -fi - -cdir=`pwd` -echo "Current directory is $cdir -- chrooting on it" >&2 -$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe -ret=$? -if [ $ret -gt 10 ]; then - ret=0 -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/bits/run/java b/boca-1.5.0/doc/problemexamples/bits/run/java deleted file mode 100755 index 945f15d..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/run/java +++ /dev/null @@ -1,163 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 main_class -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r run.jar ]; then - echo "ERROR: file run.jar not found - possible error during compilation" - exit 1 -fi -name="$1" -if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then - echo "WARNING: removing .class file extension" -fi -if [ "${name##*.}" == "class" ]; then - name=`basename "$1" .class` -fi -if [ "${name##*.}" == "CLASS" ]; then - name=`basename "$1" .CLASS` -fi -input=`basename "$2"` -if [ ! -r "$input" ]; then - echo "$2 not found (or is not in the current dir) or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5} -fi - -rm -f stdin0 2>/dev/null -mv "$input" stdin0 - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -java=`which java` -[ -x "$java" ] || java=/usr/bin/java -if [ ! -x $java ]; then - echo "$java not found or it's not executable" - exit 47 -fi -export CLASSPATH=.:./run.jar:$CLASSPATH -cd $cdir -$sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- $java -Xmx${maxm}M -Xms${maxm}M "$name" -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail $cdir/runit.sh - ret=`cat runit.retcode` - if [ "$ret" == "" ]; then - echo "Execution error - check autojudging" - exit 49 - fi - if [ $ret -gt 10 ]; then - echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <" - exit 9 - fi - else - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 -# $java "$name" < stdin0 - $sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- $java -cp run.jar -Xmx${maxm}M -Xms${maxm}M "$name" - ret=$? - fi - if [ $ret -gt 10 ]; then - echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <" - ret=9 - fi -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/bits/tests b/boca-1.5.0/doc/problemexamples/bits/tests new file mode 120000 index 0000000..7ef2d62 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/bits/tests @@ -0,0 +1 @@ +../problemtemplate/tests
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/bits/tests/c b/boca-1.5.0/doc/problemexamples/bits/tests/c deleted file mode 100755 index 1a0ca95..0000000 --- a/boca-1.5.0/doc/problemexamples/bits/tests/c +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -cat > test.c <<EOF -int main() { - char s[100]; - scanf("%s", s); - printf("%s\n",s); - return 0; -} -EOF -cat > test.in <<EOF -inputdata -EOF - -TL=2 -REP=10 -../compile/c test.c test.exe TL -../run/c test.exe test.in TL REP -output=`cat stdout0` -if [ "$output" != "inputdata" ]; then - echo "ERROR" - exit 1 -fi -exit 0 diff --git a/boca-1.5.0/doc/problemexamples/formiga/compare b/boca-1.5.0/doc/problemexamples/formiga/compare new file mode 120000 index 0000000..934e331 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/formiga/compare @@ -0,0 +1 @@ +../problemtemplate/compare
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/formiga/compare/c b/boca-1.5.0/doc/problemexamples/formiga/compare/c deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/compare/c +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/formiga/compare/cpp b/boca-1.5.0/doc/problemexamples/formiga/compare/cpp deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/compare/cpp +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/formiga/compare/java b/boca-1.5.0/doc/problemexamples/formiga/compare/java deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/compare/java +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/formiga/compile b/boca-1.5.0/doc/problemexamples/formiga/compile new file mode 120000 index 0000000..83641d6 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/formiga/compile @@ -0,0 +1 @@ +../problemtemplate/compile
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/formiga/compile/c b/boca-1.5.0/doc/problemexamples/formiga/compile/c deleted file mode 100644 index 04a08e9..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/compile/c +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.exe) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 - -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - name="*.c" -else - mv $name src -fi -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi -maxm=512000 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=${4}000 -fi - -# setting up the timelimit according to the problem -if [ "$3" == "" ]; then -time=5 -else -time=$3 -fi -let ttime=$time+30 - -if [ "$2" == "" ]; then - exe=run.exe -else - exe=$2 -fi - -rm -f ../$exe 2>/dev/null -cat <<EOF > compileit.sh -#!/bin/bash -cc=\`which gcc\` -[ -x "\$cc" ] || cc=/usr/bin/gcc -if [ ! -x "\$cc" ]; then - echo "\$cc not found or it's not executable" - exit 47 -fi -cd src -"\$cc" -static -O2 -lm -o ../$exe "$name" -echo \$? > compileit.retcode -exit 0 -EOF -chmod 755 compileit.sh - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" - $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/formiga/compile/cpp b/boca-1.5.0/doc/problemexamples/formiga/compile/cpp deleted file mode 100644 index 2ec55ac..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/compile/cpp +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.exe) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 - -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - name="*.c" -else - mv $name src -fi -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi -maxm=512000 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=${4}000 -fi - -# setting up the timelimit according to the problem -if [ "$3" == "" ]; then -time=5 -else -time=$3 -fi -let ttime=$time+30 - -if [ "$2" == "" ]; then - exe=run.exe -else - exe=$2 -fi - -rm -f ../$exe 2>/dev/null -cat <<EOF > compileit.sh -#!/bin/bash -cc=\`which g++\` -[ -x "\$cc" ] || cc=/usr/bin/g++ -if [ ! -x "\$cc" ]; then - echo "\$cc not found or it's not executable" - exit 47 -fi -cd src -"\$cc" -static -O2 -lm -o ../$exe "$name" -echo \$? > compileit.retcode -exit 0 -EOF -chmod 755 compileit.sh - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" - $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/formiga/compile/java b/boca-1.5.0/doc/problemexamples/formiga/compile/java deleted file mode 100644 index dae050e..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/compile/java +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.jar) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - if [ "${name##*.}" == "zip" ]; then - name=`basename $name .zip` - else - name=`basename $name .ZIP` - fi -else - mv $name src -fi - -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$4 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -maxm=512 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=$4 -fi - -if [ "$2" == "" ]; then - jarfile=run.jar -else - jarfile=$2 -fi - -cdir=`pwd` -echo "Current directory is $cdir" >&2 - -cat <<EOF > compileit.sh -#!/bin/bash -javac=`which javac` -[ -x "\$javac" ] || javac=/usr/bin/javac -if [ ! -x \$javac ]; then - echo "\$javac not found or it's not executable" - exit 47 -fi -jar=`which jar` -[ -x "\$jar" ] || jar=/usr/bin/jar -if [ ! -x \$jar ]; then - echo "\$jar not found or it's not executable" - exit 47 -fi -export CLASSPATH=.:\$CLASSPATH -cd src -if [ -r "$name" ]; then - \$javac -Xmx${maxm}M -Xms${maxm}M "$name" - echo \$? > compileit.retcode -fi -find . -name "*.java" | while read lin; do - \$javac -Xmx${maxm}M -Xms${maxm}M "\$lin" - echo \$? > compileit.retcode -done -rm -f ../$jarfile -\$jar cvf ../$jarfile * -EOF -chmod 755 compileit.sh - -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys - -$sf -r1 -t$time -T$ttime -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 ./compileit.sh - -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" -# $javac "$name" - $sf -r1 -t$time -T$ttime -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/formiga/limits b/boca-1.5.0/doc/problemexamples/formiga/limits new file mode 120000 index 0000000..3744764 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/formiga/limits @@ -0,0 +1 @@ +../problemtemplate/limits
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/formiga/limits/c b/boca-1.5.0/doc/problemexamples/formiga/limits/c deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/limits/c +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/formiga/limits/cpp b/boca-1.5.0/doc/problemexamples/formiga/limits/cpp deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/limits/cpp +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/formiga/limits/java b/boca-1.5.0/doc/problemexamples/formiga/limits/java deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/limits/java +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/formiga/run b/boca-1.5.0/doc/problemexamples/formiga/run new file mode 120000 index 0000000..fd7410f --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/formiga/run @@ -0,0 +1 @@ +../problemtemplate/run
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/formiga/run/c b/boca-1.5.0/doc/problemexamples/formiga/run/c deleted file mode 100755 index d65ed58..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/run/c +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 exe_file -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -name=`basename "$1"` -if [ ! -x "$name" ]; then - echo "$1 not found (or is not in the current dir) or it's not executable" - exit 44 -fi -if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then - echo "WARNING: executable file extension is not .exe" -fi -input=`basename "$2"` -if [ ! -r "$input" ]; then - echo "$2 not found (or is not in the current dir) or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512000 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5}000 -fi - -rm -f stdin0 2>/dev/null -mv "$input" stdin0 - -rm -f run.exe 2>/dev/null -mv "$name" run.exe -file run.exe | grep -iq "statically linked" -if [ "$?" != "0" ]; then - echo "Aborting because $name is not statically linked" - exit 47 -fi - -cdir=`pwd` -echo "Current directory is $cdir -- chrooting on it" >&2 -$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe -ret=$? -if [ $ret -gt 10 ]; then - ret=0 -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/formiga/run/cpp b/boca-1.5.0/doc/problemexamples/formiga/run/cpp deleted file mode 100755 index 9b2d092..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/run/cpp +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 exe_file -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -x "$1" ]; then - echo "$1 not found or it's not executable" - exit 44 -fi -name="$1" -if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then - echo "WARNING: executable file extension is not .exe" -fi -if [ ! -r "$2" ]; then - echo "$2 not found or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512000 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5}000 -fi - -rm -f stdin0 2>/dev/null -mv "$2" stdin0 - -rm -f run.exe 2>/dev/null -mv "$name" run.exe -file run.exe | grep -iq "statically linked" -if [ "$?" != "0" ]; then - echo "Aborting because $name is not statically linked" - exit 47 -fi - -cdir=`pwd` -echo "Current directory is $cdir -- chrooting on it" >&2 -$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe -ret=$? -if [ $ret -gt 10 ]; then - ret=0 -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/formiga/run/java b/boca-1.5.0/doc/problemexamples/formiga/run/java deleted file mode 100755 index 945f15d..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/run/java +++ /dev/null @@ -1,163 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 main_class -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r run.jar ]; then - echo "ERROR: file run.jar not found - possible error during compilation" - exit 1 -fi -name="$1" -if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then - echo "WARNING: removing .class file extension" -fi -if [ "${name##*.}" == "class" ]; then - name=`basename "$1" .class` -fi -if [ "${name##*.}" == "CLASS" ]; then - name=`basename "$1" .CLASS` -fi -input=`basename "$2"` -if [ ! -r "$input" ]; then - echo "$2 not found (or is not in the current dir) or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5} -fi - -rm -f stdin0 2>/dev/null -mv "$input" stdin0 - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -java=`which java` -[ -x "$java" ] || java=/usr/bin/java -if [ ! -x $java ]; then - echo "$java not found or it's not executable" - exit 47 -fi -export CLASSPATH=.:./run.jar:$CLASSPATH -cd $cdir -$sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- $java -Xmx${maxm}M -Xms${maxm}M "$name" -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail $cdir/runit.sh - ret=`cat runit.retcode` - if [ "$ret" == "" ]; then - echo "Execution error - check autojudging" - exit 49 - fi - if [ $ret -gt 10 ]; then - echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <" - exit 9 - fi - else - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 -# $java "$name" < stdin0 - $sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- $java -cp run.jar -Xmx${maxm}M -Xms${maxm}M "$name" - ret=$? - fi - if [ $ret -gt 10 ]; then - echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <" - ret=9 - fi -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/formiga/tests b/boca-1.5.0/doc/problemexamples/formiga/tests new file mode 120000 index 0000000..7ef2d62 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/formiga/tests @@ -0,0 +1 @@ +../problemtemplate/tests
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/formiga/tests/c b/boca-1.5.0/doc/problemexamples/formiga/tests/c deleted file mode 100755 index 1a0ca95..0000000 --- a/boca-1.5.0/doc/problemexamples/formiga/tests/c +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -cat > test.c <<EOF -int main() { - char s[100]; - scanf("%s", s); - printf("%s\n",s); - return 0; -} -EOF -cat > test.in <<EOF -inputdata -EOF - -TL=2 -REP=10 -../compile/c test.c test.exe TL -../run/c test.exe test.in TL REP -output=`cat stdout0` -if [ "$output" != "inputdata" ]; then - echo "ERROR" - exit 1 -fi -exit 0 diff --git a/boca-1.5.0/doc/problemexamples/gen_examples.sh b/boca-1.5.0/doc/problemexamples/gen_examples.sh new file mode 100644 index 0000000..e25f7e7 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/gen_examples.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -f keys.txt +../../src/private/createproblemzip.php abacaxi A.problem.zip password | grep -A2 "The following line" | tail -n1 >> keys.txt +../../src/private/createproblemzip.php bits B.problem.zip password | grep -A2 "The following line" | tail -n1 >> keys.txt +../../src/private/createproblemzip.php formiga C.problem.zip password | grep -A2 "The following line" | tail -n1 >> keys.txt +../../src/private/createproblemzip.php multas D.problem.zip password | grep -A2 "The following line" | tail -n1 >> keys.txt diff --git a/boca-1.5.0/doc/problemexamples/multas/compare b/boca-1.5.0/doc/problemexamples/multas/compare new file mode 120000 index 0000000..934e331 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/multas/compare @@ -0,0 +1 @@ +../problemtemplate/compare
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/multas/compare/c b/boca-1.5.0/doc/problemexamples/multas/compare/c deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/compare/c +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/multas/compare/cpp b/boca-1.5.0/doc/problemexamples/multas/compare/cpp deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/compare/cpp +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/multas/compare/java b/boca-1.5.0/doc/problemexamples/multas/compare/java deleted file mode 100755 index 4998be3..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/compare/java +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -# // Last modified 21/jul/2012 by cassio@ime.usp.br -# -# This script receives: -# $1 team_output -# $2 sol_output -# $3 problem_input (might be used by some specific checkers, here it is not) -# -# BOCA reads the last line of the standard output -# and pass it to judges -# -if [ ! -r "$1" -o ! -r "$2" ]; then - echo "Parameter problem" - exit 43 -fi - -# Next lines of this script just compares team_output and sol_output, -# although it is possible to change them to more complex evaluations. - -diff -q "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff \"$1\" \"$2\" # files match" - echo "Files match exactly" - exit 4 -fi -diff -q -b "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b \"$1\" \"$2\" # files match" - echo -e "diff -c \"$1\" \"$2\" # files dont match - see output" - diff -c "$1" "$2" - echo "Files match with differences in the amount of white spaces" - exit 5 -fi -diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output" - diff -c -b "$1" "$2" - echo "Files match with differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B "$1" "$2" - echo "Files match if we ignore case and differences in the amount of white spaces and blank lines" - exit 5 -fi -diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B "$1" "$2" - echo "Files match if we discard all white spaces" - exit 5 -fi -diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null -if [ "$?" == "0" ]; then - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match" - echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -b -B -w "$1" "$2" - echo "Files match if we ignore case and discard all white spaces" - exit 5 -fi -wd=`which wdiff` -if [ "$wd" != "" ]; then - wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null - if [ "$?" == "0" ]; then - echo -e "wdiff \"$1\" \"$2\" # files match" - echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output" - diff -c -i -b -B -w "$1" "$2" - echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff" - echo "diff has a bug that, if a line contains a single space, this is not discarded by -w" - exit 5 - fi -fi -echo -e "### files dont match - see output" -diff -c -i -b -B -w "$1" "$2" -echo "Differences found" -exit 6 diff --git a/boca-1.5.0/doc/problemexamples/multas/compile b/boca-1.5.0/doc/problemexamples/multas/compile new file mode 120000 index 0000000..83641d6 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/multas/compile @@ -0,0 +1 @@ +../problemtemplate/compile
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/multas/compile/c b/boca-1.5.0/doc/problemexamples/multas/compile/c deleted file mode 100644 index 04a08e9..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/compile/c +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.exe) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 - -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - name="*.c" -else - mv $name src -fi -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi -maxm=512000 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=${4}000 -fi - -# setting up the timelimit according to the problem -if [ "$3" == "" ]; then -time=5 -else -time=$3 -fi -let ttime=$time+30 - -if [ "$2" == "" ]; then - exe=run.exe -else - exe=$2 -fi - -rm -f ../$exe 2>/dev/null -cat <<EOF > compileit.sh -#!/bin/bash -cc=\`which gcc\` -[ -x "\$cc" ] || cc=/usr/bin/gcc -if [ ! -x "\$cc" ]; then - echo "\$cc not found or it's not executable" - exit 47 -fi -cd src -"\$cc" -static -O2 -lm -o ../$exe "$name" -echo \$? > compileit.retcode -exit 0 -EOF -chmod 755 compileit.sh - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" - $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/multas/compile/cpp b/boca-1.5.0/doc/problemexamples/multas/compile/cpp deleted file mode 100644 index 2ec55ac..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/compile/cpp +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.exe) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 - -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - name="*.c" -else - mv $name src -fi -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi -maxm=512000 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=${4}000 -fi - -# setting up the timelimit according to the problem -if [ "$3" == "" ]; then -time=5 -else -time=$3 -fi -let ttime=$time+30 - -if [ "$2" == "" ]; then - exe=run.exe -else - exe=$2 -fi - -rm -f ../$exe 2>/dev/null -cat <<EOF > compileit.sh -#!/bin/bash -cc=\`which g++\` -[ -x "\$cc" ] || cc=/usr/bin/g++ -if [ ! -x "\$cc" ]; then - echo "\$cc not found or it's not executable" - exit 47 -fi -cd src -"\$cc" -static -O2 -lm -o ../$exe "$name" -echo \$? > compileit.retcode -exit 0 -EOF -chmod 755 compileit.sh - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" - $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/multas/compile/java b/boca-1.5.0/doc/problemexamples/multas/compile/java deleted file mode 100644 index dae050e..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/compile/java +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 source_file -# $2 exe_file (default run.jar) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) -# $4 maximum allowed memory (in MBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -if [ "$1" == "" ]; then - echo "parameter problem" - exit 43 -fi -name="$1" -if [ ! -r "$1" ]; then - echo "$1 not found or it's not readable" - exit 44 -fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - if [ "${name##*.}" == "zip" ]; then - name=`basename $name .zip` - else - name=`basename $name .ZIP` - fi -else - mv $name src -fi - -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$4 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -maxm=512 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=$4 -fi - -if [ "$2" == "" ]; then - jarfile=run.jar -else - jarfile=$2 -fi - -cdir=`pwd` -echo "Current directory is $cdir" >&2 - -cat <<EOF > compileit.sh -#!/bin/bash -javac=`which javac` -[ -x "\$javac" ] || javac=/usr/bin/javac -if [ ! -x \$javac ]; then - echo "\$javac not found or it's not executable" - exit 47 -fi -jar=`which jar` -[ -x "\$jar" ] || jar=/usr/bin/jar -if [ ! -x \$jar ]; then - echo "\$jar not found or it's not executable" - exit 47 -fi -export CLASSPATH=.:\$CLASSPATH -cd src -if [ -r "$name" ]; then - \$javac -Xmx${maxm}M -Xms${maxm}M "$name" - echo \$? > compileit.retcode -fi -find . -name "*.java" | while read lin; do - \$javac -Xmx${maxm}M -Xms${maxm}M "\$lin" - echo \$? > compileit.retcode -done -rm -f ../$jarfile -\$jar cvf ../$jarfile * -EOF -chmod 755 compileit.sh - -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys - -$sf -r1 -t$time -T$ttime -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 ./compileit.sh - -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` -else - echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" -# $javac "$name" - $sf -r1 -t$time -T$ttime -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 ./compileit.sh - ret=$? -fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 -fi -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - exit $ret -fi -ret=`cat compileit.retcode` -if [ "$ret" != "0" ]; then - echo "Compilation Error: $ret" - ret=1 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/multas/limits b/boca-1.5.0/doc/problemexamples/multas/limits new file mode 120000 index 0000000..3744764 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/multas/limits @@ -0,0 +1 @@ +../problemtemplate/limits
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/multas/limits/c b/boca-1.5.0/doc/problemexamples/multas/limits/c deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/limits/c +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/multas/limits/cpp b/boca-1.5.0/doc/problemexamples/multas/limits/cpp deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/limits/cpp +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/multas/limits/java b/boca-1.5.0/doc/problemexamples/multas/limits/java deleted file mode 100644 index b48a3b7..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/limits/java +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename -echo 4 -# and the number of repetitions to run within the given timelimit in the second line -echo 10 -# and the maximum amount of memory per repetition in the third line (in Mbytes) -echo 512 -# and shall return zero to indicate no failure -exit 0 -# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be -# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is -# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs -# the value. diff --git a/boca-1.5.0/doc/problemexamples/multas/run b/boca-1.5.0/doc/problemexamples/multas/run new file mode 120000 index 0000000..fd7410f --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/multas/run @@ -0,0 +1 @@ +../problemtemplate/run
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/multas/run/c b/boca-1.5.0/doc/problemexamples/multas/run/c deleted file mode 100755 index d65ed58..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/run/c +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 exe_file -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -name=`basename "$1"` -if [ ! -x "$name" ]; then - echo "$1 not found (or is not in the current dir) or it's not executable" - exit 44 -fi -if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then - echo "WARNING: executable file extension is not .exe" -fi -input=`basename "$2"` -if [ ! -r "$input" ]; then - echo "$2 not found (or is not in the current dir) or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512000 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5}000 -fi - -rm -f stdin0 2>/dev/null -mv "$input" stdin0 - -rm -f run.exe 2>/dev/null -mv "$name" run.exe -file run.exe | grep -iq "statically linked" -if [ "$?" != "0" ]; then - echo "Aborting because $name is not statically linked" - exit 47 -fi - -cdir=`pwd` -echo "Current directory is $cdir -- chrooting on it" >&2 -$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe -ret=$? -if [ $ret -gt 10 ]; then - ret=0 -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/multas/run/cpp b/boca-1.5.0/doc/problemexamples/multas/run/cpp deleted file mode 100755 index 9b2d092..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/run/cpp +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 exe_file -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -x "$1" ]; then - echo "$1 not found or it's not executable" - exit 44 -fi -name="$1" -if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then - echo "WARNING: executable file extension is not .exe" -fi -if [ ! -r "$2" ]; then - echo "$2 not found or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512000 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5}000 -fi - -rm -f stdin0 2>/dev/null -mv "$2" stdin0 - -rm -f run.exe 2>/dev/null -mv "$name" run.exe -file run.exe | grep -iq "statically linked" -if [ "$?" != "0" ]; then - echo "Aborting because $name is not statically linked" - exit 47 -fi - -cdir=`pwd` -echo "Current directory is $cdir -- chrooting on it" >&2 -$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe -ret=$? -if [ $ret -gt 10 ]; then - ret=0 -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/multas/run/java b/boca-1.5.0/doc/problemexamples/multas/run/java deleted file mode 100755 index 945f15d..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/run/java +++ /dev/null @@ -1,163 +0,0 @@ -#!/bin/bash -# //////////////////////////////////////////////////////////////////////////////// -# //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) -# // -# // This program is free software: you can redistribute it and/or modify -# // it under the terms of the GNU General Public License as published by -# // the Free Software Foundation, either version 3 of the License, or -# // (at your option) any later version. -# // -# // This program is distributed in the hope that it will be useful, -# // but WITHOUT ANY WARRANTY; without even the implied warranty of -# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# // GNU General Public License for more details. -# // You should have received a copy of the GNU General Public License -# // along with this program. If not, see <http://www.gnu.org/licenses/>. -# //////////////////////////////////////////////////////////////////////////////// -#Last modified: 21/july/2012 by cassio@ime.usp.br -# -# parameters are: -# $1 main_class -# $2 input_file -# $3 timelimit (limit to run all the repetitions, by default only one repetition) -# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -# $5 maximum allowed memory (in KBytes) -# -# the output of the submission should be directed to the standard output -# -# the return code show what happened (according to safeexec): -# 0 ok -# 1 compile error -# 2 runtime error -# 3 timelimit exceeded -# 4 internal error -# 5 parameter error -# 6 internal error -# 7 memory limit exceeded -# 8 security threat -# 9 runtime error -# other_codes are unknown to boca: in this case BOCA will present the -# last line of standard output to the judge - -umask 0022 -id -u bocajail >/dev/null 2>/dev/null -if [ $? == 0 ]; then - bocau=`id -u bocajail` - bocag=`id -g bocajail` - chown bocajail.nogroup . -else - bocau=`id -u nobody` - bocag=`id -g nobody` - chown nobody.nogroup . -fi -if [ "$bocau" == "" -o "$bocag" == "" ]; then - echo "error finding user to run script" - exit 43 -fi - -# this script makes use of safeexec to execute the code with less privilegies -# make sure that directories below are correct. -sf=`which safeexec` -[ -x "$sf" ] || sf=/usr/bin/safeexec - -if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then - echo "parameter problem" - exit 43 -fi -if [ ! -r run.jar ]; then - echo "ERROR: file run.jar not found - possible error during compilation" - exit 1 -fi -name="$1" -if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then - echo "WARNING: removing .class file extension" -fi -if [ "${name##*.}" == "class" ]; then - name=`basename "$1" .class` -fi -if [ "${name##*.}" == "CLASS" ]; then - name=`basename "$1" .CLASS` -fi -input=`basename "$2"` -if [ ! -r "$input" ]; then - echo "$2 not found (or is not in the current dir) or it's not readable" - exit 45 -fi -if [ ! -x $sf ]; then - echo "$sf not found or it's not executable" - exit 46 -fi - -time=$3 -if [ "$time" -gt "0" ]; then - let "ttime = $time + 30" -else - time=1 - ttime=30 -fi - -nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 -fi -maxm=512 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5} -fi - -rm -f stdin0 2>/dev/null -mv "$input" stdin0 - -cdir=`pwd` -echo "Current directory is $cdir" >&2 -echo $cdir | grep -q "/bocajail" -if [ $? == 0 ]; then - cdir=`echo $cdir | sed "s/.*\/bocajail//"` - cat <<EOF > runit.sh -#!/bin/bash -[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc -#/bin/mount --bind /dev /dev -[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys -java=`which java` -[ -x "$java" ] || java=/usr/bin/java -if [ ! -x $java ]; then - echo "$java not found or it's not executable" - exit 47 -fi -export CLASSPATH=.:./run.jar:$CLASSPATH -cd $cdir -$sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- $java -Xmx${maxm}M -Xms${maxm}M "$name" -echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null -EOF - chmod 755 runit.sh - chroot /bocajail $cdir/runit.sh - ret=`cat runit.retcode` - if [ "$ret" == "" ]; then - echo "Execution error - check autojudging" - exit 49 - fi - if [ $ret -gt 10 ]; then - echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <" - exit 9 - fi - else - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 -# $java "$name" < stdin0 - $sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- $java -cp run.jar -Xmx${maxm}M -Xms${maxm}M "$name" - ret=$? - fi - if [ $ret -gt 10 ]; then - echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <" - ret=9 - fi -fi -if [ -f stdout0 ]; then - cat stdout0 -fi -exit $ret diff --git a/boca-1.5.0/doc/problemexamples/multas/tests b/boca-1.5.0/doc/problemexamples/multas/tests new file mode 120000 index 0000000..7ef2d62 --- /dev/null +++ b/boca-1.5.0/doc/problemexamples/multas/tests @@ -0,0 +1 @@ +../problemtemplate/tests
\ No newline at end of file diff --git a/boca-1.5.0/doc/problemexamples/multas/tests/c b/boca-1.5.0/doc/problemexamples/multas/tests/c deleted file mode 100755 index 1a0ca95..0000000 --- a/boca-1.5.0/doc/problemexamples/multas/tests/c +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -cat > test.c <<EOF -int main() { - char s[100]; - scanf("%s", s); - printf("%s\n",s); - return 0; -} -EOF -cat > test.in <<EOF -inputdata -EOF - -TL=2 -REP=10 -../compile/c test.c test.exe TL -../run/c test.exe test.in TL REP -output=`cat stdout0` -if [ "$output" != "inputdata" ]; then - echo "ERROR" - exit 1 -fi -exit 0 diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/compile/c b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/c index 04a08e9..4cb7ea8 100644 --- a/boca-1.5.0/doc/problemexamples/problemtemplate/compile/c +++ b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/c @@ -59,7 +59,7 @@ if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then unzip "$name" -d src name="*.c" else - mv $name src + cp "$name" src fi id -u bocajail >/dev/null 2>/dev/null if [ $? == 0 ]; then @@ -85,8 +85,10 @@ if [ ! -x $sf ]; then exit 46 fi maxm=512000 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=${4}000 +if [ "$4" != "" ]; then + if [ "$4" -gt "0" ]; then + maxm=${4}000 + fi fi # setting up the timelimit according to the problem @@ -95,7 +97,7 @@ time=5 else time=$3 fi -let ttime=$time+30 +let "ttime = $time + 30" if [ "$2" == "" ]; then exe=run.exe @@ -103,7 +105,7 @@ else exe=$2 fi -rm -f ../$exe 2>/dev/null +rm -f $exe compileit.retcode runit.retcode 2>/dev/null cat <<EOF > compileit.sh #!/bin/bash cc=\`which gcc\` @@ -113,8 +115,8 @@ if [ ! -x "\$cc" ]; then exit 47 fi cd src -"\$cc" -static -O2 -lm -o ../$exe "$name" -echo \$? > compileit.retcode +"\$cc" -static -O2 -o ../$exe $name -lm +echo \$? > ../compileit.retcode exit 0 EOF chmod 755 compileit.sh @@ -124,29 +126,40 @@ echo "Current directory is $cdir" >&2 echo $cdir | grep -q "/bocajail" if [ $? == 0 ]; then cdir=`echo $cdir | sed "s/.*\/bocajail//"` + echo "Internal directory is $cdir" cat <<EOF > runit.sh #!/bin/bash +cd "$cdir" [ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc #/bin/mount --bind /dev /dev [ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null +if [ ! -d /bocajail ]; then + /bin/umount /proc 2>/dev/null + #/bin/umount /dev + /bin/umount /sys 2>/dev/null +fi EOF chmod 755 runit.sh chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` + if [ -r runit.retcode ]; then + ret=`cat runit.retcode` + else + ret=99 + fi else echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh ret=$? fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 +if [ -f "stdout0" ]; then + cat "stdout0" fi +if [ -f "stderr0" ]; then + cat "stderr0" +fi +rm -rf src/ if [ "$ret" != "0" ]; then echo "Compilation Error: $ret" exit $ret diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/compile/cpp b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/cpp index 2ec55ac..6a61bc1 100644 --- a/boca-1.5.0/doc/problemexamples/problemtemplate/compile/cpp +++ b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/cpp @@ -59,7 +59,7 @@ if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then unzip "$name" -d src name="*.c" else - mv $name src + cp "$name" src fi id -u bocajail >/dev/null 2>/dev/null if [ $? == 0 ]; then @@ -85,8 +85,10 @@ if [ ! -x $sf ]; then exit 46 fi maxm=512000 -if [ "$4" != "" -a "$4" -gt "0" ]; then -maxm=${4}000 +if [ "$4" != "" ]; then + if [ "$4" -gt "0" ]; then + maxm=${4}000 + fi fi # setting up the timelimit according to the problem @@ -95,7 +97,7 @@ time=5 else time=$3 fi -let ttime=$time+30 +let "ttime = $time + 30" if [ "$2" == "" ]; then exe=run.exe @@ -103,7 +105,7 @@ else exe=$2 fi -rm -f ../$exe 2>/dev/null +rm -f $exe compileit.retcode runit.retcode 2>/dev/null cat <<EOF > compileit.sh #!/bin/bash cc=\`which g++\` @@ -113,8 +115,8 @@ if [ ! -x "\$cc" ]; then exit 47 fi cd src -"\$cc" -static -O2 -lm -o ../$exe "$name" -echo \$? > compileit.retcode +"\$cc" -static -O2 -o ../$exe $name -lm +echo \$? > ../compileit.retcode exit 0 EOF chmod 755 compileit.sh @@ -124,29 +126,40 @@ echo "Current directory is $cdir" >&2 echo $cdir | grep -q "/bocajail" if [ $? == 0 ]; then cdir=`echo $cdir | sed "s/.*\/bocajail//"` + echo "Internal directory is $cdir" cat <<EOF > runit.sh #!/bin/bash +cd "$cdir" [ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc #/bin/mount --bind /dev /dev [ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null +if [ ! -d /bocajail ]; then + /bin/umount /proc 2>/dev/null + #/bin/umount /dev + /bin/umount /sys 2>/dev/null +fi EOF chmod 755 runit.sh chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` + if [ -r runit.retcode ]; then + ret=`cat runit.retcode` + else + ret=99 + fi else echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh ret=$? fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 +if [ -f "stdout0" ]; then + cat "stdout0" fi +if [ -f "stderr0" ]; then + cat "stderr0" +fi +rm -rf src/ if [ "$ret" != "0" ]; then echo "Compilation Error: $ret" exit $ret diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/compile/java b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/java index dae050e..f62215b 100644 --- a/boca-1.5.0/doc/problemexamples/problemtemplate/compile/java +++ b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/java @@ -49,18 +49,6 @@ if [ ! -r "$1" ]; then echo "$1 not found or it's not readable" exit 44 fi -mkdir -p src -if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then - unzip "$name" -d src - if [ "${name##*.}" == "zip" ]; then - name=`basename $name .zip` - else - name=`basename $name .ZIP` - fi -else - mv $name src -fi - id -u bocajail >/dev/null 2>/dev/null if [ $? == 0 ]; then bocau=`id -u bocajail` @@ -76,6 +64,20 @@ if [ "$bocau" == "" -o "$bocag" == "" ]; then exit 43 fi +mkdir -p src +if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then + unzip "$name" -d src + if [ "${name##*.}" == "zip" ]; then + name=`basename $name .zip` + else + name=`basename $name .ZIP` + fi +else + cp $name src +fi +chown -R $bocau src +chmod -R 700 src + # this script makes use of safeexec to execute the code with less privilegies # make sure that directories below are correct. sf=`which safeexec` @@ -124,15 +126,16 @@ fi export CLASSPATH=.:\$CLASSPATH cd src if [ -r "$name" ]; then - \$javac -Xmx${maxm}M -Xms${maxm}M "$name" - echo \$? > compileit.retcode + \$javac "$name" + echo \$? > ../compileit.retcode fi find . -name "*.java" | while read lin; do - \$javac -Xmx${maxm}M -Xms${maxm}M "\$lin" - echo \$? > compileit.retcode + \$javac "\$lin" + echo \$? > ../compileit.retcode done rm -f ../$jarfile \$jar cvf ../$jarfile * +exit 0 EOF chmod 755 compileit.sh @@ -141,29 +144,39 @@ if [ $? == 0 ]; then cdir=`echo $cdir | sed "s/.*\/bocajail//"` cat <<EOF > runit.sh #!/bin/bash +cd "$cdir" [ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc #/bin/mount --bind /dev /dev [ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys $sf -r1 -t$time -T$ttime -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 ./compileit.sh - -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null +echo \$? > runit.retcode +if [ ! -d /bocajail ]; then + /bin/umount /proc 2>/dev/null + #/bin/umount /dev + /bin/umount /sys 2>/dev/null +fi EOF chmod 755 runit.sh chroot /bocajail "$cdir/runit.sh" - ret=`cat runit.retcode` + if [ -r runit.retcode ]; then + ret=`cat runit.retcode` + else + ret=99 + fi else echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING" # $javac "$name" $sf -r1 -t$time -T$ttime -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 ./compileit.sh ret=$? fi -rm -rf src/ -if [ -f stdout0 ]; then - cat stdout0 +if [ -f "stdout0" ]; then + cat "stdout0" +fi +if [ -f "stderr0" ]; then + cat "stderr0" fi +rm -rf src/ if [ "$ret" != "0" ]; then echo "Compilation Error: $ret" exit $ret diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/run/c b/boca-1.5.0/doc/problemexamples/problemtemplate/run/c index d65ed58..75720ee 100755 --- a/boca-1.5.0/doc/problemexamples/problemtemplate/run/c +++ b/boca-1.5.0/doc/problemexamples/problemtemplate/run/c @@ -65,16 +65,11 @@ if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then echo "parameter problem" exit 43 fi -name=`basename "$1"` -if [ ! -x "$name" ]; then +if [ ! -x "$1" ]; then echo "$1 not found (or is not in the current dir) or it's not executable" exit 44 fi -if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then - echo "WARNING: executable file extension is not .exe" -fi -input=`basename "$2"` -if [ ! -r "$input" ]; then +if [ ! -r "$2" ]; then echo "$2 not found (or is not in the current dir) or it's not readable" exit 45 fi @@ -92,22 +87,24 @@ else fi nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 +if [ "$4" != "" ]; then + if [ "$4" -gt "0" ]; then + nruns=$4 + fi fi maxm=512000 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5}000 +if [ "$5" != "" ]; then + if [ "$5" -gt "0" ]; then + maxm=${5}000 + fi fi -rm -f stdin0 2>/dev/null -mv "$input" stdin0 +cp "$2" stdin0 2>/dev/null +cp "$1" run.exe 2>/dev/null -rm -f run.exe 2>/dev/null -mv "$name" run.exe file run.exe | grep -iq "statically linked" if [ "$?" != "0" ]; then - echo "Aborting because $name is not statically linked" + echo "Aborting because $1 is not statically linked" exit 47 fi diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/run/cpp b/boca-1.5.0/doc/problemexamples/problemtemplate/run/cpp index 9b2d092..e5c7620 100755 --- a/boca-1.5.0/doc/problemexamples/problemtemplate/run/cpp +++ b/boca-1.5.0/doc/problemexamples/problemtemplate/run/cpp @@ -69,10 +69,6 @@ if [ ! -x "$1" ]; then echo "$1 not found or it's not executable" exit 44 fi -name="$1" -if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then - echo "WARNING: executable file extension is not .exe" -fi if [ ! -r "$2" ]; then echo "$2 not found or it's not readable" exit 45 @@ -91,22 +87,24 @@ else fi nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 +if [ "$4" != "" ]; then + if [ "$4" -gt "0" ]; then + nruns=$4 + fi fi maxm=512000 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5}000 +if [ "$5" != "" ]; then + if [ "$5" -gt "0" ]; then + maxm=${5}000 + fi fi -rm -f stdin0 2>/dev/null -mv "$2" stdin0 +cp "$2" stdin0 2>/dev/null +cp "$1" run.exe 2>/dev/null -rm -f run.exe 2>/dev/null -mv "$name" run.exe file run.exe | grep -iq "statically linked" if [ "$?" != "0" ]; then - echo "Aborting because $name is not statically linked" + echo "Aborting because $1 is not statically linked" exit 47 fi diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/run/java b/boca-1.5.0/doc/problemexamples/problemtemplate/run/java index 945f15d..c24d842 100755 --- a/boca-1.5.0/doc/problemexamples/problemtemplate/run/java +++ b/boca-1.5.0/doc/problemexamples/problemtemplate/run/java @@ -65,6 +65,12 @@ if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then echo "parameter problem" exit 43 fi +if [ -r run.exe ]; then + mv run.exe run.jar +fi +if [ -r "$1" ]; then + mv "$1" run.jar +fi if [ ! -r run.jar ]; then echo "ERROR: file run.jar not found - possible error during compilation" exit 1 @@ -79,8 +85,7 @@ fi if [ "${name##*.}" == "CLASS" ]; then name=`basename "$1" .CLASS` fi -input=`basename "$2"` -if [ ! -r "$input" ]; then +if [ ! -r "$2" ]; then echo "$2 not found (or is not in the current dir) or it's not readable" exit 45 fi @@ -98,16 +103,20 @@ else fi nruns=1 -if [ "$4" != "" -a "$4" -gt "0" ]; then -nruns=$4 +if [ "$4" != "" ]; then + if [ "$4" -gt "0" ]; then + nruns=$4 + fi fi maxm=512 -if [ "$5" != "" -a "$5" -gt "0" ]; then -maxm=${5} +if [ "$5" != "" ]; then + if [ "$5" -gt "0" ]; then + maxm=${5} + fi fi -rm -f stdin0 2>/dev/null -mv "$input" stdin0 +rm -f runit.retcode 2>/dev/null +cp "$2" stdin0 2>/dev/null cdir=`pwd` echo "Current directory is $cdir" >&2 @@ -116,46 +125,44 @@ if [ $? == 0 ]; then cdir=`echo $cdir | sed "s/.*\/bocajail//"` cat <<EOF > runit.sh #!/bin/bash +cd "$cdir" [ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc #/bin/mount --bind /dev /dev [ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys java=`which java` -[ -x "$java" ] || java=/usr/bin/java -if [ ! -x $java ]; then - echo "$java not found or it's not executable" +[ -x "\$java" ] || java=/usr/bin/java +if [ ! -x \$java ]; then + echo "\$java not found or it's not executable" exit 47 fi export CLASSPATH=.:./run.jar:$CLASSPATH -cd $cdir -$sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- $java -Xmx${maxm}M -Xms${maxm}M "$name" +$sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- \$java -Xmx${maxm}M -Xms${maxm}M "$name" echo \$? > runit.retcode -/bin/umount /proc 2>/dev/null -#/bin/umount /dev -/bin/umount /sys 2>/dev/null +if [ ! -d /bocajail ]; then + /bin/umount /proc 2>/dev/null + #/bin/umount /dev + /bin/umount /sys 2>/dev/null +fi EOF - chmod 755 runit.sh - chroot /bocajail $cdir/runit.sh - ret=`cat runit.retcode` - if [ "$ret" == "" ]; then - echo "Execution error - check autojudging" - exit 49 - fi - if [ $ret -gt 10 ]; then - echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <" - exit 9 - fi - else - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 - echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 -# $java "$name" < stdin0 - $sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- $java -cp run.jar -Xmx${maxm}M -Xms${maxm}M "$name" - ret=$? - fi - if [ $ret -gt 10 ]; then - echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <" - ret=9 + chmod 755 runit.sh + chroot /bocajail "$cdir/runit.sh" + if [ -r runit.retcode ]; then + ret=`cat runit.retcode` fi + if [ "$ret" == "" ]; then + echo "Execution error - check autojudging" + exit 49 + fi +else + echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 + echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 + echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 + $sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- $java -cp run.jar -Xmx${maxm}M -Xms${maxm}M "$name" + ret=$? +fi +if [ $ret -gt 10 ]; then + echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <" + ret=9 fi if [ -f stdout0 ]; then cat stdout0 diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/tests/c b/boca-1.5.0/doc/problemexamples/problemtemplate/tests/c index d7d0411..de0a9c5 100755 --- a/boca-1.5.0/doc/problemexamples/problemtemplate/tests/c +++ b/boca-1.5.0/doc/problemexamples/problemtemplate/tests/c @@ -4,6 +4,7 @@ # and the script files that are included in the problem package cat > test.c <<EOF +#include<stdio.h> int main() { char s[100]; scanf("%s", s); @@ -17,11 +18,19 @@ EOF TL=2 REP=10 -../compile/c test.c test.exe TL -../run/c test.exe test.in TL REP -output=`cat stdout0` -if [ "$output" != "inputdata" ]; then +chmod 755 ../compile/c +../compile/c test.c test.exe $TL +chmod 755 ../run/c +../run/c test.exe test.in $TL $REP +if [ -r stdout0 ]; then + output=`cat stdout0` + if [ "$output" != "inputdata" ]; then + echo "ERROR" + exit 1 + fi +else echo "ERROR" exit 1 fi +echo "TEST PASSED" exit 0 |