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

Make nix build again on OpenBSD 6.4-current #1000

Merged
merged 1 commit into from
Jan 15, 2019
Merged

Conversation

thendiscard
Copy link
Contributor

First of all, I'm not a rust developer so please be gentle :)

I'm using https://github.com/jwilm/alacritty on OpenBSD. I'm trying to track the latest versions of both OpenBSD and alacritty so I'm recompiling alacritty fairly often. However the latest version of alacritty updated some of it's nix dependencies to v0.12.0 and that doesn't build on OpenBSD anymore:

user1 ~/ALACRITTY/nix $ sysctl kern.version
kern.version=OpenBSD 6.4-current (GENERIC.MP) #529: Tue Dec 18 22:36:49 MST 2018
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

user1 ~/ALACRITTY/nix $ rustc -vV
rustc 1.31.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-openbsd
release: 1.31.0
LLVM version: 6.0

user1 ~/ALACRITTY/nix $ cargo build
    Updating crates.io index
    Updating git repository `https://github.com/rust-lang/libc/`
   Compiling libc v0.2.45 (https://github.com/rust-lang/libc/#027d4834)
   Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix)
   Compiling bitflags v1.0.4
   Compiling cfg-if v0.1.6
   Compiling void v1.0.2
error[E0425]: cannot find function `lutimes` in module `libc`
   --> src/sys/stat.rs:216:15
    |
216 |         libc::lutimes(cstr.as_ptr(), &times[0])
    |               ^^^^^^^ did you mean `futimes`?
help: possible candidate is found in another module, you can import it into scope
    |
1   | use sys::stat::lutimes;
    |

error: aborting due to previous error

In order to build nix v0.12.0 on OpenBSD 6.4-current the change in 85ae87c is sufficient, however in order to get the tests to build the 2 additional commits I've included in this PR are required. However even with 680ff30 & 6bdd9f2 the tests build but there is 1 failure:

user1 ~/ALACRITTY/nix $ cargo build
   Compiling libc v0.2.45 (https://github.com/rust-lang/libc/#027d4834)
   Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix)
   Compiling void v1.0.2
   Compiling cfg-if v0.1.6
   Compiling bitflags v1.0.4
    Finished dev [unoptimized + debuginfo] target(s) in 15.14s

user1 ~/ALACRITTY/nix $ cargo test
   Compiling semver-parser v0.7.0
   Compiling libc v0.2.45
   Compiling rand_core v0.3.0
   Compiling byteorder v1.2.7
   Compiling remove_dir_all v0.5.1
   Compiling lazy_static v1.2.0
   Compiling rand_xorshift v0.1.0
   Compiling rand_hc v0.1.0
   Compiling rand_isaac v0.1.1
   Compiling rand_core v0.2.2
   Compiling semver v0.9.0
   Compiling iovec v0.1.2
   Compiling rand v0.5.5
   Compiling rustc_version v0.2.3
   Compiling bytes v0.4.11
   Compiling rand_chacha v0.1.0
   Compiling rand_pcg v0.1.1
   Compiling rand v0.6.1
   Compiling tempfile v3.0.5
   Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix)
warning: unused import: `nix::sys::signal::*`
 --> test/sys/test_aio_drop.rs:6:5
  |
6 | use nix::sys::signal::*;
  |     ^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default
< ..................................... >
test sys::time::test::test_timeval_fmt ... ok
test sys::time::test::test_timeval_neg ... ok

test result: ok. 35 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/test-6e77230ab75553a1

running 88 tests
test sys::test_ioctl::bsd::test_op_read_64 ... ok
test sys::test_ioctl::bsd::test_op_none ... ok
< ..................................... >
test test_unistd::test_alarm ... ok
test test_unistd::test_canceling_alarm ... ok

failures:

---- sys::test_socket::test_scm_rights stdout ----
thread 'sys::test_socket::test_scm_rights' panicked at 'slice index starts at 24 but ends at 20', libcore/slice/mod.rs:2340:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.


failures:
    sys::test_socket::test_scm_rights

test result: FAILED. 87 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--test test'

user1 ~/ALACRITTY/nix $ RUST_BACKTRACE=1 cargo test
< ..................................... >

failures:

