refactor: hardcode sandbox tempdir as /tmp
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
|
||||
const (
|
||||
recordVisibleHome = "/home/test"
|
||||
recordVisibleTmp = "/tmp"
|
||||
recordGitDate = "2024-01-01T00:00:00Z"
|
||||
)
|
||||
|
||||
|
||||
@@ -60,11 +60,9 @@ func buildRecordShellScript() string {
|
||||
var body bytes.Buffer
|
||||
if err := recordShellTemplate.Execute(&body, struct {
|
||||
VisibleHome string
|
||||
VisibleTmp string
|
||||
GitDate string
|
||||
}{
|
||||
VisibleHome: shQuote(recordVisibleHome),
|
||||
VisibleTmp: shQuote(recordVisibleTmp),
|
||||
GitDate: shQuote(recordGitDate),
|
||||
}); err != nil {
|
||||
panic(fmt.Sprintf("render record shell template: %v", err))
|
||||
|
||||
@@ -19,7 +19,7 @@ exec bwrap \
|
||||
--ro-bind / / \
|
||||
--tmpfs /home \
|
||||
--bind "$host_home" {{ .VisibleHome }} \
|
||||
--bind "$host_tmp" {{ .VisibleTmp }} \
|
||||
--bind "$host_tmp" '/tmp' \
|
||||
--dev /dev \
|
||||
--proc /proc \
|
||||
--unshare-pid \
|
||||
@@ -36,7 +36,7 @@ exec bwrap \
|
||||
--setenv PATH "$path_env" \
|
||||
--setenv PS1 '$ ' \
|
||||
--setenv TERM 'xterm-256color' \
|
||||
--setenv TMPDIR {{ .VisibleTmp }} \
|
||||
--setenv TMPDIR '/tmp' \
|
||||
--setenv TZ 'UTC' \
|
||||
--chdir {{ .VisibleHome }} \
|
||||
bash --noprofile --norc -i
|
||||
|
||||
@@ -172,7 +172,7 @@ func TestBuildRecordShellScriptUsesExpectedCommands(t *testing.T) {
|
||||
"path_env=${MIRO_RECORD_PATH_ENV:?}",
|
||||
"HOME=\"$host_home\" GIT_CONFIG_NOSYSTEM=1 git config --global user.name 'Miro Test'",
|
||||
"--bind \"$host_home\" " + shQuote(recordVisibleHome),
|
||||
"--bind \"$host_tmp\" " + shQuote(recordVisibleTmp),
|
||||
"--bind \"$host_tmp\" '/tmp'",
|
||||
"--setenv HOME " + shQuote(recordVisibleHome),
|
||||
"--setenv PATH \"$path_env\"",
|
||||
"--setenv PS1 '$ '",
|
||||
@@ -234,7 +234,7 @@ func TestRunRecordSessionUsesSandboxedScriptCommand(t *testing.T) {
|
||||
"--ro-bind / /",
|
||||
"--tmpfs /home",
|
||||
"--setenv HOME " + shQuote(recordVisibleHome),
|
||||
"--setenv TMPDIR " + shQuote(recordVisibleTmp),
|
||||
"--setenv TMPDIR '/tmp'",
|
||||
"bash --noprofile --norc -i",
|
||||
} {
|
||||
if !strings.Contains(body, want) {
|
||||
|
||||
Reference in New Issue
Block a user