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

nix 0.24 made VsockAddr opaque #24

Closed
jamessan opened this issue Jun 4, 2022 · 3 comments · Fixed by #25
Closed

nix 0.24 made VsockAddr opaque #24

jamessan opened this issue Jun 4, 2022 · 3 comments · Fixed by #25

Comments

@jamessan
Copy link

jamessan commented Jun 4, 2022

nix-rust/nix#1614

vsock won't build with nix >= 0.24.

Build log
error[E0423]: cannot initialize a tuple struct which contains private fields
    --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:117:32
     |
117  |             Ok(SockAddr::Vsock(VsockAddr(vsock_addr)))
     |                                ^^^^^^^^^ help: a local variable with a similar name exists: `vsock_addr`
     |
note: constructor is not visible here due to private fields
    --> /tmp/tmp.xk1r9Xh1Kg/registry/nix-0.24.1/src/sys/socket/addr.rs:2518:26
     |
2518 |     pub struct VsockAddr(pub(in super::super) sockaddr_vm);
     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private field

error[E0423]: cannot initialize a tuple struct which contains private fields
    --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:281:32
     |
281  |             Ok(SockAddr::Vsock(VsockAddr(vsock_addr)))
     |                                ^^^^^^^^^ help: a local variable with a similar name exists: `vsock_addr`
     |
note: constructor is not visible here due to private fields
    --> /tmp/tmp.xk1r9Xh1Kg/registry/nix-0.24.1/src/sys/socket/addr.rs:2518:26
     |
2518 |     pub struct VsockAddr(pub(in super::super) sockaddr_vm);
     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private field

error[E0423]: cannot initialize a tuple struct which contains private fields
    --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:305:32
     |
305  |             Ok(SockAddr::Vsock(VsockAddr(vsock_addr)))
     |                                ^^^^^^^^^ help: a local variable with a similar name exists: `vsock_addr`
     |
note: constructor is not visible here due to private fields
    --> /tmp/tmp.xk1r9Xh1Kg/registry/nix-0.24.1/src/sys/socket/addr.rs:2518:26
     |
2518 |     pub struct VsockAddr(pub(in super::super) sockaddr_vm);
     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private field

warning: use of deprecated enum `nix::sys::socket::SockAddr`: use SockaddrLike or SockaddrStorage instead
  --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:29:28
   |
29 | pub use nix::sys::socket::{SockAddr, VsockAddr};
   |                            ^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

warning: use of deprecated enum `nix::sys::socket::SockAddr`: use SockaddrLike or SockaddrStorage instead
  --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:57:24
   |
