Skip to content

Fix correct CStr pointer type#2

Merged
suyulin merged 1 commit into
suyulin:mainfrom
FliegendeWurst:patch-1
Dec 24, 2024
Merged

Fix correct CStr pointer type#2
suyulin merged 1 commit into
suyulin:mainfrom
FliegendeWurst:patch-1

Conversation

@FliegendeWurst

Copy link
Copy Markdown
Contributor

On aarch64 this would be u8, not i8.

@suyulin

suyulin commented Dec 24, 2024

Copy link
Copy Markdown
Owner

Thank you! It’s more appropriate to clarify the semantics here.

@suyulin suyulin merged commit 86fe0a3 into suyulin:main Dec 24, 2024
@FliegendeWurst

Copy link
Copy Markdown
Contributor Author

It is a bit unfortunate that the rustdoc documentation is always built for a specific platform. If you check https://doc.rust-lang.org/std/ffi/struct.CStr.html#method.from_ptr for example, it says i8 - not c_char. So it is really easy to make this mistake.

@FliegendeWurst

Copy link
Copy Markdown
Contributor Author

To find the right type, you'd need to check the source using the link next to the method.

@suyulin

suyulin commented Dec 25, 2024

Copy link
Copy Markdown
Owner

Thank you for your pr, I learned a lot.

singhc7 added a commit to singhc7/nixpkgs that referenced this pull request May 10, 2026
Fixes build on aarch64-linux. Upstream v1.0.0 corrected c_char
pointer casts that hardcoded i8 instead of the target-portable
c_char type (suyulin/afptool-rs#2).

Upstream v1.2.3 also updates the integration test assertions to
match current clap output (suyulin/afptool-rs#11), so the previous
checkFlags workaround is no longer needed.

Part of ZHF: NixOS#516381
singhc7 added a commit to singhc7/nixpkgs that referenced this pull request May 18, 2026
Fixes build on aarch64-linux. Upstream v1.0.0 corrected c_char
pointer casts that hardcoded i8 instead of the target-portable
c_char type (suyulin/afptool-rs#2).

Upstream v1.2.3 also updates the integration test assertions to
match current clap output (suyulin/afptool-rs#11), so the previous
checkFlags workaround is no longer needed.

Part of ZHF: NixOS#516381
singhc7 added a commit to singhc7/nixpkgs that referenced this pull request May 18, 2026
Fixes build on aarch64-linux. Upstream v1.0.0 corrected c_char
pointer casts that hardcoded i8 instead of the target-portable
c_char type (suyulin/afptool-rs#2).

Upstream v1.2.3 also updates the integration test assertions to
match current clap output (suyulin/afptool-rs#11), so the previous
checkFlags workaround is no longer needed.

Part of ZHF: NixOS#516381
coolcuber pushed a commit to coolcuber/nixpkgs that referenced this pull request May 18, 2026
Fixes build on aarch64-linux. Upstream v1.0.0 corrected c_char
pointer casts that hardcoded i8 instead of the target-portable
c_char type (suyulin/afptool-rs#2).

Upstream v1.2.3 also updates the integration test assertions to
match current clap output (suyulin/afptool-rs#11), so the previous
checkFlags workaround is no longer needed.

Part of ZHF: NixOS#516381
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