nix icon indicating copy to clipboard operation
nix copied to clipboard

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

Open ClarkGuan opened this issue 3 years ago • 2 comments
trafficstars

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

ClarkGuan avatar Sep 22 '22 13:09 ClarkGuan

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

Thanks!

rtzoeller avatar Sep 22 '22 16:09 rtzoeller

@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.

ClarkGuan avatar Sep 23 '22 05:09 ClarkGuan

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 avatar Sep 24 '22 16:09 rtzoeller

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

rtzoeller avatar Sep 24 '22 18:09 rtzoeller

@rtzoeller OK.

ClarkGuan avatar Sep 24 '22 18:09 ClarkGuan