-
Notifications
You must be signed in to change notification settings - Fork 1.2k
removing freebsd 11 EOL proposal. #3139
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
base: main
Are you sure you want to change the base?
Conversation
r? @JohnTitor (rustbot has picked a reviewer for you, use r? to override) |
Note that there're some overrides with #2406. |
☔ The latest upstream changes (presumably #3037) made this pull request unmergeable. Please resolve the merge conflicts. |
e30b5ac
to
f01623a
Compare
☔ The latest upstream changes (presumably #2999) made this pull request unmergeable. Please resolve the merge conflicts. |
@devnexen Please resolve the merge conflict. |
f01623a
to
9e7d63b
Compare
build.rs
Outdated
Some(13) if libc_ci => set_cfg("freebsd13"), | ||
Some(14) if libc_ci => set_cfg("freebsd14"), | ||
Some(_) | None => set_cfg("freebsd11"), | ||
Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a merge conflict. You should use set_cfg
instead of println!
// APIs that were changed after FreeBSD 11 | ||
|
||
// The type of `nlink_t` changed from `u16` to `u64` in FreeBSD 12: | ||
pub type nlink_t = u16; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the stuff that was in this file should now be moved into freebsdlike/freebsd/mod.rs For example, move all three nlink_t
definitions from freebsd{12,13,14}.rs into that file.
ce5b55f
to
72de88e
Compare
I started a conversation on Zulip to see how people feel about this. |
This is basically 100% conflicted, but @devnexen would you be up for rebasing this? EOL was 5 years ago so I can't imagine anyone would object at this point. |
72de88e
to
e3d1192
Compare
3fe771e
to
662e1b4
Compare
1c0de03
to
5eb24f0
Compare
build.rs
Outdated
@@ -74,8 +72,6 @@ fn main() { | |||
|
|||
match which_freebsd { | |||
x if x < 10 => panic!("FreeBSD older than 10 is not supported"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update this comment?
I haven't looked through this in detail yet but the changes look correct. @asomers would you be able to review? |
5eb24f0
to
2da0438
Compare
In theory I agree with this. I'll try to review it next Saturday. We'll want to run a few dozen crates' test suites with this change, too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the only two problems I've found in my testing so far. But that begs the question: how did you test these changes?
all(target_os = "freebsd", any(freebsd11, freebsd10)), | ||
link_name = "kevent@FBSD_1.0" | ||
)] | ||
pub fn kevent( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you really mean to remove this function? I think you should just remove the link_name
instead. The function is definitely needed.
@@ -53,6 +53,11 @@ pub type sctp_assoc_t = u32; | |||
|
|||
pub type eventfd_t = u64; | |||
|
|||
pub type nlink_t = u64; | |||
pub type dev_t = u64; | |||
pub type ino_t = c_ulong; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be u64. Otherwise stat
is broken on x86.
pub type ino_t = c_ulong; | |
pub type ino_t = u64; |
2c962b8
to
cb008d7
Compare
Your latest changes fix the two bugs that I found. What about you? How did you test these changes? |
I test within a VM the vast majority of time, sometimes when I can t I look at freebsd sources and count on CI to see. Not ideal I know. |
But what did you do within that VM? What projects did you test? How did you patch them to use libc main branch? |
Usually, I just do |
cb008d7
to
3f8c507
Compare
For a change like this, that really isn't sufficient. You need to run the test suites of a selection of other crates, patched to use this branch of libc. |
Ok I ll try |
@asomers, here a test with nix crate [dcarlier@ ~/Contribs/nix]$ cargo test --all-features
Updating git repository `https://github.com/devnexen/libc`
Locking 1 package to latest compatible version
Adding libc v1.0.0-alpha.1 (https://github.com/devnexen/libc?branch=remove_fbsd11_support#3f8c5074)
Compiling libc v0.2.172
Compiling nix v0.30.1 (/home/dcarlier/Contribs/nix)
Compiling getrandom v0.3.3
Compiling errno v0.3.13
Compiling parking_lot_core v0.9.11
Compiling rustix v1.0.8
Compiling rand_core v0.9.3
Compiling rand_chacha v0.9.0
Compiling parking_lot v0.12.4
Compiling rand v0.9.2
Compiling sysctl v0.4.6
Compiling tempfile v3.21.0
error[E0308]: mismatched types
--> src/sys/select.rs:25:53
|
25 | usize::try_from(fd).map_or(false, |fd| fd < FD_SETSIZE),
| -- ^^^^^^^^^^ expected `usize`, found `i32`
| |
| expected because this is `usize`
|
help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit
|
25 | usize::try_from(fd).map_or(false, |fd| fd < FD_SETSIZE.try_into().unwrap()),
| ++++++++++++++++++++
error[E0308]: mismatched types
--> src/sys/select.rs:113:65
|
113 | range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE),
| --------- ^^^^^^^^^^ expected `usize`, found `i32`
| |
| arguments to this method are incorrect
|
help: the return type of this call is `i32` due to the type of the argument passed
--> src/sys/select.rs:113:23
|
113 | range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------^
| |
| this argument influences the return type of `unwrap_or`
note: method defined here
--> /home/dcarlier/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/core/src/option.rs:1031:18
|
1031 | pub const fn unwrap_or(self, default: T) -> T
| ^^^^^^^^^
help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit
|
113 | range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE.try_into().unwrap()),
| ++++++++++++++++++++
error[E0308]: mismatched types
--> src/unistd.rs:1100:41
|
1100 | unsafe { libc::execv(path.as_ptr(), args_p.as_ptr()) };
| ----------- ^^^^^^^^^^^^^^^ types differ in mutability
| |
| arguments to this function are incorrect
|
= note: expected raw pointer `*const *mut i8`
found raw pointer `*const *const i8`
note: function defined here
--> /home/dcarlier/.cargo/git/checkouts/libc-42f01ba267c5d37b/3f8c507/src/unix/mod.rs:1033:12
|
1033 | pub fn execv(prog: *const c_char, argv: *const *mut c_char) -> c_int;
| ^^^^^
error[E0308]: arguments to this function are incorrect
--> src/unistd.rs:1126:14
|
1126 | unsafe { libc::execve(path.as_ptr(), args_p.as_ptr(), env_p.as_ptr()) };
| ^^^^^^^^^^^^
|
note: types differ in mutability
--> src/unistd.rs:1126:42
|
1126 | unsafe { libc::execve(path.as_ptr(), args_p.as_ptr(), env_p.as_ptr()) };
| ^^^^^^^^^^^^^^^
= note: expected raw pointer `*const *mut i8`
found raw pointer `*const *const i8`
note: types differ in mutability
--> src/unistd.rs:1126:59
|
1126 | unsafe { libc::execve(path.as_ptr(), args_p.as_ptr(), env_p.as_ptr()) };
| ^^^^^^^^^^^^^^
= note: expected raw pointer `*const *mut i8`
found raw pointer `*const *const i8`
note: function defined here
--> /home/dcarlier/.cargo/git/checkouts/libc-42f01ba267c5d37b/3f8c507/src/unix/mod.rs:1034:12
|
1034 | pub fn execve(prog: *const c_char, argv: *const *mut c_char, envp: *const *mut c_char)
| ^^^^^^
error[E0308]: mismatched types
--> src/unistd.rs:1147:46
|
1147 | unsafe { libc::execvp(filename.as_ptr(), args_p.as_ptr()) };
| ------------ ^^^^^^^^^^^^^^^ types differ in mutability
| |
| arguments to this function are incorrect
|
= note: expected raw pointer `*const *mut i8`
found raw pointer `*const *const i8`
note: function defined here
--> /home/dcarlier/.cargo/git/checkouts/libc-42f01ba267c5d37b/3f8c507/src/unix/mod.rs:1036:12
|
1036 | pub fn execvp(c: *const c_char, argv: *const *mut c_char) -> c_int;
| ^^^^^^
error[E0308]: arguments to this function are incorrect
--> src/unistd.rs:1197:14
|
1197 | unsafe { libc::fexecve(fd.as_fd().as_raw_fd(), args_p.as_ptr(), env_p.as_ptr()) };
| ^^^^^^^^^^^^^
|
note: types differ in mutability
--> src/unistd.rs:1197:52
|
1197 | unsafe { libc::fexecve(fd.as_fd().as_raw_fd(), args_p.as_ptr(), env_p.as_ptr()) };
| ^^^^^^^^^^^^^^^
= note: expected raw pointer `*const *mut i8`
found raw pointer `*const *const i8`
note: types differ in mutability
--> src/unistd.rs:1197:69
|
1197 | unsafe { libc::fexecve(fd.as_fd().as_raw_fd(), args_p.as_ptr(), env_p.as_ptr()) };
| ^^^^^^^^^^^^^^
= note: expected raw pointer `*const *mut i8`
found raw pointer `*const *const i8`
note: function defined here
--> /home/dcarlier/.cargo/git/checkouts/libc-42f01ba267c5d37b/3f8c507/src/unix/bsd/freebsdlike/mod.rs:1530:12
|
1530 | pub fn fexecve(fd: c_int, argv: *const *mut c_char, envp: *const *mut c_char) -> c_int;
| ^^^^^^^
error[E0308]: mismatched types
--> src/macros.rs:72:35
|
72 | const $Flag = libc::$Flag $(as $cast)*;
| ^^^^^^^^^^^ expected `i32`, found `i16`
|
::: src/spawn.rs:203:1
|
203 | / libc_bitflags!(
204 | | /// Process attributes to be changed in the new process image when invoking [`posix_spawn`]
205 | | /// or [`posix_spawnp`]. See
206 | | /// [posix_spawn](https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html).
... |
227 | | );
| | -
| | |
| |_arguments to this function are incorrect
| in this macro invocation
|
note: associated function defined here
--> src/spawn.rs:203:1
|
203 | / libc_bitflags!(
204 | | /// Process attributes to be changed in the new process image when invoking [`posix_spawn`]
205 | | /// or [`posix_spawnp`]. See
206 | | /// [posix_spawn](https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html).
... |
227 | | );
| |_^
= note: this error originates in the macro `libc_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0308`.
error: could not compile `nix` (lib) due to 10 previous errors |
No description provided.