Skip to content

Commit 3fe7c0a

Browse files
authored
fix: drop workDir-adjacent chroot-home mount on split-fs sysroot (#5857)
1 parent b7ededb commit 3fe7c0a

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

src/compose-generator.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,5 +541,21 @@ describe('generateDockerCompose', () => {
541541
expect(volumes).toContain('/dev:/host/dev:ro');
542542
expect(volumes).toContain('sysroot:/host:rw');
543543
});
544+
545+
it('drops the workDir-adjacent chroot-home bind mount on split-fs', () => {
546+
const config = {
547+
...mockConfig,
548+
runnerTopology: 'arc-dind' as const,
549+
workDir: '/tmp/awf-12345',
550+
};
551+
const result = generateDockerCompose(config, mockNetworkConfig);
552+
const volumes = result.services.agent.volumes as string[];
553+
554+
// The empty-home mount is sourced from `${workDir}-chroot-home`, a sibling
555+
// of workDir under the runner's /tmp that the DinD daemon cannot see.
556+
expect(volumes.some(v => v.split(':')[0] === '/tmp/awf-12345-chroot-home')).toBe(false);
557+
expect(volumes.some(v => v.split(':')[0].startsWith('/tmp/awf-12345'))).toBe(false);
558+
});
544559
});
545560
});
561+

src/services/optional-services.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,16 @@ function filterAgentVolumesForSysroot(
7070
// Drop sysroot-shadowed targets (system binaries provided by volume)
7171
if (sysrootShadowedTargets.has(target)) return false;
7272

73-
// Drop mounts sourced from AWF workDir (runner's unshared /tmp/awf-*)
74-
if (source === normalizedWorkDirPrefix || source.startsWith(`${normalizedWorkDirPrefix}/`)) {
73+
// Drop mounts sourced from AWF workDir (runner's unshared /tmp/awf-*).
74+
// Matches: the workDir itself, paths under it (`workDir/…`), and the known
75+
// sibling pattern `workDir-…` (e.g. `${workDir}-chroot-home`). Using three
76+
// explicit conditions avoids dropping unrelated bind mounts when workDir is
77+
// configured to a short or non-unique prefix.
78+
if (
79+
source === normalizedWorkDirPrefix ||
80+
source.startsWith(normalizedWorkDirPrefix + '/') ||
81+
source.startsWith(normalizedWorkDirPrefix + '-')
82+
) {
7583
return false;
7684
}
7785
// Drop home dot-directory mounts (e.g. .cache, .config) — sysroot provides them.

0 commit comments

Comments
 (0)