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

implemented I/O safety traits and bump nix to 0.29 #6301

Open
solomoncyj opened this issue Oct 20, 2024 · 0 comments
Open

implemented I/O safety traits and bump nix to 0.29 #6301

solomoncyj opened this issue Oct 20, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@solomoncyj
Copy link

Is your feature request related to a problem? Please describe.
in the nix 0.29 crates, the project cannot be built due the following errors, due to the enforcements of /O safety traits
https://download.copr.fedorainfracloud.org/results/solomoncyj/rust/fedora-rawhide-aarch64/08159687-rust-portable-pty/builder-live.log.gz

Compiling filedescriptor v0.8.2
     Running `/usr/bin/rustc --crate-name filedescriptor --edition=2018 /usr/share/cargo/registry/filedescriptor-0.8.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=cf2838f63fefe3c3 -C extra-filename=-cf2838f63fefe3c3 --out-dir /builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps -L dependency=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps --extern libc=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps/liblibc-47e6d11bfd847524.rmeta --extern thiserror=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps/libthiserror-9d9875ce5cfdfb82.rmeta --cap-lints allow -Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-specs=/usr/lib/rpm/redhat/redhat-package-notes --cap-lints=warn`
   Compiling portable-pty v0.8.1 (/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1)
     Running `/usr/bin/rustc --crate-name portable_pty --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --cfg 'feature="default"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("default", "serde", "serde_derive", "serde_support"))' -C metadata=7af3effd4ac531b0 -C extra-filename=-7af3effd4ac531b0 --out-dir /builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps -L dependency=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps --extern anyhow=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps/libanyhow-ba7a49b18d361cb0.rmeta --extern downcast_rs=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps/libdowncast_rs-a83f85380c6eb557.rmeta --extern filedescriptor=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps/libfiledescriptor-cf2838f63fefe3c3.rmeta --extern libc=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps/liblibc-47e6d11bfd847524.rmeta --extern log=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps/liblog-1927702d3a3787c8.rmeta --extern nix=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps/libnix-8bf9f532a7732807.rmeta --extern serial=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps/libserial-8c85a65000a910d1.rmeta --extern shell_words=/builddir/build/BUILD/rust-portable-pty-0.8.1-build/portable-pty-0.8.1/target/rpm/deps/libshell_words-6fe34738507834dd.rmeta -Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-specs=/usr/lib/rpm/redhat/redhat-package-notes --cap-lints=warn`
warning: unexpected `cfg` condition value: `cargo-clippy`
  --> src/unix.rs:31:20
   |
31 |         #[cfg_attr(feature = "cargo-clippy", allow(clippy::unnecessary_mut_passed))]
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: expected values for `feature` are: `default`, `serde`, `serde_derive`, and `serde_support`
   = help: consider adding `cargo-clippy` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition value: `cargo-clippy`
   --> src/unix.rs:228:32
    |
228 |                     #[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_lossless))]
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `feature` are: `default`, `serde`, `serde_derive`, and `serde_support`
    = help: consider adding `cargo-clippy` as a feature in `Cargo.toml`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

error[E0277]: the trait bound `i32: AsFd` is not satisfied
   --> src/unix.rs:340:38
    |
340 |         nix::sys::termios::tcgetattr(self.fd.0.as_raw_fd()).ok()
    |         ---------------------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `AsFd` is not implemented for `i32`
    |         |
    |         required by a bound introduced by this call
    |
    = help: the following other types implement trait `AsFd`:
              &T
              &mut T
              Arc<T>
              BorrowedFd<'_>
              Box<T>
              ChildStderr
              ChildStdin
              ChildStdout
            and 21 others
note: required by a bound in `nix::sys::termios::tcgetattr`
   --> /usr/share/cargo/registry/nix-0.29.0/src/sys/termios.rs:840:22
    |
840 | pub fn tcgetattr<Fd: AsFd>(fd: Fd) -> Result<Termios> {
    |                      ^^^^ required by this bound in `tcgetattr`

For more information about this error, try `rustc --explain E0277`.
warning: `portable-pty` (lib) generated 2 warnings
error: could not compile `portable-pty` (lib) due to 1 previous error; 2 warnings emitted

Describe the solution you'd like
please update the relevent code in portable-pty

Additional context
(sunfishcode/io-lifetimes#38 for more context around I/O safety)

@solomoncyj solomoncyj added the enhancement New feature or request label Oct 20, 2024
@solomoncyj solomoncyj changed the title implemented I/O safety traits implemented I/O safety traits and bump nix to 0.29 Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant