cat
2edcfe1e68
internal/pipewire: define size constants
...
This gets rid of magic numbers in marshal/unmarshal.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-27 00:54:56 +09:00
cat
2698ca00e8
internal/pipewire: implement Core::Done
...
The message in the sample does not correspond to any known method call. The spec does not mention what to do with messages like this, but all existing usage code simply drops it.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-26 19:02:21 +09:00
cat
1d0143386d
internal/pipewire: optional final trailing garbage check
...
Omitting the check is only useful for custom unmarshaler.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-26 18:50:39 +09:00
cat
a55c209099
internal/pipewire: additional Client::Info test case
...
This appears to add *one single entry* compared to the message before it. The inefficiency of this protocol is beyond imagination.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-26 16:28:57 +09:00
cat
10ff276da1
internal/pipewire: additional Client::Info test case
...
This message follows the other Client::Info event before it. No idea why.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-26 16:17:38 +09:00
cat
fd4d379b67
internal/pipewire: implement Client::Info
...
Everything is already supported, as usual.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-26 16:05:46 +09:00
cat
77f5b89a41
internal/pipewire: implement Core::BoundProps
...
Very straightforward type, everything is already supported.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 18:40:19 +09:00
cat
14e33f17e5
internal/pipewire: check nil marshaler
...
NULL values have special case in the format. This check ensures correctness serialising nil pointers.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 18:36:08 +09:00
cat
cfeb7818eb
internal/pipewire: implement Core::Info and generation footer
...
These are not directly related but are first encountered on the same message in the capture.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 15:16:12 +09:00
cat
05391da556
internal/pipewire: implement footer
...
The POD itself is serialised without requiring a special case, however its presence is only indicated by the difference in size recorded in the header and payload.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 15:11:22 +09:00
cat
463f8836e6
internal/pipewire: implement Long type
...
Thankfully no special case here.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 15:05:37 +09:00
cat
2e465c94da
internal/pipewire: implement Id type
...
This is, in fact, just a glorified Int type.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 15:01:58 +09:00
cat
26009fd3f7
internal/pipewire: slice at POD boundary
...
This prevents incorrectly reading trailing data as part of the current POD.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 14:58:56 +09:00
cat
2d7b896a8c
internal/pipewire: bounds check against wire size
...
This covers cases where wire size is not known ahead of time.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 13:42:31 +09:00
cat
a0eb010aab
internal/pipewire: spa_dict trailing garbage within POD
...
This performs the check within the bounds of the POD only. This was not caught since spa_dict was only used as the final struct field until now.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 13:39:02 +09:00
cat
b1b27ac1df
internal/pipewire: zero size before validation
...
Leftover values from previous invocations cause incorrect behaviour here.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 12:21:37 +09:00
cat
fc3d78fe01
internal/pipewire: implement Core::Sync
...
Once again, already entirely supported, the offset is not yet fully verified but makes intuitive sense. Will verify this on future occurrences of the message.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 08:52:06 +09:00
cat
591637264a
internal/pipewire: implement Core::GetRegistry
...
This struct is entirely supported, so this change is very straightforward.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 08:34:19 +09:00
cat
e77652bf89
internal/pipewire: move test data to files
...
These get very big later on, and would be painful to represent as the compound literal.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 08:09:10 +09:00
cat
88d3e46413
internal/pipewire: implement Client::UpdateProperties
...
This is the second message on the captured sample.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 04:16:11 +09:00
cat
e51e81bb22
internal/pipewire: implement spa_dict type
...
This is a terrible type that defies the type system. It is implemented on the concrete type to avoid special cases.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 04:08:52 +09:00
cat
8f4a3bcf9f
internal/pipewire: use custom marshaler when available
...
This reduces special cases. This change also exposes unmarshalled message size on the wire.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 04:05:22 +09:00
cat
827dc9e1ba
internal/pipewire: implement string type
...
This is still NUL terminated strings, and an extra NUL character on an 8-byte string does cause an extra 7 bytes of padding.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 04:00:59 +09:00
cat
d92de1c709
internal/pipewire: check for trailing garbage
...
This is useful during development.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 01:59:29 +09:00
cat
5bcafcf734
internal/pipewire: implement Core::Hello
...
This implements enough types to correctly marshal and unmarshal Core::Hello.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 01:20:30 +09:00
cat
9f7b0c2f46
internal/pipewire: add type constants
...
This change also centralises encoding testing.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-24 22:00:09 +09:00
cat
3e87187c4c
internal/pipewire: implement message header
...
Test cases are from interactions between pw-container and PipeWire. Results are validated against corresponding body.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-23 16:20:35 +09:00
cat
b651d95e77
workflows: do not duplicate on pulls
...
This condition causes two runs to be created on a pull, as gitea does not check whether a run has already been created for the current commit.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-19 06:59:32 +09:00
cat
aab92ce3c1
internal/wayland: clean up pathname socket
...
This is cleaner than cleaning up in internal/system as it covers the failure paths.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-19 06:37:04 +09:00
cat
a495e09a8f
internal/wayland: do not double close fd
...
These are already closed during securityContextBindPipe on a non-nil error.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-17 22:03:29 +09:00
cat
3afca2bd5b
internal/wayland: expose WAYLAND_VERSION
...
This might be useful troubleshooting information.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-17 01:46:01 +09:00
cat
b73a789dfe
.clang-format: increase indent width
...
This significantly increases readability. This patch is pretty big so it is being done after mostly everything has settled.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-16 20:57:29 +09:00
cat
38b5ff0cec
internal/wayland: check pathname size
...
This avoids passing a truncated pathname to the kernel.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-16 03:34:05 +09:00
cat
3c204b9b40
internal/wayland: increase error detail
...
This includes targeted paths in the returned errors.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-16 02:09:50 +09:00
cat
00771efeb4
internal/wayland: remove fd typecasts
...
These are no longer necessary since RawConn is no longer used.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-16 01:45:37 +09:00
cat
61972d61f6
internal/wayland: reimplement connect/bind code
...
The old implementation is relocated to system/wayland/deprecated.go.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-16 01:23:16 +09:00
cat
fe40af7b7e
internal/wayland: relocate connection struct
...
This interface is getting replaced, so relocating it to the deprecated wrapper package before working on its replacement.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-15 23:25:46 +09:00
cat
12751932d1
internal/wayland: improve error handling
...
Note: wl_registry_add_listener is undocumented everywhere. Its implementation calls wl_proxy_add_listener which returns 0 on success or -1 on failure.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-15 21:26:31 +09:00
cat
41b49137a8
.clang-format: do not limit line length
...
This hard limit destroys readability in some places.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-15 17:06:43 +09:00
cat
c761e1de4d
nix: build with clang
...
Clang is better than gcc in various ways. This also pulls in clang-format which is very helpful.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-15 16:36:36 +09:00
cat
a91920310d
internal: relocate packages
...
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-15 13:58:34 +09:00
cat
16e674782a
cmd/hakurei: reorder show entries
...
This order semantically makes more sense and generally looks tidier.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 22:14:49 +09:00
cat
47244daefb
treewide: migrate ldd callers
...
This discontinues use of the deprecated ldd.Exec function for #25 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 21:59:59 +09:00
cat
46fa104419
ldd: require absolute pathname
...
The sandbox which ldd(1) runs in does not inherit parent work directory, so relative pathnames will not work correctly. While it is trivial to support such a use case, the use of relative pathnames is highly error-prone and generally frowned against in this project. The Exec function remains available under the same signature until v0.4.0 where it will be removed.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 21:53:10 +09:00
cat
45953b3d9c
ldd: cancel on decoder error
...
This prevents blocking from failures caused by ldd(1) emitting output that is not anticipated by the decoder.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 21:43:34 +09:00
cat
42759e7a9f
ldd: create musl entry representation
...
This mostly helps with debugging.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 21:38:35 +09:00
cat
8e2d2c8246
ldd: check decoder scan guard
...
This was unreachable via the Parse wrapper.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 18:32:47 +09:00
cat
299685775a
container: provide usage example
...
This requires cgo so unfortunately will not run in the playground.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 18:25:22 +09:00
cat
b7406cc4c4
ldd: update package doc comment
...
This should hopefully deter misuse of this package.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 17:49:01 +09:00
cat
690a0ed0d6
ldd: decode from reader
...
This should reduce memory footprint of the parsing process and allow decoding part of the stream.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 08:33:19 +09:00
cat
a9d72a5eb1
internal/outcome: rename run from main
...
The "main.go" name is quite confusing as this is often only present in main packages.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 01:06:14 +09:00
cat
6d14bb814f
container/fhs: add constant for /dev/shm/
...
This is mounted for the default read-only /dev/ when programs want to use shm_open(3). Defining it here is less error-prone and saves the extra append at runtime.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 01:03:26 +09:00
cat
be0e387ab0
internal/info: relocate from internal
...
This is cleaner and makes more sense. The longer LDFLAGS was never a valid concern since it is always inserted by a script.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-13 07:29:46 +09:00
cat
abeb67964f
treewide: document linkname uses
...
These provide justification for each use of linkname. Poorly thought out uses of linkname are removed.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-13 07:14:16 +09:00
cat
bf5d10743f
treewide: import internal/system
...
For #24 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-13 01:22:47 +09:00
cat
4e7aab07d5
internal/system: relocate from system
...
These packages are highly specific to hakurei and are difficult to use safely from other pieces of code.
Their exported symbols are made available until v0.4.0 where they will be removed for #24 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-13 01:17:47 +09:00
cat
15a66a2b31
treewide: import internal/helper
...
For #24 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-12 23:19:34 +09:00
cat
f347d44c22
internal/helper: relocate from helper
...
This package is ugly and is pending removal only kept alive by xdg-dbus-proxy.
Its exported symbols are made available until v0.4.0 where it will be removed for #24 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-12 23:16:13 +09:00
cat
b5630f6883
test: move package sandbox internal
...
This should never be used outside vm tests.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-12 23:03:22 +09:00
cat
17ffdb2dcf
release: 0.3.1
...
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-12 00:53:14 +09:00
cat
ac34635890
container: set FD_CLOEXEC on all open files
...
While fd created from this side always has the FD_CLOEXEC flag, the same is not true for files left open by the parent. This change prevents those files from leaking into the container.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-12 00:18:29 +09:00
cat
9dec9dbc4b
container/init: close setup pipe early
...
This prevents leaking the setup pipe.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-11 07:31:58 +09:00
cat
2f74adc8bd
container/init: close initial process files on termination
...
This closes them during the adopt wait delay. This also keeps them alive.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-10 20:35:59 +09:00
cat
d7e0104ae4
treewide: reject impossible user-supplied fd
...
These are all trusted user input, however this check reduces the likelihood of hard to debug errors.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-10 20:31:26 +09:00
cat
bb92e3ada9
cmd/hakurei: expose current instance identifier
...
This writes the 16-byte instance identifier to file descriptor specified by --identifier-fd if set, and closes the file.
This enables safely obtaining the new instance's identifier.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-10 07:52:35 +09:00
cat
fad419c2a2
internal/outcome: handle group lookup message
...
This results in slightly less messy error reporting.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-09 02:15:48 +09:00
cat
b1a1e73238
nix: update names to reflect new terminology
...
These are terminology from way early days. Update them now to be less confusing.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-09 01:48:31 +09:00
cat
38e9128a8c
container/std/seccomp: remove ineffectual typecast
...
This is no longer necessary since the return type changed.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-07 05:45:51 +09:00
cat
7ee702a44e
container/seccomp/presets: add fields to literals
...
This keeps composites analysis happy.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-07 05:11:57 +09:00
cat
3d188ef884
std: separate seccomp constants
...
This avoids inadvertently using PNRs as syscall numbers.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-07 04:30:06 +09:00
cat
34ccda84b2
release: 0.3.0
...
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-06 01:37:15 +09:00
cat
042013bb04
container/std: syscall JSON adapter
...
This provides cross-platform JSON adapter for syscall number.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-06 00:57:53 +09:00
cat
5c2b63a7f1
container: add 386 constants
...
While it is unlikely a use case for hakurei on i686 exists, it does not hurt to have this support.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-05 20:21:14 +09:00
cat
9fd97e71d0
treewide: fit test untyped int literals in 32-bit
...
This enables hakurei test suite to run on 32-bit targets.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-05 20:13:19 +09:00
cat
fba201c995
container/std: relocate rule types
...
This enables its use in hst for #15 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-05 06:00:39 +09:00
cat
7f27a6dc51
container/seccomp: use native types
...
This prepares NativeRule for relocation to std for #15 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-05 05:48:59 +09:00
cat
b65aba9446
container/seccomp: alias libseccomp types
...
This enables tests to refer to these types and check its size.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-05 05:21:43 +09:00
cat
becaf8b6d7
std: relocate seccomp lookup tables
...
This should enable resolving NativeRule in hst.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-05 04:48:05 +09:00
cat
54c0d6bf48
container/seccomp/pnr: define pseudo syscalls
...
This eliminates the cgo dependency from syscall lookup.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-05 04:32:41 +09:00
cat
c1399f5030
std: rename from comp
...
Seccomp lookup tables are going to be relocated here, and PNR constants.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-05 02:47:43 +09:00
cat
9ac63aac0c
hst/grp_pwd: add extra test cases
...
Does not change coverage but this helps me crosscheck with my phone.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-05 01:42:42 +09:00
cat
cb9ebf0e15
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 >
2025-11-04 08:24:41 +09:00
cat
9a2a7b749f
cmd/hakurei/print: handle nil config
...
There is nothing to print in this case, and such a nil check is missing.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-03 02:20:18 +09:00
cat
ec5cb9400c
cmd/hpkg/test: print share directory
...
This is more useful now that state is tracked here.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-03 01:51:57 +09:00
cat
ae66b3d2fb
message: rename NewMsg to New
...
Should have done this when relocating this from container. Now is a good time to rename it before v0.3.x.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-03 01:49:27 +09:00
cat
149bc3671a
internal/store: remove compat adapter
...
This is no longer used as everything has been migrated.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-03 01:26:01 +09:00
cat
24435694a5
hst/config: make identifier omitempty
...
This is an optional field. Serialise it as such.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-03 01:23:15 +09:00
cat
1c168babf2
cmd/hakurei/print: use new store interface
...
This removes the final uses of the compat interfaces.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-03 01:19:16 +09:00
cat
0edcb7c1d3
test: print share directory
...
This is more useful now that state is tracked here.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-02 17:00:59 +09:00
cat
0e5ca74b98
cmd/hakurei/print: serialise array for ps
...
Wanted to do this for a long time, since the key is redundant. This also makes it easier to migrate to the new store interface.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-02 16:37:08 +09:00
cat
23ae7822bf
cmd/hakurei/parse: use new store interface
...
This greatly reduces overhead. The iterator also significantly cleans up the usage code.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-02 16:00:41 +09:00
cat
898b5aed3d
internal/store: iterator over all entries
...
This is quite convenient for searching the store or printing active instance information.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-02 15:54:00 +09:00
cat
7c3c3135d8
internal/outcome: track state in TMPDIR
...
The SharePath is a more stable path than RunDirPath, since it is available all the time and should remain consistent. This also fits better into the intended use case of XDG_RUNTIME_DIR.
Closes #17 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-02 12:40:58 +09:00
cat
f33aea9ff9
internal/env: cleaner runtime dir fallback
...
This now places rundir inside the fallback runtime dir, so special case in internal/outcome is avoided.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-02 12:22:32 +09:00
cat
e7fc311d0b
internal/outcome/shim: cover reparent and exit request paths
...
These test cases were missed when making the changes.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-02 11:58:09 +09:00
cat
f5274067f6
internal/outcome/process: nil-safe unlock when failing to lock
...
This also prints a debug message which might be useful.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-02 11:47:51 +09:00
cat
e7161f8e61
internal/outcome: measure finalise time
...
This also increases precision of state time output.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-02 05:17:33 +09:00
cat
6931ad95c3
internal/outcome/shim: EOF as exit request fallback
...
In some cases the signal might be delivered before the signal handler is installed, and synchronising against such a case is too expensive. Instead, use the pipe being closed as a fallback to the regular exit request. This change also moves installation of the signal handler early.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-02 04:41:26 +09:00
cat
2ba599b399
internal/outcome/process: use new store interface
...
This change also spawns shim before committing system state, leaving it blocking on the setup pipe. The internal/outcome/process structure is also entirely reworked to be much more readable and less error-prone, while enabling basic performance measurements. A long-standing bug where segment lock is not held during Commit is also resolved.
Closes #19 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-02 04:25:45 +09:00
cat
d3d3417125
internal/outcome/process: relocate start and serve
...
This is useful for reordering these operations for further cleanup.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-01 19:14:59 +09:00