---- sys::test_socket::test_scm_rights stdout ----
thread 'sys::test_socket::test_scm_rights' panicked at 'slice index starts at 24 but ends at 20', libcore/slice/mod.rs:2340:5
stack backtrace:
   0: __register_frame_info
   1: __register_frame_info
   2: __register_frame_info
   3: __register_frame_info
   4: __register_frame_info
   5: __register_frame_info
   6: __register_frame_info
   7: __register_frame_info
   8: __register_frame_info
   9: __register_frame_info
  10: __register_frame_info
  11: __register_frame_info
  12: __register_frame_info
  13: __register_frame_info
  14: __register_frame_info
  15: __register_frame_info
  16: __register_frame_info
  17: __register_frame_info
  18: __register_frame_info
  19: __register_frame_info
  20: __register_frame_info
  21: __register_frame_info
  22: __register_frame_info
  23: __register_frame_info
  24: pthread_create


failures:
    sys::test_socket::test_scm_rights

test result: FAILED. 87 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--test test'

I could add a conditional compilation attribute for test_scm_rights but I'm not sure if it's the best option, maybe someone with actual rust skills wants to fix it.

Apart from that 1 failed test nix works fine for me and I can build and use alacritty.

src/sys/stat.rs Outdated Show resolved Hide resolved
src/unistd.rs Outdated Show resolved Hide resolved
test/sys/test_aio_drop.rs Outdated Show resolved Hide resolved
test/test_stat.rs Outdated Show resolved Hide resolved
test/test_stat.rs Outdated Show resolved Hide resolved
thendiscard added a commit to thendiscard/nix that referenced this pull request Dec 21, 2018
@thendiscard
Copy link
Contributor Author

asomers commented on b21598b an hour ago

Please revert this change. There was a reason I did it this way. As I explain in the comment, on OSX this test hoses the AIO subsystem for the whole process on OSX.

@asomers Somehow I managed to miss the big warning in the comment,
sorry about that :)

src/unistd.rs Outdated Show resolved Hide resolved
test/test_stat.rs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
src/unistd.rs Show resolved Hide resolved
test/sys/test_aio_drop.rs Outdated Show resolved Hide resolved
@asomers
Copy link
Member

asomers commented Jan 12, 2019

Could you please take a look at PR #1001 ? It has the same goal as this PR. Let's close one or the other.

@asomers
Copy link
Member

asomers commented Jan 14, 2019

Please squash your commits and then I'll merge this PR. Then we can release.

@thendiscard
Copy link
Contributor Author

Rebased on top of nix-rust/nix:master and squashed commits. Thanks!

Tests on OpenBSD 6.4:

user1 ~/ALACRITTY/nix $ cargo build
   Compiling libc v0.2.45 (https://github.com/rust-lang/libc/#027d4834)
   Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix)
   Compiling bitflags v1.0.4
   Compiling cfg-if v0.1.6
   Compiling void v1.0.2
    Finished dev [unoptimized + debuginfo] target(s) in 13.03s

user1 ~/ALACRITTY/nix $ cargo build --release
   Compiling libc v0.2.45 (https://github.com/rust-lang/libc/#027d4834)
   Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix)
   Compiling bitflags v1.0.4
   Compiling void v1.0.2
   Compiling cfg-if v0.1.6
    Finished release [optimized] target(s) in 12.58s

user1 ~/ALACRITTY/nix $ cargo test
   Compiling semver-parser v0.7.0
   Compiling libc v0.2.45
   Compiling rand_core v0.3.0
   Compiling remove_dir_all v0.5.1
   Compiling byteorder v1.2.7
   Compiling lazy_static v1.2.0
   Compiling rand_isaac v0.1.1
   Compiling rand_hc v0.1.0
   Compiling rand_xorshift v0.1.0
   Compiling rand_core v0.2.2
   Compiling semver v0.9.0
   Compiling iovec v0.1.2
   Compiling rand v0.5.5
   Compiling rustc_version v0.2.3
   Compiling bytes v0.4.11
   Compiling rand_chacha v0.1.0
   Compiling rand_pcg v0.1.1
   Compiling rand v0.6.1
   Compiling tempfile v3.0.5
   Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix)
    Finished dev [unoptimized + debuginfo] target(s) in 21.88s
     Running target/debug/deps/nix-99a4ce04750d6005

