Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Expose the socket address clients can use #182

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jokeyrhyme
Copy link
Contributor

@jokeyrhyme jokeyrhyme commented Dec 14, 2024

This PR takes the BusType, --session, and --system work from #159 . And then builds upon that (perhaps unnecessarily) to fix addresses the issue identified here: #175 (comment)

i.e. --print-address previously didn't always produce a bus address that clients could use.

I've confirmed that the output from --print-address can be used with DBUS_SESSION_BUS_ADDRESS=... cargo test in the zbus repository

src/bin/busd.rs Outdated Show resolved Hide resolved
@jokeyrhyme jokeyrhyme force-pushed the default-addresses-and-printing-oh-my branch 2 times, most recently from 654a7f5 to aa8fa3b Compare December 14, 2024 06:28
@jokeyrhyme jokeyrhyme force-pushed the default-addresses-and-printing-oh-my branch 4 times, most recently from f8fd47f to 0e6497a Compare December 25, 2024 10:17
Copy link
Collaborator

@zeenix zeenix left a comment

Choose a reason for hiding this comment

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

Look great otherwise.

src/bus/mod.rs Outdated Show resolved Hide resolved
src/bus/mod.rs Outdated Show resolved Hide resolved
src/bus/mod.rs Outdated Show resolved Hide resolved
@jokeyrhyme jokeyrhyme force-pushed the default-addresses-and-printing-oh-my branch 2 times, most recently from 21415a9 to 50d093f Compare December 29, 2024 05:22
src/bus/mod.rs Outdated Show resolved Hide resolved
@jokeyrhyme jokeyrhyme force-pushed the default-addresses-and-printing-oh-my branch from 50d093f to 77fa221 Compare January 6, 2025 23:09
src/bus/mod.rs Outdated
#[cfg(unix)]
use std::{env, path::Path};
use std::{str::FromStr, sync::Arc};

use anyhow::{bail, Ok, Result};
Copy link
Collaborator

Choose a reason for hiding this comment

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

also this change is unrelated to the commit. :) I wouldn't have even mentioned it but since you're going to update the commit anyway. :)

@jokeyrhyme jokeyrhyme force-pushed the default-addresses-and-printing-oh-my branch from 77fa221 to 4bee358 Compare January 8, 2025 06:41
src/bus/mod.rs Outdated
@@ -2,6 +2,7 @@ use anyhow::{bail, Ok, Result};
#[cfg(unix)]
use std::{env, path::Path};
use std::{str::FromStr, sync::Arc};

Copy link
Collaborator

Choose a reason for hiding this comment

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

still. 😢

@jokeyrhyme jokeyrhyme force-pushed the default-addresses-and-printing-oh-my branch from 4bee358 to 54d1535 Compare January 8, 2025 21:59
Previously, we'd take the `--address` or default address, resolve it
into the socket address, and start listening on that address. But we
need to be able to expose that address to clients, too. So we break
`Bus::unix_stream()` apart giving us a separate `Bus::unix_addr()` and
access to the intermediate socket address.
Until now, `--print-address` would print the address specification,
that is, the input used to determine how and where the server would
listen. This would be useful for clients for `unix:path=...`, but for
`unix:dir=...` and `unix:tmpdir=...` this would not work. So now we
share the socket address that we produce from the address
specification.
Comment on lines +67 to +69
address = Address::try_from(
format!("unix:path={}", addr.as_pathname().unwrap().display()).as_str(),
)?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

So sorry but I did point out this before here: You don't (at least should not) need any parsing here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants