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

c-scape: Incompatible type in listxattr #132

Closed
pothos opened this issue May 17, 2024 · 5 comments · Fixed by #133
Closed

c-scape: Incompatible type in listxattr #132

pothos opened this issue May 17, 2024 · 5 comments · Fixed by #133

Comments

@pothos
Copy link
Contributor

pothos commented May 17, 2024

I run into mismatches types because c-scape:src/fs/xattr.rs has READ_BUFFER as [u8] and passes it to rustix::fs::listxattr which expects [i8] (actually c::c_char).
That happens with rustix 0.38.34 and Eyra from main. Using the nightly-2024-04-21 from the Eyra toolchain didn't help.
Other functions such as fgetxattr in rustix expect u8 and if rustix is right if might make sense to add a second READ_BUFFER definition in c-scape that uses i8, or?

sunfishcode added a commit that referenced this issue May 17, 2024
`READ_BUFFER` was originally added for `read`, but `read` no longer
needs it now that we can use `rustix::io::read_uninit`. So the only
thing left using `READ_BUFFER` is the xattr functions. It wasn't really
correct for the xattr functions to use a `PIPE_BUF`-sized buffer anyway,
so remove `READ_BUFFER` entirely and just use `Vec`s for their buffers.

This also fixes compile errors with u8/i8 mismatches when `linux-raw-sys/std`
is enabled.

Fixes #132.
@sunfishcode
Copy link
Owner

Thanks for the report! I've now filed #133 to fix it.

sunfishcode added a commit that referenced this issue May 17, 2024
`READ_BUFFER` was originally added for `read`, but `read` no longer
needs it now that we can use `rustix::io::read_uninit`. So the only
thing left using `READ_BUFFER` is the xattr functions. It wasn't really
correct for the xattr functions to use a `PIPE_BUF`-sized buffer anyway,
so remove `READ_BUFFER` entirely and just use `Vec`s for their buffers.

This also fixes compile errors with u8/i8 mismatches when `linux-raw-sys/std`
is enabled.

Fixes #132.
@pothos
Copy link
Contributor Author

pothos commented May 18, 2024

Thanks! With that I got a rebased version of your coreutils patch to compile :)

Edit: Using main for Eyra and c-scape until there are new releases.
Edit2: Actually, the patch is not needed if you do cargo add eyra --rename=std and set up RUSTFLAGS="-C link-arg=-nostartfiles -C target-feature=+crt-static -C relocation-model=static" (Last two args to get a static binary).

@sunfishcode
Copy link
Owner

This is now released in c-scape 0.16.0 and eyra 0.16.11.

@pothos
Copy link
Contributor Author

pothos commented May 19, 2024

Thanks a lot, I've finally switched https://github.com/pothos/rust-userland to use Eyra

@sunfishcode
Copy link
Owner

Cool!

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 a pull request may close this issue.

2 participants