Skip to content

Conversation

@Ecordonnier
Copy link
Collaborator

Commit 2a0d58d changed this line from libc::fsid_t to nix::sys::statfs::fsid_t. The pull-request description at #3396 indicates that this was done in order to fix the android build, however I think it should compile for android without this change.

Inside the nix crate, fsid_t is defined as:

pub type fsid_t = libc::fsid_t;

This all works as long as the libc version used by nix is the same than the libc version used by coreutils.

This breaks when using a local libc version (for local debugging, I was modifying libc and testing changes), because self.f_fsid which is of type libc::fsid_t (local version of libc) is then incompatible with nix::sys::statfs::fsid_t (upstream version of libc).

I was getting this error:

coreutils$ cargo build
   Compiling libc v0.2.171 (/home/ecordonnier/dev/libc)
   Compiling uucore v0.0.30 (/home/ecordonnier/dev/coreutils/src/uucore)
error[E0606]: casting `&libc::fsid_t` as `*const nix::libc::fsid_t` is invalid
   --> src/uucore/src/lib/features/fsext.rs:816:25
    |
816 |             unsafe { &*(&self.f_fsid as *const nix::sys::statfs::fsid_t as *const [u32; 2]) };
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0606`.
error: could not compile `uucore` (lib) due to 1 previous error

Commit uutils@2a0d58d changed this line from libc::fsid_t to nix::sys::statfs::fsid_t.
The pull-request description at uutils#3396 indicates that this was done in order to fix the android build, however I think it should
compile for android without this change.

Inside the nix crate, fsid_t is defined as:
```
pub type fsid_t = libc::fsid_t;
```

This all works as long as the libc version used by nix is the same than the libc version used by coreutils.

This breaks when using a local libc version (for local debugging, I was modifying libc and testing changes),
because self.f_fsid which is of type libc::fsid_t (local version of libc) is
then incompatible with nix::sys::statfs::fsid_t (upstream version of libc).

I was getting this error:

```
coreutils$ cargo build
   Compiling libc v0.2.171 (/home/ecordonnier/dev/libc)
   Compiling uucore v0.0.30 (/home/ecordonnier/dev/coreutils/src/uucore)
error[E0606]: casting `&libc::fsid_t` as `*const nix::libc::fsid_t` is invalid
   --> src/uucore/src/lib/features/fsext.rs:816:25
    |
816 |             unsafe { &*(&self.f_fsid as *const nix::sys::statfs::fsid_t as *const [u32; 2]) };
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0606`.
error: could not compile `uucore` (lib) due to 1 previous error
```

Signed-off-by: Etienne Cordonnier <[email protected]>
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.

1 participant