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

Feature user for emscripten #2496

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

ChanTsune
Copy link
Contributor

What does this PR do

Fix failed to build for target wasm32-unknown-emscripten with --features user with this error:

error[E0432]: unresolved import `self::os`
 --> src/features.rs:2:15
  |
2 | pub use self::os::*;
  |               ^^ could not find `os` in `self`

error[E0609]: no field `pw_class` on type `&passwd`
    --> src/unistd.rs:3569:55
     |
3569 |                 class: CString::new(CStr::from_ptr(pw.pw_class).to_bytes())
     |                                                       ^^^^^^^^ unknown field
     |
     = note: available fields are: `pw_name`, `pw_passwd`, `pw_uid`, `pw_gid`, `pw_gecos` ... and 2 others

error[E0609]: no field `pw_change` on type `&passwd`
    --> src/unistd.rs:3579:28
     |
3579 |                 change: pw.pw_change,
     |                            ^^^^^^^^^ unknown field
     |
     = note: available fields are: `pw_name`, `pw_passwd`, `pw_uid`, `pw_gid`, `pw_gecos` ... and 2 others

error[E0609]: no field `pw_expire` on type `&passwd`
    --> src/unistd.rs:3588:28
     |
3588 |                 expire: pw.pw_expire,
     |                            ^^^^^^^^^ unknown field
     |
     = note: available fields are: `pw_name`, `pw_passwd`, `pw_uid`, `pw_gid`, `pw_gecos` ... and 2 others

error[E0560]: struct `passwd` has no field named `pw_class`
    --> src/unistd.rs:3629:13
     |
3629 |             pw_class: u.class.into_raw(),
     |             ^^^^^^^^ `passwd` does not have this field
     |
     = note: all struct fields are already assigned

error[E0560]: struct `passwd` has no field named `pw_change`
    --> src/unistd.rs:3638:13
     |
3638 |             pw_change: u.change,
     |             ^^^^^^^^^ `passwd` does not have this field
     |
     = note: all struct fields are already assigned

error[E0560]: struct `passwd` has no field named `pw_expire`
    --> src/unistd.rs:3647:13
     |
3647 |             pw_expire: u.expire,
     |             ^^^^^^^^^ `passwd` does not have this field
     |
     = note: all struct fields are already assigned

Some errors have detailed explanations: E0432, E0560, E0609.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `nix` (lib) due to 7 previous errors
  • struct passwd for emscripten not have some fields, so disabled it.

Even if this error is resolved, full support for emscripten will not be possible because libc does not provide some functions for emscripten like libc::getpwuid_r. but this change will be useful in the future.

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

@ChanTsune ChanTsune force-pushed the feature-user-for-emscripten branch from b218461 to 3839a7a Compare September 10, 2024 14:19
@SteveLauC SteveLauC self-requested a review September 13, 2024 09:47
Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the patch!

@SteveLauC SteveLauC added this pull request to the merge queue Sep 15, 2024
Merged via the queue into nix-rust:master with commit 08ad7d6 Sep 15, 2024
38 checks passed
@ChanTsune ChanTsune deleted the feature-user-for-emscripten branch September 15, 2024 03:08
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