57 |     pub fn bind(addr: &SockAddr) -> Result<VsockListener> {
   |                        ^^^^^^^^

warning: use of deprecated variant `nix::sys::socket::SockAddr::Vsock`: use SockaddrLike or SockaddrStorage instead
  --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:58:47
   |
58 |         let mut vsock_addr = if let SockAddr::Vsock(addr) = addr {
   |                                               ^^^^^

warning: use of deprecated variant `nix::sys::socket::SockAddr::Vsock`: use SockaddrLike or SockaddrStorage instead
  --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:94:31
   |
94 |         Self::bind(&SockAddr::Vsock(VsockAddr::new(cid, port)))
   |                               ^^^^^

warning: use of deprecated enum `nix::sys::socket::SockAddr`: use SockaddrLike or SockaddrStorage instead
  --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:98:40
   |
98 |     pub fn local_addr(&self) -> Result<SockAddr> {
   |                                        ^^^^^^^^

warning: use of deprecated variant `nix::sys::socket::SockAddr::Vsock`: use SockaddrLike or SockaddrStorage instead
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:117:26
    |
117 |             Ok(SockAddr::Vsock(VsockAddr(vsock_addr)))
    |                          ^^^^^

warning: use of deprecated enum `nix::sys::socket::SockAddr`: use SockaddrLike or SockaddrStorage instead
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:127:50
    |
127 |     pub fn accept(&self) -> Result<(VsockStream, SockAddr)> {
    |                                                  ^^^^^^^^

warning: use of deprecated variant `nix::sys::socket::SockAddr::Vsock`: use SockaddrLike or SockaddrStorage instead
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:149:27
    |
149 |                 SockAddr::Vsock(VsockAddr::new(vsock_addr.svm_cid, vsock_addr.svm_port)),
    |                           ^^^^^

warning: use of deprecated enum `nix::sys::socket::SockAddr`: use SockaddrLike or SockaddrStorage instead
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:228:27
    |
228 |     pub fn connect(addr: &SockAddr) -> Result<Self> {
    |                           ^^^^^^^^

warning: use of deprecated variant `nix::sys::socket::SockAddr::Vsock`: use SockaddrLike or SockaddrStorage instead
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:229:43
    |
229 |         let vsock_addr = if let SockAddr::Vsock(addr) = addr {
    |                                           ^^^^^

warning: use of deprecated variant `nix::sys::socket::SockAddr::Vsock`: use SockaddrLike or SockaddrStorage instead
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:258:34
    |
258 |         Self::connect(&SockAddr::Vsock(VsockAddr::new(cid, port)))
    |                                  ^^^^^

warning: use of deprecated enum `nix::sys::socket::SockAddr`: use SockaddrLike or SockaddrStorage instead
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:262:39
    |
262 |     pub fn peer_addr(&self) -> Result<SockAddr> {
    |                                       ^^^^^^^^

warning: use of deprecated variant `nix::sys::socket::SockAddr::Vsock`: use SockaddrLike or SockaddrStorage instead
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:281:26
    |
281 |             Ok(SockAddr::Vsock(VsockAddr(vsock_addr)))
    |                          ^^^^^

warning: use of deprecated enum `nix::sys::socket::SockAddr`: use SockaddrLike or SockaddrStorage instead
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:286:40
    |
286 |     pub fn local_addr(&self) -> Result<SockAddr> {
    |                                        ^^^^^^^^

warning: use of deprecated variant `nix::sys::socket::SockAddr::Vsock`: use SockaddrLike or SockaddrStorage instead
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:305:26
    |
305 |             Ok(SockAddr::Vsock(VsockAddr(vsock_addr)))
    |                          ^^^^^

warning: use of deprecated field `nix::sys::socket::SockAddr::Vsock::0`: use SockaddrLike or SockaddrStorage instead
  --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:58:53
   |
58 |         let mut vsock_addr = if let SockAddr::Vsock(addr) = addr {
   |                                                     ^^^^

error[E0616]: field `0` of struct `VsockAddr` is private
  --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:59:18
   |
59 |             addr.0
   |                  ^ private field

warning: use of deprecated field `nix::sys::socket::SockAddr::Vsock::0`: use SockaddrLike or SockaddrStorage instead
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:229:49
    |
229 |         let vsock_addr = if let SockAddr::Vsock(addr) = addr {
    |                                                 ^^^^

error[E0616]: field `0` of struct `VsockAddr` is private
   --> /tmp/tmp.xk1r9Xh1Kg/registry/vsock-0.2.4/src/lib.rs:230:18
    |
230 |             addr.0
    |                  ^ private field
@Tim-Zhang
Copy link
Contributor

Tim-Zhang commented Jun 8, 2022

Why you guys need such a new version of nix. just curious. Knowing usecases of our users will make the project better.

@qwandor
Copy link
Contributor

qwandor commented Jun 8, 2022

In Android we vendor in all third-party dependencies, including Rust crates, and build with Soong (not cargo). This means that we can only have one version of each crate in the tree. We will need to update nix at some point for other users, and so we need the vsock crate to build with the latest version.

And even in the cargo ecosystem, it's generally desirable to avoid having multiple versions of the same crate where possible, to reduce build time and binary size.

@jamessan
Copy link
Author

jamessan commented Jun 8, 2022

I'm in a similar situation as qwandor. Debian packages crates, primarily to serve building bin crates. It's possible for us to have multiple, versioned crates for a single project in Debian, but we try to avoid it if at all possible.

We recently bumped nix to 0.24 without realizing that a couple of the dependent packages, vsock included, would be affected by the breaking changes in 0.24.

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 a pull request may close this issue.

3 participants