Use pkgdir inside isolate sandbox to account for packages that have been built with a custom PREFIX

closes #686
This commit is contained in:
Omar Brikaa 2024-09-15 20:48:45 +03:00
parent ecdced9ee7
commit c4afd97a38
2 changed files with 4 additions and 5 deletions

View File

@ -157,7 +157,7 @@ class Job {
'-c', '-c',
'/box/submission', '/box/submission',
'-e', '-e',
`--dir=/runtime=${this.runtime.pkgdir}`, `--dir=${this.runtime.pkgdir}`,
`--dir=/etc:noexec`, `--dir=/etc:noexec`,
`--processes=${this.runtime.max_process_count}`, `--processes=${this.runtime.max_process_count}`,
`--open-files=${this.runtime.max_open_files}`, `--open-files=${this.runtime.max_open_files}`,
@ -171,7 +171,7 @@ class Job {
...(config.disable_networking ? [] : ['--share-net']), ...(config.disable_networking ? [] : ['--share-net']),
'--', '--',
'/bin/bash', '/bin/bash',
file, path.join(this.runtime.pkgdir, file),
...args, ...args,
], ],
{ {
@ -365,7 +365,7 @@ class Job {
emit_event_bus_stage('compile'); emit_event_bus_stage('compile');
compile = await this.safe_call( compile = await this.safe_call(
box, box,
'/runtime/compile', 'compile',
code_files.map(x => x.name), code_files.map(x => x.name),
this.timeouts.compile, this.timeouts.compile,
this.cpu_times.compile, this.cpu_times.compile,
@ -390,7 +390,7 @@ class Job {
emit_event_bus_stage('run'); emit_event_bus_stage('run');
run = await this.safe_call( run = await this.safe_call(
box, box,
'/runtime/run', 'run',
[code_files[0].name, ...this.args], [code_files[0].name, ...this.args],
this.timeouts.run, this.timeouts.run,
this.cpu_times.run, this.cpu_times.run,

View File

@ -185,7 +185,6 @@ class Runtime {
.split('\n') .split('\n')
.map(line => line.split('=', 2)) .map(line => line.split('=', 2))
.forEach(([key, val]) => { .forEach(([key, val]) => {
val = val.replace_all(this.pkgdir, '/runtime');
this._env_vars[key.trim()] = val.trim(); this._env_vars[key.trim()] = val.trim();
}); });
} }