From 9c6d07495c70fcf49f816ce2df4b9f6647a1ba43 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Sat, 25 May 2024 01:15:28 +0200 Subject: [PATCH] Revert "try to copy the cache" This reverts commit 9883edd9118da0a082934d1b1dc0512e9833bda8. --- backend/src/sandbox.rs | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/backend/src/sandbox.rs b/backend/src/sandbox.rs index 7b2bfc6..ebcfe25 100644 --- a/backend/src/sandbox.rs +++ b/backend/src/sandbox.rs @@ -78,24 +78,6 @@ fn home_dir(uid: u32) -> Vec { ] } -fn copy_cache(uid: u32) -> (TempDir, Vec) { - let cache_dir = format!("/run/user/{uid}/home/.cache/hare"); - let tmp_cache_dir = tempfile::tempdir().unwrap(); - - let src_dir = "/root/.cache/hare/usr"; - let opts = fs_extra::dir::CopyOptions::new(); - fs_extra::copy_items(&[src_dir], tmp_cache_dir.path(), &opts).unwrap(); - - let tmp_cache_dir_path = tmp_cache_dir.path().display().to_string(); - - (tmp_cache_dir, - vec![ - "--bind".to_string(), - tmp_cache_dir_path, - cache_dir, - ]) -} - fn shared_app_dir() -> (TempDir, Vec) { let tmp_app_dir = tempfile::tempdir().unwrap(); let app_dir_path = tmp_app_dir.path().display().to_string(); @@ -117,7 +99,6 @@ fn command(app_file: &str) -> Vec { "/usr/bin/timeout".to_string(), DEFAULT_TIMEOUT.to_string(), HARE_COMMAND.to_string(), "run".to_string(), - "-v".to_string(), app_file.to_string(), ] } @@ -138,9 +119,6 @@ pub fn run_code(code: &str) -> std::process::Output { let home_args = home_dir(uid); bwrap_cmd.args(home_args); - let (_cache_dir, cache_args) = copy_cache(uid); - bwrap_cmd.args(cache_args); - let (_passwd, _group, file_args) = passwd_files(uid, gid); bwrap_cmd.args(file_args);