From c4afd97a38013f7062a51a13f32802c6266fb089 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Sun, 15 Sep 2024 20:48:45 +0300 Subject: [PATCH] Use pkgdir inside isolate sandbox to account for packages that have been built with a custom PREFIX closes #686 --- api/src/job.js | 8 ++++---- api/src/runtime.js | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/api/src/job.js b/api/src/job.js index 881aa9f..d46120b 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -157,7 +157,7 @@ class Job { '-c', '/box/submission', '-e', - `--dir=/runtime=${this.runtime.pkgdir}`, + `--dir=${this.runtime.pkgdir}`, `--dir=/etc:noexec`, `--processes=${this.runtime.max_process_count}`, `--open-files=${this.runtime.max_open_files}`, @@ -171,7 +171,7 @@ class Job { ...(config.disable_networking ? [] : ['--share-net']), '--', '/bin/bash', - file, + path.join(this.runtime.pkgdir, file), ...args, ], { @@ -365,7 +365,7 @@ class Job { emit_event_bus_stage('compile'); compile = await this.safe_call( box, - '/runtime/compile', + 'compile', code_files.map(x => x.name), this.timeouts.compile, this.cpu_times.compile, @@ -390,7 +390,7 @@ class Job { emit_event_bus_stage('run'); run = await this.safe_call( box, - '/runtime/run', + 'run', [code_files[0].name, ...this.args], this.timeouts.run, this.cpu_times.run, diff --git a/api/src/runtime.js b/api/src/runtime.js index 1d4a8fc..9a2adf4 100644 --- a/api/src/runtime.js +++ b/api/src/runtime.js @@ -185,7 +185,6 @@ class Runtime { .split('\n') .map(line => line.split('=', 2)) .forEach(([key, val]) => { - val = val.replace_all(this.pkgdir, '/runtime'); this._env_vars[key.trim()] = val.trim(); }); }