Export to GitHub

xar - issue #1

xar doesn't handle composed characters in filenames correctly


Posted on Jan 21, 2007 by Happy Panda

What steps will reproduce the problem? 1. Make a new folder 2. Make four new folders inside this folder, and name them "naïve", "resumé", "el niño", and "bibliothèque" 3. Open the Terminal and cd to this folder 4. xar -cf ../test.xar . 5. xar -tf ../test.xar (notice how the filenames are chopped off)

What is the expected output? What do you see instead?

I expected to see the following output:

$ xar -tf test.xar .DS_Store bibliothèque el niño naïve resumé

but instead I saw this:

$ xar -tf test.xar .DS_Store bibliothèq el niño naïv resume

Only "el niño" survived. The rest had their names chopped off. Extracting the files from the archive gives the same results - you get the files back, with chopped filenames.

It gets worse if you use filenames with more unusual composed characters, like for example "Antonín Dvořák". In this case, the file will not even extract from the archive. This is what happens:

$ xar -tf test2.xar Antonín Dvořa?

$ xar -xf test2.xar Error while extracting archive:(Antonín Dvořa?): stat: Could not create directory (Invalid argument) - ignored

If using the xar library with a C app, using xar_prop_get() with "name" as the key gets you the following:

"Antoni\314\201n Dvor\314\214a\314"

whereas the correct string should be:

"Antoni\314\201n Dvor\314\214a\314\201k"

Clearly, this is a problem as it will make it impossible to reliably store files with special characters in their names within a xar archive until it is fixed.

What version of the product are you using? On what operating system?

This occurs with xar 1.4 as well as with the latest snapshot from SVN.

Comment #1

Posted on Jan 21, 2007 by Happy Panda

I neglected to provide my OS version; it is Mac OS X 10.4.8, build 8L127.

Comment #2

Posted on Jan 28, 2007 by Happy Dog

The patch you submitted seems to have resolved the problem, thanks! The patch has been committed, and if you can verify the fix is in SVN, and that it fixes your problem, we can close the bug.

Thanks! Rob

Status: Fixed

Labels:
Type-Defect Priority-Medium