scuffle hardcodes *const i8 for C strings, so it only compiles where c_char is signed
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 90/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- operating-systems
Research direction
Start by reviewing the affected signatures in src/scope.rs, src/snapshot.rs, src/property_group.rs, src/instance.rs, src/service.rs, and src/value.rs, plus the casts in src/scf.rs and src/value.rs. Compare them with the existing libc::c_char usage and run cargo build for the aarch64 target or stub configuration; done means the crate builds without the reported type mismatches.
Written by the indexing model from the issue text.
Description
Description
scuffle wraps libscf-sys, which correctly declares its non-illumos stubs in
terms of c_char. scuffle itself hardcodes i8 in nine function signatures
and four explicit casts, so the two only agree on platforms where c_char is
signed. On aarch64, where c_char is unsigned, the crate fails to compile with
17 errors pointing in both directions:
error[E0308]: mismatched types
--> scuffle-0.1.0/src/snapshot.rs:53:35
|
53 | .scf_get_snapshot(name.as_c_str().as_ptr(), handle.as_mut_ptr())
| ---------------- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const i8`, found `*const u8`
error[E0308]: mismatched types
--> scuffle-0.1.0/src/value.rs:373:17
|
371 | libscf_sys::scf_handle_decorate(
| ------------------------------- arguments to this function are incorrect
373 | decoration,
| ^^^^^^^^^^ expected `*const u8`, found `*const i8`
Both directions appear because CStr::as_ptr() returns *const c_char
(unsigned here) while scuffle's own signatures say i8, and libscf-sys's
stubs say c_char while scuffle passes i8 into them.
The affected sites are:
src/scope.rs:37 name: *const i8
src/snapshot.rs:74 name: *const i8
src/property_group.rs:219 name: *const i8
src/instance.rs:143,157,168 name: *const i8
src/service.rs:88,102 name: *const i8
src/value.rs:368 decoration: *const i8
src/scf.rs:129,152,250 .cast::<i8>()
src/value.rs:731 .cast::<i8>()
The crate already uses libc::c_char correctly elsewhere — src/iter.rs,
src/libscf_sys_supplemental.rs and src/property_group.rs:458 all declare
*mut libc::c_char — so this looks like an oversight rather than a decision.
I understand SMF is illumos-only and that these code paths are stubs that
unimplemented!() off illumos. The point is narrower: the stubs exist
specifically so that higher-level crates can build on other platforms (the
libscf-sys module comment says exactly that), and on aarch64 they do not.
This blocks building dendrite and omicron on aarch64 Linux.
Steps to reproduce
- On an aarch64 Linux host:
cargo buildany crate depending on scuffle 0.1.0. - 17
error[E0308]mismatches in scuffle.
Expected result
The crate compiles on any platform where the stubs are used, matching the stated
purpose of libscf-sys's stub module.
Actual result
error: could not compile 'scuffle' (lib) due to 17 previous errors
Suggested fix
Replace the hardcoded i8 with libc::c_char in the nine signatures and four
casts listed above. On x86_64 this is a no-op, since c_char is i8 there.
Environment
scuffle 0.1.0 (crates.io)
via oxidecomputer/omicron @ df990b05, oxidecomputer/dendrite @ 04a52a32
platform aarch64-unknown-linux-gnu, Ubuntu 24.04
rust 1.98.1 (omicron), 1.90.0 (dendrite)
Disclosure: this issue was investigated and written up with AI assistance
(Claude). Everything in it was measured rather than inferred — the timings,
error output, version numbers and reproduction steps are all from real runs on
real hardware, and where a fix is suggested it is one I am actually running. I
have read it through before filing. Happy to clarify anything or test a patch.
- Dominant language
- Rust
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100