diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-11-04 08:00:37 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-11-04 08:24:41 +0900 |
| commit | cb9ebf0e1541c0e49380cda6d4c2d619a0e9933f (patch) | |
| tree | 8bd0bfe3714fd5975dcacb69c0a2afcd2e04c687 /internal/outcome | |
| parent | 9a2a7b749f41f73c2c11e4a4557516307838457b (diff) | |
hst/grp_pwd: specify new uid format
This leaves slots available for additional uid ranges in Rosa OS.
This breaks all existing installations! Users are required to fix ownership manually.
Closes #18.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/outcome')
| -rw-r--r-- | internal/outcome/hsu.go | 4 | ||||
| -rw-r--r-- | internal/outcome/main_test.go | 8 | ||||
| -rw-r--r-- | internal/outcome/outcome.go | 2 | ||||
| -rw-r--r-- | internal/outcome/shim_test.go | 2 | ||||
| -rw-r--r-- | internal/outcome/spx11_test.go | 6 |
5 files changed, 9 insertions, 13 deletions
diff --git a/internal/outcome/hsu.go b/internal/outcome/hsu.go index b1107331..3047a2e9 100644 --- a/internal/outcome/hsu.go +++ b/internal/outcome/hsu.go @@ -95,7 +95,3 @@ func (h *Hsu) MustID(msg message.Msg) int { return -0xdeadbeef // not reached } } - -// HsuUid returns target uid for the stable hsu uid format. -// No bounds check is performed, a value retrieved by [Hsu] is expected. -func HsuUid(id, identity int) int { return 1000000 + id*10000 + identity } diff --git a/internal/outcome/main_test.go b/internal/outcome/main_test.go index 14aa34d7..ea9c872c 100644 --- a/internal/outcome/main_test.go +++ b/internal/outcome/main_test.go @@ -40,7 +40,7 @@ func TestOutcomeMain(t *testing.T) { wantSys *system.I wantParams *container.Params }{ - {"template", new(stubNixOS), hst.Template(), checkExpectInstanceId, system.New(panicMsgContext{}, message.New(nil), 1000009). + {"template", new(stubNixOS), hst.Template(), checkExpectInstanceId, system.New(panicMsgContext{}, message.New(nil), 10009). // spParamsOp Ensure(m("/tmp/hakurei.0"), 0711). @@ -215,7 +215,7 @@ func TestOutcomeMain(t *testing.T) { 0x96, 0xd7, 0xbc, 0x15, 0xbd, 0x01, 0x78, 0x0e, 0xb9, 0xa6, 0x07, 0xac, - }, system.New(t.Context(), msg, 1000000). + }, system.New(t.Context(), msg, 10000). Ensure(m("/tmp/hakurei.0"), 0711). Ensure(m("/tmp/hakurei.0/runtime"), 0700). UpdatePermType(system.User, m("/tmp/hakurei.0/runtime"), acl.Execute). @@ -339,7 +339,7 @@ func TestOutcomeMain(t *testing.T) { 0xb1, 0x75, 0x91, 0x17, 0x82, 0xd4, 0x13, 0x36, 0x9b, 0x64, 0xce, 0x7c, - }, system.New(t.Context(), msg, 1000009). + }, system.New(t.Context(), msg, 10009). Ensure(m("/tmp/hakurei.0"), 0711). Ensure(m("/tmp/hakurei.0/runtime"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime"), acl.Execute). Ensure(m("/tmp/hakurei.0/runtime/9"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime/9"), acl.Read, acl.Write, acl.Execute). @@ -493,7 +493,7 @@ func TestOutcomeMain(t *testing.T) { 0x66, 0xda, 0xbe, 0x57, 0x4c, 0xf0, 0x73, 0xbd, 0xb4, 0x6e, 0xb5, 0xc1, - }, system.New(t.Context(), msg, 1000001). + }, system.New(t.Context(), msg, 10001). Ensure(m("/tmp/hakurei.0"), 0711). Ensure(m("/tmp/hakurei.0/runtime"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime"), acl.Execute). Ensure(m("/tmp/hakurei.0/runtime/1"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime/1"), acl.Read, acl.Write, acl.Execute). diff --git a/internal/outcome/outcome.go b/internal/outcome/outcome.go index 9cf426f6..1af253ce 100644 --- a/internal/outcome/outcome.go +++ b/internal/outcome/outcome.go @@ -128,7 +128,7 @@ func (s *outcomeState) populateLocal(k syscallDispatcher, msg message.Msg) error s.identity = newInt(s.Identity) s.mapuid, s.mapgid = newInt(s.Mapuid), newInt(s.Mapgid) - s.uid = newInt(HsuUid(s.UserID, s.identity.unwrap())) + s.uid = newInt(hst.ToUser(s.UserID, s.identity.unwrap())) return nil } diff --git a/internal/outcome/shim_test.go b/internal/outcome/shim_test.go index f16d3718..ad0fce6c 100644 --- a/internal/outcome/shim_test.go +++ b/internal/outcome/shim_test.go @@ -123,7 +123,7 @@ func TestShimEntrypoint(t *testing.T) { templateState := outcomeState{ Shim: newShimParams(), ID: &checkExpectInstanceId, - Identity: hst.IdentityMax, + Identity: hst.IdentityEnd, UserID: 10, Container: hst.Template().Container, Mapuid: 1000, diff --git a/internal/outcome/spx11_test.go b/internal/outcome/spx11_test.go index c958e946..85446a4d 100644 --- a/internal/outcome/spx11_test.go +++ b/internal/outcome/spx11_test.go @@ -60,7 +60,7 @@ func TestSpX11Op(t *testing.T) { call("lookupEnv", stub.ExpectArgs{"DISPLAY"}, "unix:/tmp/.X11-unix/X0", nil), call("stat", stub.ExpectArgs{"/tmp/.X11-unix/X0"}, (*stubFi)(nil), os.ErrNotExist), }, newI(). - ChangeHosts("#1000009"), nil, nil, insertsOps(nil), []stub.Call{ + ChangeHosts("#10009"), nil, nil, insertsOps(nil), []stub.Call{ // this op configures the container state and does not make calls during toContainer }, &container.Params{ Ops: new(container.Ops). @@ -84,7 +84,7 @@ func TestSpX11Op(t *testing.T) { call("stat", stub.ExpectArgs{"/tmp/.X11-unix/X0"}, (*stubFi)(nil), nil), }, newI(). UpdatePermType(hst.EX11, m("/tmp/.X11-unix/X0"), acl.Read, acl.Write, acl.Execute). - ChangeHosts("#1000009"), nil, nil, insertsOps(nil), []stub.Call{ + ChangeHosts("#10009"), nil, nil, insertsOps(nil), []stub.Call{ // this op configures the container state and does not make calls during toContainer }, &container.Params{ Ops: new(container.Ops). @@ -107,7 +107,7 @@ func TestSpX11Op(t *testing.T) { call("stat", stub.ExpectArgs{"/tmp/.X11-unix/X0"}, (*stubFi)(nil), nil), }, newI(). UpdatePermType(hst.EX11, m("/tmp/.X11-unix/X0"), acl.Read, acl.Write, acl.Execute). - ChangeHosts("#1000009"), nil, nil, insertsOps(nil), []stub.Call{ + ChangeHosts("#10009"), nil, nil, insertsOps(nil), []stub.Call{ // this op configures the container state and does not make calls during toContainer }, &container.Params{ Ops: new(container.Ops). |
