Skip to content

Commit 597497f

Browse files
committed
Use relative path for vm state directory
Prevents socket paths becoming too long when the resolved current working directory differs from the given bundle path, for example current working directory resolving to `/private/var/...` but the bundle directory reported as `/var/...`. The vm state directory does not need to be associated with a specific bundle and the working directory assigned to the shim is sufficient as the parent for the vm state directory. Signed-off-by: Derek McGowan <derek@mcg.dev>
1 parent fc08ecd commit 597497f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/shim/task/service.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ *
207207
}
208208
b.AddExtraFile(nwcfg.Filename, nwJSON)
209209

210-
vmState := filepath.Join(r.Bundle, "vm")
210+
// vmState directory should be relative path to current working directory, not specific to a single bundle
211+
vmState, err := filepath.Abs("vm")
212+
if err != nil {
213+
return nil, errgrpc.ToGRPCf(err, "failed to resolve vm state directory")
214+
}
211215
if err := os.Mkdir(vmState, 0700); err != nil {
212216
return nil, errgrpc.ToGRPCf(err, "failed to create vm state directory %q", vmState)
213217
}

0 commit comments

Comments
 (0)