https://bugzilla.wikimedia.org/show_bug.cgi?id=24230

--- Comment #3 from Marcin CieĊ›lak <marcin.cies...@gmail.com> 2011-02-07 
00:28:52 UTC ---
To be sucessfully execute, JAR file needs to have a "Main-Class" entry in the
META-INF/MANIFEST.MF file:

Here is a test using the abovementioned class using Jython
(http://www.jython.org/):

$ jython                                          
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54) 
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_03-p4
Type "help", "copyright", "credits" or "license" for more information.
>>> import java
>>> y = java.util.jar.JarFile("/usr/local/share/java/apache-ant/lib/ant.jar") 
>>> print y.manifest.mainAttributes.getValue("Main-Class")
org.apache.tools.ant.Main
>>> y = java.util.jar.JarFile("/usr/local/share/java/classes/log4j.jar")     
>>> print y.manifest.mainAttributes.getValue("Main-Class")              
None

So "ant.jar" is "executable" with while log4j.jar is not. 

Maybe checking for "Main-Class:" string is better, since zip_open() does not
really detect embedded JAR as a ZIP file (checked with
http://quarkmitsauce.files.wordpress.com/2008/08/gifar.gif). 

This gif file has no zip entries according to PHP zip_entry_name, but Java
still detects the manifest:

$ java -jar gifar.gif 
Exception in thread "main" java.lang.NoClassDefFoundError: gifar/Main

We need a reasonable middle ground between a crude check of sequence of bytes
and canonical unpacking of the ZIP file.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to