Skip to content

Conversation

@josch
Copy link
Contributor

@josch josch commented Dec 26, 2021

This allows libarchive (in case it is activated) to handle filenames.
We only change LC_CTYPE since libarchive only needs the charset set.
We don't use LC_ALL because it causes problems on some systems.
We restore the original LC_CTYPE after extraction to avoid side effects.
We use uselocale instead of setlocale to avoid setting LC_CTYPE globally.
See on libarchive Website for a more complete description of the issue:
libarchive/libarchive#587
https://github.com/libarchive/libarchive/wiki/Filenames
https://github.com/sbabic/swupdate/blob/master/handlers/archive_handler.c#L94

This allows libarchive (in case it is activated) to handle filenames.
We only change LC_CTYPE since libarchive only needs the charset set.
We don't use LC_ALL because it causes problems on some systems.
We restore the original LC_CTYPE after extraction to avoid side effects.
We use uselocale instead of setlocale to avoid setting LC_CTYPE globally.
See on libarchive Website for a more complete description of the issue:
 libarchive/libarchive#587
 https://github.com/libarchive/libarchive/wiki/Filenames
 https://github.com/sbabic/swupdate/blob/master/handlers/archive_handler.c#L94
@josch
Copy link
Contributor Author

josch commented Dec 26, 2021

Without it, handling a tarball in pax format containing utf8 characters in its filenames will result in this error message:

archive_read_next_header(): Pathname can't be converted from UTF-8 to current locale.

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