Skip to content

fix bugs on android armv7, because pw.pw_passwd.is_null()#1824

Merged
bors[bot] merged 1 commit intonix-rust:masterfrom
ClarkGuan:master
Sep 24, 2022
Merged

fix bugs on android armv7, because pw.pw_passwd.is_null()#1824
bors[bot] merged 1 commit intonix-rust:masterfrom
ClarkGuan:master

Conversation

@ClarkGuan
Copy link
Copy Markdown

crash on my Android phone because pw.pw_passwd == NULL

@rtzoeller
Copy link
Copy Markdown
Collaborator

How are you testing these changes - something like Termux? I'd like to see if I can reproduce this on my end.

Thanks!

@ClarkGuan
Copy link
Copy Markdown
Author

@rtzoeller use adb which in Android SDK like below:

$ adb push <path-to-exec> /data/local/tmp
$ adb shell /data/local/tmp/<exec-file>

Rust code:

use nix::unistd::{self, User};

fn main() {
    let user = User::from_uid(unistd::getuid())
        .expect("getpwuid_r()")
        .expect("option");
    println!("{:?}", user);
}

Crash also happened on aarch64 android platform.

@rtzoeller
Copy link
Copy Markdown
Collaborator

Thanks! Confirmed this reproduces for me.

Can you add an entry to the CHANGELOG.md file under the Fixed section, squashed into the current commit?

@rtzoeller
Copy link
Copy Markdown
Collaborator

@ClarkGuan can you squash the current two commits into a single commit?

@ClarkGuan
Copy link
Copy Markdown
Author

@rtzoeller OK.

Copy link
Copy Markdown
Collaborator

@rtzoeller rtzoeller left a comment

Choose a reason for hiding this comment

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

bors r+

@bors bors bot merged commit 7aaf808 into nix-rust:master Sep 24, 2022
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.

2 participants