Bug #906

Mountain Lion Plugin crashes when setxattr called

Added by Robin Mills almost 4 years ago. Updated almost 4 years ago.

Status:ClosedStart date:10 Jun 2013
Priority:NormalDue date:
Assignee:Robin Mills% Done:

50%

Category:buildEstimated time:4.00 hours
Target version:0.24

Description

This has been reported by Yang Yang of Topaz Labs.


Related issues

Related to Exiv2 - Bug #910: Bug #836 possibly reintroduced: writeMetadata() destroys ... Assigned 25 Jul 2013

Associated revisions

Revision 3065
Added by Robin Mills almost 4 years ago

Mac build #906 fix compilation error (thanks to Tuan for this fix).

History

#1 Updated by Robin Mills almost 4 years ago

I think it's clear that this is a fault being thrown by Mac's 'sandbox' feature which was introduced by Mountain Lion. The 'sandbox' restricts system calls. As our test suite passes, it would appear that Terminal applications are not 'sandboxed'.

I believe we can dummy it to be effectivly void copyXattrFrom(const FileIo&) { return ; }.

#ifndef APPLE
if (::setxattr(path_.c_str(), name, value, valueSize, 0, 0) != 0) {
throw Error(2, path_, strError(), "setxattr");
}
#endif

What's xattr and how to work with it:

I've googled up a couple of pages about this
http://www.jetseven.org/2011/09/tiny-terminal-tip-xattr.html
http://xahlee.info/comp/OS_X_extended_attributes_xattr.html

I've applied an xattr to Volker's test files:

$ cd <exiv2dir>/test/data
$ xattr -w -x aabbcc 2233445566 *.eps
$ ls -alt@ *.eps
….
-rw-r--r--@ 1 rmills  staff  1256239 Oct 19  2012 test/data/eps/eps-flat_coreldraw-x3-lev2.eps
    aabbcc          5 
564 rmills@rmills-imac:~/gnu/exiv2/test.build $ 

I added a cout to copyXattrFrom to be certain it's being called:

#ifdef DEBUG
            EXV_DEBUG << "Copying xattr \"" << name << "\" with value size " << valueSize << "\n";
#endif
#ifndef __APPLE__
            if (::setxattr(path_.c_str(), name, value, valueSize, 0, 0) != 0) {
                throw Error(2, path_, strError(), "setxattr");
            }
#else
            std::cout << "SETATTR" << std::endl;
#endif

555 rmills@rmills-imac:~/gnu/exiv2/test.build $ make teste
cd test && make teste
Running eps-test.sh ...
.............................................................................................................
Files /Users/rmills/gnu/exiv2/test.build/test/tmp/../data/eps/eps-test.out and /Users/rmills/gnu/exiv2/test.build/test/tmp/eps-test.out differ
--- /Users/rmills/gnu/exiv2/test.build/test/tmp/../data/eps/eps-test.out    2012-10-19 21:18:22.000000000 -0700
+++ /Users/rmills/gnu/exiv2/test.build/test/tmp/eps-test.out    2013-06-03 11:25:13.000000000 -0700
@@ -5,6 +5,7 @@
 Exit code: 253

 Command: exiv2 -dx eps-flat_coreldraw-x3-lev2.eps
+SETATTR
 Exit code: 0

 Command: exiv2 -f -ex eps-flat_coreldraw-x3-lev2.eps
@@ -16,6 +17,7 @@
 Exit code: 0

 Command: exiv2 -ix eps-flat_coreldraw-x3-lev2.eps
+SETATTR
 Exit code: 0

 Command: (2) exiv2 -ix eps-flat_coreldraw-x3-lev2.eps
make[1]: *** [teste] Error 1
make: *** [teste] Error 2
556 rmills@rmills-imac:~/gnu/exiv2/test.build $ 

Notice there is an exception coming from test/data/eps-test.out
560 rmills@rmills-imac:~/gnu/exiv2/test.build $ ls -alt@ test/tmp/eps-test.out 
-rw-r--r--+ 1 rmills  staff  427419 Jun  3 11:25 test/tmp/eps-test.out
561 rmills@rmills-imac:~/gnu/exiv2/test.build $ ls -alt@ test/data/eps/eps-test.out 
-rw-r--r--+ 1 rmills  staff  427403 Oct 19  2012 test/data/eps/eps-test.out
562 rmills@rmills-imac:~/gnu/exiv2/test.build $ 

Both have extended attributes and the second is shorter by 16 bytes. However ls -alt@ didn't list anything. I think he has an invisible string in his xattr. Volker's test is strong enough to detect this. I think this exception is benign.

#2 Updated by Robin Mills almost 4 years ago

Fix submitted: r3050.

#3 Updated by Robin Mills almost 4 years ago

  • Status changed from Assigned to Closed

I believe this is fixed in 0.24. If you wish this issue to be reconsidered, please open a new issue on dev.exiv2.org and reference this report.

#4 Updated by Volker Grabsch almost 4 years ago

Please note that the MacOSX platform was the reason we introduced the xattr stuff in the first place, as otherwise the resource fork of images bigger than 1MB would be destroyed (see issue #836).

So I think that disabling this mechanism for all MacOSX platforms is going too far.

We should either disable this for exactly the MacOSX versions that cause trouble.

Or better: provide an alternative mechanism that preserves resource forks.

#5 Updated by Volker Grabsch almost 4 years ago

I created a new issue #910 to address this possible reintroduction of a bug.

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux