Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 282260

Summary: Executable bit is not set on exported launcher executable.
Product: [Eclipse Project] PDE Reporter: Andrei Neshcheret <a.nesheret>
Component: BuildAssignee: pde-build-inbox <pde-build-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, bhunt, boehme, ChristianOrtolf, eric.jain, hniederhausen, irbull, kasemirk, lmarchal, pascal, sources, Tod_Creasey, torkildr, zstorok
Version: 3.5Flags: dj.houghton: review+
Target Milestone: 3.6 RC1   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Bug Depends on:    
Bug Blocks: 532463    
Attachments:
Description Flags
patch none

Description Andrei Neshcheret CLA 2009-07-02 04:07:30 EDT
Build ID: 20090619-0625

Steps To Reproduce:
Export RCP product based on features with:
+Destination is: Archive file - (important)
+Generate metadata repository - (important)
+Export for multiple platforms

More information:
Host OS: Windows Vista and Mac OS X 10.5.7 produce same results.
Same export without 'Generate metadata repository' and/or ZIP Archive options, provide valid executable bit set on exported launcher.
Comment 1 Christian CLA 2009-07-06 11:28:29 EDT
Is there any simple workaround?
Comment 2 Andrew Niefer CLA 2009-07-06 17:14:51 EDT
Workaround would be export to folder and manually zip up the results using the native "zip" command.
Comment 3 Andrew Niefer CLA 2009-07-06 17:15:09 EDT
*** Bug 273757 has been marked as a duplicate of this bug. ***
Comment 4 Christian CLA 2009-07-06 17:40:46 EDT
Problem for me with zipping by hand is that MacOSX seems then not to recognize the .icns file for the executable if I do export without zipping.
Comment 5 Hannes Niederhausen CLA 2009-07-15 04:57:21 EDT
(In reply to comment #2)
> Workaround would be export to folder and manually zip up the results using the
> native "zip" command.
> 

How is that possible with headless building? I can't find a flag for exporting to folder in the propertioes files.
Comment 6 Andrew Niefer CLA 2009-07-15 10:08:46 EDT
(In reply to comment #5)
> (In reply to comment #2)
> > Workaround would be export to folder and manually zip up the results using the
> > native "zip" command.
> > 
> 
> How is that possible with headless building? I can't find a flag for exporting
> to folder in the propertioes files.
> 

If you are building headless, you can specify that the native "zip" be used directly using the archiveFormat property.  eg:
  archivesFormat=macosx,cocoa,x86-zip
"folder" will also work here, though there may be problems if you are building more than one platform
  archivesFormat=macosx,cocoa,x86-folder

I did just realize that this doesn't really help when building on windows, but it would be fine when building from mac or linux.
Comment 7 Christian CLA 2009-07-15 10:16:37 EDT
(In reply to comment #5)
> (In reply to comment #2)
> > Workaround would be export to folder and manually zip up the results using the
> > native "zip" command.
> > 
> 
> How is that possible with headless building? I can't find a flag for exporting
> to folder in the propertioes files.
> 

It doesn't need headless building.
This bug appears also when exporting through eclipse directly.


Comment 8 Torkild Resheim CLA 2009-08-13 07:58:41 EDT
I've run into the same problem and tried the suggested work-around. Building on Linux I use "p2.gathering=true" and
"archivesFormat=linux,gtk,x86-zip & win32,win32,x86-zip & macosx,carbon,x86-zip & linux,gtk,x86_64-zip"

Which produces nothing! When leaving "archivesFormat" to the default value I get the zip's but with the unset executable bit.

Comment 9 Eric Jain CLA 2009-08-20 13:29:26 EDT
"archivesFormat = linux, gtk, x86 - zip" produces a zip file with the correct permissions when I do a headless build on Linux (Eclipse 20090619-0625). There's another issue though with using "tar" (see bug 287127)...
Comment 10 Hannes Niederhausen CLA 2009-09-29 11:48:52 EDT
Can anyone of the PDE people give a hint where to look to fix this bug?
Comment 11 Andrew Niefer CLA 2009-09-29 15:57:13 EDT
(In reply to comment #10)
> Can anyone of the PDE people give a hint where to look to fix this bug?

See comment #6, you need to use the native "zip" archive format instead of the default "antZip".  Or build to a folder and zip it yourself.
Comment 12 Christian CLA 2009-09-29 16:02:04 EDT
Does someone else have the same problem with exporting to folder and then zipping: .icns file for Mac launcher not being accepted?
Comment 13 Laurent Marchal CLA 2009-09-30 04:29:27 EDT
Comment #6 is a workaround for the headless build, but there is still no solution when exporting from eclipse with the export wizard. The binary in the zip file on linux and Mac OSX is not executable.

Lots of users should have this problem it's quite critical, is there a fix worked on for this bug ?
Comment 14 Kay Kasemir CLA 2010-05-06 18:21:48 EDT
(In reply to comment #8), I see the same under OS X:
Default settings generate a ZIP without executable bit.

archivesFormat=macosx,carbon,x86-zip  results in no ZIP at all

archivesFormat=macosx,carbon,x86-tar creates a file ending in 'zip' that seems to be a valid yet empty 'tgz'.
Comment 15 Andrew Niefer CLA 2010-05-11 16:56:34 EDT
Created attachment 168036 [details]
patch
Comment 16 Andrew Niefer CLA 2010-05-11 16:59:01 EDT
In general, PDE/Build does not know what permissions p2 is going to set on what files.  We can only preserve those permissions that we know about.  This is the permissions set by the root.permissions properties in feature build.properties files.  This does include the launchers that come from the org.eclipse.equinox.executable feature.
Comment 17 Andrew Niefer CLA 2010-05-11 17:58:02 EDT
patch released.

The difference between "p2.gathering=true" and not, is that when we aren't doing p2, we know exactly what files are going to end up in the final archive, and which ones are supposed to have special permissions.

When creating an archive using antZip (which is the default), we must explicitly list files with special permission because ant can't preserve whatever is on disk (because Java code can't see these permissions).  This was fine when not doing p2 since we knew everything.

When doing p2, we no longer know exactly what files are involved in the install, so we were just zipping up everything without listing out anything explicitly.  This loses the permissions.  The fix here is to list out the files that we know about through the normal feature root properties.  This does not cover any files inside bundles that may have had permissions set using the p2 chmod action.

If you are running on linux or mac, using "zip" or "tar" as the archive format is a workaround because that invokes the native "zip" or "tar" executables.

If you are running on windows, there is no workaround because the OS itself does not have permissions so they are lost from the beginning.  To get executable bits on windows you need this fix and you need "antZip" as the format.
Comment 18 Andrew Niefer CLA 2010-06-18 14:11:49 EDT
*** Bug 289614 has been marked as a duplicate of this bug. ***
Comment 19 Helge Böhme CLA 2010-11-12 15:20:56 EST
In org.eclipse.pde.build_3.6.1.R36x_v20100823.jar this only works for antZip and not for antTar because in the TarFileSet constructor the permission parameter is not passed to the super ZipFileSet.

public TarFileSet(String dir, boolean file, String defaultexcludes, String includes, String includesfile, String excludes, String excludesfile, String prefix, String casesensitive, String permission) {
		super(dir, file, defaultexcludes, includes, includesfile, excludes, excludesfile, prefix, casesensitive, null);
	}

For me it only works on a windows build machine to create a tar.gz linux build with permissions set if I pass the parameter.