kfowler / xar

Automatically exported from code.google.com/p/xar
0 stars 0 forks source link

xar doesn't handle composed characters in filenames correctly #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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.

Original issue reported on code.google.com by Charle...@gmail.com on 21 Jan 2007 at 12:05

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

Original comment by Charle...@gmail.com on 21 Jan 2007 at 12:15

GoogleCodeExporter commented 8 years ago
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

Original comment by bbraun on 28 Jan 2007 at 5:40