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

[regression] unable to connect to abstract path #6903

Closed
tones111 opened this issue Oct 16, 2024 · 5 comments
Closed

[regression] unable to connect to abstract path #6903

tones111 opened this issue Oct 16, 2024 · 5 comments
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-net Module: tokio/net

Comments

@tones111
Copy link

Version
cargo tree | grep tokio
tokio v1.40.0
tokio-macros v2.4.0

Platform
uname -a
Linux mobile 6.11.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 10 Oct 2024 20:11:06 +0000 x86_64 GNU/Linux

Description
The following examples fail to connect to an abstract path with tokio 1.40, however, they work when built against tokio 1.38.

I'm confused on the status of abstract path support. Open issues #4610 and #6202 suggest abstract paths aren't supported yet, however, the release notes for 1.39.3 highlight #6767 which suggests they do work. I had been using them successfully with 1.38 and only discovered this issue upon updating to 1.40.

# Cargo.toml
[dependencies]
regex = "1"
#tokio = { version = "=1.38", features = ["macros", "net", "rt"] }
tokio = { version = "=1.40", features = ["macros", "net", "rt"] }
use {
    regex::Regex,
    tokio::net::{UnixListener, UnixStream},
};

#[tokio::main(flavor = "current_thread")]
async fn main() {
    {
        const PATH: &str = "\0foo";
        let _listener = UnixListener::bind(PATH).unwrap();
        assert!(UnixStream::connect(PATH).await.is_ok());
    }

    {
        let listener = UnixListener::bind("").unwrap();
        let addr = format!("{:?}", listener.local_addr().unwrap());
        println!("local addr: {addr}");

        let re_exec_path = Regex::new(r#""(.*)" \((.*)\)"#).unwrap();
        if let Some(caps) = re_exec_path.captures(&addr) {
            match (
                caps.get(1).map(|m| m.as_str()),
                caps.get(2).map(|m| m.as_str()),
            ) {
                (Some(path), Some("abstract")) => {
                    let path = String::from("\0") + path;
                    assert!(UnixStream::connect(path).await.is_ok());
                }
                _ => todo!("not abstract"),
            }
        }
    }
}
@tones111 tones111 added A-tokio Area: The main tokio crate C-bug Category: This is a bug. labels Oct 16, 2024
@Darksonn Darksonn added the M-net Module: tokio/net label Oct 16, 2024
@Darksonn
Copy link
Contributor

That's weird. This should have been fixed by #6772.

@mox692
Copy link
Member

mox692 commented Oct 16, 2024

@tones111
Could you try out using the master branch to see if your issue is resolved? I think the fix #6838 is not released yet.

@Darksonn
Copy link
Contributor

I guess we should probably make a release.

@tones111
Copy link
Author

Thank you, that was it! Closing this as a duplicate of #6837.

@mox692
Copy link
Member

mox692 commented Oct 17, 2024

I guess we should probably make a release.

I can prepare for the release tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-net Module: tokio/net
Projects
None yet
Development

No branches or pull requests

3 participants