Skip to content

Add passwd/group APIs needed for nix-rust/nix#864 #934

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

Merged
merged 8 commits into from
Mar 3, 2018

Conversation

ctrlcctrlv
Copy link
Contributor

Hope I did this right. I only added platforms I could personally test. . .

cc: @gnzlbg

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@ctrlcctrlv
Copy link
Contributor Author

The build is failing on some platforms due to automatically generated tests, I'm not sure how to fix that...

@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 1, 2018

I only added platforms I could personally test. . .

Don't worry about this that much. This is what CI is for :)

@@ -388,6 +389,10 @@ extern {
pub fn getpwent() -> *mut passwd;
pub fn setpwent();
pub fn endpwent();
pub fn setgrent();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setgrent is not available in freebsd (or it looks like this is the case), you are going to have to put it in the folders of all bsd targets except for the freebsd one :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setgrent is available in FreeBSD. What gives you the impression it isn't?

https://github.com/freebsd/freebsd/blob/d5842c73935af7f7a7eeaeaec75ad8f3cf6cdf50/include/grp.h#L80

Copy link
Contributor

@gnzlbg gnzlbg Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setgrent is available in FreeBSD. What gives you the impression it isn't?

Indeed, this buildbot: https://travis-ci.org/rust-lang/libc/jobs/347737123#L1402

Says that the pointer types are incompatible. It looks like its signature was changed in: freebsd/freebsd-src@786c392

from int setgrent() to void setgrent(). That commit was 2 years ago, but it might be that we are testing against a FreeBSD release that is older as the release where that commit was included.

You might want to change the signature to int setgrent() and see if that fixes the build. If so, please open an issue about updating the FreeBSD version. Ideally we would do that in a different PR, and then update everything that breaks (like making setgrent void setgrent()).

Copy link
Contributor

@gnzlbg gnzlbg Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it turns out to be the case that changing the signature to int setgrent() fixes this issue, what you can also do is change it back afterwards to void setgrent() and whitelist the function here: https://github.com/rust-lang/libc/blob/master/libc-test/build.rs#L606

By adding a match arm like this:

// FIXME: need to upgrade FreeBSD version. Issue: rust-lang/libc/xxxxxx
"setgrent" if freebsd => true,

This basically disables testing for the setgrent function for FreeBSD.

@alexcrichton
Copy link
Member

Thanks! Looks like CI is failing though?

@ctrlcctrlv
Copy link
Contributor Author

@alexcrichton The build is now passing :)

@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 2, 2018

lgtm

@alexcrichton
Copy link
Member

Thanks! I think lockfile may need another update though?

@ctrlcctrlv
Copy link
Contributor Author

@alexcrichton Done

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 3, 2018

📌 Commit d058e0c has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Mar 3, 2018

⌛ Testing commit d058e0c with merge 936e16b...

bors added a commit that referenced this pull request Mar 3, 2018
Add passwd/group APIs needed for nix-rust/nix#864

Hope I did this right. I only added platforms I could personally test. . .

cc: @gnzlbg
@bors
Copy link
Contributor

bors commented Mar 3, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 936e16b to master...

@bors bors merged commit d058e0c into rust-lang:master Mar 3, 2018
@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 3, 2018

@ctrlcctrlv nice thanks :) I don't know if nix-rust has some more open issues on libc for missing interfaces (they used to have some at least), but now you guys should be able to quickly add to libc whatever you find its missing :)

ctrlcctrlv added a commit to ctrlcctrlv/libc that referenced this pull request Mar 5, 2018
Sorry, accidentally forgot this when submitting rust-lang#934..
bors added a commit that referenced this pull request Mar 5, 2018
Add FreeBSD `get[pw|gr]ent_r`, forgotten in #934

Sorry, accidentally forgot this when submitting #934..
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.

None yet

5 participants