rbx.cp 0.5.46__py3-none-any.whl → 0.5.47__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. rbx/box/checkers.py +81 -28
  2. rbx/box/cli.py +12 -10
  3. rbx/box/packaging/boca/packager.py +44 -7
  4. rbx/box/packaging/main.py +7 -0
  5. rbx/box/packaging/moj/packager.py +88 -8
  6. rbx/box/packaging/packager.py +7 -2
  7. rbx/box/packaging/polygon/packager.py +5 -4
  8. rbx/box/solutions.py +2 -2
  9. rbx/box/stresses.py +0 -1
  10. rbx/box/tasks.py +6 -4
  11. rbx/grading/judge/sandbox.py +29 -1
  12. rbx/grading/judge/sandboxes/isolate.py +10 -0
  13. rbx/grading/judge/sandboxes/stupid_sandbox.py +16 -4
  14. rbx/grading/judge/sandboxes/timeit.py +12 -3
  15. rbx/grading/processing_context.py +48 -0
  16. rbx/grading/steps.py +24 -13
  17. rbx/resources/packagers/boca/checker.sh +8 -6
  18. rbx/resources/packagers/boca/compare.sh +48 -0
  19. rbx/resources/packagers/boca/interactive/c +207 -0
  20. rbx/resources/packagers/boca/interactive/cc +207 -0
  21. rbx/resources/packagers/boca/interactive/cpp +207 -0
  22. rbx/resources/packagers/boca/interactive/java +240 -0
  23. rbx/resources/packagers/boca/interactive/kt +231 -0
  24. rbx/resources/packagers/boca/interactive/py2 +209 -0
  25. rbx/resources/packagers/boca/interactive/py3 +209 -0
  26. rbx/resources/packagers/boca/interactor_compile.sh +45 -0
  27. rbx/resources/packagers/boca/run/bkp +163 -0
  28. rbx/resources/packagers/boca/run/c +19 -19
  29. rbx/resources/packagers/boca/run/cc +19 -19
  30. rbx/resources/packagers/boca/run/cpp +19 -19
  31. rbx/resources/packagers/boca/run/java +51 -51
  32. rbx/resources/packagers/boca/run/kt +30 -30
  33. rbx/resources/packagers/boca/run/py2 +42 -42
  34. rbx/resources/packagers/boca/run/py3 +42 -42
  35. rbx/resources/packagers/moj/scripts/c/compile.sh +19 -0
  36. rbx/resources/packagers/moj/scripts/c/prep.sh +5 -0
  37. rbx/resources/packagers/moj/scripts/c/run.sh +16 -0
  38. rbx/resources/packagers/moj/scripts/compare.sh +32 -6
  39. rbx/resources/packagers/moj/scripts/cpp/compile.sh +19 -0
  40. rbx/resources/packagers/moj/scripts/cpp/prep.sh +5 -0
  41. rbx/resources/packagers/moj/scripts/cpp/run.sh +16 -0
  42. rbx/resources/packagers/moj/scripts/interactor_prep.sh +14 -0
  43. rbx/resources/packagers/moj/scripts/interactor_run.sh +38 -0
  44. rbx/resources/packagers/moj/scripts/java/compile.sh +12 -0
  45. rbx/resources/packagers/moj/scripts/java/prep.sh +8 -0
  46. rbx/resources/packagers/moj/scripts/java/run.sh +17 -0
  47. rbx/resources/packagers/moj/scripts/py2/compile.sh +7 -0
  48. rbx/resources/packagers/moj/scripts/py2/prep.sh +5 -0
  49. rbx/resources/packagers/moj/scripts/py2/run.sh +16 -0
  50. rbx/resources/packagers/moj/scripts/py3/compile.sh +7 -0
  51. rbx/resources/packagers/moj/scripts/py3/prep.sh +5 -0
  52. rbx/resources/packagers/moj/scripts/py3/run.sh +16 -0
  53. {rbx_cp-0.5.46.dist-info → rbx_cp-0.5.47.dist-info}/METADATA +1 -1
  54. {rbx_cp-0.5.46.dist-info → rbx_cp-0.5.47.dist-info}/RECORD +57 -30
  55. rbx/resources/packagers/boca/compare +0 -53
  56. {rbx_cp-0.5.46.dist-info → rbx_cp-0.5.47.dist-info}/LICENSE +0 -0
  57. {rbx_cp-0.5.46.dist-info → rbx_cp-0.5.47.dist-info}/WHEEL +0 -0
  58. {rbx_cp-0.5.46.dist-info → rbx_cp-0.5.47.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,163 @@
1
+ #!/bin/bash
2
+ # ////////////////////////////////////////////////////////////////////////////////
3
+ # //BOCA Online Contest Administrator
4
+ # // Copyright (C) 2003-2014 by BOCA System (bocasystem@gmail.com)
5
+ # //
6
+ # // This program is free software: you can redistribute it and/or modify
7
+ # // it under the terms of the GNU General Public License as published by
8
+ # // the Free Software Foundation, either version 3 of the License, or
9
+ # // (at your option) any later version.
10
+ # //
11
+ # // This program is distributed in the hope that it will be useful,
12
+ # // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # // GNU General Public License for more details.
15
+ # // You should have received a copy of the GNU General Public License
16
+ # // along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ # ////////////////////////////////////////////////////////////////////////////////
18
+ #Last modified: 21/aug/2014 by cassio@ime.usp.br
19
+ #
20
+ # parameters are:
21
+ # $1 exe_file
22
+ # $2 input_file
23
+ # $3 timelimit (limit to run all the repetitions, by default only one repetition)
24
+ # $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
25
+ # $5 maximum allowed memory (in MBytes)
26
+ # $6 maximum allowed output size (in KBytes)
27
+ #
28
+ # the output of the submission should be directed to the standard output
29
+ #
30
+ # the return code show what happened (according to safeexec):
31
+ # 0 ok
32
+ # 1 compile error
33
+ # 2 runtime error
34
+ # 3 timelimit exceeded
35
+ # 4 internal error
36
+ # 5 parameter error
37
+ # 6 internal error
38
+ # 7 memory limit exceeded
39
+ # 8 security threat
40
+ # 9 runtime error
41
+ # other_codes are unknown to boca: in this case BOCA will present the
42
+ # last line of standard output to the judge
43
+
44
+ umask 0022
45
+ id -u bocajail >/dev/null 2>/dev/null
46
+ if [ $? == 0 ]; then
47
+ bocau=$(id -u bocajail)
48
+ bocag=$(id -g bocajail)
49
+ chown bocajail.nogroup .
50
+ else
51
+ bocau=$(id -u nobody)
52
+ bocag=$(id -g nobody)
53
+ chown nobody.nogroup .
54
+ fi
55
+ if [ "$bocau" == "" -o "$bocag" == "" ]; then
56
+ echo "error finding user to run script"
57
+ exit 43
58
+ fi
59
+
60
+ # this script makes use of safeexec to execute the code with less privilegies
61
+ # make sure that directories below are correct.
62
+ sf=$(which safeexec)
63
+ [ -x "$sf" ] || sf=/usr/bin/safeexec
64
+
65
+ if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
66
+ echo "parameter problem"
67
+ exit 43
68
+ fi
69
+ if [ ! -x "$1" ]; then
70
+ echo "$1 not found (or is not in the current dir) or it's not executable"
71
+ exit 44
72
+ fi
73
+ if [ ! -r "$2" ]; then
74
+ echo "$2 not found (or is not in the current dir) or it's not readable"
75
+ exit 45
76
+ fi
77
+ if [ ! -x "$sf" ]; then
78
+ echo "$sf not found or it's not executable"
79
+ exit 46
80
+ fi
81
+
82
+ time=$3
83
+ if [ "$time" -gt "0" ]; then
84
+ let "ttime = $time + 30"
85
+ else
86
+ time=1
87
+ ttime=30
88
+ fi
89
+
90
+ nruns=1
91
+ if [ "$4" != "" ]; then
92
+ if [ "$4" -gt "0" ]; then
93
+ nruns=$4
94
+ fi
95
+ fi
96
+ maxm=512000
97
+ if [ "$5" != "" ]; then
98
+ if [ "$5" -gt "0" ]; then
99
+ maxm=${5}000
100
+ fi
101
+ fi
102
+ maxf=1024
103
+ if [ "$6" != "" ]; then
104
+ if [ "$6" -gt "0" ]; then
105
+ maxf=${6}
106
+ fi
107
+ fi
108
+
109
+ TDIR=$(dirname "$1")
110
+ ls -l ".." >&2
111
+ cp "$2" stdin0 2>/dev/null
112
+ cp "$1" run.exe 2>/dev/null
113
+ cp ../interactor.exe interactor.exe 2>/dev/null
114
+
115
+ file run.exe | grep -iq "statically linked"
116
+ if [ "$?" != "0" ]; then
117
+ echo "Aborting because $1 is not statically linked"
118
+ exit 47
119
+ fi
120
+
121
+ mkfifo fifo.in fifo.out
122
+
123
+ cdir=$(pwd)
124
+ echo "Current directory is $cdir -- chrooting on it" >&2
125
+ #SFCMD=$sf -F10 -f$maxf -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ofifo.out -d$maxm -m$maxm -t$time -T$ttime -ififo.in ./run.exe
126
+
127
+ ### START OF BOCA RUN COMMAND
128
+ ./run.exe >fifo.out <fifo.in &
129
+ SFPID=$!
130
+
131
+ ./interactor.exe "stdin0" "stdout0" <fifo.out >fifo.in 2>stderr0 &
132
+ INTPID=$!
133
+
134
+ wait $SFPID
135
+ ECSF=$?
136
+
137
+ wait $INTPID
138
+ ECINT=$?
139
+
140
+ echo "interactor $INTPID -> $ECINT" >&2
141
+ echo "solution $SFPID -> $ECSF" >&2
142
+
143
+ echo "interactor exitcode $ECINT" >&2
144
+ echo "solution exitcode $ECSF" >&2
145
+ ret=0
146
+
147
+ if [[ $ECINT -ge 1 ]] && [[ $ECINT -le 4 ]]; then
148
+ rm -rf stdout0 2>/dev/null
149
+ ret=0
150
+ elif [[ $ECSF -ne 0 ]]; then
151
+ ret=$ECSF
152
+ elif [[ $ECINT -ne 0 ]]; then
153
+ ret=9
154
+ fi
155
+ ### END OF BOCA RUN COMMAND
156
+
157
+ if [ $ret -gt 10 ]; then
158
+ ret=0
159
+ fi
160
+ if [ -f stdout0 ]; then
161
+ cat stdout0
162
+ fi
163
+ exit $ret
@@ -44,39 +44,39 @@
44
44
  umask 0022
45
45
  id -u bocajail >/dev/null 2>/dev/null
46
46
  if [ $? == 0 ]; then
47
- bocau=`id -u bocajail`
48
- bocag=`id -g bocajail`
49
- chown bocajail.nogroup .
47
+ bocau=$(id -u bocajail)
48
+ bocag=$(id -g bocajail)
49
+ chown bocajail.nogroup .
50
50
  else
51
- bocau=`id -u nobody`
52
- bocag=`id -g nobody`
53
- chown nobody.nogroup .
51
+ bocau=$(id -u nobody)
52
+ bocag=$(id -g nobody)
53
+ chown nobody.nogroup .
54
54
  fi
55
55
  if [ "$bocau" == "" -o "$bocag" == "" ]; then
56
- echo "error finding user to run script"
57
- exit 43
56
+ echo "error finding user to run script"
57
+ exit 43
58
58
  fi
59
59
 
60
60
  # this script makes use of safeexec to execute the code with less privilegies
61
61
  # make sure that directories below are correct.
62
- sf=`which safeexec`
62
+ sf=$(which safeexec)
63
63
  [ -x "$sf" ] || sf=/usr/bin/safeexec
64
64
 
65
65
  if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
66
- echo "parameter problem"
67
- exit 43
66
+ echo "parameter problem"
67
+ exit 43
68
68
  fi
69
69
  if [ ! -x "$1" ]; then
70
- echo "$1 not found (or is not in the current dir) or it's not executable"
71
- exit 44
70
+ echo "$1 not found (or is not in the current dir) or it's not executable"
71
+ exit 44
72
72
  fi
73
73
  if [ ! -r "$2" ]; then
74
- echo "$2 not found (or is not in the current dir) or it's not readable"
75
- exit 45
74
+ echo "$2 not found (or is not in the current dir) or it's not readable"
75
+ exit 45
76
76
  fi
77
77
  if [ ! -x "$sf" ]; then
78
- echo "$sf not found or it's not executable"
79
- exit 46
78
+ echo "$sf not found or it's not executable"
79
+ exit 46
80
80
  fi
81
81
 
82
82
  time=$3
@@ -115,12 +115,12 @@ if [ "$?" != "0" ]; then
115
115
  exit 47
116
116
  fi
117
117
 
118
- cdir=`pwd`
118
+ cdir=$(pwd)
119
119
  echo "Current directory is $cdir -- chrooting on it" >&2
120
120
  "$sf" -F10 -f$maxf -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe
121
121
  ret=$?
122
122
  if [ $ret -gt 10 ]; then
123
- ret=0
123
+ ret=0
124
124
  fi
125
125
  if [ -f stdout0 ]; then
126
126
  cat stdout0
@@ -44,39 +44,39 @@
44
44
  umask 0022
45
45
  id -u bocajail >/dev/null 2>/dev/null
46
46
  if [ $? == 0 ]; then
47
- bocau=`id -u bocajail`
48
- bocag=`id -g bocajail`
49
- chown bocajail.nogroup .
47
+ bocau=$(id -u bocajail)
48
+ bocag=$(id -g bocajail)
49
+ chown bocajail.nogroup .
50
50
  else
51
- bocau=`id -u nobody`
52
- bocag=`id -g nobody`
53
- chown nobody.nogroup .
51
+ bocau=$(id -u nobody)
52
+ bocag=$(id -g nobody)
53
+ chown nobody.nogroup .
54
54
  fi
55
55
  if [ "$bocau" == "" -o "$bocag" == "" ]; then
56
- echo "error finding user to run script"
57
- exit 43
56
+ echo "error finding user to run script"
57
+ exit 43
58
58
  fi
59
59
 
60
60
  # this script makes use of safeexec to execute the code with less privilegies
61
61
  # make sure that directories below are correct.
62
- sf=`which safeexec`
62
+ sf=$(which safeexec)
63
63
  [ -x "$sf" ] || sf=/usr/bin/safeexec
64
64
 
65
65
  if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
66
- echo "parameter problem"
67
- exit 43
66
+ echo "parameter problem"
67
+ exit 43
68
68
  fi
69
69
  if [ ! -x "$1" ]; then
70
- echo "$1 not found (or is not in the current dir) or it's not executable"
71
- exit 44
70
+ echo "$1 not found (or is not in the current dir) or it's not executable"
71
+ exit 44
72
72
  fi
73
73
  if [ ! -r "$2" ]; then
74
- echo "$2 not found (or is not in the current dir) or it's not readable"
75
- exit 45
74
+ echo "$2 not found (or is not in the current dir) or it's not readable"
75
+ exit 45
76
76
  fi
77
77
  if [ ! -x "$sf" ]; then
78
- echo "$sf not found or it's not executable"
79
- exit 46
78
+ echo "$sf not found or it's not executable"
79
+ exit 46
80
80
  fi
81
81
 
82
82
  time=$3
@@ -115,12 +115,12 @@ if [ "$?" != "0" ]; then
115
115
  exit 47
116
116
  fi
117
117
 
118
- cdir=`pwd`
118
+ cdir=$(pwd)
119
119
  echo "Current directory is $cdir -- chrooting on it" >&2
120
120
  "$sf" -F10 -f$maxf -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe
121
121
  ret=$?
122
122
  if [ $ret -gt 10 ]; then
123
- ret=0
123
+ ret=0
124
124
  fi
125
125
  if [ -f stdout0 ]; then
126
126
  cat stdout0
@@ -44,39 +44,39 @@
44
44
  umask 0022
45
45
  id -u bocajail >/dev/null 2>/dev/null
46
46
  if [ $? == 0 ]; then
47
- bocau=`id -u bocajail`
48
- bocag=`id -g bocajail`
49
- chown bocajail.nogroup .
47
+ bocau=$(id -u bocajail)
48
+ bocag=$(id -g bocajail)
49
+ chown bocajail.nogroup .
50
50
  else
51
- bocau=`id -u nobody`
52
- bocag=`id -g nobody`
53
- chown nobody.nogroup .
51
+ bocau=$(id -u nobody)
52
+ bocag=$(id -g nobody)
53
+ chown nobody.nogroup .
54
54
  fi
55
55
  if [ "$bocau" == "" -o "$bocag" == "" ]; then
56
- echo "error finding user to run script"
57
- exit 43
56
+ echo "error finding user to run script"
57
+ exit 43
58
58
  fi
59
59
 
60
60
  # this script makes use of safeexec to execute the code with less privilegies
61
61
  # make sure that directories below are correct.
62
- sf=`which safeexec`
62
+ sf=$(which safeexec)
63
63
  [ -x "$sf" ] || sf=/usr/bin/safeexec
64
64
 
65
65
  if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
66
- echo "parameter problem"
67
- exit 43
66
+ echo "parameter problem"
67
+ exit 43
68
68
  fi
69
69
  if [ ! -x "$1" ]; then
70
- echo "$1 not found (or is not in the current dir) or it's not executable"
71
- exit 44
70
+ echo "$1 not found (or is not in the current dir) or it's not executable"
71
+ exit 44
72
72
  fi
73
73
  if [ ! -r "$2" ]; then
74
- echo "$2 not found (or is not in the current dir) or it's not readable"
75
- exit 45
74
+ echo "$2 not found (or is not in the current dir) or it's not readable"
75
+ exit 45
76
76
  fi
77
77
  if [ ! -x "$sf" ]; then
78
- echo "$sf not found or it's not executable"
79
- exit 46
78
+ echo "$sf not found or it's not executable"
79
+ exit 46
80
80
  fi
81
81
 
82
82
  time=$3
@@ -115,12 +115,12 @@ if [ "$?" != "0" ]; then
115
115
  exit 47
116
116
  fi
117
117
 
118
- cdir=`pwd`
118
+ cdir=$(pwd)
119
119
  echo "Current directory is $cdir -- chrooting on it" >&2
120
120
  "$sf" -F10 -f$maxf -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe
121
121
  ret=$?
122
122
  if [ $ret -gt 10 ]; then
123
- ret=0
123
+ ret=0
124
124
  fi
125
125
  if [ -f stdout0 ]; then
126
126
  cat stdout0
@@ -44,27 +44,27 @@
44
44
  umask 0022
45
45
  id -u bocajail >/dev/null 2>/dev/null
46
46
  if [ $? == 0 ]; then
47
- bocau=`id -u bocajail`
48
- bocag=`id -g bocajail`
49
- chown bocajail.nogroup .
47
+ bocau=$(id -u bocajail)
48
+ bocag=$(id -g bocajail)
49
+ chown bocajail.nogroup .
50
50
  else
51
- bocau=`id -u nobody`
52
- bocag=`id -g nobody`
53
- chown nobody.nogroup .
51
+ bocau=$(id -u nobody)
52
+ bocag=$(id -g nobody)
53
+ chown nobody.nogroup .
54
54
  fi
55
55
  if [ "$bocau" == "" -o "$bocag" == "" ]; then
56
- echo "error finding user to run script"
57
- exit 43
56
+ echo "error finding user to run script"
57
+ exit 43
58
58
  fi
59
59
 
60
60
  # this script makes use of safeexec to execute the code with less privilegies
61
61
  # make sure that directories below are correct.
62
- sf=`which safeexec`
62
+ sf=$(which safeexec)
63
63
  [ -x "$sf" ] || sf=/usr/bin/safeexec
64
64
 
65
65
  if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
66
- echo "parameter problem"
67
- exit 43
66
+ echo "parameter problem"
67
+ exit 43
68
68
  fi
69
69
  if [ -r run.exe ]; then
70
70
  rm -f run.jar
@@ -78,23 +78,23 @@ if [ ! -r run.jar ]; then
78
78
  echo "ERROR: file run.jar not found - possible error during compilation"
79
79
  exit 1
80
80
  fi
81
- name=`basename "$1"`
81
+ name=$(basename "$1")
82
82
  if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then
83
- echo "WARNING: removing .class file extension"
83
+ echo "WARNING: removing .class file extension"
84
84
  fi
85
85
  if [ "${name##*.}" == "class" ]; then
86
- name=`basename "$1" .class`
86
+ name=$(basename "$1" .class)
87
87
  fi
88
88
  if [ "${name##*.}" == "CLASS" ]; then
89
- name=`basename "$1" .CLASS`
89
+ name=$(basename "$1" .CLASS)
90
90
  fi
91
91
  if [ ! -r "$2" ]; then
92
- echo "$2 not found (or is not in the current dir) or it's not readable"
93
- exit 45
92
+ echo "$2 not found (or is not in the current dir) or it's not readable"
93
+ exit 45
94
94
  fi
95
95
  if [ ! -x "$sf" ]; then
96
- echo "$sf not found or it's not executable"
97
- exit 46
96
+ echo "$sf not found or it's not executable"
97
+ exit 46
98
98
  fi
99
99
 
100
100
  time=$3
@@ -128,18 +128,18 @@ fi
128
128
  rm -f runit.retcode 2>/dev/null
129
129
  cp "$2" stdin0 2>/dev/null
130
130
 
131
- cdir=`pwd`
131
+ cdir=$(pwd)
132
132
  echo "Current directory is $cdir" >&2
133
133
  echo $cdir | grep -q "/bocajail"
134
134
  if [ $? == 0 ]; then
135
- cdir=`echo $cdir | sed "s/.*\/bocajail//"`
136
- cat <<EOF > runit.sh
135
+ cdir=$(echo $cdir | sed "s/.*\/bocajail//")
136
+ cat <<EOF >runit.sh
137
137
  #!/bin/bash
138
138
  cd "$cdir"
139
139
  [ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
140
140
  #/bin/mount --bind /dev /dev
141
141
  [ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
142
- java=`which java`
142
+ java=$(which java)
143
143
  [ -x "\$java" ] || java=/usr/bin/java
144
144
  if [ ! -x "\$java" ]; then
145
145
  echo "\$java not found or it's not executable"
@@ -155,38 +155,38 @@ if [ ! -d /bocajail ]; then
155
155
  /bin/umount /sys 2>/dev/null
156
156
  fi
157
157
  EOF
158
- chmod 755 runit.sh
159
- chroot /bocajail "$cdir/runit.sh"
160
- if [ -r runit.retcode ]; then
161
- ret=`cat runit.retcode`
162
- fi
163
- if [ "$ret" == "" ]; then
164
- echo "Execution error - check autojudging"
165
- exit 49
166
- fi
158
+ chmod 755 runit.sh
159
+ chroot /bocajail "$cdir/runit.sh"
160
+ if [ -r runit.retcode ]; then
161
+ ret=$(cat runit.retcode)
162
+ fi
163
+ if [ "$ret" == "" ]; then
164
+ echo "Execution error - check autojudging"
165
+ exit 49
166
+ fi
167
167
  else
168
- echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
169
- echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
170
- echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
171
- java=`which java`
172
- [ -x "$java" ] || java=/usr/bin/java
173
- if [ ! -x "$java" ]; then
174
- echo "$java not found or it's not executable"
175
- exit 47
176
- fi
177
- "$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}K -Xss${maxms}K -Xms${maxm}K "$name"
178
- ret=$?
168
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
169
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
170
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
171
+ java=$(which java)
172
+ [ -x "$java" ] || java=/usr/bin/java
173
+ if [ ! -x "$java" ]; then
174
+ echo "$java not found or it's not executable"
175
+ exit 47
176
+ fi
177
+ "$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}K -Xss${maxms}K -Xms${maxm}K "$name"
178
+ ret=$?
179
179
  fi
180
180
  if [ $ret -gt 10 ]; then
181
- if [ -r stderr0 ]; then
182
- grep -q "not find or load main class" stderr0
183
- if [ $? == 0 ]; then
184
- echo "> > > Nonzero return code - possible class name mismatch - do check < < <"
185
- else
186
- echo "> > > Nonzero return code - possible runtime error - do check < < <"
187
- fi
188
- ret=9
181
+ if [ -r stderr0 ]; then
182
+ grep -q "not find or load main class" stderr0
183
+ if [ $? == 0 ]; then
184
+ echo "> > > Nonzero return code - possible class name mismatch - do check < < <"
185
+ else
186
+ echo "> > > Nonzero return code - possible runtime error - do check < < <"
189
187
  fi
188
+ ret=9
189
+ fi
190
190
  fi
191
191
  if [ -f stdout0 ]; then
192
192
  cat stdout0
@@ -44,27 +44,27 @@
44
44
  umask 0022
45
45
  id -u bocajail >/dev/null 2>/dev/null
46
46
  if [ $? == 0 ]; then
47
- bocau=`id -u bocajail`
48
- bocag=`id -g bocajail`
49
- chown bocajail.nogroup .
47
+ bocau=$(id -u bocajail)
48
+ bocag=$(id -g bocajail)
49
+ chown bocajail.nogroup .
50
50
  else
51
- bocau=`id -u nobody`
52
- bocag=`id -g nobody`
53
- chown nobody.nogroup .
51
+ bocau=$(id -u nobody)
52
+ bocag=$(id -g nobody)
53
+ chown nobody.nogroup .
54
54
  fi
55
55
  if [ "$bocau" == "" -o "$bocag" == "" ]; then
56
- echo "error finding user to run script"
57
- exit 43
56
+ echo "error finding user to run script"
57
+ exit 43
58
58
  fi
59
59
 
60
60
  # this script makes use of safeexec to execute the code with less privilegies
61
61
  # make sure that directories below are correct.
62
- sf=`which safeexec`
62
+ sf=$(which safeexec)
63
63
  [ -x "$sf" ] || sf=/usr/bin/safeexec
64
64
 
65
65
  if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
66
- echo "parameter problem"
67
- exit 43
66
+ echo "parameter problem"
67
+ exit 43
68
68
  fi
69
69
  if [ -r run.exe ]; then
70
70
  rm -f run.jar
@@ -78,23 +78,23 @@ if [ ! -r run.jar ]; then
78
78
  echo "ERROR: file run.jar not found - possible error during compilation"
79
79
  exit 1
80
80
  fi
81
- name=`basename "$1"`
81
+ name=$(basename "$1")
82
82
  if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then
83
- echo "WARNING: removing .class file extension"
83
+ echo "WARNING: removing .class file extension"
84
84
  fi
85
85
  if [ "${name##*.}" == "class" ]; then
86
- name=`basename "$1" .class`
86
+ name=$(basename "$1" .class)
87
87
  fi
88
88
  if [ "${name##*.}" == "CLASS" ]; then
89
- name=`basename "$1" .CLASS`
89
+ name=$(basename "$1" .CLASS)
90
90
  fi
91
91
  if [ ! -r "$2" ]; then
92
- echo "$2 not found (or is not in the current dir) or it's not readable"
93
- exit 45
92
+ echo "$2 not found (or is not in the current dir) or it's not readable"
93
+ exit 45
94
94
  fi
95
95
  if [ ! -x "$sf" ]; then
96
- echo "$sf not found or it's not executable"
97
- exit 46
96
+ echo "$sf not found or it's not executable"
97
+ exit 46
98
98
  fi
99
99
 
100
100
  time=$3
@@ -128,7 +128,7 @@ fi
128
128
  rm -f runit.retcode 2>/dev/null
129
129
  cp "$2" stdin0 2>/dev/null
130
130
 
131
- cdir=`pwd`
131
+ cdir=$(pwd)
132
132
  echo "Current directory is $cdir" >&2
133
133
  echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
134
134
  echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
@@ -136,22 +136,22 @@ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
136
136
  kotlin=/snap/kotlin/24/bin/kotlin
137
137
  [ -x "$kotlin" ] || kotlin=/usr/bin/kotlin
138
138
  if [ ! -x "$kotlin" ]; then
139
- echo "$kotlin not found or it's not executable"
140
- exit 47
139
+ echo "$kotlin not found or it's not executable"
140
+ exit 47
141
141
  fi
142
142
  "$sf" -r$nruns -t$time -T$ttime -istdin0 -F512 -u512 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d40000000000 -m40000000000 -- "$kotlin" -cp run.jar -J-Xmx${maxm}K -J-Xss${maxms}K -J-Xms${maxm}K "$name"
143
143
  #"$kotlin" -cp run.jar -J-Xmx${maxm}K -J-Xss${maxms}K -J-Xms${maxm}K "$name"
144
144
  ret=$?
145
145
  if [ $ret -gt 10 ]; then
146
- if [ -r stderr0 ]; then
147
- grep -q "not find or load main class" stderr0
148
- if [ $? == 0 ]; then
149
- echo "> > > Nonzero return code - possible class name mismatch - do check < < <"
150
- else
151
- echo "> > > Nonzero return code - possible runtime error - do check < < <"
152
- fi
153
- ret=9
146
+ if [ -r stderr0 ]; then
147
+ grep -q "not find or load main class" stderr0
148
+ if [ $? == 0 ]; then
149
+ echo "> > > Nonzero return code - possible class name mismatch - do check < < <"
150
+ else
151
+ echo "> > > Nonzero return code - possible runtime error - do check < < <"
154
152
  fi
153
+ ret=9
154
+ fi
155
155
  fi
156
156
  if [ -f stdout0 ]; then
157
157
  cat stdout0