vodik / repose

an archlinux repo poking tool
GNU General Public License v2.0
128 stars 15 forks source link

Character Set Handling #34

Closed mkoskar closed 8 years ago

mkoskar commented 8 years ago

Having repository with package shaman-git-2.0.0_α_19_gd28fd8e-1-x86_64.pkg.tar.xz (notice the α in the name) and running repose -f custom resulting files db seems to be causing trouble with pkgfile. At first I've suspected pkgfile and reported issue there https://github.com/falconindy/pkgfile/issues/24.

It turns out that instead probably repose should be adjusted. AFAIK repose uses libarchive which also provides bsdtar which is in turn used by repo-add. libarchive uses user's locale to decode filenames. Since explicit setlocale() is not done, C/POSIX locale is assumed resulting in archive with hdrcharset=BINARY, which seem to later trouble pkgfile. Interestingly bsdtar --list works OK.

Nevertheless, as pointed out in the issue linked above, to do proper character set handling following should be done close to beginning of the program:

setlocale(LC_ALL, "");