[pacman-dev] makepkg, bsdtar and non-ASCII user/group names

David Macek david.macek.0 at gmail.com
Tue May 5 19:20:26 UTC 2015

Hey everyone. Can someone help me understand why makepkg sets `LANG=C` for invoking bsdtar? According to dreisner, the change was introduced in 537a335cc724a5c7c, but the commit message there only explains what the change does, not how it does it:

> Use C locale for bsdtar calls during package creation

> This ensures packages build on a UTF-8 locale system with non-ASCII character
> names can be installed on non-UTF-8 systems.

I'm asking because I'm getting errors regarding group names (but I assume it'd be the same with user names) like this one:

> bsdtar: somefile: Can't translate gname 'Отсутствует' to UTF-8

Removing `LANG=C` makes the errors go away. The error can be reproduced outside of makepkg just by running `LANG=C bsdtar -cf /tmp/foo.tar *` in a suitable directory.

I know this is not exactly a common scenario on Arch Linux, as the combination of fakeroot, the special status of the root user and group and the ASCII-only policy of groupadd makes it very unlikely that the packaging bsdtar invocation will encounter any such problems. In Cygwin however, the probability of encountering non-ASCII user/group names is pretty high.

I wonder if there's some combination of locale settings and bsdtar arguments that allows for the thing the commit was targeted on, but also for non-ASCII user/group names. One possibility would be to specify `--uname "" --gname ""` to bsdtar, assuming the names are useless for pacman anyway.

If manipulating the locale variables is more desirable, I ask for an example of the situation that this change fixed (or a link), otherwise I don't know how to correctly test it.

Extending this idea further, makepkg could pass `--uname root --gname root --uid 0 --gid 0` to bsdtar, which could help with moving the bsdtar/gnupg step out of fakeroot, if it's not possible already (and if it's desirable). That's of course assuming that all packages contain files with only root.root ownership.

David Macek

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4234 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20150505/15765e87/attachment.p7s>

More information about the pacman-dev mailing list