Skip to content

Comments

demo: fix socket location for bazel sandbox#187

Merged
benbardin merged 1 commit intomasterfrom
sockets
Sep 4, 2025
Merged

demo: fix socket location for bazel sandbox#187
benbardin merged 1 commit intomasterfrom
sockets

Conversation

@benbardin
Copy link
Contributor

This resolves a failure when demo mode tried to start a socket in $HOME without permissions.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rickystewart)


testserver/testservernode.go line 145 at r1 (raw file):

	if ts.serverArgs.demoMode {
		// Prefer a very short path to stay under Unix-domain socket length limits.
		preferred := filepath.Join("/tmp", fmt.Sprintf("cd-%d", os.Getpid()))

[nit] We should use os.MkdirTemp


testserver/testservernode.go line 148 at r1 (raw file):

		demoHome := preferred
		if err := os.MkdirAll(demoHome, 0700); err != nil {
			log.Printf("%s: /tmp not writable for demo HOME (%v); falling back to base dir %s", testserverMessagePrefix, err, ts.baseDir)

Is this necessary (did you see this error under bazel)?

This resolves a failure when demo mode tried to start a socket in $HOME without
permissions.
@benbardin
Copy link
Contributor Author

Switched to os.MkdirTemp and removed the fallback, as you're right - it is not necessary. Thanks!

@benbardin benbardin merged commit 379e970 into master Sep 4, 2025
3 checks passed
@benbardin benbardin deleted the sockets branch September 4, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants