oracle / railcar

RailCar: Rust implementation of the Open Containers Initiative oci-runtime
Other
1.12k stars 101 forks source link

nix 0.9.0 #24

Open aep opened 7 years ago

aep commented 7 years ago

compilation fails with the upcoming nix 0.9.0 (required for android)

error[E0432]: unresolved import `nix::c_int`
 --> src/signals.rs:2:5
  |
2 | use nix::c_int;
  |     ^^^^^^^^^^ no `c_int` in the root

error[E0432]: unresolved import `nix::poll::poll`
  --> src/main.rs:41:17
   |
41 | use nix::poll::{poll, PollFd, POLLIN, POLLHUP, POLLNVAL, EventFlags};
   |                 ^^^^ Could not find `poll` in `nix`

error[E0432]: unresolved import `nix::poll::PollFd`
  --> src/main.rs:41:23
   |
41 | use nix::poll::{poll, PollFd, POLLIN, POLLHUP, POLLNVAL, EventFlags};
   |                       ^^^^^^ Could not find `poll` in `nix`

error[E0432]: unresolved import `nix::poll::POLLIN`
  --> src/main.rs:41:31
   |
41 | use nix::poll::{poll, PollFd, POLLIN, POLLHUP, POLLNVAL, EventFlags};
   |                               ^^^^^^ Could not find `poll` in `nix`

error[E0432]: unresolved import `nix::poll::POLLHUP`
  --> src/main.rs:41:39
   |
41 | use nix::poll::{poll, PollFd, POLLIN, POLLHUP, POLLNVAL, EventFlags};
   |                                       ^^^^^^^ Could not find `poll` in `nix`

error[E0432]: unresolved import `nix::poll::POLLNVAL`
  --> src/main.rs:41:48
   |
41 | use nix::poll::{poll, PollFd, POLLIN, POLLHUP, POLLNVAL, EventFlags};
   |                                                ^^^^^^^^ Could not find `poll` in `nix`

error[E0432]: unresolved import `nix::poll::EventFlags`
  --> src/main.rs:41:58
   |
41 | use nix::poll::{poll, PollFd, POLLIN, POLLHUP, POLLNVAL, EventFlags};
   |                                                          ^^^^^^^^^^ Could not find `poll` in `nix`

error[E0425]: cannot find function `lsetxattr` in module `libc`
  --> src/nix_ext.rs:16:15
   |
16 |         libc::lsetxattr(
   |               ^^^^^^^^^ did you mean `tcsetattr`?
   |
help: possible candidate is found in another module, you can import it into scope
   | use nix_ext::lsetxattr;

error[E0425]: cannot find function `set_dumpable` in module `prctl`
   --> src/main.rs:906:28
    |
906 |     if let Err(e) = prctl::set_dumpable(false) {
    |                            ^^^^^^^^^^^^ not found in `prctl`

error[E0425]: cannot find function `set_child_subreaper` in module `prctl`
   --> src/main.rs:975:32
    |
975 |         if let Err(e) = prctl::set_child_subreaper(true) {
    |                                ^^^^^^^^^^^^^^^^^^^ not found in `prctl`

error[E0425]: cannot find function `set_no_new_privileges` in module `prctl`
    --> src/main.rs:1143:32
     |
1143 |         if let Err(e) = prctl::set_no_new_privileges(true) {
     |                                ^^^^^^^^^^^^^^^^^^^^^ not found in `prctl`

error[E0425]: cannot find function `set_keep_capabilities` in module `prctl`
    --> src/main.rs:1602:28
     |
1602 |     if let Err(e) = prctl::set_keep_capabilities(true) {
     |                            ^^^^^^^^^^^^^^^^^^^^^ not found in `prctl`

error[E0425]: cannot find function `set_keep_capabilities` in module `prctl`
    --> src/main.rs:1611:28
     |
1611 |     if let Err(e) = prctl::set_keep_capabilities(false) {
     |                            ^^^^^^^^^^^^^^^^^^^^^ not found in `prctl`

error[E0425]: cannot find function `set_name` in module `prctl`
    --> src/main.rs:1639:28
     |
1639 |     if let Err(e) = prctl::set_name(name) {
     |                            ^^^^^^^^ not found in `prctl`
     |
help: possible candidate is found in another module, you can import it into scope
     | use set_name;

error[E0599]: no method named `errno` found for type `nix::Error` in the current scope
   --> src/main.rs:637:22
    |
637 |                 if e.errno() != Errno::ENOENT {
    |                      ^^^^^

error[E0599]: no method named `errno` found for type `nix::Error` in the current scope
   --> src/main.rs:648:18
    |
648 |             if e.errno() != Errno::ENOENT {
    |                  ^^^^^

error[E0599]: no method named `errno` found for type `nix::Error` in the current scope
   --> src/main.rs:759:26
    |
759 |                     if n.errno() == Errno::ESRCH {
    |                          ^^^^^

error[E0308]: mismatched types
   --> src/main.rs:860:59
    |
860 |                     let (exit_code, sig) = wait_for_child(child)?;
    |                                                           ^^^^^ expected i32, found struct `nix::unistd::Pid`
    |
    = note: expected type `i32`
               found type `nix::unistd::Pid`

error[E0308]: mismatched types
   --> src/main.rs:885:49
    |
885 |             let (exit_code, _) = wait_for_child(child)?;
    |                                                 ^^^^^ expected i32, found struct `nix::unistd::Pid`
    |
    = note: expected type `i32`
               found type `nix::unistd::Pid`

error[E0308]: mismatched types
    --> src/main.rs:1250:45
     |
1250 |                 let (_, _) = wait_for_child(child)?;
     |                                             ^^^^^ expected i32, found struct `nix::unistd::Pid`
     |
     = note: expected type `i32`
                found type `nix::unistd::Pid`

error[E0599]: no method named `errno` found for type `nix::Error` in the current scope
    --> src/main.rs:1419:18
     |
1419 |             if e.errno() != Errno::ENOENT {
     |                  ^^^^^

error[E0277]: the trait bound `std::option::Option<nix::unistd::Pid>: std::convert::From<{integer}>` is not satisfied
    --> src/main.rs:1529:28
     |
1529 |         let result = match waitpid(-1, None) {
     |                            ^^^^^^^ the trait `std::convert::From<{integer}>` is not implemented for `std::option::Option<nix::unistd::Pid>`
     |
     = help: the following implementations were found:
               <std::option::Option<T> as std::convert::From<T>>
     = note: required because of the requirements on the impl of `std::convert::Into<std::option::Option<nix::unistd::Pid>>` for `{integer}`
     = note: required by `nix::sys::wait::waitpid`

error[E0599]: no method named `errno` found for type `nix::Error` in the current scope
    --> src/main.rs:1532:22
     |
1532 |                 if e.errno() == Errno::EINTR {
     |                      ^^^^^

error[E0308]: mismatched types
    --> src/main.rs:1542:42
     |
1542 |                 if child != -1 && pid != child {
     |                                          ^^^^^ expected struct `nix::unistd::Pid`, found i32
     |
     = note: expected type `nix::unistd::Pid`
                found type `i32`

error[E0308]: mismatched types
    --> src/main.rs:1549:42
     |
1549 |                 if child != -1 && pid != child {
     |                                          ^^^^^ expected struct `nix::unistd::Pid`, found i32
     |
     = note: expected type `nix::unistd::Pid`
                found type `i32`

error[E0308]: mismatched types
    --> src/main.rs:1579:41
     |
1579 |     let mut result = WaitStatus::Exited(0, 0);
     |                                         ^ expected struct `nix::unistd::Pid`, found integral variable
     |
     = note: expected type `nix::unistd::Pid`
                found type `{integer}`

error[E0277]: the trait bound `std::option::Option<nix::unistd::Pid>: std::convert::From<{integer}>` is not satisfied
    --> src/main.rs:1581:15
     |
1581 |         match waitpid(-1, Some(WNOHANG)) {
     |               ^^^^^^^ the trait `std::convert::From<{integer}>` is not implemented for `std::option::Option<nix::unistd::Pid>`
     |
     = help: the following implementations were found:
               <std::option::Option<T> as std::convert::From<T>>
     = note: required because of the requirements on the impl of `std::convert::Into<std::option::Option<nix::unistd::Pid>>` for `{integer}`
     = note: required by `nix::sys::wait::waitpid`

error[E0599]: no method named `errno` found for type `nix::Error` in the current scope
    --> src/main.rs:1583:22
     |
1583 |                 if e.errno() != Errno::ECHILD {
     |                      ^^^^^

error[E0308]: mismatched types
    --> src/main.rs:1605:15
     |
1605 |     setresgid(gid, gid, gid)?;
     |               ^^^ expected struct `nix::unistd::Gid`, found u32
     |
     = note: expected type `nix::unistd::Gid`
                found type `u32`

error[E0308]: mismatched types
    --> src/main.rs:1605:20
     |
1605 |     setresgid(gid, gid, gid)?;
     |                    ^^^ expected struct `nix::unistd::Gid`, found u32
     |
     = note: expected type `nix::unistd::Gid`
                found type `u32`

error[E0308]: mismatched types
    --> src/main.rs:1605:25
     |
1605 |     setresgid(gid, gid, gid)?;
     |                         ^^^ expected struct `nix::unistd::Gid`, found u32
     |
     = note: expected type `nix::unistd::Gid`
                found type `u32`

error[E0308]: mismatched types
    --> src/main.rs:1606:15
     |
1606 |     setresuid(uid, uid, uid)?;
     |               ^^^ expected struct `nix::unistd::Uid`, found u32
     |
     = note: expected type `nix::unistd::Uid`
                found type `u32`

error[E0308]: mismatched types
    --> src/main.rs:1606:20
     |
1606 |     setresuid(uid, uid, uid)?;
     |                    ^^^ expected struct `nix::unistd::Uid`, found u32
     |
     = note: expected type `nix::unistd::Uid`
                found type `u32`

error[E0308]: mismatched types
    --> src/main.rs:1606:25
     |
1606 |     setresuid(uid, uid, uid)?;
     |                         ^^^ expected struct `nix::unistd::Uid`, found u32
     |
     = note: expected type `nix::unistd::Uid`
                found type `u32`

error[E0599]: no method named `errno` found for type `nix::Error` in the current scope
   --> src/mounts.rs:343:14
    |
343 |         if e.errno() != Errno::EINVAL {
    |              ^^^^^

error[E0308]: mismatched types
   --> src/mounts.rs:443:34
    |
443 |         Mode::from_bits_truncate(dev.file_mode.unwrap_or(0)),
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u16, found u32

error[E0308]: mismatched types
   --> src/mounts.rs:444:9
    |
444 |         makedev(dev.major, dev.minor),
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found u64
    |
    = help: here are some functions which might fulfill your needs:
            - .count_ones()
            - .count_zeros()
            - .leading_zeros()
            - .trailing_zeros()

error[E0308]: mismatched types
   --> src/mounts.rs:446:27
    |
446 |     chown(&dev.path[1..], dev.uid, dev.gid)?;
    |                           ^^^^^^^ expected struct `nix::unistd::Uid`, found u32
    |
    = note: expected type `std::option::Option<nix::unistd::Uid>`
               found type `std::option::Option<u32>`
    = help: here are some functions which might fulfill your needs:
            - .take()
            - .unwrap()
            - .unwrap_or_default()

error[E0308]: mismatched types
   --> src/mounts.rs:446:36
    |
446 |     chown(&dev.path[1..], dev.uid, dev.gid)?;
    |                                    ^^^^^^^ expected struct `nix::unistd::Gid`, found u32
    |
    = note: expected type `std::option::Option<nix::unistd::Gid>`
               found type `std::option::Option<u32>`
    = help: here are some functions which might fulfill your needs:
            - .take()
            - .unwrap()
            - .unwrap_or_default()

error[E0599]: no method named `errno` found for type `nix::Error` in the current scope
   --> src/mounts.rs:482:14
    |
482 |         if e.errno() != Errno::ENOENT && e.errno() != Errno::ENOTDIR {
    |              ^^^^^

error[E0599]: no method named `errno` found for type `nix::Error` in the current scope
   --> src/mounts.rs:482:44
    |
482 |         if e.errno() != Errno::ENOENT && e.errno() != Errno::ENOTDIR {
    |                                            ^^^^^

error[E0599]: no method named `errno` found for type `nix::Error` in the current scope
   --> src/mounts.rs:505:14
    |
505 |         if e.errno() != Errno::ENOENT {
    |              ^^^^^

error[E0308]: mismatched types
  --> src/signals.rs:24:22
   |
24 |         let _ = kill(CHILD_PID, Signal::from_c_int(signo).unwrap());
   |                      ^^^^^^^^^ expected struct `nix::unistd::Pid`, found i32
   |
   = note: expected type `nix::unistd::Pid`
              found type `i32`

error[E0308]: mismatched types
  --> src/signals.rs:56:10
   |
56 |     kill(0, signal)?;
   |          ^ expected struct `nix::unistd::Pid`, found integral variable
   |
   = note: expected type `nix::unistd::Pid`
              found type `{integer}`

error[E0308]: mismatched types
   --> src/signals.rs:102:10
    |
102 |     kill(pid, signal)?;
    |          ^^^ expected struct `nix::unistd::Pid`, found i32
    |
    = note: expected type `nix::unistd::Pid`
               found type `i32`

error[E0308]: mismatched types
  --> src/nix_ext.rs:46:19
   |
46 |         rlim_cur: soft,
   |                   ^^^^ expected u32, found u64
   |
   = help: here are some functions which might fulfill your needs:
           - .count_ones()
           - .count_zeros()
           - .leading_zeros()
           - .trailing_zeros()

error[E0308]: mismatched types
  --> src/nix_ext.rs:47:19
   |
47 |         rlim_max: hard,
   |                   ^^^^ expected u32, found u64
   |
   = help: here are some functions which might fulfill your needs:
           - .count_ones()
           - .count_zeros()
           - .leading_zeros()
           - .trailing_zeros()
Susurrus commented 7 years ago

This is indeed a breaking release. Please see the changelog for things that have been changed. They should all be documented there so that upgrading should be easy.

bachp commented 6 years ago

I think this was fixed with https://github.com/oracle/railcar/pull/26

drahnr commented 6 years ago

See #39 for an update to nix 0.11.0