running 35 tests
test sys::event::test_struct_kevent ... ok
test sys::select::tests::fdset_insert ... ok
test sys::select::tests::fdset_remove ... ok
test sys::select::tests::fdset_clear ... ok
test ifaddrs::tests::test_getifaddrs ... ok
test sys::select::tests::test_select_nfds ... ok
test sys::select::tests::test_select ... ok
test sys::select::tests::fdset_highest ... ok
test sys::signal::tests::test_contains ... ok
test sys::signal::tests::test_clear ... ok
test sys::signal::tests::test_from_str_invalid_value ... ok
test sys::signal::tests::test_thread_signal_block ... ok
test sys::signal::tests::test_extend ... ok
test sys::signal::tests::test_thread_signal_get_mask ... ok
test sys::signal::tests::test_from_str_round_trips ... ok
test sys::signal::tests::test_thread_signal_unblock ... ok
test sys::socket::addr::tests::test_macos_loopback_datalink_addr ... ok
test sys::signal::tests::test_thread_signal_set_mask ... ok
test sys::socket::sockopt::test::is_socket_type_dgram ... ok
test sys::select::tests::test_select_nfds2 ... ok
test sys::socket::addr::tests::test_macos_tap_datalink_addr ... ok
test sys::signal::tests::test_thread_signal_swap ... ok
test sys::signal::tests::test_sigaction ... ok
test sys::statvfs::test::fstatvfs_call ... ok
test sys::signal::tests::test_sigwait ... ok
test sys::time::test::test_timespec ... ok
test sys::statvfs::test::statvfs_call ... ok
test sys::socket::sockopt::test::is_socket_type_unix ... ok
test sys::time::test::test_timespec_fmt ... ok
test sys::time::test::test_timeval ... ok
test sys::time::test::test_timespec_ord ... ok
test sys::time::test::test_timeval_neg ... ok
test sys::time::test::test_timeval_ord ... ok
test sys::time::test::test_timeval_fmt ... ok
test sys::time::test::test_timespec_neg ... ok

test result: ok. 35 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/test-58f96996c19b993c

running 89 tests
test sys::test_ioctl::bsd::test_op_none ... ok
test sys::test_ioctl::bsd::test_op_read ... ok
test sys::test_ioctl::bsd::test_op_read_64 ... ok
test sys::test_ioctl::bsd::test_op_read_write ... ok
test sys::test_ptrace::test_ptrace ... ok
test sys::test_ioctl::bsd::test_op_read_write_64 ... ok
test sys::test_pthread::test_pthread_self ... ok
test sys::test_ioctl::bsd::test_op_write_64 ... ok
test sys::test_ioctl::bsd::test_op_write ... ok
test sys::test_signal::test_kill_none ... ok
test sys::test_ptrace::test_ptrace_cont ... ok
test sys::test_select::test_pselect ... ok
test sys::test_select::test_pselect_nfds2 ... ok
test sys::test_signal::test_old_sigaction_flags ... ok
test sys::test_signal::test_signal ... ok
test sys::test_signal::test_sigprocmask ... ok
test sys::test_signal::test_sigprocmask_noop ... ok
test sys::test_socket::test_inetv4_addr_to_sock_addr ... ok
test sys::test_socket::test_path_to_sock_addr ... ok
test sys::test_socket::test_inetv6_addr_to_sock_addr ... ok
test sys::test_termios::test_cfmakeraw ... ok
test sys::test_socket::test_sendmsg_empty_cmsgs ... ok
test sys::test_socket::test_socketpair ... ok
test sys::test_socket::test_getsockname ... ok
test sys::test_socket::test_scm_rights_single_cmsg_multiple_fds ... ok
test sys::test_socket::test_scm_rights ... FAILED
test sys::test_termios::test_local_flags ... ok
test sys::test_termios::test_tcgetattr_ebadf ... ok
test sys::test_termios::test_tcgetattr_pty ... ok
test sys::test_termios::test_output_flags ... ok
test sys::test_socket::test_unixdomain ... ok
test sys::test_termios::test_tcgetattr_enotty ... ok
test sys::test_uio::test_readv ... ok
test sys::test_uio::test_pread ... ok
test sys::test_uio::test_pwrite ... ok
test sys::test_wait::test_waitstatus_from_raw ... ok
test sys::test_wait::test_wait_exit ... ok
test sys::test_wait::test_waitstatus_pid ... ok
test test_dir::ebadf ... ok
test sys::test_wait::test_wait_signal ... ok
test sys::test_sockopt::test_so_buf ... ok
test test_dir::read ... ok
test sys::test_uio::test_writev ... ok
test test_dir::rewind ... ok
test test_net::test_if_nametoindex ... ok
test test_poll::test_poll_debug ... ok
test test_fcntl::test_openat ... ok
test test_fcntl::test_readlink ... ok
test test_pty::test_open_ptty_pair ... ok
test test_pty::test_openpty_with_termios ... ok
test test_pty::test_openpty ... ok
test test_pty::test_explicit_close ... ok
test test_stat::test_fchmod ... ok
test test_stat::test_fchmodat ... ok
test_acct requires root privileges. Skipping test.
test test_unistd::test_acct ... ok
test test_stat::test_stat_and_fstat ... ok
test test_stat::test_fstatat ... ok
test test_stat::test_futimens ... ok
test test_stat::test_utimes ... ok
test test_stat::test_utimensat ... ok
test test_stat::test_stat_fstat_lstat ... ok
test test_unistd::test_execve ... ok
test test_unistd::test_chown ... ok
test test_unistd::test_fchdir ... ok
test test_unistd::test_fpathconf_limited ... ok
test test_unistd::test_fchownat ... ok
test test_unistd::test_execvpe ... ok
test test_unistd::test_getpid ... ok
test test_unistd::test_fork_and_waitpid ... ok
test test_unistd::test_ftruncate ... ok
test_initgroups requires root privileges. Skipping test.
test test_unistd::test_getsid ... ok
test test_unistd::test_initgroups ... ok
test test_unistd::test_mkfifo_directory ... ok
test test_unistd::test_lseek ... ok
test test_unistd::test_pathconf_limited ... ok
test test_unistd::test_mkstemp ... ok
test test_unistd::test_mkstemp_directory ... ok
test test_unistd::test_pipe2 ... ok
test test_unistd::test_mkfifo ... ok
test_setgroupstest test_unistd::test_sysconf_limited ...  requires root privileges. Skipping test.
ok
test test_unistd::test_pipe ... ok
test test_unistd::test_setgroups ... ok
test test_unistd::test_symlinkat ... ok
test test_unistd::test_getcwd ... ok
test test_unistd::test_wait ... ok
test test_unistd::test_truncate ... ok
test test_poll::test_poll ... ok
test test_unistd::test_alarm ... ok
test test_unistd::test_canceling_alarm ... ok

