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

deprecation warning in nix on OSX #14

Open
oconnor663 opened this issue Jul 27, 2018 · 6 comments
Open

deprecation warning in nix on OSX #14

oconnor663 opened this issue Jul 27, 2018 · 6 comments

Comments

@oconnor663
Copy link
Owner

https://travis-ci.org/oconnor663/os_pipe.rs/jobs/408710890

warning: use of deprecated item 'sys::nix::unistd::pipe2': pipe2(2) is not actually atomic on these platforms.  Use pipe(2) and fcntl(2) instead
  --> src/unix.rs:17:9
   |
17 |         nix::unistd::pipe2(nix::fcntl::OFlag::O_CLOEXEC).map_err(nix_err_to_io_err)?;
   |         ^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(deprecated)] on by default
@oconnor663
Copy link
Owner Author

Related to nix-rust/nix#777.

@oconnor663
Copy link
Owner Author

@zopsicle
Copy link

zopsicle commented Oct 7, 2022

This crate no longer depends on the nix crate (since 68c8bf5), so I think this issue can be closed.

@parasyte
Copy link

Though it's true that the nix dependency is gone, there is still an open question WRT macOS. namely this comment:

os_pipe.rs/src/unix.rs

Lines 9 to 13 in a4ff43d

// We need to atomically create pipes and set the CLOEXEC flag on them. This is
// done with the pipe2() API. However, macOS doesn't support pipe2. There, all
// we can do is call pipe() followed by fcntl(), and hope that no other threads
// fork() in between. The following code is copied from the nix crate, where it
// works but is deprecated.

It's probably good that some issue remains open while "hope that no other threads fork()" is a concern.

@oconnor663
Copy link
Owner Author

oconnor663 commented Sep 17, 2023

My understanding is that there's simply no way to accomplish this on macOS. (I assume the same fundamental issue affects std::process::Command.) And of course if pipe2 or similar is ever added, there will be a long tail of backwards compatibility headaches related to using it. But if I'm wrong about either of those things I'd love to know.

@NobodyXu
Copy link

NobodyXu commented Sep 17, 2023

cc copies the code from stdlib for pipe creation and it simply uses pipe on MacOS

https://github.com/rust-lang/cc-rs/blob/daab9244b03e244c4f2511944870d719c443f61f/src/os_pipe/unix.rs#L11

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

No branches or pull requests

4 participants