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

Rewrite ::address (import from dbus_addr) #989

Merged
merged 21 commits into from
Oct 1, 2024
Merged

Conversation

elmarco
Copy link
Contributor

@elmarco elmarco commented Sep 15, 2024

Based on the discussion from #982, import dbus_addr as zbus_address and rebase #562 to make use of it.

@zeenix
Copy link
Contributor

zeenix commented Sep 15, 2024

Thanks! I'll have a look soon. In the meantime, could you please rebase this on top of #976? That one is just waiting for a test case to be added.

Copy link
Contributor

@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.

You'll need to change some fundamental design here to make it acceptable to me, sorry.

zbus/src/error.rs Outdated Show resolved Hide resolved
zbus_address/README.md Outdated Show resolved Hide resolved
zbus_address/README.md Outdated Show resolved Hide resolved
zbus_address/README.md Outdated Show resolved Hide resolved
zbus_address/src/lib.rs Outdated Show resolved Hide resolved
zbus_address/src/address.rs Outdated Show resolved Hide resolved
zbus_address/src/address.rs Outdated Show resolved Hide resolved
zbus_address/src/address_list.rs Outdated Show resolved Hide resolved
zbus_address/src/address.rs Outdated Show resolved Hide resolved
zbus_address/src/address.rs Outdated Show resolved Hide resolved
@zeenix
Copy link
Contributor

zeenix commented Sep 17, 2024

I mainly see only 2 blockers here now:

  • The split. As discussed before, I'm not at all convinced a split is worth it in practical terms. We should instead make use of cargo features to make zbus modular instead.
  • The naming.

@elmarco
Copy link
Contributor Author

elmarco commented Sep 17, 2024

I mainly see only 2 blockers here now:

* The split. As discussed before, I'm not at all convinced a split is worth it in practical terms. We should instead make use of cargo features to make zbus modular instead.

* The naming.

I disagree with you on those two points, but if it is what it takes to make progress...

@zeenix
Copy link
Contributor

zeenix commented Sep 17, 2024

I disagree with you on those two points

That's well established. :)

but if it is what it takes to make progress...

I'm sorry but yeah. You've to keep in mind that I did try my best to explain my reasoning in detail. I regret that I failed to convince you in the end.

@elmarco elmarco force-pushed the address branch 6 times, most recently from a0f3be2 to 8b9f688 Compare September 18, 2024 09:34
@elmarco elmarco changed the title Introduce zbus_address & use it Rewrite ::address (import from dbus_addr) Sep 18, 2024
@zeenix
Copy link
Contributor

zeenix commented Sep 18, 2024

@elmarco is this ready for review?

@elmarco
Copy link
Contributor Author

elmarco commented Sep 19, 2024

@elmarco is this ready for review?

yes please

zbus/src/address/percent.rs Show resolved Hide resolved
zbus/src/address/address.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@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.

Found a few more things, mostly minor nits.

zbus/src/address/transport/mod.rs Show resolved Hide resolved
zbus/src/address/transport/systemd.rs Show resolved Hide resolved
zbus/src/address/transport/unix.rs Outdated Show resolved Hide resolved
zbus/src/address/transport/unix.rs Show resolved Hide resolved
zbus/src/address/transport/unixexec.rs Outdated Show resolved Hide resolved
zbus/src/address/transport/unixexec.rs Show resolved Hide resolved
zbus/src/address/transport.rs Outdated Show resolved Hide resolved
zbus/src/address/transport.rs Outdated Show resolved Hide resolved
@elmarco elmarco force-pushed the address branch 4 times, most recently from 11f4e9d to f3e5d25 Compare September 24, 2024 11:04
Copy link
Contributor

@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.

Let's get it in but please fix the remaining minor things in a follow-up commit. 🙏

zbus/src/address/transport/mod.rs Outdated Show resolved Hide resolved
@zeenix
Copy link
Contributor

zeenix commented Sep 29, 2024

Seems it needs another rebase, so you might as well fix the minor issues while you rebase.

Parsing can be done with legacy Address and DBusAddr
Connecting to an address can recursively resolve to a different address
to connect to. Because it's an async function, box it.
As requested by Zeeshan.
Some addresses should only be used on specific target OS. This makes the
address handling specific to the target, which will make its usage
impractical for some use cases (web, configuration etc)

As requested by Zeeshan.
@zeenix zeenix enabled auto-merge October 1, 2024 11:50
@zeenix zeenix disabled auto-merge October 1, 2024 11:51
@zeenix zeenix merged commit fc03642 into dbus2:main Oct 1, 2024
7 checks passed
@zeenix zeenix mentioned this pull request Oct 2, 2024
#[derive(Debug, PartialEq, Eq)]
pub struct Unixexec<'a> {
path: Cow<'a, OsStr>,
argv: Vec<(usize, Cow<'a, str>)>,
Copy link
Contributor

Choose a reason for hiding this comment

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

why keep the index in a Vec? Vec and slices are indexed already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

First, because you may or may not have argv0...

You may also have multiple argvN (since we don't enforce this anymore)

And also the spec says " If a specific argvX is not specified no further argvY for Y > X are taken into account." which may be interepreted as the address may be accepted with argvX missing but further argvY.. in which case you should ignore them for exec, but you may still want to retain them?..

Copy link
Contributor

Choose a reason for hiding this comment

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

First, because you may or may not have argv0...

That just means that argv0 needs special treatment (sperate field/getter).


But nm. I didn't remember that args are specified as key=value, with key as argN..

Copy link
Contributor

Choose a reason for hiding this comment

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

Unresolving this thread for this part:

First, because you may or may not have argv0...

That just means that argv0 needs special treatment (sperate field/getter).

This is also closer to the spec since arg0 is separate key.

};

pub(crate) async fn connect(
l: &crate::address::transport::Autolaunch<'_>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sure you can come up with a better name than l.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

autol ?

Copy link
Contributor

Choose a reason for hiding this comment

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

autolaunch isn't super long. 😆

@zeenix zeenix mentioned this pull request Oct 2, 2024
zeenix added a commit to zeenix/zbus that referenced this pull request Oct 14, 2024
This reverts commit fc03642, reversing
changes made to deffbb8.

It turns out there was a major design flaw in the API: the parsed
address string was not kept in a parsed state, resulting in reparsing of
the string form, for each getter. Because of this, I decided to revert
the changes for 5.0.
zeenix added a commit to zeenix/zbus that referenced this pull request Oct 14, 2024
This reverts commit fc03642, reversing
changes made to deffbb8.

It turns out there was a major design flaw in the API: the parsed
address string was not kept in a parsed state, resulting in reparsing of
the string form, for each getter. Because of this, I decided to revert
the changes for 5.0.
zeenix added a commit to zeenix/zbus that referenced this pull request Oct 14, 2024
This reverts commit fc03642, reversing
changes made to deffbb8.

It turns out there was a major design flaw in the API: the parsed
address string was not kept in a parsed state, resulting in reparsing of
the string form, for each getter. Because of this, I decided to revert
the changes for 5.0.
zeenix added a commit to zeenix/zbus that referenced this pull request Oct 14, 2024
This reverts commit fc03642, reversing
changes made to deffbb8.

It turns out there was a major design flaw in the API: the parsed
address string was not kept in a parsed state, resulting in reparsing of
the string form, for each getter. Because of this, I decided to revert
the changes for 5.0.
zeenix added a commit that referenced this pull request Oct 14, 2024
⏪️ Revert "Merge pull request #989 from elmarco/address"
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