failures:

---- sys::test_socket::test_scm_rights stdout ----
thread 'sys::test_socket::test_scm_rights' panicked at 'slice index starts at 24 but ends at 20', libcore/slice/mod.rs:2340:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.


failures:
    sys::test_socket::test_scm_rights

test result: FAILED. 88 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--test test'

@asomers
Copy link
Member

asomers commented Jan 14, 2019

Just one more problem: your commit message says that test_scm_rights "fails to build" on OpenBSD. But it actually builds just fine. It only fails at runtime. Please fix the commit message and I'll merge it.

1)  lutimes doesn't exist on OpenBSD so it needs to be under conditional
    compilation.

    The only "reference" that I could find related to this is the discussion
    here: rust-lang/libc#790 .

2)  fexecve doesn't exist on OpenBSD so add conditional compilation for it
    in unistd and in related tests.

    The only "reference" that I could find is a mention that fexecve is
    not implemented on OpenBSD in the manual pages for signal(3) and
    sigaction(2):

    Official repository (search for "fexecve"):
    https://cvsweb.openbsd.org/src/lib/libc/sys/sigaction.2?rev=1.75&content-type=text/x-cvsweb-markup

    Github mirror:
    https://github.com/openbsd/src/blob/master/lib/libc/sys/sigaction.2#L619

3)  AIO doesn't work on OpenBSD so put test_aio_drop under conditional
    compilation.

4)  Add relevant changelog entries.

P.S. On OpenBSD remains the issue of test_scm_rights which builds
correctly but fails at runtime.
@thendiscard
Copy link
Contributor Author

I've changed the test_scm_rights part of the commit message.

@asomers Thanks for looking into this and your patience 😄

@asomers
Copy link
Member

asomers commented Jan 14, 2019

bors r+

bors bot added a commit that referenced this pull request Jan 14, 2019
1000: Make nix build again on OpenBSD 6.4-current r=asomers a=thendiscard

First of all, I'm not a rust developer so please be gentle :)

I'm using https://github.com/jwilm/alacritty on OpenBSD. I'm trying to track the latest versions of both OpenBSD and alacritty so I'm recompiling alacritty fairly often. However the latest version of alacritty updated some of it's nix dependencies to v0.12.0 and that doesn't build on OpenBSD anymore:

