Skip to content

Commit 2ec2c99

Browse files
sarg3ntclaude
andcommitted
address Copilot review findings on PR #145
- Pin busybox by image-index digest (sha256:19b646668802469d968a05342a601e78da4322a414a7c09b1c9ee25165042138) so the build is reproducible across upstream tag rebuilds. buildx multi-arch resolver picks the right platform manifest from the index automatically. Verified busybox 1.37.0's nsenter applet supports -t/--target, -m/--mount, -u/--uts, -i/--ipc, -n/--net, -p/--pid — the exact flags SpawnNsenter emits. - Restore /proc/1/root/usr/sbin/nsenter and /proc/1/root/sbin/nsenter to the candidate list so the host-fallback search mirrors the container-local list (which already includes /usr/sbin and /sbin). - "binary not found" error now reports the actual list searched (built from the candidates slice) instead of the stale "/proc/1/root and /usr/bin" string. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2d67ec8 commit 2ec2c99

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

gearbox-agent/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ COPY --from=go-builder --chown=65532:65532 /var/lib/gearbox-agent /var/lib/gearb
4646
# mount namespace. busybox is statically linked, ~1MB, and dispatches
4747
# applets by argv[0], so dropping it in as /usr/bin/nsenter is enough.
4848
# Operators not running host-exec mode pay only the 1MB image cost.
49-
COPY --from=busybox:1.37.0-musl /bin/busybox /usr/bin/nsenter
49+
#
50+
# Pinned by index digest (not just tag) so the build is reproducible
51+
# across busybox tag rebuilds. The buildx multi-arch resolver picks
52+
# the right platform manifest from this index automatically. busybox
53+
# 1.37.0's nsenter applet supports -t/--target, -m/--mount,
54+
# -u/--uts, -i/--ipc, -n/--net, -p/--pid (which is what SpawnNsenter
55+
# emits); verified against the upstream applet list before pinning.
56+
COPY --from=busybox:1.37.0-musl@sha256:19b646668802469d968a05342a601e78da4322a414a7c09b1c9ee25165042138 /bin/busybox /usr/bin/nsenter
5057

5158
# Expose API port
5259
EXPOSE 8405

gearbox-agent/internal/api/console/pty/nsenter_linux.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,12 @@ var nsenterCandidates = []string{
132132
"/sbin/nsenter",
133133
// Host fallback via /proc/1/root — only loads when libc paths
134134
// happen to line up. Kept for completeness; never relied on.
135+
// Mirrors the container-local list (incl. sbin) so non-distroless
136+
// agent flavors that match host layout get parity coverage.
135137
"/proc/1/root/usr/bin/nsenter",
136138
"/proc/1/root/bin/nsenter",
139+
"/proc/1/root/usr/sbin/nsenter",
140+
"/proc/1/root/sbin/nsenter",
137141
}
138142

139143
// resolveHostNsenter returns the first reachable nsenter binary path,
@@ -171,7 +175,7 @@ func SpawnNsenter(ctx context.Context, command []string, runAs string, cols, row
171175
}
172176
nsenterBin := resolveHostNsenter()
173177
if nsenterBin == "" {
174-
return nil, errors.New("nsenter: binary not found (looked under /proc/1/root and /usr/bin)")
178+
return nil, fmt.Errorf("nsenter: binary not found (searched %v)", nsenterCandidates)
175179
}
176180
argv := append([]string{
177181
nsenterBin,

0 commit comments

Comments
 (0)