jmichaelh / xar

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

Custom MacOS X extended attributes are deleted #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use the xattr utility to set a custom extended attribute (e.g. echo
"Hello world" > testfile.txt; xattr --set testxa testxavalue testfile.txt)

2. Archive the file in Xar (xar -cf testfile.xar testfile.txt)

3. De-archive the file (xar -xf testfile.xar)

4. The custom EA is missing. (xattr --list testfile.txt)

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

I would expect for the extended attributes to be maintained. They are not.

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

1.4 (installed via Fink unstable) on MacOS X 10.4.8

Please provide any additional information below.

Resource forks appear to be maintained properly.

Original issue reported on code.google.com by nik%inik...@gtempaccount.com on 12 Mar 2007 at 9:42

GoogleCodeExporter commented 8 years ago
You might want to try this with the latest SVN. It seems to work on my machine, 
at least:

$ echo "Hello world" > testfile.txt
$ xattr --set testxa testxavalue testfile.txt
$ xar -cf testfile.xar testfile.txt
$ rm testfile.txt 
$ xar -xf testfile.xar
$ xattr --list testfile.txt
testfile.txt
        testxa  testxavalue

Original comment by Charle...@gmail.com on 14 Mar 2007 at 11:21

GoogleCodeExporter commented 8 years ago
Aha. Found the problem. Xar is only recovering the FIRST extended attribute. So 
if a file has multiple extended 
attributes or a resource fork and other extended attributes, only the first one 
is restored.

Try the following:

$ echo "test" > test1.txt ; xattr --set foo bar test1.txt ; xattr --set foo2 
bar2 test1.txt
$ echo "test" > test2.txt ; echo "resource fork data" >> test2.txt/rsrc; xattr 
--set foo bar test2.txt ; xattr --set 
foo2 bar2 test2.txt
$ xattr --list test1.txt test2.txt

test1.txt
         foo    bar
        foo2    bar2
test2.txt
        com.apple.ResourceFork  resource fork data

                           foo  bar
                          foo2  bar2

$ xar -cf test.xar test1.txt test2.txt
$ rm test1.txt test2.txt
$ xar -xf test.xar
$ xattr --list test1.txt test2.txt
test1.txt
        foo     bar
test2.txt
        com.apple.ResourceFork  resource fork data

This is off the HEAD revision of the SVN trunk.

Original comment by nik%inik...@gtempaccount.com on 15 Mar 2007 at 5:10

GoogleCodeExporter commented 8 years ago
I've just completely overhauled the way EAs are handled in xar, to fix some 
fundamental issues.  As part of the 
fix, EAs in old archives won't be extracted properly.  This doesn't seem to be 
a huge issue with xarchives created 
on Mac OS X, because of this bug.

However, this particular issue seems to have been related to a bug of incorrect 
variable reuse causing (most 
frequently, but not always) only the first EA returned by listxattr() to be 
archived.

This should be fixed in r123 in trunk.  Since this bug affected archival and 
not extraction, you'll need to recreate 
your xarchives so all the EAs will be captured.

Original comment by bbraun on 17 Apr 2007 at 2:15

GoogleCodeExporter commented 8 years ago
Since I believe this is resolved, I'm marking this as fixed.  If you concur, it 
can
be marked as verified.  If you don't believe it is fixed, we'll move it back to 
New.

Original comment by bbraun on 18 Apr 2007 at 1:43