```bash
user1 ~/ALACRITTY/nix $ sysctl kern.version
kern.version=OpenBSD 6.4-current (GENERIC.MP) #529: Tue Dec 18 22:36:49 MST 2018
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

user1 ~/ALACRITTY/nix $ rustc -vV
rustc 1.31.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-openbsd
release: 1.31.0
LLVM version: 6.0

user1 ~/ALACRITTY/nix $ cargo build
    Updating crates.io index
    Updating git repository `https://github.com/rust-lang/libc/`
   Compiling libc v0.2.45 (https://github.com/rust-lang/libc/#027d4834)
   Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix)
   Compiling bitflags v1.0.4
   Compiling cfg-if v0.1.6
   Compiling void v1.0.2
error[E0425]: cannot find function `lutimes` in module `libc`
   --> src/sys/stat.rs:216:15
    |
216 |         libc::lutimes(cstr.as_ptr(), &times[0])
    |               ^^^^^^^ did you mean `futimes`?
help: possible candidate is found in another module, you can import it into scope
    |
1   | use sys::stat::lutimes;
    |

error: aborting due to previous error
```
In order to build nix v0.12.0 on OpenBSD 6.4-current the change in 85ae87c is sufficient, however in order to get the tests to build the 2 additional commits I've included in this PR are required. However even with 680ff30 & 6bdd9f2 the tests build but there is 1 failure:

```bash
user1 ~/ALACRITTY/nix $ cargo build
   Compiling libc v0.2.45 (https://github.com/rust-lang/libc/#027d4834)
   Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix)
   Compiling void v1.0.2
   Compiling cfg-if v0.1.6
   Compiling bitflags v1.0.4
    Finished dev [unoptimized + debuginfo] target(s) in 15.14s

user1 ~/ALACRITTY/nix $ cargo test
   Compiling semver-parser v0.7.0
   Compiling libc v0.2.45
   Compiling rand_core v0.3.0
   Compiling byteorder v1.2.7
   Compiling remove_dir_all v0.5.1
   Compiling lazy_static v1.2.0
   Compiling rand_xorshift v0.1.0
   Compiling rand_hc v0.1.0
   Compiling rand_isaac v0.1.1
   Compiling rand_core v0.2.2
   Compiling semver v0.9.0
   Compiling iovec v0.1.2
   Compiling rand v0.5.5
   Compiling rustc_version v0.2.3
   Compiling bytes v0.4.11
   Compiling rand_chacha v0.1.0
   Compiling rand_pcg v0.1.1
   Compiling rand v0.6.1
   Compiling tempfile v3.0.5
   Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix)
warning: unused import: `nix::sys::signal::*`
 --> test/sys/test_aio_drop.rs:6:5
  |
6 | use nix::sys::signal::*;
  |     ^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default
< ..................................... >
test sys::time::test::test_timeval_fmt ... ok
test sys::time::test::test_timeval_neg ... ok

test result: ok. 35 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/test-6e77230ab75553a1

running 88 tests
test sys::test_ioctl::bsd::test_op_read_64 ... ok
test sys::test_ioctl::bsd::test_op_none ... ok
< ..................................... >
test test_unistd::test_alarm ... ok
test test_unistd::test_canceling_alarm ... ok

failures:

---- sys::test_socket::test_scm_rights stdout ----
thread 'sys::test_socket::test_scm_rights' panicked at 'slice index starts at 24 but ends at 20', libcore/slice/mod.rs:2340:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.


failures:
    sys::test_socket::test_scm_rights

test result: FAILED. 87 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--test test'

user1 ~/ALACRITTY/nix $ RUST_BACKTRACE=1 cargo test
< ..................................... >

failures:

---- sys::test_socket::test_scm_rights stdout ----
thread 'sys::test_socket::test_scm_rights' panicked at 'slice index starts at 24 but ends at 20', libcore/slice/mod.rs:2340:5
stack backtrace:
   0: __register_frame_info
   1: __register_frame_info
   2: __register_frame_info
   3: __register_frame_info
   4: __register_frame_info
   5: __register_frame_info
   6: __register_frame_info
   7: __register_frame_info
   8: __register_frame_info
   9: __register_frame_info
  10: __register_frame_info
  11: __register_frame_info
  12: __register_frame_info
  13: __register_frame_info
  14: __register_frame_info
  15: __register_frame_info
  16: __register_frame_info
  17: __register_frame_info
  18: __register_frame_info
  19: __register_frame_info
  20: __register_frame_info
  21: __register_frame_info
  22: __register_frame_info
  23: __register_frame_info
  24: pthread_create


