From 6d015a949e27f20c86409c7d78053f0b0493f165 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 17 Mar 2026 15:35:58 +0900 Subject: check: move from container This package is not container specific, and widely used across the project. Signed-off-by: Ophestra --- check/absolute.go | 132 ++++++++++++ check/absolute_test.go | 401 +++++++++++++++++++++++++++++++++++ check/overlay.go | 30 +++ check/overlay_test.go | 31 +++ cmd/hakurei/command.go | 2 +- cmd/hakurei/parse_test.go | 2 +- cmd/hakurei/print_test.go | 2 +- cmd/mbf/main.go | 2 +- cmd/sharefs/fuse.go | 2 +- cmd/sharefs/fuse_test.go | 2 +- container/autoetc.go | 2 +- container/autoetc_test.go | 2 +- container/autoroot.go | 2 +- container/autoroot_test.go | 2 +- container/check/absolute.go | 132 ------------ container/check/absolute_test.go | 401 ----------------------------------- container/check/overlay.go | 30 --- container/check/overlay_test.go | 31 --- container/container.go | 2 +- container/container_test.go | 2 +- container/errors.go | 2 +- container/errors_test.go | 2 +- container/fhs/abs.go | 4 +- container/init_test.go | 2 +- container/initbind.go | 2 +- container/initbind_test.go | 2 +- container/initdaemon.go | 2 +- container/initdaemon_test.go | 2 +- container/initdev.go | 2 +- container/initdev_test.go | 2 +- container/initmkdir.go | 2 +- container/initmkdir_test.go | 2 +- container/initoverlay.go | 2 +- container/initoverlay_test.go | 2 +- container/initplace.go | 2 +- container/initplace_test.go | 2 +- container/initproc.go | 2 +- container/initproc_test.go | 2 +- container/initremount.go | 2 +- container/initremount_test.go | 2 +- container/initsymlink.go | 2 +- container/initsymlink_test.go | 2 +- container/inittmpfs.go | 2 +- container/inittmpfs_test.go | 2 +- container/path_test.go | 2 +- hst/config.go | 2 +- hst/container.go | 2 +- hst/fs.go | 2 +- hst/fs_test.go | 2 +- hst/fsbind.go | 2 +- hst/fsdaemon.go | 2 +- hst/fsephemeral.go | 2 +- hst/fslink.go | 2 +- hst/fsoverlay.go | 2 +- hst/fsoverlay_test.go | 2 +- hst/hst.go | 2 +- internal/dbus/proc.go | 2 +- internal/env/env.go | 2 +- internal/env/env_test.go | 2 +- internal/helper/container.go | 2 +- internal/helper/container_test.go | 2 +- internal/info/path.go | 2 +- internal/info/path_test.go | 2 +- internal/outcome/dispatcher.go | 2 +- internal/outcome/dispatcher_test.go | 2 +- internal/outcome/outcome.go | 2 +- internal/outcome/process.go | 2 +- internal/outcome/run_test.go | 2 +- internal/outcome/shim.go | 2 +- internal/outcome/spcontainer.go | 2 +- internal/outcome/spcontainer_test.go | 2 +- internal/outcome/sppipewire.go | 2 +- internal/outcome/sppulse.go | 2 +- internal/outcome/sppulse_test.go | 2 +- internal/outcome/spruntime.go | 2 +- internal/outcome/sptmpdir.go | 2 +- internal/outcome/spwayland.go | 2 +- internal/outcome/spx11.go | 2 +- internal/pkg/dir.go | 2 +- internal/pkg/exec.go | 2 +- internal/pkg/exec_test.go | 2 +- internal/pkg/file_test.go | 2 +- internal/pkg/ir_test.go | 2 +- internal/pkg/net_test.go | 2 +- internal/pkg/pkg.go | 2 +- internal/pkg/pkg_test.go | 2 +- internal/pkg/tar_test.go | 2 +- internal/pkg/testdata/main.go | 2 +- internal/rosa/rosa_test.go | 2 +- internal/store/segment.go | 2 +- internal/store/segment_test.go | 2 +- internal/store/store.go | 2 +- internal/store/store_test.go | 2 +- internal/system/acl.go | 2 +- internal/system/dispatcher.go | 2 +- internal/system/dispatcher_test.go | 2 +- internal/system/link.go | 2 +- internal/system/mkdir.go | 2 +- internal/system/pipewire.go | 2 +- internal/system/system_test.go | 2 +- internal/system/wayland.go | 2 +- internal/wayland/conn.go | 2 +- internal/wayland/conn_test.go | 2 +- ldd/exec.go | 2 +- ldd/exec_test.go | 2 +- ldd/ldd.go | 2 +- ldd/ldd_test.go | 2 +- 107 files changed, 694 insertions(+), 694 deletions(-) create mode 100644 check/absolute.go create mode 100644 check/absolute_test.go create mode 100644 check/overlay.go create mode 100644 check/overlay_test.go delete mode 100644 container/check/absolute.go delete mode 100644 container/check/absolute_test.go delete mode 100644 container/check/overlay.go delete mode 100644 container/check/overlay_test.go diff --git a/check/absolute.go b/check/absolute.go new file mode 100644 index 00000000..d17d5e1a --- /dev/null +++ b/check/absolute.go @@ -0,0 +1,132 @@ +// Package check provides types yielding values checked to meet a condition. +package check + +import ( + "encoding/json" + "errors" + "fmt" + "path" + "slices" + "strings" + "syscall" + "unique" +) + +// AbsoluteError is returned by [NewAbs] and holds the invalid pathname. +type AbsoluteError string + +func (e AbsoluteError) Error() string { + return fmt.Sprintf("path %q is not absolute", string(e)) +} + +func (e AbsoluteError) Is(target error) bool { + var ce AbsoluteError + if !errors.As(target, &ce) { + return errors.Is(target, syscall.EINVAL) + } + return e == ce +} + +// Absolute holds a pathname checked to be absolute. +type Absolute struct{ pathname unique.Handle[string] } + +// ok returns whether [Absolute] is not the zero value. +func (a *Absolute) ok() bool { return a != nil && *a != (Absolute{}) } + +// unsafeAbs returns [check.Absolute] on any string value. +func unsafeAbs(pathname string) *Absolute { + return &Absolute{unique.Make(pathname)} +} + +// String returns the checked pathname. +func (a *Absolute) String() string { + if !a.ok() { + panic("attempted use of zero Absolute") + } + return a.pathname.Value() +} + +// Handle returns the underlying [unique.Handle]. +func (a *Absolute) Handle() unique.Handle[string] { + return a.pathname +} + +// Is efficiently compares the underlying pathname. +func (a *Absolute) Is(v *Absolute) bool { + if a == nil && v == nil { + return true + } + return a.ok() && v.ok() && a.pathname == v.pathname +} + +// NewAbs checks pathname and returns a new [Absolute] if pathname is absolute. +func NewAbs(pathname string) (*Absolute, error) { + if !path.IsAbs(pathname) { + return nil, AbsoluteError(pathname) + } + return unsafeAbs(pathname), nil +} + +// MustAbs calls [NewAbs] and panics on error. +func MustAbs(pathname string) *Absolute { + if a, err := NewAbs(pathname); err != nil { + panic(err) + } else { + return a + } +} + +// Append calls [path.Join] with [Absolute] as the first element. +func (a *Absolute) Append(elem ...string) *Absolute { + return unsafeAbs(path.Join(append([]string{a.String()}, elem...)...)) +} + +// Dir calls [path.Dir] with [Absolute] as its argument. +func (a *Absolute) Dir() *Absolute { return unsafeAbs(path.Dir(a.String())) } + +// GobEncode returns the checked pathname. +func (a *Absolute) GobEncode() ([]byte, error) { + return []byte(a.String()), nil +} + +// GobDecode stores data if it represents an absolute pathname. +func (a *Absolute) GobDecode(data []byte) error { + pathname := string(data) + if !path.IsAbs(pathname) { + return AbsoluteError(pathname) + } + a.pathname = unique.Make(pathname) + return nil +} + +// MarshalJSON returns a JSON representation of the checked pathname. +func (a *Absolute) MarshalJSON() ([]byte, error) { + return json.Marshal(a.String()) +} + +// UnmarshalJSON stores data if it represents an absolute pathname. +func (a *Absolute) UnmarshalJSON(data []byte) error { + var pathname string + if err := json.Unmarshal(data, &pathname); err != nil { + return err + } + if !path.IsAbs(pathname) { + return AbsoluteError(pathname) + } + a.pathname = unique.Make(pathname) + return nil +} + +// SortAbs calls [slices.SortFunc] for a slice of [Absolute]. +func SortAbs(x []*Absolute) { + slices.SortFunc(x, func(a, b *Absolute) int { + return strings.Compare(a.String(), b.String()) + }) +} + +// CompactAbs calls [slices.CompactFunc] for a slice of [Absolute]. +func CompactAbs(s []*Absolute) []*Absolute { + return slices.CompactFunc(s, func(a *Absolute, b *Absolute) bool { + return a.Is(b) + }) +} diff --git a/check/absolute_test.go b/check/absolute_test.go new file mode 100644 index 00000000..445ff2e2 --- /dev/null +++ b/check/absolute_test.go @@ -0,0 +1,401 @@ +package check_test + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "errors" + "reflect" + "strings" + "syscall" + "testing" + _ "unsafe" // for go:linkname + + . "hakurei.app/check" +) + +// unsafeAbs returns check.Absolute on any string value. +// +//go:linkname unsafeAbs hakurei.app/check.unsafeAbs +func unsafeAbs(pathname string) *Absolute + +func TestAbsoluteError(t *testing.T) { + t.Parallel() + + testCases := []struct { + name string + + err error + cmp error + ok bool + }{ + {"EINVAL", new(AbsoluteError), syscall.EINVAL, true}, + {"not EINVAL", new(AbsoluteError), syscall.EBADE, false}, + {"ne val", new(AbsoluteError), AbsoluteError("etc"), false}, + {"equals", AbsoluteError("etc"), AbsoluteError("etc"), true}, + } + + for _, tc := range testCases { + if got := errors.Is(tc.err, tc.cmp); got != tc.ok { + t.Errorf("Is: %v, want %v", got, tc.ok) + } + } + + t.Run("string", func(t *testing.T) { + t.Parallel() + + want := `path "etc" is not absolute` + if got := (AbsoluteError("etc")).Error(); got != want { + t.Errorf("Error: %q, want %q", got, want) + } + }) +} + +func TestNewAbs(t *testing.T) { + t.Parallel() + + testCases := []struct { + name string + + pathname string + want *Absolute + wantErr error + }{ + {"good", "/etc", MustAbs("/etc"), nil}, + {"not absolute", "etc", nil, AbsoluteError("etc")}, + {"zero", "", nil, AbsoluteError("")}, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + got, err := NewAbs(tc.pathname) + if !reflect.DeepEqual(got, tc.want) { + t.Errorf("NewAbs: %#v, want %#v", got, tc.want) + } + if !errors.Is(err, tc.wantErr) { + t.Errorf("NewAbs: error = %v, want %v", err, tc.wantErr) + } + }) + } + + t.Run("must", func(t *testing.T) { + t.Parallel() + + defer func() { + wantPanic := AbsoluteError("etc") + + if r := recover(); !reflect.DeepEqual(r, wantPanic) { + t.Errorf("MustAbs: panic = %v; want %v", r, wantPanic) + } + }() + + MustAbs("etc") + }) +} + +func TestAbsoluteString(t *testing.T) { + t.Run("passthrough", func(t *testing.T) { + t.Parallel() + + pathname := "/etc" + if got := unsafeAbs(pathname).String(); got != pathname { + t.Errorf("String: %q, want %q", got, pathname) + } + }) + + t.Run("zero", func(t *testing.T) { + t.Parallel() + + defer func() { + wantPanic := "attempted use of zero Absolute" + + if r := recover(); r != wantPanic { + t.Errorf("String: panic = %v, want %v", r, wantPanic) + } + }() + + panic(new(Absolute).String()) + }) +} + +func TestAbsoluteIs(t *testing.T) { + t.Parallel() + + testCases := []struct { + name string + a, v *Absolute + want bool + }{ + {"nil", (*Absolute)(nil), (*Absolute)(nil), true}, + {"nil a", (*Absolute)(nil), MustAbs("/"), false}, + {"nil v", MustAbs("/"), (*Absolute)(nil), false}, + {"zero", new(Absolute), new(Absolute), false}, + {"zero a", new(Absolute), MustAbs("/"), false}, + {"zero v", MustAbs("/"), new(Absolute), false}, + {"equals", MustAbs("/"), MustAbs("/"), true}, + } + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + if got := tc.a.Is(tc.v); got != tc.want { + t.Errorf("Is: %v, want %v", got, tc.want) + } + }) + } +} + +type sCheck struct { + Pathname *Absolute `json:"val"` + Magic uint64 `json:"magic"` +} + +func TestCodecAbsolute(t *testing.T) { + t.Parallel() + + testCases := []struct { + name string + a *Absolute + + wantErr error + + gob, sGob string + json, sJson string + }{ + {"nil", nil, nil, + "\x00", "\x00", + `null`, `{"val":null,"magic":3236757504}`}, + + {"good", MustAbs("/etc"), + nil, + "\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\b\xff\x80\x00\x04/etc", + ",\xff\x83\x03\x01\x01\x06sCheck\x01\xff\x84\x00\x01\x02\x01\bPathname\x01\xff\x80\x00\x01\x05Magic\x01\x06\x00\x00\x00\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\x0f\xff\x84\x01\x04/etc\x01\xfc\xc0\xed\x00\x00\x00", + + `"/etc"`, `{"val":"/etc","magic":3236757504}`}, + {"not absolute", nil, + AbsoluteError("etc"), + "\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\a\xff\x80\x00\x03etc", + ",\xff\x83\x03\x01\x01\x06sCheck\x01\xff\x84\x00\x01\x02\x01\bPathname\x01\xff\x80\x00\x01\x05Magic\x01\x06\x00\x00\x00\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\x0f\xff\x84\x01\x03etc\x01\xfb\x01\x81\xda\x00\x00\x00", + + `"etc"`, `{"val":"etc","magic":3236757504}`}, + {"zero", nil, + new(AbsoluteError), + "\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\x04\xff\x80\x00\x00", + ",\xff\x83\x03\x01\x01\x06sCheck\x01\xff\x84\x00\x01\x02\x01\bPathname\x01\xff\x80\x00\x01\x05Magic\x01\x06\x00\x00\x00\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\f\xff\x84\x01\x00\x01\xfb\x01\x81\xda\x00\x00\x00", + `""`, `{"val":"","magic":3236757504}`}, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + t.Run("gob", func(t *testing.T) { + if tc.gob == "\x00" && tc.sGob == "\x00" { + // these values mark the current test to skip gob + return + } + t.Parallel() + + t.Run("encode", func(t *testing.T) { + t.Parallel() + + // encode is unchecked + if errors.Is(tc.wantErr, syscall.EINVAL) { + return + } + + { + buf := new(bytes.Buffer) + err := gob.NewEncoder(buf).Encode(tc.a) + if !errors.Is(err, tc.wantErr) { + t.Errorf("Encode: error = %v, want %v", err, tc.wantErr) + } + if tc.wantErr != nil { + goto checkSEncode + } + if buf.String() != tc.gob { + t.Errorf("Encode:\n%q\nwant:\n%q", buf.String(), tc.gob) + } + } + + checkSEncode: + { + buf := new(bytes.Buffer) + err := gob.NewEncoder(buf).Encode(&sCheck{tc.a, syscall.MS_MGC_VAL}) + if !errors.Is(err, tc.wantErr) { + t.Errorf("Encode: error = %v, want %v", err, tc.wantErr) + } + if tc.wantErr != nil { + return + } + if buf.String() != tc.sGob { + t.Errorf("Encode:\n%q\nwant:\n%q", buf.String(), tc.sGob) + } + } + }) + + t.Run("decode", func(t *testing.T) { + t.Parallel() + + { + var gotA *Absolute + err := gob.NewDecoder(strings.NewReader(tc.gob)).Decode(&gotA) + if !errors.Is(err, tc.wantErr) { + t.Errorf("Decode: error = %v, want %v", err, tc.wantErr) + } + if tc.wantErr != nil { + goto checkSDecode + } + if !reflect.DeepEqual(tc.a, gotA) { + t.Errorf("Decode: %#v, want %#v", tc.a, gotA) + } + } + + checkSDecode: + { + var gotSCheck sCheck + err := gob.NewDecoder(strings.NewReader(tc.sGob)).Decode(&gotSCheck) + if !errors.Is(err, tc.wantErr) { + t.Errorf("Decode: error = %v, want %v", err, tc.wantErr) + } + if tc.wantErr != nil { + return + } + want := sCheck{tc.a, syscall.MS_MGC_VAL} + if !reflect.DeepEqual(gotSCheck, want) { + t.Errorf("Decode: %#v, want %#v", gotSCheck, want) + } + } + }) + + }) + + t.Run("json", func(t *testing.T) { + t.Parallel() + + t.Run("marshal", func(t *testing.T) { + t.Parallel() + + // marshal is unchecked + if errors.Is(tc.wantErr, syscall.EINVAL) { + return + } + + { + d, err := json.Marshal(tc.a) + if !errors.Is(err, tc.wantErr) { + t.Errorf("Marshal: error = %v, want %v", err, tc.wantErr) + } + if tc.wantErr != nil { + goto checkSMarshal + } + if string(d) != tc.json { + t.Errorf("Marshal:\n%s\nwant:\n%s", string(d), tc.json) + } + } + + checkSMarshal: + { + d, err := json.Marshal(&sCheck{tc.a, syscall.MS_MGC_VAL}) + if !errors.Is(err, tc.wantErr) { + t.Errorf("Marshal: error = %v, want %v", err, tc.wantErr) + } + if tc.wantErr != nil { + return + } + if string(d) != tc.sJson { + t.Errorf("Marshal:\n%s\nwant:\n%s", string(d), tc.sJson) + } + } + }) + + t.Run("unmarshal", func(t *testing.T) { + t.Parallel() + + { + var gotA *Absolute + err := json.Unmarshal([]byte(tc.json), &gotA) + if !errors.Is(err, tc.wantErr) { + t.Errorf("Unmarshal: error = %v, want %v", err, tc.wantErr) + } + if tc.wantErr != nil { + goto checkSUnmarshal + } + if !reflect.DeepEqual(tc.a, gotA) { + t.Errorf("Unmarshal: %#v, want %#v", tc.a, gotA) + } + } + + checkSUnmarshal: + { + var gotSCheck sCheck + err := json.Unmarshal([]byte(tc.sJson), &gotSCheck) + if !errors.Is(err, tc.wantErr) { + t.Errorf("Unmarshal: error = %v, want %v", err, tc.wantErr) + } + if tc.wantErr != nil { + return + } + want := sCheck{tc.a, syscall.MS_MGC_VAL} + if !reflect.DeepEqual(gotSCheck, want) { + t.Errorf("Unmarshal: %#v, want %#v", gotSCheck, want) + } + } + }) + }) + }) + } + + t.Run("json passthrough", func(t *testing.T) { + t.Parallel() + + wantErr := "invalid character ':' looking for beginning of value" + if err := new(Absolute).UnmarshalJSON([]byte(":3")); err == nil || err.Error() != wantErr { + t.Errorf("UnmarshalJSON: error = %v, want %s", err, wantErr) + } + }) +} + +func TestAbsoluteWrap(t *testing.T) { + t.Parallel() + + t.Run("join", func(t *testing.T) { + t.Parallel() + + want := "/etc/nix/nix.conf" + if got := MustAbs("/etc").Append("nix", "nix.conf"); got.String() != want { + t.Errorf("Append: %q, want %q", got, want) + } + }) + + t.Run("dir", func(t *testing.T) { + t.Parallel() + + want := "/" + if got := MustAbs("/etc").Dir(); got.String() != want { + t.Errorf("Dir: %q, want %q", got, want) + } + }) + + t.Run("sort", func(t *testing.T) { + t.Parallel() + + want := []*Absolute{MustAbs("/etc"), MustAbs("/proc"), MustAbs("/sys")} + got := []*Absolute{MustAbs("/proc"), MustAbs("/sys"), MustAbs("/etc")} + SortAbs(got) + if !reflect.DeepEqual(got, want) { + t.Errorf("SortAbs: %#v, want %#v", got, want) + } + }) + + t.Run("compact", func(t *testing.T) { + t.Parallel() + + want := []*Absolute{MustAbs("/etc"), MustAbs("/proc"), MustAbs("/sys")} + if got := CompactAbs([]*Absolute{MustAbs("/etc"), MustAbs("/proc"), MustAbs("/proc"), MustAbs("/sys")}); !reflect.DeepEqual(got, want) { + t.Errorf("CompactAbs: %#v, want %#v", got, want) + } + }) +} diff --git a/check/overlay.go b/check/overlay.go new file mode 100644 index 00000000..fbbcd1e6 --- /dev/null +++ b/check/overlay.go @@ -0,0 +1,30 @@ +package check + +import "strings" + +const ( + // SpecialOverlayEscape is the escape string for overlay mount options. + SpecialOverlayEscape = `\` + // SpecialOverlayOption is the separator string between overlay mount options. + SpecialOverlayOption = "," + // SpecialOverlayPath is the separator string between overlay paths. + SpecialOverlayPath = ":" +) + +// EscapeOverlayDataSegment escapes a string for formatting into the data +// argument of an overlay mount system call. +func EscapeOverlayDataSegment(s string) string { + if s == "" { + return "" + } + + if f := strings.SplitN(s, "\x00", 2); len(f) > 0 { + s = f[0] + } + + return strings.NewReplacer( + SpecialOverlayEscape, SpecialOverlayEscape+SpecialOverlayEscape, + SpecialOverlayOption, SpecialOverlayEscape+SpecialOverlayOption, + SpecialOverlayPath, SpecialOverlayEscape+SpecialOverlayPath, + ).Replace(s) +} diff --git a/check/overlay_test.go b/check/overlay_test.go new file mode 100644 index 00000000..9b32dbcb --- /dev/null +++ b/check/overlay_test.go @@ -0,0 +1,31 @@ +package check_test + +import ( + "testing" + + "hakurei.app/check" +) + +func TestEscapeOverlayDataSegment(t *testing.T) { + t.Parallel() + + testCases := []struct { + name string + s string + want string + }{ + {"zero", "", ""}, + {"multi", `\\\:,:,\\\`, `\\\\\\\:\,\:\,\\\\\\`}, + {"bwrap", `/path :,\`, `/path \:\,\\`}, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + if got := check.EscapeOverlayDataSegment(tc.s); got != tc.want { + t.Errorf("escapeOverlayDataSegment: %s, want %s", got, tc.want) + } + }) + } +} diff --git a/cmd/hakurei/command.go b/cmd/hakurei/command.go index 2b0752ea..7b8e35b8 100644 --- a/cmd/hakurei/command.go +++ b/cmd/hakurei/command.go @@ -13,8 +13,8 @@ import ( "time" _ "unsafe" // for go:linkname + "hakurei.app/check" "hakurei.app/command" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/ext" "hakurei.app/hst" diff --git a/cmd/hakurei/parse_test.go b/cmd/hakurei/parse_test.go index 2939ab03..1a574966 100644 --- a/cmd/hakurei/parse_test.go +++ b/cmd/hakurei/parse_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/internal/store" "hakurei.app/message" diff --git a/cmd/hakurei/print_test.go b/cmd/hakurei/print_test.go index d2e5ea37..e67580b4 100644 --- a/cmd/hakurei/print_test.go +++ b/cmd/hakurei/print_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/internal/store" "hakurei.app/message" diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go index 2b4f2e10..3dc1f06e 100644 --- a/cmd/mbf/main.go +++ b/cmd/mbf/main.go @@ -18,9 +18,9 @@ import ( "time" "unique" + "hakurei.app/check" "hakurei.app/command" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/container/seccomp" "hakurei.app/container/std" diff --git a/cmd/sharefs/fuse.go b/cmd/sharefs/fuse.go index a52ee035..f636d423 100644 --- a/cmd/sharefs/fuse.go +++ b/cmd/sharefs/fuse.go @@ -31,8 +31,8 @@ import ( "syscall" "unsafe" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/container/std" "hakurei.app/hst" diff --git a/cmd/sharefs/fuse_test.go b/cmd/sharefs/fuse_test.go index d25bc888..e760cf75 100644 --- a/cmd/sharefs/fuse_test.go +++ b/cmd/sharefs/fuse_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "hakurei.app/container/check" + "hakurei.app/check" ) func TestParseOpts(t *testing.T) { diff --git a/container/autoetc.go b/container/autoetc.go index a2be68b9..f487e383 100644 --- a/container/autoetc.go +++ b/container/autoetc.go @@ -4,7 +4,7 @@ import ( "encoding/gob" "fmt" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" ) diff --git a/container/autoetc_test.go b/container/autoetc_test.go index a7e3ae49..232413b5 100644 --- a/container/autoetc_test.go +++ b/container/autoetc_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" ) diff --git a/container/autoroot.go b/container/autoroot.go index 82ca9e29..7aecf8be 100644 --- a/container/autoroot.go +++ b/container/autoroot.go @@ -4,7 +4,7 @@ import ( "encoding/gob" "fmt" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" "hakurei.app/message" ) diff --git a/container/autoroot_test.go b/container/autoroot_test.go index e4a982f5..282a41fb 100644 --- a/container/autoroot_test.go +++ b/container/autoroot_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/std" "hakurei.app/container/stub" "hakurei.app/message" diff --git a/container/check/absolute.go b/container/check/absolute.go deleted file mode 100644 index d17d5e1a..00000000 --- a/container/check/absolute.go +++ /dev/null @@ -1,132 +0,0 @@ -// Package check provides types yielding values checked to meet a condition. -package check - -import ( - "encoding/json" - "errors" - "fmt" - "path" - "slices" - "strings" - "syscall" - "unique" -) - -// AbsoluteError is returned by [NewAbs] and holds the invalid pathname. -type AbsoluteError string - -func (e AbsoluteError) Error() string { - return fmt.Sprintf("path %q is not absolute", string(e)) -} - -func (e AbsoluteError) Is(target error) bool { - var ce AbsoluteError - if !errors.As(target, &ce) { - return errors.Is(target, syscall.EINVAL) - } - return e == ce -} - -// Absolute holds a pathname checked to be absolute. -type Absolute struct{ pathname unique.Handle[string] } - -// ok returns whether [Absolute] is not the zero value. -func (a *Absolute) ok() bool { return a != nil && *a != (Absolute{}) } - -// unsafeAbs returns [check.Absolute] on any string value. -func unsafeAbs(pathname string) *Absolute { - return &Absolute{unique.Make(pathname)} -} - -// String returns the checked pathname. -func (a *Absolute) String() string { - if !a.ok() { - panic("attempted use of zero Absolute") - } - return a.pathname.Value() -} - -// Handle returns the underlying [unique.Handle]. -func (a *Absolute) Handle() unique.Handle[string] { - return a.pathname -} - -// Is efficiently compares the underlying pathname. -func (a *Absolute) Is(v *Absolute) bool { - if a == nil && v == nil { - return true - } - return a.ok() && v.ok() && a.pathname == v.pathname -} - -// NewAbs checks pathname and returns a new [Absolute] if pathname is absolute. -func NewAbs(pathname string) (*Absolute, error) { - if !path.IsAbs(pathname) { - return nil, AbsoluteError(pathname) - } - return unsafeAbs(pathname), nil -} - -// MustAbs calls [NewAbs] and panics on error. -func MustAbs(pathname string) *Absolute { - if a, err := NewAbs(pathname); err != nil { - panic(err) - } else { - return a - } -} - -// Append calls [path.Join] with [Absolute] as the first element. -func (a *Absolute) Append(elem ...string) *Absolute { - return unsafeAbs(path.Join(append([]string{a.String()}, elem...)...)) -} - -// Dir calls [path.Dir] with [Absolute] as its argument. -func (a *Absolute) Dir() *Absolute { return unsafeAbs(path.Dir(a.String())) } - -// GobEncode returns the checked pathname. -func (a *Absolute) GobEncode() ([]byte, error) { - return []byte(a.String()), nil -} - -// GobDecode stores data if it represents an absolute pathname. -func (a *Absolute) GobDecode(data []byte) error { - pathname := string(data) - if !path.IsAbs(pathname) { - return AbsoluteError(pathname) - } - a.pathname = unique.Make(pathname) - return nil -} - -// MarshalJSON returns a JSON representation of the checked pathname. -func (a *Absolute) MarshalJSON() ([]byte, error) { - return json.Marshal(a.String()) -} - -// UnmarshalJSON stores data if it represents an absolute pathname. -func (a *Absolute) UnmarshalJSON(data []byte) error { - var pathname string - if err := json.Unmarshal(data, &pathname); err != nil { - return err - } - if !path.IsAbs(pathname) { - return AbsoluteError(pathname) - } - a.pathname = unique.Make(pathname) - return nil -} - -// SortAbs calls [slices.SortFunc] for a slice of [Absolute]. -func SortAbs(x []*Absolute) { - slices.SortFunc(x, func(a, b *Absolute) int { - return strings.Compare(a.String(), b.String()) - }) -} - -// CompactAbs calls [slices.CompactFunc] for a slice of [Absolute]. -func CompactAbs(s []*Absolute) []*Absolute { - return slices.CompactFunc(s, func(a *Absolute, b *Absolute) bool { - return a.Is(b) - }) -} diff --git a/container/check/absolute_test.go b/container/check/absolute_test.go deleted file mode 100644 index 25592a71..00000000 --- a/container/check/absolute_test.go +++ /dev/null @@ -1,401 +0,0 @@ -package check_test - -import ( - "bytes" - "encoding/gob" - "encoding/json" - "errors" - "reflect" - "strings" - "syscall" - "testing" - _ "unsafe" // for go:linkname - - . "hakurei.app/container/check" -) - -// unsafeAbs returns check.Absolute on any string value. -// -//go:linkname unsafeAbs hakurei.app/container/check.unsafeAbs -func unsafeAbs(pathname string) *Absolute - -func TestAbsoluteError(t *testing.T) { - t.Parallel() - - testCases := []struct { - name string - - err error - cmp error - ok bool - }{ - {"EINVAL", new(AbsoluteError), syscall.EINVAL, true}, - {"not EINVAL", new(AbsoluteError), syscall.EBADE, false}, - {"ne val", new(AbsoluteError), AbsoluteError("etc"), false}, - {"equals", AbsoluteError("etc"), AbsoluteError("etc"), true}, - } - - for _, tc := range testCases { - if got := errors.Is(tc.err, tc.cmp); got != tc.ok { - t.Errorf("Is: %v, want %v", got, tc.ok) - } - } - - t.Run("string", func(t *testing.T) { - t.Parallel() - - want := `path "etc" is not absolute` - if got := (AbsoluteError("etc")).Error(); got != want { - t.Errorf("Error: %q, want %q", got, want) - } - }) -} - -func TestNewAbs(t *testing.T) { - t.Parallel() - - testCases := []struct { - name string - - pathname string - want *Absolute - wantErr error - }{ - {"good", "/etc", MustAbs("/etc"), nil}, - {"not absolute", "etc", nil, AbsoluteError("etc")}, - {"zero", "", nil, AbsoluteError("")}, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - - got, err := NewAbs(tc.pathname) - if !reflect.DeepEqual(got, tc.want) { - t.Errorf("NewAbs: %#v, want %#v", got, tc.want) - } - if !errors.Is(err, tc.wantErr) { - t.Errorf("NewAbs: error = %v, want %v", err, tc.wantErr) - } - }) - } - - t.Run("must", func(t *testing.T) { - t.Parallel() - - defer func() { - wantPanic := AbsoluteError("etc") - - if r := recover(); !reflect.DeepEqual(r, wantPanic) { - t.Errorf("MustAbs: panic = %v; want %v", r, wantPanic) - } - }() - - MustAbs("etc") - }) -} - -func TestAbsoluteString(t *testing.T) { - t.Run("passthrough", func(t *testing.T) { - t.Parallel() - - pathname := "/etc" - if got := unsafeAbs(pathname).String(); got != pathname { - t.Errorf("String: %q, want %q", got, pathname) - } - }) - - t.Run("zero", func(t *testing.T) { - t.Parallel() - - defer func() { - wantPanic := "attempted use of zero Absolute" - - if r := recover(); r != wantPanic { - t.Errorf("String: panic = %v, want %v", r, wantPanic) - } - }() - - panic(new(Absolute).String()) - }) -} - -func TestAbsoluteIs(t *testing.T) { - t.Parallel() - - testCases := []struct { - name string - a, v *Absolute - want bool - }{ - {"nil", (*Absolute)(nil), (*Absolute)(nil), true}, - {"nil a", (*Absolute)(nil), MustAbs("/"), false}, - {"nil v", MustAbs("/"), (*Absolute)(nil), false}, - {"zero", new(Absolute), new(Absolute), false}, - {"zero a", new(Absolute), MustAbs("/"), false}, - {"zero v", MustAbs("/"), new(Absolute), false}, - {"equals", MustAbs("/"), MustAbs("/"), true}, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - - if got := tc.a.Is(tc.v); got != tc.want { - t.Errorf("Is: %v, want %v", got, tc.want) - } - }) - } -} - -type sCheck struct { - Pathname *Absolute `json:"val"` - Magic uint64 `json:"magic"` -} - -func TestCodecAbsolute(t *testing.T) { - t.Parallel() - - testCases := []struct { - name string - a *Absolute - - wantErr error - - gob, sGob string - json, sJson string - }{ - {"nil", nil, nil, - "\x00", "\x00", - `null`, `{"val":null,"magic":3236757504}`}, - - {"good", MustAbs("/etc"), - nil, - "\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\b\xff\x80\x00\x04/etc", - ",\xff\x83\x03\x01\x01\x06sCheck\x01\xff\x84\x00\x01\x02\x01\bPathname\x01\xff\x80\x00\x01\x05Magic\x01\x06\x00\x00\x00\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\x0f\xff\x84\x01\x04/etc\x01\xfc\xc0\xed\x00\x00\x00", - - `"/etc"`, `{"val":"/etc","magic":3236757504}`}, - {"not absolute", nil, - AbsoluteError("etc"), - "\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\a\xff\x80\x00\x03etc", - ",\xff\x83\x03\x01\x01\x06sCheck\x01\xff\x84\x00\x01\x02\x01\bPathname\x01\xff\x80\x00\x01\x05Magic\x01\x06\x00\x00\x00\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\x0f\xff\x84\x01\x03etc\x01\xfb\x01\x81\xda\x00\x00\x00", - - `"etc"`, `{"val":"etc","magic":3236757504}`}, - {"zero", nil, - new(AbsoluteError), - "\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\x04\xff\x80\x00\x00", - ",\xff\x83\x03\x01\x01\x06sCheck\x01\xff\x84\x00\x01\x02\x01\bPathname\x01\xff\x80\x00\x01\x05Magic\x01\x06\x00\x00\x00\t\x7f\x05\x01\x02\xff\x82\x00\x00\x00\f\xff\x84\x01\x00\x01\xfb\x01\x81\xda\x00\x00\x00", - `""`, `{"val":"","magic":3236757504}`}, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - - t.Run("gob", func(t *testing.T) { - if tc.gob == "\x00" && tc.sGob == "\x00" { - // these values mark the current test to skip gob - return - } - t.Parallel() - - t.Run("encode", func(t *testing.T) { - t.Parallel() - - // encode is unchecked - if errors.Is(tc.wantErr, syscall.EINVAL) { - return - } - - { - buf := new(bytes.Buffer) - err := gob.NewEncoder(buf).Encode(tc.a) - if !errors.Is(err, tc.wantErr) { - t.Errorf("Encode: error = %v, want %v", err, tc.wantErr) - } - if tc.wantErr != nil { - goto checkSEncode - } - if buf.String() != tc.gob { - t.Errorf("Encode:\n%q\nwant:\n%q", buf.String(), tc.gob) - } - } - - checkSEncode: - { - buf := new(bytes.Buffer) - err := gob.NewEncoder(buf).Encode(&sCheck{tc.a, syscall.MS_MGC_VAL}) - if !errors.Is(err, tc.wantErr) { - t.Errorf("Encode: error = %v, want %v", err, tc.wantErr) - } - if tc.wantErr != nil { - return - } - if buf.String() != tc.sGob { - t.Errorf("Encode:\n%q\nwant:\n%q", buf.String(), tc.sGob) - } - } - }) - - t.Run("decode", func(t *testing.T) { - t.Parallel() - - { - var gotA *Absolute - err := gob.NewDecoder(strings.NewReader(tc.gob)).Decode(&gotA) - if !errors.Is(err, tc.wantErr) { - t.Errorf("Decode: error = %v, want %v", err, tc.wantErr) - } - if tc.wantErr != nil { - goto checkSDecode - } - if !reflect.DeepEqual(tc.a, gotA) { - t.Errorf("Decode: %#v, want %#v", tc.a, gotA) - } - } - - checkSDecode: - { - var gotSCheck sCheck - err := gob.NewDecoder(strings.NewReader(tc.sGob)).Decode(&gotSCheck) - if !errors.Is(err, tc.wantErr) { - t.Errorf("Decode: error = %v, want %v", err, tc.wantErr) - } - if tc.wantErr != nil { - return - } - want := sCheck{tc.a, syscall.MS_MGC_VAL} - if !reflect.DeepEqual(gotSCheck, want) { - t.Errorf("Decode: %#v, want %#v", gotSCheck, want) - } - } - }) - - }) - - t.Run("json", func(t *testing.T) { - t.Parallel() - - t.Run("marshal", func(t *testing.T) { - t.Parallel() - - // marshal is unchecked - if errors.Is(tc.wantErr, syscall.EINVAL) { - return - } - - { - d, err := json.Marshal(tc.a) - if !errors.Is(err, tc.wantErr) { - t.Errorf("Marshal: error = %v, want %v", err, tc.wantErr) - } - if tc.wantErr != nil { - goto checkSMarshal - } - if string(d) != tc.json { - t.Errorf("Marshal:\n%s\nwant:\n%s", string(d), tc.json) - } - } - - checkSMarshal: - { - d, err := json.Marshal(&sCheck{tc.a, syscall.MS_MGC_VAL}) - if !errors.Is(err, tc.wantErr) { - t.Errorf("Marshal: error = %v, want %v", err, tc.wantErr) - } - if tc.wantErr != nil { - return - } - if string(d) != tc.sJson { - t.Errorf("Marshal:\n%s\nwant:\n%s", string(d), tc.sJson) - } - } - }) - - t.Run("unmarshal", func(t *testing.T) { - t.Parallel() - - { - var gotA *Absolute - err := json.Unmarshal([]byte(tc.json), &gotA) - if !errors.Is(err, tc.wantErr) { - t.Errorf("Unmarshal: error = %v, want %v", err, tc.wantErr) - } - if tc.wantErr != nil { - goto checkSUnmarshal - } - if !reflect.DeepEqual(tc.a, gotA) { - t.Errorf("Unmarshal: %#v, want %#v", tc.a, gotA) - } - } - - checkSUnmarshal: - { - var gotSCheck sCheck - err := json.Unmarshal([]byte(tc.sJson), &gotSCheck) - if !errors.Is(err, tc.wantErr) { - t.Errorf("Unmarshal: error = %v, want %v", err, tc.wantErr) - } - if tc.wantErr != nil { - return - } - want := sCheck{tc.a, syscall.MS_MGC_VAL} - if !reflect.DeepEqual(gotSCheck, want) { - t.Errorf("Unmarshal: %#v, want %#v", gotSCheck, want) - } - } - }) - }) - }) - } - - t.Run("json passthrough", func(t *testing.T) { - t.Parallel() - - wantErr := "invalid character ':' looking for beginning of value" - if err := new(Absolute).UnmarshalJSON([]byte(":3")); err == nil || err.Error() != wantErr { - t.Errorf("UnmarshalJSON: error = %v, want %s", err, wantErr) - } - }) -} - -func TestAbsoluteWrap(t *testing.T) { - t.Parallel() - - t.Run("join", func(t *testing.T) { - t.Parallel() - - want := "/etc/nix/nix.conf" - if got := MustAbs("/etc").Append("nix", "nix.conf"); got.String() != want { - t.Errorf("Append: %q, want %q", got, want) - } - }) - - t.Run("dir", func(t *testing.T) { - t.Parallel() - - want := "/" - if got := MustAbs("/etc").Dir(); got.String() != want { - t.Errorf("Dir: %q, want %q", got, want) - } - }) - - t.Run("sort", func(t *testing.T) { - t.Parallel() - - want := []*Absolute{MustAbs("/etc"), MustAbs("/proc"), MustAbs("/sys")} - got := []*Absolute{MustAbs("/proc"), MustAbs("/sys"), MustAbs("/etc")} - SortAbs(got) - if !reflect.DeepEqual(got, want) { - t.Errorf("SortAbs: %#v, want %#v", got, want) - } - }) - - t.Run("compact", func(t *testing.T) { - t.Parallel() - - want := []*Absolute{MustAbs("/etc"), MustAbs("/proc"), MustAbs("/sys")} - if got := CompactAbs([]*Absolute{MustAbs("/etc"), MustAbs("/proc"), MustAbs("/proc"), MustAbs("/sys")}); !reflect.DeepEqual(got, want) { - t.Errorf("CompactAbs: %#v, want %#v", got, want) - } - }) -} diff --git a/container/check/overlay.go b/container/check/overlay.go deleted file mode 100644 index fbbcd1e6..00000000 --- a/container/check/overlay.go +++ /dev/null @@ -1,30 +0,0 @@ -package check - -import "strings" - -const ( - // SpecialOverlayEscape is the escape string for overlay mount options. - SpecialOverlayEscape = `\` - // SpecialOverlayOption is the separator string between overlay mount options. - SpecialOverlayOption = "," - // SpecialOverlayPath is the separator string between overlay paths. - SpecialOverlayPath = ":" -) - -// EscapeOverlayDataSegment escapes a string for formatting into the data -// argument of an overlay mount system call. -func EscapeOverlayDataSegment(s string) string { - if s == "" { - return "" - } - - if f := strings.SplitN(s, "\x00", 2); len(f) > 0 { - s = f[0] - } - - return strings.NewReplacer( - SpecialOverlayEscape, SpecialOverlayEscape+SpecialOverlayEscape, - SpecialOverlayOption, SpecialOverlayEscape+SpecialOverlayOption, - SpecialOverlayPath, SpecialOverlayEscape+SpecialOverlayPath, - ).Replace(s) -} diff --git a/container/check/overlay_test.go b/container/check/overlay_test.go deleted file mode 100644 index 8fdcd69f..00000000 --- a/container/check/overlay_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package check_test - -import ( - "testing" - - "hakurei.app/container/check" -) - -func TestEscapeOverlayDataSegment(t *testing.T) { - t.Parallel() - - testCases := []struct { - name string - s string - want string - }{ - {"zero", "", ""}, - {"multi", `\\\:,:,\\\`, `\\\\\\\:\,\:\,\\\\\\`}, - {"bwrap", `/path :,\`, `/path \:\,\\`}, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - - if got := check.EscapeOverlayDataSegment(tc.s); got != tc.want { - t.Errorf("escapeOverlayDataSegment: %s, want %s", got, tc.want) - } - }) - } -} diff --git a/container/container.go b/container/container.go index 86bb3b36..8666e760 100644 --- a/container/container.go +++ b/container/container.go @@ -16,7 +16,7 @@ import ( . "syscall" "time" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" "hakurei.app/container/seccomp" "hakurei.app/container/std" diff --git a/container/container_test.go b/container/container_test.go index a5ca11a9..fcef2d5d 100644 --- a/container/container_test.go +++ b/container/container_test.go @@ -18,9 +18,9 @@ import ( "testing" "time" + "hakurei.app/check" "hakurei.app/command" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/container/seccomp" "hakurei.app/container/std" diff --git a/container/errors.go b/container/errors.go index 7c45037a..a1069b65 100644 --- a/container/errors.go +++ b/container/errors.go @@ -5,7 +5,7 @@ import ( "os" "syscall" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/message" "hakurei.app/vfs" ) diff --git a/container/errors_test.go b/container/errors_test.go index a7a1bb80..27dafbcd 100644 --- a/container/errors_test.go +++ b/container/errors_test.go @@ -8,7 +8,7 @@ import ( "syscall" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" "hakurei.app/vfs" ) diff --git a/container/fhs/abs.go b/container/fhs/abs.go index 45c50bfd..ce2ae34d 100644 --- a/container/fhs/abs.go +++ b/container/fhs/abs.go @@ -3,14 +3,14 @@ package fhs import ( _ "unsafe" // for go:linkname - "hakurei.app/container/check" + "hakurei.app/check" ) /* constants in this file bypass abs check, be extremely careful when changing them! */ // unsafeAbs returns check.Absolute on any string value. // -//go:linkname unsafeAbs hakurei.app/container/check.unsafeAbs +//go:linkname unsafeAbs hakurei.app/check.unsafeAbs func unsafeAbs(pathname string) *check.Absolute var ( diff --git a/container/init_test.go b/container/init_test.go index 6177ff3d..4f067fd5 100644 --- a/container/init_test.go +++ b/container/init_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/seccomp" "hakurei.app/container/std" "hakurei.app/container/stub" diff --git a/container/initbind.go b/container/initbind.go index 7f240a37..8fa0fc06 100644 --- a/container/initbind.go +++ b/container/initbind.go @@ -6,7 +6,7 @@ import ( "os" "syscall" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/std" ) diff --git a/container/initbind_test.go b/container/initbind_test.go index 40b5039b..7d1cc36b 100644 --- a/container/initbind_test.go +++ b/container/initbind_test.go @@ -6,7 +6,7 @@ import ( "syscall" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/std" "hakurei.app/container/stub" ) diff --git a/container/initdaemon.go b/container/initdaemon.go index 1e58e2ab..19f95ea1 100644 --- a/container/initdaemon.go +++ b/container/initdaemon.go @@ -12,7 +12,7 @@ import ( "syscall" "time" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" ) diff --git a/container/initdaemon_test.go b/container/initdaemon_test.go index ad8c7a93..262e6bde 100644 --- a/container/initdaemon_test.go +++ b/container/initdaemon_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" "hakurei.app/message" ) diff --git a/container/initdev.go b/container/initdev.go index 1ce722cb..56662f9e 100644 --- a/container/initdev.go +++ b/container/initdev.go @@ -6,7 +6,7 @@ import ( "path" . "syscall" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" ) diff --git a/container/initdev_test.go b/container/initdev_test.go index e885c359..0566e9af 100644 --- a/container/initdev_test.go +++ b/container/initdev_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" ) diff --git a/container/initmkdir.go b/container/initmkdir.go index d43c8b8f..4a131af5 100644 --- a/container/initmkdir.go +++ b/container/initmkdir.go @@ -5,7 +5,7 @@ import ( "fmt" "os" - "hakurei.app/container/check" + "hakurei.app/check" ) func init() { gob.Register(new(MkdirOp)) } diff --git a/container/initmkdir_test.go b/container/initmkdir_test.go index 4bec4fa4..65da693d 100644 --- a/container/initmkdir_test.go +++ b/container/initmkdir_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" ) diff --git a/container/initoverlay.go b/container/initoverlay.go index 2fec6364..061772b4 100644 --- a/container/initoverlay.go +++ b/container/initoverlay.go @@ -6,7 +6,7 @@ import ( "slices" "strings" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" ) diff --git a/container/initoverlay_test.go b/container/initoverlay_test.go index 0ff3cb41..4047e4f6 100644 --- a/container/initoverlay_test.go +++ b/container/initoverlay_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" ) diff --git a/container/initplace.go b/container/initplace.go index d0567ff6..8c48edc4 100644 --- a/container/initplace.go +++ b/container/initplace.go @@ -5,7 +5,7 @@ import ( "fmt" "syscall" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" ) diff --git a/container/initplace_test.go b/container/initplace_test.go index b1de5fbf..dd2f982e 100644 --- a/container/initplace_test.go +++ b/container/initplace_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" ) diff --git a/container/initproc.go b/container/initproc.go index 42b519d7..d568e88e 100644 --- a/container/initproc.go +++ b/container/initproc.go @@ -5,7 +5,7 @@ import ( "fmt" . "syscall" - "hakurei.app/container/check" + "hakurei.app/check" ) func init() { gob.Register(new(MountProcOp)) } diff --git a/container/initproc_test.go b/container/initproc_test.go index 12b4def7..51311f02 100644 --- a/container/initproc_test.go +++ b/container/initproc_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" ) diff --git a/container/initremount.go b/container/initremount.go index 64822914..fba0c2b7 100644 --- a/container/initremount.go +++ b/container/initremount.go @@ -4,7 +4,7 @@ import ( "encoding/gob" "fmt" - "hakurei.app/container/check" + "hakurei.app/check" ) func init() { gob.Register(new(RemountOp)) } diff --git a/container/initremount_test.go b/container/initremount_test.go index 03a7b645..3855c18d 100644 --- a/container/initremount_test.go +++ b/container/initremount_test.go @@ -4,7 +4,7 @@ import ( "syscall" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" ) diff --git a/container/initsymlink.go b/container/initsymlink.go index df0ddc11..f4f608a6 100644 --- a/container/initsymlink.go +++ b/container/initsymlink.go @@ -5,7 +5,7 @@ import ( "fmt" "path" - "hakurei.app/container/check" + "hakurei.app/check" ) func init() { gob.Register(new(SymlinkOp)) } diff --git a/container/initsymlink_test.go b/container/initsymlink_test.go index 86d0be1f..3a4144d3 100644 --- a/container/initsymlink_test.go +++ b/container/initsymlink_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" ) diff --git a/container/inittmpfs.go b/container/inittmpfs.go index fb477236..aad6e1ab 100644 --- a/container/inittmpfs.go +++ b/container/inittmpfs.go @@ -8,7 +8,7 @@ import ( "strconv" . "syscall" - "hakurei.app/container/check" + "hakurei.app/check" ) func init() { gob.Register(new(MountTmpfsOp)) } diff --git a/container/inittmpfs_test.go b/container/inittmpfs_test.go index f5dfafad..e8a36602 100644 --- a/container/inittmpfs_test.go +++ b/container/inittmpfs_test.go @@ -5,7 +5,7 @@ import ( "syscall" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" ) diff --git a/container/path_test.go b/container/path_test.go index b0ec4645..7f28b5f4 100644 --- a/container/path_test.go +++ b/container/path_test.go @@ -10,7 +10,7 @@ import ( "testing" "unsafe" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/vfs" ) diff --git a/hst/config.go b/hst/config.go index da68ac26..6b7e26f4 100644 --- a/hst/config.go +++ b/hst/config.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/ext" ) diff --git a/hst/container.go b/hst/container.go index 8696d85b..15a5d221 100644 --- a/hst/container.go +++ b/hst/container.go @@ -6,7 +6,7 @@ import ( "syscall" "time" - "hakurei.app/container/check" + "hakurei.app/check" ) // PrivateTmp is a private writable path in a hakurei container. diff --git a/hst/fs.go b/hst/fs.go index 3f0f6017..92ca51af 100644 --- a/hst/fs.go +++ b/hst/fs.go @@ -7,7 +7,7 @@ import ( "os" "reflect" - "hakurei.app/container/check" + "hakurei.app/check" ) // FilesystemConfig is an abstract representation of a mount point. diff --git a/hst/fs_test.go b/hst/fs_test.go index fdef9bc6..94d44078 100644 --- a/hst/fs_test.go +++ b/hst/fs_test.go @@ -9,8 +9,8 @@ import ( "syscall" "testing" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/hst" ) diff --git a/hst/fsbind.go b/hst/fsbind.go index 282f9a32..ac628b99 100644 --- a/hst/fsbind.go +++ b/hst/fsbind.go @@ -4,7 +4,7 @@ import ( "encoding/gob" "strings" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" "hakurei.app/container/std" ) diff --git a/hst/fsdaemon.go b/hst/fsdaemon.go index fd3f3758..2e28de78 100644 --- a/hst/fsdaemon.go +++ b/hst/fsdaemon.go @@ -3,7 +3,7 @@ package hst import ( "encoding/gob" - "hakurei.app/container/check" + "hakurei.app/check" ) func init() { gob.Register(new(FSDaemon)) } diff --git a/hst/fsephemeral.go b/hst/fsephemeral.go index 78c4a55a..9da79003 100644 --- a/hst/fsephemeral.go +++ b/hst/fsephemeral.go @@ -5,7 +5,7 @@ import ( "os" "strings" - "hakurei.app/container/check" + "hakurei.app/check" ) func init() { gob.Register(new(FSEphemeral)) } diff --git a/hst/fslink.go b/hst/fslink.go index 57c1ffc7..77351258 100644 --- a/hst/fslink.go +++ b/hst/fslink.go @@ -4,7 +4,7 @@ import ( "encoding/gob" "path" - "hakurei.app/container/check" + "hakurei.app/check" ) func init() { gob.Register(new(FSLink)) } diff --git a/hst/fsoverlay.go b/hst/fsoverlay.go index 72df1deb..738ecf53 100644 --- a/hst/fsoverlay.go +++ b/hst/fsoverlay.go @@ -4,7 +4,7 @@ import ( "encoding/gob" "strings" - "hakurei.app/container/check" + "hakurei.app/check" ) func init() { gob.Register(new(FSOverlay)) } diff --git a/hst/fsoverlay_test.go b/hst/fsoverlay_test.go index df6ec082..f1097481 100644 --- a/hst/fsoverlay_test.go +++ b/hst/fsoverlay_test.go @@ -3,8 +3,8 @@ package hst_test import ( "testing" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/hst" ) diff --git a/hst/hst.go b/hst/hst.go index 45f1eb83..eb4ef26d 100644 --- a/hst/hst.go +++ b/hst/hst.go @@ -7,7 +7,7 @@ import ( "net" "os" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" ) diff --git a/internal/dbus/proc.go b/internal/dbus/proc.go index c934e89e..e7af8885 100644 --- a/internal/dbus/proc.go +++ b/internal/dbus/proc.go @@ -8,8 +8,8 @@ import ( "strconv" "syscall" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/seccomp" "hakurei.app/container/std" "hakurei.app/internal/helper" diff --git a/internal/env/env.go b/internal/env/env.go index cdacb203..45fd5fcb 100644 --- a/internal/env/env.go +++ b/internal/env/env.go @@ -6,7 +6,7 @@ import ( "os" "strconv" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" ) diff --git a/internal/env/env_test.go b/internal/env/env_test.go index b3fc3987..8758ca31 100644 --- a/internal/env/env_test.go +++ b/internal/env/env_test.go @@ -5,8 +5,8 @@ import ( "reflect" "testing" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/container/stub" "hakurei.app/hst" diff --git a/internal/helper/container.go b/internal/helper/container.go index 56a51954..7f088187 100644 --- a/internal/helper/container.go +++ b/internal/helper/container.go @@ -9,8 +9,8 @@ import ( "slices" "sync" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/internal/helper/proc" "hakurei.app/message" ) diff --git a/internal/helper/container_test.go b/internal/helper/container_test.go index f55da75c..300d17f4 100644 --- a/internal/helper/container_test.go +++ b/internal/helper/container_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/internal/helper" ) diff --git a/internal/info/path.go b/internal/info/path.go index 9f96734a..5406f56b 100644 --- a/internal/info/path.go +++ b/internal/info/path.go @@ -3,7 +3,7 @@ package info import ( "log" - "hakurei.app/container/check" + "hakurei.app/check" ) // Absolute paths to the Hakurei installation. diff --git a/internal/info/path_test.go b/internal/info/path_test.go index 3137ee6a..754c634a 100644 --- a/internal/info/path_test.go +++ b/internal/info/path_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "hakurei.app/container/check" + "hakurei.app/check" ) func TestMustCheckPath(t *testing.T) { diff --git a/internal/outcome/dispatcher.go b/internal/outcome/dispatcher.go index 93adfbb9..e9f75237 100644 --- a/internal/outcome/dispatcher.go +++ b/internal/outcome/dispatcher.go @@ -10,8 +10,8 @@ import ( "os/user" "path/filepath" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/seccomp" "hakurei.app/container/std" "hakurei.app/internal/dbus" diff --git a/internal/outcome/dispatcher_test.go b/internal/outcome/dispatcher_test.go index 84f06c7c..a11fb869 100644 --- a/internal/outcome/dispatcher_test.go +++ b/internal/outcome/dispatcher_test.go @@ -18,8 +18,8 @@ import ( "time" "unsafe" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/seccomp" "hakurei.app/container/std" "hakurei.app/container/stub" diff --git a/internal/outcome/outcome.go b/internal/outcome/outcome.go index c72f688f..98ad718a 100644 --- a/internal/outcome/outcome.go +++ b/internal/outcome/outcome.go @@ -7,8 +7,8 @@ import ( "maps" "strconv" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/hst" "hakurei.app/internal/acl" "hakurei.app/internal/env" diff --git a/internal/outcome/process.go b/internal/outcome/process.go index be919a63..6ee26f6d 100644 --- a/internal/outcome/process.go +++ b/internal/outcome/process.go @@ -12,8 +12,8 @@ import ( "syscall" "time" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/hst" "hakurei.app/internal/info" diff --git a/internal/outcome/run_test.go b/internal/outcome/run_test.go index 0f58dec6..83e6d98a 100644 --- a/internal/outcome/run_test.go +++ b/internal/outcome/run_test.go @@ -15,8 +15,8 @@ import ( "testing" "time" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/container/seccomp" "hakurei.app/container/std" diff --git a/internal/outcome/shim.go b/internal/outcome/shim.go index 91bd70a4..3f5a86dc 100644 --- a/internal/outcome/shim.go +++ b/internal/outcome/shim.go @@ -13,8 +13,8 @@ import ( "syscall" "time" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/container/seccomp" "hakurei.app/container/std" diff --git a/internal/outcome/spcontainer.go b/internal/outcome/spcontainer.go index 2d6bb78b..307729f4 100644 --- a/internal/outcome/spcontainer.go +++ b/internal/outcome/spcontainer.go @@ -10,8 +10,8 @@ import ( "strconv" "syscall" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/container/seccomp" "hakurei.app/container/std" diff --git a/internal/outcome/spcontainer_test.go b/internal/outcome/spcontainer_test.go index 51a04020..6b3d2b1c 100644 --- a/internal/outcome/spcontainer_test.go +++ b/internal/outcome/spcontainer_test.go @@ -7,8 +7,8 @@ import ( "syscall" "testing" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/container/seccomp" "hakurei.app/container/std" diff --git a/internal/outcome/sppipewire.go b/internal/outcome/sppipewire.go index 96675ebf..f2c38024 100644 --- a/internal/outcome/sppipewire.go +++ b/internal/outcome/sppipewire.go @@ -3,7 +3,7 @@ package outcome import ( "encoding/gob" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/internal/pipewire" ) diff --git a/internal/outcome/sppulse.go b/internal/outcome/sppulse.go index 386800bb..d185abae 100644 --- a/internal/outcome/sppulse.go +++ b/internal/outcome/sppulse.go @@ -10,7 +10,7 @@ import ( "strconv" "syscall" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/message" ) diff --git a/internal/outcome/sppulse_test.go b/internal/outcome/sppulse_test.go index f3f0635f..9b014470 100644 --- a/internal/outcome/sppulse_test.go +++ b/internal/outcome/sppulse_test.go @@ -7,8 +7,8 @@ import ( "syscall" "testing" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/stub" "hakurei.app/hst" "hakurei.app/internal/acl" diff --git a/internal/outcome/spruntime.go b/internal/outcome/spruntime.go index 727a5be0..1bf26a02 100644 --- a/internal/outcome/spruntime.go +++ b/internal/outcome/spruntime.go @@ -3,7 +3,7 @@ package outcome import ( "encoding/gob" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" "hakurei.app/container/std" "hakurei.app/hst" diff --git a/internal/outcome/sptmpdir.go b/internal/outcome/sptmpdir.go index 9fb3f8d1..44931867 100644 --- a/internal/outcome/sptmpdir.go +++ b/internal/outcome/sptmpdir.go @@ -3,7 +3,7 @@ package outcome import ( "encoding/gob" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" "hakurei.app/container/std" "hakurei.app/hst" diff --git a/internal/outcome/spwayland.go b/internal/outcome/spwayland.go index 55066611..3c60ff10 100644 --- a/internal/outcome/spwayland.go +++ b/internal/outcome/spwayland.go @@ -3,7 +3,7 @@ package outcome import ( "encoding/gob" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/internal/acl" "hakurei.app/internal/wayland" diff --git a/internal/outcome/spx11.go b/internal/outcome/spx11.go index 70ab2421..49e5863f 100644 --- a/internal/outcome/spx11.go +++ b/internal/outcome/spx11.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" "hakurei.app/hst" "hakurei.app/internal/acl" diff --git a/internal/pkg/dir.go b/internal/pkg/dir.go index 1d98350f..ca7fc0fc 100644 --- a/internal/pkg/dir.go +++ b/internal/pkg/dir.go @@ -11,7 +11,7 @@ import ( "path/filepath" "syscall" - "hakurei.app/container/check" + "hakurei.app/check" ) // FlatEntry is a directory entry to be encoded for [Flatten]. diff --git a/internal/pkg/exec.go b/internal/pkg/exec.go index c5b8b10d..34837c35 100644 --- a/internal/pkg/exec.go +++ b/internal/pkg/exec.go @@ -15,8 +15,8 @@ import ( "time" "unique" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/container/seccomp" "hakurei.app/container/std" diff --git a/internal/pkg/exec_test.go b/internal/pkg/exec_test.go index 16e5031c..5b0fa765 100644 --- a/internal/pkg/exec_test.go +++ b/internal/pkg/exec_test.go @@ -13,7 +13,7 @@ import ( "testing" "unique" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" "hakurei.app/hst" "hakurei.app/internal/pkg" diff --git a/internal/pkg/file_test.go b/internal/pkg/file_test.go index ee5359ee..ca0046ab 100644 --- a/internal/pkg/file_test.go +++ b/internal/pkg/file_test.go @@ -3,7 +3,7 @@ package pkg_test import ( "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/internal/pkg" ) diff --git a/internal/pkg/ir_test.go b/internal/pkg/ir_test.go index c5ffc6dc..a946d60f 100644 --- a/internal/pkg/ir_test.go +++ b/internal/pkg/ir_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/internal/pkg" ) diff --git a/internal/pkg/net_test.go b/internal/pkg/net_test.go index 5f92c2c0..9f668e71 100644 --- a/internal/pkg/net_test.go +++ b/internal/pkg/net_test.go @@ -10,7 +10,7 @@ import ( "unique" "unsafe" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/internal/pkg" ) diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go index 6080fd68..995357e8 100644 --- a/internal/pkg/pkg.go +++ b/internal/pkg/pkg.go @@ -27,7 +27,7 @@ import ( "unique" "unsafe" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/internal/info" "hakurei.app/internal/lockedfile" "hakurei.app/message" diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go index f8a72564..22f99683 100644 --- a/internal/pkg/pkg_test.go +++ b/internal/pkg/pkg_test.go @@ -21,8 +21,8 @@ import ( "unique" "unsafe" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/container/stub" "hakurei.app/internal/pkg" diff --git a/internal/pkg/tar_test.go b/internal/pkg/tar_test.go index 26a67d6c..09e1e4db 100644 --- a/internal/pkg/tar_test.go +++ b/internal/pkg/tar_test.go @@ -12,7 +12,7 @@ import ( "testing" "testing/fstest" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" "hakurei.app/internal/pkg" ) diff --git a/internal/pkg/testdata/main.go b/internal/pkg/testdata/main.go index f013f088..b3b6d035 100644 --- a/internal/pkg/testdata/main.go +++ b/internal/pkg/testdata/main.go @@ -12,7 +12,7 @@ import ( "slices" "strings" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/fhs" "hakurei.app/vfs" ) diff --git a/internal/rosa/rosa_test.go b/internal/rosa/rosa_test.go index b4578cf3..c0b01a31 100644 --- a/internal/rosa/rosa_test.go +++ b/internal/rosa/rosa_test.go @@ -9,8 +9,8 @@ import ( "syscall" "testing" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/internal/pkg" "hakurei.app/internal/rosa" "hakurei.app/message" diff --git a/internal/store/segment.go b/internal/store/segment.go index 79f652e7..c2a718ca 100644 --- a/internal/store/segment.go +++ b/internal/store/segment.go @@ -8,7 +8,7 @@ import ( "strconv" "sync" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/internal/lockedfile" ) diff --git a/internal/store/segment_test.go b/internal/store/segment_test.go index 67915459..671f27a0 100644 --- a/internal/store/segment_test.go +++ b/internal/store/segment_test.go @@ -12,7 +12,7 @@ import ( "testing" _ "unsafe" // for go:linkname - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" "hakurei.app/hst" "hakurei.app/internal/store" diff --git a/internal/store/store.go b/internal/store/store.go index 4fefd5c9..3604521c 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -10,7 +10,7 @@ import ( "sync" "syscall" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/internal/lockedfile" ) diff --git a/internal/store/store_test.go b/internal/store/store_test.go index 9abf480e..2210f543 100644 --- a/internal/store/store_test.go +++ b/internal/store/store_test.go @@ -14,7 +14,7 @@ import ( "time" _ "unsafe" // for go:linkname - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/internal/store" ) diff --git a/internal/system/acl.go b/internal/system/acl.go index 060d8854..4df0d9c1 100644 --- a/internal/system/acl.go +++ b/internal/system/acl.go @@ -6,7 +6,7 @@ import ( "os" "slices" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/internal/acl" ) diff --git a/internal/system/dispatcher.go b/internal/system/dispatcher.go index 88091595..d9a9fdb9 100644 --- a/internal/system/dispatcher.go +++ b/internal/system/dispatcher.go @@ -6,7 +6,7 @@ import ( "log" "os" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/internal/acl" "hakurei.app/internal/dbus" diff --git a/internal/system/dispatcher_test.go b/internal/system/dispatcher_test.go index f69422c9..01236e4b 100644 --- a/internal/system/dispatcher_test.go +++ b/internal/system/dispatcher_test.go @@ -9,7 +9,7 @@ import ( "testing" "unsafe" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" "hakurei.app/hst" "hakurei.app/internal/acl" diff --git a/internal/system/link.go b/internal/system/link.go index a13adaae..872ac80a 100644 --- a/internal/system/link.go +++ b/internal/system/link.go @@ -3,7 +3,7 @@ package system import ( "fmt" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" ) diff --git a/internal/system/mkdir.go b/internal/system/mkdir.go index f375579c..cff5d662 100644 --- a/internal/system/mkdir.go +++ b/internal/system/mkdir.go @@ -5,7 +5,7 @@ import ( "fmt" "os" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" ) diff --git a/internal/system/pipewire.go b/internal/system/pipewire.go index 2026b2b4..a78cee26 100644 --- a/internal/system/pipewire.go +++ b/internal/system/pipewire.go @@ -5,7 +5,7 @@ import ( "fmt" "io" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/internal/acl" "hakurei.app/internal/pipewire" diff --git a/internal/system/system_test.go b/internal/system/system_test.go index f36ff54e..f82aa932 100644 --- a/internal/system/system_test.go +++ b/internal/system/system_test.go @@ -8,7 +8,7 @@ import ( "strconv" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/container/stub" "hakurei.app/hst" "hakurei.app/internal/xcb" diff --git a/internal/system/wayland.go b/internal/system/wayland.go index 43112784..ada91167 100644 --- a/internal/system/wayland.go +++ b/internal/system/wayland.go @@ -5,7 +5,7 @@ import ( "fmt" "io" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/hst" "hakurei.app/internal/acl" ) diff --git a/internal/wayland/conn.go b/internal/wayland/conn.go index 7aebafb8..0e709bbf 100644 --- a/internal/wayland/conn.go +++ b/internal/wayland/conn.go @@ -5,7 +5,7 @@ import ( "os" "syscall" - "hakurei.app/container/check" + "hakurei.app/check" ) // SecurityContext holds resources associated with a Wayland security_context. diff --git a/internal/wayland/conn_test.go b/internal/wayland/conn_test.go index 148f077b..a884c182 100644 --- a/internal/wayland/conn_test.go +++ b/internal/wayland/conn_test.go @@ -8,7 +8,7 @@ import ( "syscall" "testing" - "hakurei.app/container/check" + "hakurei.app/check" ) func TestSecurityContextClose(t *testing.T) { diff --git a/ldd/exec.go b/ldd/exec.go index 7392bd8b..45d33ec0 100644 --- a/ldd/exec.go +++ b/ldd/exec.go @@ -9,8 +9,8 @@ import ( "os/exec" "time" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/container/seccomp" "hakurei.app/container/std" diff --git a/ldd/exec_test.go b/ldd/exec_test.go index a1e97344..b24b30e4 100644 --- a/ldd/exec_test.go +++ b/ldd/exec_test.go @@ -6,8 +6,8 @@ import ( "os/exec" "testing" + "hakurei.app/check" "hakurei.app/container" - "hakurei.app/container/check" "hakurei.app/ldd" "hakurei.app/message" ) diff --git a/ldd/ldd.go b/ldd/ldd.go index 2e8cf59f..91797f18 100644 --- a/ldd/ldd.go +++ b/ldd/ldd.go @@ -15,7 +15,7 @@ import ( "strconv" "strings" - "hakurei.app/container/check" + "hakurei.app/check" ) var ( diff --git a/ldd/ldd_test.go b/ldd/ldd_test.go index 77f20a68..db41355c 100644 --- a/ldd/ldd_test.go +++ b/ldd/ldd_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "hakurei.app/container/check" + "hakurei.app/check" "hakurei.app/ldd" ) -- cgit v1.3.1