Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pkg/defaults/defaults_darwin.go
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All the paths should be handled consistently, not just DataRoot

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in a5cdb0d. I applied the same root/non-root + XDG convention consistently to DataRoot, CNINetConfPath, CNIRuntimeDir, NerdctlTOML, HostsDirs, and CDISpecDirs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably (most of) defaults_darwin.go and defaults_freebsd.go can be consolidated into a single defaults_unix.go

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@

package defaults

import gocni "github.com/containerd/go-cni"
import (
"os"
"path/filepath"

gocni "github.com/containerd/go-cni"
)

const (
AppArmorProfileName = ""
Expand All @@ -41,6 +46,9 @@ func CNINetConfPath() string {
}

func DataRoot() string {
if home, err := os.UserHomeDir(); err == nil && home != "" {
return filepath.Join(home, ".local", "share", "nerdctl")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

$XDG_DATA_HOME should be respected

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in a5cdb0d. For non-root on Darwin, DataRoot now respects XDG_DATA_HOME (fallback: ~/.local/share).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The convention should be consistent with nerdbox.
Let me cc @containerd/nerdbox-committers @containerd/nerdbox-reviewers

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in a5cdb0d. Updated Darwin defaults to follow the same user-writable/XDG convention consistently across paths for non-root, while keeping system defaults for root.

}
return "/var/lib/nerdctl"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should remain the default when EUID is 0

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in a5cdb0d. DataRoot now keeps /var/lib/nerdctl when EUID == 0.

}

Expand Down
Loading