Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly support filenames with special characters #7

Open
rzimmer opened this issue Sep 5, 2016 · 2 comments
Open

Correctly support filenames with special characters #7

rzimmer opened this issue Sep 5, 2016 · 2 comments
Labels

Comments

@rzimmer
Copy link
Contributor

rzimmer commented Sep 5, 2016

Currently, it seems that filenames like Alex' file.txt get encoded to Alex' file.txt in the TOC.xml when creating an xar file. When extracting the archive, this encoded filename gets used as final filename (thus creating a file called Alex' file.txt), because there is no decoding happening. This should be investigated more and fixed.

@rzimmer
Copy link
Contributor Author

rzimmer commented Sep 7, 2016

Couldn't reproduce this issue anymore. Closing this for now.

@rzimmer rzimmer closed this as completed Sep 7, 2016
@rzimmer rzimmer added the wontfix label Sep 7, 2016
@rzimmer
Copy link
Contributor Author

rzimmer commented Sep 7, 2016

The official xar tool produces invalid XML for the ToC: It does not escape chars like ' to '. This Java port does and thus produces valid XML (currently there seems to be no way to turn this behaviour off).

It seems that 7-Zip has problems with this. Creating an archive using xar for Java with the following files

├── test's.txt
└── xar.patch

0 directories, 2 files

leads to the following file listing for the created archive:

$ 7z l test.xar 

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=de_DE.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz (506E3),ASM,AES-NI)

Scanning the drive for archives:
1 file, 1007 bytes (1 KiB)

Listing archive: test.xar

--
Path = test.xar
Type = Xar
Physical Size = 1007
Headers Size = 295

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
                    .....           10           16  test's.txt
                    .....          676          676  xar.patch
                    .....          741          741  [TOC].xml
------------------- ----- ------------ ------------  ------------------------
                                  1427         1433  3 files

$ xar -t -f test.xar 
xar.patch
test's.txt

$ java -jar xar-cli-0.9.5-SNAPSHOT-standalone.jar -t -f test.xar
INFO xar.patch
INFO test's.txt

While the official xar implementation (presumably using libxml) as well as the Java one and even file-roller (GNOME's archive manager) correctly de-escape the file name from the TOC.xml, 7-Zip doesn't and thus while create wrongly named files when extracting.

I consider this rather a bug in 7-Zip than in xar for Java, although xar (official) behaves somehow buggy, too, when not creating valid XML...

The currently used XML implementation doesn't allow disabling escaping, thus this won't be fixed in the near future. Leaving this open for reference, though...

@rzimmer rzimmer reopened this Sep 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant