aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatt Godbolt <matt@godbolt.org>2024-02-04 13:53:50 -0600
committerGitHub <noreply@github.com>2024-02-04 13:53:50 -0600
commit01b7992ada0fcad7223a47af2c5e4fabf0e55e4c (patch)
treebccafe2264fb5cad9e150a663c68ad0e0c99b249 /test
parentc26a2924fce6eba73a6c8f1180dcb0e8222e5887 (diff)
downloadcompiler-explorer-01b7992ada0fcad7223a47af2c5e4fabf0e55e4c.tar.gz
compiler-explorer-01b7992ada0fcad7223a47af2c5e4fabf0e55e4c.zip
Fix nsjail environment variables that need mapping to destination paths (#6084)gh-10443
Maps env vars just like we map everything else, to catch all cases where "app dir" is an input to jailed processes, the jailed process only sees the "right" path (`/app/something`). Tested locally and fixes the dot net "read only `/nosym`" thing while keeping the `/nosym` behaviour etc
Diffstat (limited to 'test')
-rw-r--r--test/exec-tests.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/exec-tests.ts b/test/exec-tests.ts
index 21821736b..e5053043f 100644
--- a/test/exec-tests.ts
+++ b/test/exec-tests.ts
@@ -329,6 +329,26 @@ describe('Execution tests', () => {
'./output.s',
]);
});
+ it('Should remap env vars', () => {
+ const {args, options} = exec.getSandboxNsjailOptions('/tmp/hellow/output.s', [], {
+ customCwd: '/tmp/hellow',
+ env: {SOME_DOTNET_THING: '/tmp/hellow/dotnet'},
+ });
+
+ options.should.deep.equals({});
+ args.should.deep.equals([
+ '--config',
+ 'etc/nsjail/sandbox.cfg',
+ '--cwd',
+ '/app',
+ '--bindmount',
+ '/tmp/hellow:/app',
+ '--env=SOME_DOTNET_THING=/app/dotnet',
+ '--env=HOME=/app',
+ '--',
+ './output.s',
+ ]);
+ });
it('Subdirectory', () => {
const {args, options} = exec.getSandboxNsjailOptions('/tmp/hellow/subdir/output.s', [], {