failures:
    sys::test_socket::test_scm_rights

test result: FAILED. 87 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--test test'
```

I could add a conditional compilation attribute for `test_scm_rights` but I'm not sure if it's the best option, maybe someone with actual rust skills wants to fix it.

Apart from that 1 failed test nix works fine for me and I can build and use alacritty.

Co-authored-by: Andrei-Marius Radu <thendiscard@users.noreply.github.com>
@asomers
Copy link
Member

asomers commented Jan 15, 2019

bors isn't merging the commit even though all the tests have passed. @Susurrus I think it wants you to approve the PR.

@bors
Copy link
Contributor

bors bot commented Jan 15, 2019

Build succeeded

@bors bors bot merged commit bdca86b into nix-rust:master Jan 15, 2019
@asomers
Copy link
Member

asomers commented Jan 15, 2019

Nevermind. I guess bors just needed more time to deliberate.

bors added a commit to rust-lang/libc that referenced this pull request Jan 15, 2019
Remove fexecve from netbsdlike as it's not implemented

Sometimes it causes confusion in downstream users of libc, for example it caused nix-rust/nix to fail to compile on OpenBSD 6.4 (see nix-rust/nix#1000).

OpenBSD doesn't implement fexecve. The only reference of it that I can
find in the OpenBSD source is in the man pages of signal(3) and
sigaction(2) (where it's mentioned that it is not implemented).

OpenBSD official source code link:
https://cvsweb.openbsd.org/src/lib/libc/sys/sigaction.2?rev=1.75&content-type=text/x-cvsweb-markup

OpenBSD Github mirror:
https://github.com/openbsd/src/blob/master/lib/libc/sys/sigaction.2#L619

On NetBSD's unistd.h I see that it is under an ifdef. Calling it returns
78 / ENOSYS / Function not implemented.

NetBSD office source code link:
http://cvsweb.netbsd.org/bsdweb.cgi/src/include/unistd.h?rev=1.151&content-type=text/x-cvsweb-markup&only_with_tag=MAIN

NetBSD Github mirror:
https://github.com/NetBSD/src/blob/trunk/include/unistd.h#L319

Tests on OpenBSD 6.4 after the change:
```bash
user@openbsd64 ~/RUST/libc $ cargo build
   Compiling libc v0.2.46 (/home/user/RUST/libc)
    Finished dev [unoptimized + debuginfo] target(s) in 3.88s

user@openbsd64 ~/RUST/libc $ cargo build --release
   Compiling libc v0.2.46 (/home/user/RUST/libc)
    Finished release [optimized] target(s) in 2.21s

user@openbsd64 ~/RUST/libc/libc-test $ cargo test
   Compiling proc-macro2 v0.4.24
   Compiling unicode-xid v0.1.0
   Compiling semver-parser v0.7.0
   Compiling serde v1.0.84
   Compiling libc v0.2.45
   Compiling num-traits v0.2.6
   Compiling ryu v0.2.7
   Compiling cfg-if v0.1.6
   Compiling itoa v0.4.3
   Compiling term v0.4.6
   Compiling bitflags v0.9.1
   Compiling cc v1.0.28
   Compiling libc v0.2.46 (/home/user/RUST/libc)
   Compiling log v0.4.6
   Compiling semver v0.9.0
   Compiling log v0.3.9
   Compiling rustc_version v0.2.3
   Compiling rand v0.4.3
   Compiling extprim v1.6.0
   Compiling quote v0.6.10
   Compiling syn v0.15.23
   Compiling serde_derive v1.0.84
   Compiling syntex_pos v0.59.1
   Compiling serde_json v1.0.34
   Compiling syntex_errors v0.59.1
   Compiling syntex_syntax v0.59.1
   Compiling ctest v0.2.8
   Compiling libc-test v0.1.0 (/home/user/RUST/libc/libc-test)
    Finished dev [unoptimized + debuginfo] target(s) in 2m 16s
     Running /home/user/RUST/libc/target/debug/deps/linux_fcntl-08861a7cd96d1b94
RUNNING ALL TESTS
PASSED 0 tests
     Running /home/user/RUST/libc/target/debug/deps/main-57e266d38aa58cce
RUNNING ALL TESTS
PASSED 7187 tests
```
I've tried running the tests on a NetBSD 8.0 box unfortunately there `libc-test` fails to compile even before this change.
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 this pull request may close these issues.

3 participants