aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/pkg.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-03-26 15:00:25 +0900
committerOphestra <cat@gensokyo.uk>2026-03-26 15:05:04 +0900
commite661260607573009d0f7b0cbcbb8ee561fc08f3f (patch)
tree8a4f1393ed289acc023add65ba42eaf7b701b4f6 /internal/pkg/pkg.go
parent044490e0a521036ce10fed0b6813a8ff912237b5 (diff)
internal/pkg: enter exec container
This enables much easier troubleshooting of failing cures. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/pkg.go')
-rw-r--r--internal/pkg/pkg.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go
index 9a8dc9fd..a8fb91ba 100644
--- a/internal/pkg/pkg.go
+++ b/internal/pkg/pkg.go
@@ -22,6 +22,7 @@ import (
"slices"
"strings"
"sync"
+ "sync/atomic"
"syscall"
"testing"
"unique"
@@ -466,6 +467,11 @@ const (
// pathnames allocated during [Cache.Cure].
dirTemp = "temp"
+ // dirExecScratch is the directory name appended to Cache.base for scratch
+ // space setting up the container started by [Cache.EnterExec]. Exclusivity
+ // via Cache.inExec.
+ dirExecScratch = "scratch"
+
// checksumLinknamePrefix is prepended to the encoded [Checksum] value
// of an [Artifact] when creating a symbolic link to dirChecksum.
checksumLinknamePrefix = "../" + dirChecksum + "/"
@@ -481,7 +487,7 @@ type cureRes struct {
// subject to the cures limit. Values pointed to by result addresses are safe
// to access after the [sync.WaitGroup] associated with this pendingArtifactDep
// is done. pendingArtifactDep must not be reused or modified after it is sent
-// to Cache.cureDep.
+// to cure.
type pendingArtifactDep struct {
// Dependency artifact populated during [Cache.Cure].
a Artifact
@@ -553,6 +559,9 @@ type Cache struct {
unlock func()
// Synchronises calls to Close.
closeOnce sync.Once
+
+ // Whether EnterExec has not yet returned.
+ inExec atomic.Bool
}
// IsStrict returns whether the [Cache] strictly verifies checksums.