Mojo

Incorrect SetFile attributes on buildapp.app. Bundle bit not set as expected. Other bits set, not as expected.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: buildnumber-maven-plugin-1.0-beta-3
  • Fix Version/s: None
  • Component/s: osxappbundle
  • Labels:
    None
  • Environment:
  • Complexity:
    Intermediate
  • Number of attachments :
    1

Description

After a mvn clean package I looked at the SetFile specific bits in the com.apple.FinderInfo information for the app file using
xattr -l target/buildapp-1.0-SNAPSHOT/BuildApp.app
on the mac app bundle directory. What came out was:

  • * * *
    0000 00 00 00 00 00 00 00 00 08 80 00 00 00 00 00 00 ................
    0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    What was expected was:
  • * * *
    0000 00 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 ................
    0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

As far as I can tell by using SetFile to set and unset bits on a directory the meaning of the 16 bits are as follows (see the SetFile man page):

AVBS TC?I - NM?E ???D
0000 1000 - 1000 0000 --> what was produced
0010 0000 - 0000 0000 --> what I expected from SetFile -a B "someDir"

Related to this problem was another where I switched from using alpha-1 to the alpha-2 version of the plugin. This caused me to get a *.app file that had the invisible bit set. I.e.
0000 00 00 00 00 00 00 00 00 48 01 00 00 00 00 00 00 ........H.......
0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
which translates to:
0100 1000 - 0000 0001 -> invisible *.app file.

This made the .app file not show up in the find and even the .dmg file appear empty when opened. The only way I could get around this was to use a different application/build name.

Out of curiosity I tried the directory creation and SetFile code from the plugin in a test app, but it works fine, and sets the bit as expected on any new file I create. However I can get strange bits showing up if I reuse the same directory names as the build, even after a mvn clean. Its like the mac is remembering and reapplying file attribute information elsewhere.

SetFile from the command line works as expected i.e.
SetFile -a avBstclinmed target/buildapp-1.0-SNAPSHOT/BuildApp.app/
ensures the bundle bit is set and everything else is unset.
But running the same command from a java app does not work and doesn't throw and exception as to why not.

Has anyone else seen this problem? It may be related to the empty dmg file reported in MOJO-1302.
Can you check that your file attribute bits are set as expected on your machine (i.e. is it just my machine acting weird)?

Thank you (and thank you for the plugin!)

Issue Links

Activity

Hide
Matthew Jensen added a comment -

I was having the same problem and I did some digging and think I found the cause.

The creation of the setfile process is like this:

setFile.setExecutable(SET_FILE_PATH);
setFile.createArgument().setValue( "-a B" );
setFile.createArgument().setValue( bundleDir.getAbsolutePath() );
setFile.execute();

This is essentially the same as running the command line this:

setfile "-a B" /path/to/Application.app

because the each value is sent as a seperate argument. In this case setfile thinks "-a B" is the file name (I guess because it doesnt match any of its options?) and fails with a useless error message:

Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute
Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File
Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.
ERROR: File Not Found. (-43)  on file: -a B

I got the same error message when I logged the output of the process within the plugin. I'm not sure why some file/directory names don't expose this problem, I have two builds going, 3.1-SNAPSHOT and 3.0.1-SNAPSHOT and only one of them had this problem.

The attached patch splits the argument in two so its parsed properly. It fixed it in my case at least.

setFile.createArgument().setValue( "-a" );
setFile.createArgument().setValue( "B" );
Show
Matthew Jensen added a comment - I was having the same problem and I did some digging and think I found the cause. The creation of the setfile process is like this:
setFile.setExecutable(SET_FILE_PATH);
setFile.createArgument().setValue( "-a B" );
setFile.createArgument().setValue( bundleDir.getAbsolutePath() );
setFile.execute();
This is essentially the same as running the command line this:
setfile "-a B" /path/to/Application.app
because the each value is sent as a seperate argument. In this case setfile thinks "-a B" is the file name (I guess because it doesnt match any of its options?) and fails with a useless error message:
Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute
Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File
Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.Invalid File Attribute Specified.
ERROR: File Not Found. (-43)  on file: -a B
I got the same error message when I logged the output of the process within the plugin. I'm not sure why some file/directory names don't expose this problem, I have two builds going, 3.1-SNAPSHOT and 3.0.1-SNAPSHOT and only one of them had this problem. The attached patch splits the argument in two so its parsed properly. It fixed it in my case at least.
setFile.createArgument().setValue( "-a" );
setFile.createArgument().setValue( "B" );
Hide
David J. M. Karlsen added a comment -

Fixed in rev 10408.

Show
David J. M. Karlsen added a comment - Fixed in rev 10408.
Hide
Matthew Jensen added a comment -

David, can we get another alpha release of this plugin so we can get one with this fix in it?

Show
Matthew Jensen added a comment - David, can we get another alpha release of this plugin so we can get one with this fix in it?

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: