Группа :: Сети/WWW
Пакет: jobe
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: jobe-alt-fixes.patch
Скачать
Скачать
diff --git a/application/config/config.php b/application/config/config.php
index b2ab664..4aaa3c3 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -547,7 +547,8 @@ $ncpu = count($matches[0]);
$config['jobe_max_users'] = $ncpu;
$config['jobe_wait_timeout'] = 10; // Max number of secs to wait for a free Jobe user.
$config['cputime_upper_limit_secs'] = 50;
-$config['clean_up_path'] = '/tmp;/var/tmp;/var/crash;/run/lock;/var/lock';
+#$config['clean_up_path'] = '/tmp;/var/tmp;/var/crash;/run/lock;/var/lock';
+$config['clean_up_path'] = '/var/lib/jobe';
$config['debugging'] = FALSE;
$config['python3_version'] = 'python3'; # /usr/bin/<python3_version> is the python to run
// NB: if you modify the python3_version configuration you will also need to
diff --git a/application/controllers/Restapi.php b/application/controllers/Restapi.php
index f26b9d4..a78e2d7 100644
--- a/application/controllers/Restapi.php
+++ b/application/controllers/Restapi.php
@@ -174,7 +174,7 @@ class Restapi extends REST_Controller {
// Get the the request languages and check it.
$language = $run->language_id;
- if (!array_key_exists($language, $this->languages)) {
+ if (!isset($language, $this->languages)) {
$this->response("Language '$language' is not known", 400);
}
$reqdTaskClass = ucwords($language) . '_Task';
diff --git a/application/libraries/LanguageTask.php b/application/libraries/LanguageTask.php
index 4193c9d..05033d6 100644
--- a/application/libraries/LanguageTask.php
+++ b/application/libraries/LanguageTask.php
@@ -105,7 +105,7 @@ abstract class Task {
// to hoover up other students' submissions.
public function prepare_execution_environment($sourceCode) {
// Create the temporary directory that will be used.
- $this->workdir = tempnam("/home/jobe/runs", "jobe_");
+ $this->workdir = tempnam("/var/lib/jobe/runs", "jobe_");
if (!unlink($this->workdir) || !mkdir($this->workdir)) {
log_message('error', 'LanguageTask constructor: error making temp directory');
throw new Exception("Task: error making temp directory (race error?)");
@@ -184,7 +184,7 @@ abstract class Task {
if ($deleteFiles && $this->workdir) {
$dir = $this->workdir;
- exec("sudo rm -R $dir");
+ exec("sudo /bin/rm -R $dir");
$this->workdir = null;
}
}
@@ -281,7 +281,7 @@ abstract class Task {
$killtime = 2 * $cputime; // Kill the job after twice the allowed cpu time
$numProcs = $this->getParam('numprocs', $iscompile) + 1; // The + 1 allows for the sh command below.
$sandboxCommandBits = array(
- "sudo " . dirname(__FILE__) . "/../../runguard/runguard",
+ "sudo /var/www/webapps/jobe/runguard/runguard",
"--user={$this->user}",
"--group=jobe",
"--cputime=$cputime", // Seconds of execution time allowed
diff --git a/application/libraries/filecache.php b/application/libraries/filecache.php
index d391150..6852e17 100644
--- a/application/libraries/filecache.php
+++ b/application/libraries/filecache.php
@@ -32,7 +32,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-define('FILE_CACHE_BASE', '/home/jobe/files');
+define('FILE_CACHE_BASE', '/var/lib/jobe/files');
define('MD5_PATTERN', '/[0-9abcdef]{32}/');
define('MAX_PERCENT_FULL', 0.95);
define('TESTING_FILE_CACHE_CLEAR', false);
diff --git a/runguard/runguard-config.h b/runguard/runguard-config.h
index b899f12..ef43be8 100644
--- a/runguard/runguard-config.h
+++ b/runguard/runguard-config.h
@@ -13,6 +13,6 @@
#define VALID_USERS "domjudge,jobe,jobe00,jobe01,jobe02,jobe03,jobe04,jobe05,jobe06,jobe07,jobe08,jobe09,jobe10,jobe11,jobe12,jobe13,jobe14,jobe15,jobe16,jobe17,jobe18,jobe19"
-#define CHROOT_PREFIX "/var/www/jobe/chrootjail"
+#define CHROOT_PREFIX "/var/lib/jobe/chrootjail"
#endif /* _RUNGUARD_CONFIG_ */
diff --git a/testsubmit.py b/testsubmit.py
index f24a70c..692888b 100755
--- a/testsubmit.py
+++ b/testsubmit.py
@@ -44,7 +44,7 @@ from base64 import b64encode
API_KEY = '2AAA7A5415B4A9B394B54BF1D2E9D' # A working (100/hr) key on Jobe2
DEBUGGING = False # If true, all runs are saved on the Jobe server. Not recommended (there are lots!)
-RUNS_RESOURCE = '/jobe/index.php/restapi/runs/'
+RUNS_RESOURCE = '/index.php/restapi/runs/'
# The next constant controls the maximum number of parallel submissions to
# throw at Jobe at once. Numbers less than or equal to the number of Jobe
@@ -203,7 +203,7 @@ def check_code(s):
env = os.environ.copy()
os.mkdir('Home')
env['HOME'] = os.getcwd() + '/Home'
- result = subprocess.check_output(['pylint', '--reports=no', 'source.py'],
+ result = subprocess.check_output(['pylint.py3', '--reports=no', 'source.py'],
universal_newlines=True, stderr=subprocess.STDOUT, env=env)
# Fix problem with versions of pylint that insist on telling you
# what config file they're using
@@ -246,7 +246,7 @@ def check_code(s):
env = os.environ.copy()
os.mkdir('Home')
env['HOME'] = os.getcwd() + '/Home'
- result = subprocess.check_output(['pylint', '--reports=no', 'source.py'],
+ result = subprocess.check_output(['pylint.py3', '--reports=no', 'source.py'],
universal_newlines=True, stderr=subprocess.STDOUT, env=env)
# Fix problem with versions of pylint that insist on telling you
# what config file they're using
@@ -771,7 +771,7 @@ def check_file(file_id):
Returns status: 204 denotes file exists, 404 denotes file not found.
'''
- resource = '/jobe/index.php/restapi/files/' + file_id
+ resource = '/index.php/restapi/files/' + file_id
headers = {"Accept": "text/plain"}
try:
connect = http_request('HEAD', resource, '', headers)
@@ -800,7 +800,7 @@ def put_file(file_desc):
file_id, contents = file_desc
contentsb64 = b64encode(contents.encode('utf8')).decode(encoding='UTF-8')
data = json.dumps({ 'file_contents' : contentsb64 })
- resource = '/jobe/index.php/restapi/files/' + file_id
+ resource = '/index.php/restapi/files/' + file_id
headers = {"Content-type": "application/json",
"Accept": "text/plain"}
connect = http_request('PUT', resource, data, headers)
@@ -949,7 +949,7 @@ def display_result(comment, ro):
def do_get_languages():
"""List all languages available on the jobe server"""
output("Supported languages:")
- resource = '/jobe/index.php/restapi/languages'
+ resource = '/index.php/restapi/languages'
ok, lang_versions = do_http('GET', resource)
if not ok:
output("**** An exception occurred when getting languages ****")