system/dbus: use well-known address in spec
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m13s
Test / Hpkg (push) Successful in 4m8s
Test / Hakurei (race detector) (push) Successful in 5m26s
Test / Hakurei (push) Successful in 2m14s
Test / Sandbox (race detector) (push) Successful in 2m4s
Test / Flake checks (push) Successful in 1m32s
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m13s
Test / Hpkg (push) Successful in 4m8s
Test / Hakurei (race detector) (push) Successful in 5m26s
Test / Hakurei (push) Successful in 2m14s
Test / Sandbox (race detector) (push) Successful in 2m4s
Test / Flake checks (push) Successful in 1m32s
The session bus still performs non-standard formatting since it makes no sense for hakurei to start the session bus. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
f5a597c406
commit
037144b06e
@ -250,7 +250,7 @@ func TestApp(t *testing.T) {
|
|||||||
Args: []string{"zsh", "-c", "exec chromium "},
|
Args: []string{"zsh", "-c", "exec chromium "},
|
||||||
Env: []string{
|
Env: []string{
|
||||||
"DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/65534/bus",
|
"DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/65534/bus",
|
||||||
"DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket",
|
"DBUS_SYSTEM_BUS_ADDRESS=unix:path=/var/run/dbus/system_bus_socket",
|
||||||
"HOME=/home/chronos",
|
"HOME=/home/chronos",
|
||||||
"PULSE_COOKIE=" + hst.PrivateTmp + "/pulse-cookie",
|
"PULSE_COOKIE=" + hst.PrivateTmp + "/pulse-cookie",
|
||||||
"PULSE_SERVER=unix:/run/user/65534/pulse/native",
|
"PULSE_SERVER=unix:/run/user/65534/pulse/native",
|
||||||
@ -284,7 +284,7 @@ func TestApp(t *testing.T) {
|
|||||||
Bind(m("/run/user/1971/hakurei/ebf083d1b175911782d413369b64ce7c/pulse"), m("/run/user/65534/pulse/native"), 0).
|
Bind(m("/run/user/1971/hakurei/ebf083d1b175911782d413369b64ce7c/pulse"), m("/run/user/65534/pulse/native"), 0).
|
||||||
Place(m(hst.PrivateTmp+"/pulse-cookie"), bytes.Repeat([]byte{0}, pulseCookieSizeMax)).
|
Place(m(hst.PrivateTmp+"/pulse-cookie"), bytes.Repeat([]byte{0}, pulseCookieSizeMax)).
|
||||||
Bind(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/bus"), m("/run/user/65534/bus"), 0).
|
Bind(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/bus"), m("/run/user/65534/bus"), 0).
|
||||||
Bind(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/system_bus_socket"), m("/run/dbus/system_bus_socket"), 0).
|
Bind(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/system_bus_socket"), m("/var/run/dbus/system_bus_socket"), 0).
|
||||||
Remount(m("/"), syscall.MS_RDONLY),
|
Remount(m("/"), syscall.MS_RDONLY),
|
||||||
SeccompPresets: bits.PresetExt | bits.PresetDenyDevel,
|
SeccompPresets: bits.PresetExt | bits.PresetDenyDevel,
|
||||||
HostNet: true,
|
HostNet: true,
|
||||||
@ -394,7 +394,7 @@ func TestApp(t *testing.T) {
|
|||||||
Args: []string{"/nix/store/yqivzpzzn7z5x0lq9hmbzygh45d8rhqd-chromium-start"},
|
Args: []string{"/nix/store/yqivzpzzn7z5x0lq9hmbzygh45d8rhqd-chromium-start"},
|
||||||
Env: []string{
|
Env: []string{
|
||||||
"DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1971/bus",
|
"DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1971/bus",
|
||||||
"DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket",
|
"DBUS_SYSTEM_BUS_ADDRESS=unix:path=/var/run/dbus/system_bus_socket",
|
||||||
"HOME=/var/lib/persist/module/hakurei/0/1",
|
"HOME=/var/lib/persist/module/hakurei/0/1",
|
||||||
"PULSE_COOKIE=" + hst.PrivateTmp + "/pulse-cookie",
|
"PULSE_COOKIE=" + hst.PrivateTmp + "/pulse-cookie",
|
||||||
"PULSE_SERVER=unix:/run/user/1971/pulse/native",
|
"PULSE_SERVER=unix:/run/user/1971/pulse/native",
|
||||||
@ -434,7 +434,7 @@ func TestApp(t *testing.T) {
|
|||||||
Bind(m("/run/user/1971/hakurei/8e2c76b066dabe574cf073bdb46eb5c1/pulse"), m("/run/user/1971/pulse/native"), 0).
|
Bind(m("/run/user/1971/hakurei/8e2c76b066dabe574cf073bdb46eb5c1/pulse"), m("/run/user/1971/pulse/native"), 0).
|
||||||
Place(m(hst.PrivateTmp+"/pulse-cookie"), bytes.Repeat([]byte{0}, pulseCookieSizeMax)).
|
Place(m(hst.PrivateTmp+"/pulse-cookie"), bytes.Repeat([]byte{0}, pulseCookieSizeMax)).
|
||||||
Bind(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/bus"), m("/run/user/1971/bus"), 0).
|
Bind(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/bus"), m("/run/user/1971/bus"), 0).
|
||||||
Bind(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/system_bus_socket"), m("/run/dbus/system_bus_socket"), 0).
|
Bind(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/system_bus_socket"), m("/var/run/dbus/system_bus_socket"), 0).
|
||||||
Remount(m("/"), syscall.MS_RDONLY),
|
Remount(m("/"), syscall.MS_RDONLY),
|
||||||
SeccompPresets: bits.PresetExt | bits.PresetDenyTTY | bits.PresetDenyDevel,
|
SeccompPresets: bits.PresetExt | bits.PresetDenyTTY | bits.PresetDenyDevel,
|
||||||
HostNet: true,
|
HostNet: true,
|
||||||
@ -655,7 +655,7 @@ func (k *stubNixOS) evalSymlinks(path string) (string, error) {
|
|||||||
return "/run/user/1971", nil
|
return "/run/user/1971", nil
|
||||||
case "/tmp/hakurei.0":
|
case "/tmp/hakurei.0":
|
||||||
return "/tmp/hakurei.0", nil
|
return "/tmp/hakurei.0", nil
|
||||||
case "/run/dbus":
|
case "/var/run/dbus":
|
||||||
return "/run/dbus", nil
|
return "/run/dbus", nil
|
||||||
case "/dev/kvm":
|
case "/dev/kvm":
|
||||||
return "/dev/kvm", nil
|
return "/dev/kvm", nil
|
||||||
|
@ -50,7 +50,7 @@ func (s *spDBusOp) toContainer(state *outcomeStateParams) error {
|
|||||||
state.env["DBUS_SESSION_BUS_ADDRESS"] = "unix:path=" + sessionInner.String()
|
state.env["DBUS_SESSION_BUS_ADDRESS"] = "unix:path=" + sessionInner.String()
|
||||||
state.params.Bind(state.instancePath().Append("bus"), sessionInner, 0)
|
state.params.Bind(state.instancePath().Append("bus"), sessionInner, 0)
|
||||||
if s.ProxySystem {
|
if s.ProxySystem {
|
||||||
systemInner := fhs.AbsRun.Append("dbus/system_bus_socket")
|
systemInner := fhs.AbsVar.Append("run/dbus/system_bus_socket")
|
||||||
state.env["DBUS_SYSTEM_BUS_ADDRESS"] = "unix:path=" + systemInner.String()
|
state.env["DBUS_SYSTEM_BUS_ADDRESS"] = "unix:path=" + systemInner.String()
|
||||||
state.params.Bind(state.instancePath().Append("system_bus_socket"), systemInner, 0)
|
state.params.Bind(state.instancePath().Append("system_bus_socket"), systemInner, 0)
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,31 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
/*SessionBusAddress is the name of the environment variable where the address of the login session message bus is given in.
|
||||||
|
|
||||||
|
If that variable is not set, applications may also try to read the address from the X Window System root window property _DBUS_SESSION_BUS_ADDRESS.
|
||||||
|
The root window property must have type STRING. The environment variable should have precedence over the root window property.
|
||||||
|
|
||||||
|
The address of the login session message bus is given in the DBUS_SESSION_BUS_ADDRESS environment variable.
|
||||||
|
If DBUS_SESSION_BUS_ADDRESS is not set, or if it's set to the string "autolaunch:",
|
||||||
|
the system should use platform-specific methods of locating a running D-Bus session server,
|
||||||
|
or starting one if a running instance cannot be found.
|
||||||
|
Note that this mechanism is not recommended for attempting to determine if a daemon is running.
|
||||||
|
It is inherently racy to attempt to make this determination, since the bus daemon may be started just before or just after the determination is made.
|
||||||
|
Therefore, it is recommended that applications do not try to make this determination for their functionality purposes, and instead they should attempt to start the server.
|
||||||
|
|
||||||
|
This package diverges from the specification, as the caller is unlikely to be an X client, or be in a position to autolaunch a dbus server.
|
||||||
|
So a fallback address with a socket located in the well-known default XDG_RUNTIME_DIR formatting is used.*/
|
||||||
SessionBusAddress = "DBUS_SESSION_BUS_ADDRESS"
|
SessionBusAddress = "DBUS_SESSION_BUS_ADDRESS"
|
||||||
|
|
||||||
|
/*SystemBusAddress is the name of the environment variable where the address of the system message bus is given in.
|
||||||
|
|
||||||
|
If that variable is not set, applications should try to connect to the well-known address unix:path=/var/run/dbus/system_bus_socket.
|
||||||
|
Implementations of the well-known system bus should listen on an address that will result in that connection being successful.*/
|
||||||
SystemBusAddress = "DBUS_SYSTEM_BUS_ADDRESS"
|
SystemBusAddress = "DBUS_SYSTEM_BUS_ADDRESS"
|
||||||
|
|
||||||
|
// FallbackSystemBusAddress is used when [SystemBusAddress] is not set.
|
||||||
|
FallbackSystemBusAddress = "unix:path=/var/run/dbus/system_bus_socket"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -30,7 +53,7 @@ func Address() (session, system string) {
|
|||||||
// resolve upstream system bus address
|
// resolve upstream system bus address
|
||||||
if addr, ok := os.LookupEnv(SystemBusAddress); !ok {
|
if addr, ok := os.LookupEnv(SystemBusAddress); !ok {
|
||||||
// fall back to default hardcoded value
|
// fall back to default hardcoded value
|
||||||
addresses[1] = "unix:path=/run/dbus/system_bus_socket"
|
addresses[1] = FallbackSystemBusAddress
|
||||||
} else {
|
} else {
|
||||||
addresses[1] = addr
|
addresses[1] = addr
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user