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

Segment fault on Debian when listing archive files with Chinese characters #100

Closed
YaxinCheng opened this issue Jan 8, 2023 · 3 comments

Comments

@YaxinCheng
Copy link
Contributor

YaxinCheng commented Jan 8, 2023

Segment fault happens on Debian when list_archive_files or list_archive_files_with_encoding is called for archives whose files contain Chinese characters.

The two functions work fine on macOS when listing files with or without Chinese characters.

Error message:

qemu: uncaught target signal 11 (Segmentation fault) - core dumped

I realized the problem when I put my binary into docker. I don't have a Debian environment except docker, so the reproduce steps are using docker. Sorry about that.

Reproduce:

  1. Unzip compress_tools_test.zip
  2. docker build . -t compress-tools-test
  3. docker run --rm -it --entrypoint sh compress-tools-test
  4. cargo run

The zip used for the test is included in the zip above, but if you want to download it separately, here it is: test.zip

@YaxinCheng YaxinCheng changed the title Segment fault on Debian when list archives with Chinese characters Segment fault on Debian when listing archive files with Chinese characters Jan 8, 2023
@otavio
Copy link
Member

otavio commented Jan 9, 2023

Could you try to create a small test case in the form of a PR so we can have something to use as a base?

@YaxinCheng
Copy link
Contributor Author

Test case added in PR #101

otavio added a commit that referenced this issue Jan 9, 2023
If operating system doesn't has support for the required locale,
`ffi::archive_entry_pathname(...)` returns NULL and we need to error out
accordingly.

Fixes: #100
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
@otavio
Copy link
Member

otavio commented Jan 9, 2023

The error is because the Docker image lacks a default locale. Use:

LC_ALL=C.UTF-8 cargo test

However #103 address the segfault. Now it error out.

@otavio otavio closed this as completed in 2c86cfa Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants