[Soot-list] How to set -process-dir and -cp correctly in this case? I got the error: class small.DataClass read in from a classfile in which DataClass was expected.

Marc-André Laverdière marc-andre.laverdiere-papineau at polymtl.ca
Tue Nov 26 15:49:34 EST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I am able to confirm that there is a bug.

I made a very simple transformer that checks one specific exclusion.
All methods have a body. I checked with SootMethod.hasActiveBody.

I am attaching the results for those inclined.

Regards,

Marc-André Laverdière-Papineau
Doctorant - PhD Candidate

On 11/23/2013 04:02 AM, Bodden, Eric wrote:
> Hi all.
> 
> The problem is that you are using -w mode. Usually this means to
> Soot "load everything you need and can find". But when you use
> -no-bodies-for-excluded then this should prevent excluded classes'
> method bodies from being loaded. If that's not the case then this
> is a bug.
> 
> Eric
> 
> On 23.11.2013, at 02:04, Guru Devanla <gdevan2 at uic.edu> wrote:
> 
>> Ok, I was wrong with my previous analysis.
>> 
>> I did test the behavior with the latest version of soot. I see
>> the excluded classes not being transformed. Note, in -verbose
>> mode you will see log files to check. You can see them being
>> resolved but not processed/transformed.
>> 
>> Sorry, I am not able to help further. Let me know if you need
>> more information.
>> 
>> 
>> On Fri, Nov 22, 2013 at 3:33 PM, Khanh Nguyen <khanhtn1 at uci.edu>
>> wrote: Sorry for my ignorance but where exactly the -x option is
>> processed. I mean if -x option is processed before you running
>> any pack then the excluded classes should not be in the list of
>> application class. That's what -x does, right?
>> 
>> Also, PackManager.runPacksForOneClassAtATime() only called if
>> Options.v().oaat() is true. Not sure what oaat() is but probably
>> in runPacks(), PackManager should take the else branch where it
>> will take the whole program packs and run them
>> 
>> Thank you,
>> 
>> Khanh Nguyen
>> 
>> 
>> On Fri, Nov 22, 2013 at 3:12 PM, Guru Devanla <gdevan2 at uic.edu>
>> wrote: Hi Khanh,
>> 
>> I looked at the current version of Soot. I think the problem is
>> in
>> 
>> PackManager.runPacksForOneClassAtATime().  This methods loops
>> through all files it files under -process-dir and does not
>> check/respect  attributes set with -x option.
>> 
>> The looping structure in that method can have a conditional check
>> to see if the class being processed is part of the excluded
>> package.
>> 
>> Eric et all: So, is it okay to exclude classes at this method
>> level. Does anyone see any incompatibility issues with excluded
>> class under process-dir not being part of application class
>> list?
>> 
>> Thanks Guru
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> On Fri, Nov 22, 2013 at 1:20 PM, Khanh Nguyen <khanhtn1 at uci.edu>
>> wrote: Even with -no-bodies-for-excluded I still see my
>> transformation touches the excluded packages My command is this:
>> -w -pp -keep-line-number -f J -p jb use-original-names:false
>> -process-dir C:\test\bin -exclude small -no-bodies-for-excluded
>> -cp C:\test\bin Anything that is unusual?
>> 
>> Thank you,
>> 
>> Khanh Nguyen
>> 
>> 
>> On Fri, Nov 22, 2013 at 12:12 PM, Guru Devanla <gdevan2 at uic.edu>
>> wrote: I think you also need to use -no-bodies-for-excluded.  I
>> have seen excluded packages being touched for different analysis
>> when I just use the -x option.
>> 
>> Hope that helps.
>> 
>> -Guru
>> 
>> 
>> On Fri, Nov 22, 2013 at 10:38 AM, Khanh Nguyen <khanhtn1 at uci.edu>
>> wrote: Hi Eric,
>> 
>> Unfortunately, that doesnt work for me. I set the "-x small" then
>> use Scene.v().getApplicationClasses() to get the application
>> classes to check. And there are classes from package "small"
>> being analyzed. I'm using the released soot 2.5. My analysis is
>> in pack "wjtp" if that info helps.
>> 
>> 
>> 
>> Thank you,
>> 
>> Khanh Nguyen
>> 
>> 
>> On Fri, Nov 22, 2013 at 12:20 AM, Bodden, Eric
>> <eric.bodden at sit.fraunhofer.de> wrote: Hi Khanh.
>> 
>> When you set Soot's classpath or process dir then the path must
>> always point to the root of the package hierarchy, not to some
>> particular package folder, i.e., in your setting it must point to
>> C:\test\bin\ You can then the include/exclude options to
>> include/exclude certain packages from analysis. See here: 
>> http://www.sable.mcgill.ca/soot/tutorial/usage/index.html
>> 
>> Does that work for you?
>> 
>> 
>> Cheers, Eric
>> 
>> 
>> 
>> On 18.11.2013, at 08:47, Khanh Nguyen <khanhtn1 at uci.edu> wrote:
>> 
>>> Hello,
>>> 
>>> I know that this question has been in the list since a long
>>> time ago, I read all those posts and got what I wanted to do
>>> but still, I want it work in another way (if possible) The
>>> background is this: In C:\test\bin I have 2 folders, "simple"
>>> and "small" (equivalent to 2 different packages) in "small", I
>>> have one class: DataClass.class, in "simple", I also have one
>>> class called DataClass.class
>>> 
>>> I want to apply my analysis only on folder "small". Thus I used
>>> the command line :-process-dir C:\test\bin\small -cp
>>> C:\test\bin\small. I understand that by setting -process-dir
>>> C:\test\bin\small, the class Soot will find to load is
>>> DataClass.class (i.e. no info about the package 'small') which
>>> is okay, that's why I thought the -cp must be set as
>>> C:\test\bin\small. So now the file structure is identical. But
>>> I got the error instead("class small.DataClass read in from a
>>> classfile in which DataClass was expected.") Is it because even
>>> when setting -cp: C:\test\bin\small the class loaded is still
>>> be considered as small.DataClass? (because the actual class is
>>> read and thus, the name is small.DataClass?)
>>> 
>>> 
>>> Of course I can make my analysis to work only on "small" by
>>> deleting the "simple" and set both -process-dir and -cp to
>>> C:\test\bin (so that -process-dir sets the target class is
>>> actually small.DataClass and -cp will let me see
>>> small\DataClass.class) But, even with only "small" under
>>> C:\test\bin, I cant do -process-dir C:\test\bin -cp
>>> C:\test\bin\small, either (Soot will complain there is no
>>> small.DataClass on classpath- why? now -cp only see
>>> DataClass.class?)
>>> 
>>> But, bottom line is, isnt there anyway to just set the target
>>> of the analysis restricted to only 1 package like what I
>>> wanted?
>>> 
>>> Thank you,
>>> 
>>> Khanh Nguyen UC Irvine 
>>> _______________________________________________ Soot-list
>>> mailing list Soot-list at sable.mcgill.ca 
>>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> 
>> -- Prof. Eric Bodden, Ph.D., http://sse.ec-spride.de/
>> http://bodden.de/ Head of Secure Software Engineering  at
>> Fraunhofer SIT, TU Darmstadt and EC SPRIDE Tel: +49 6151 16-75422
>> Fax: +49 6151 16-72051 Room 3.2.14, Mornewegstr. 30, 64293
>> Darmstadt
>> 
>> 
>> 
>> _______________________________________________ Soot-list mailing
>> list Soot-list at sable.mcgill.ca 
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________ Soot-list mailing
>> list Soot-list at sable.mcgill.ca 
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> 
> -- Prof. Eric Bodden, Ph.D., http://sse.ec-spride.de/
> http://bodden.de/ Head of Secure Software Engineering  at
> Fraunhofer SIT, TU Darmstadt and EC SPRIDE Tel: +49 6151 16-75422
> Fax: +49 6151 16-72051 Room 3.2.14, Mornewegstr. 30, 64293
> Darmstadt
> 
> 
> 
> _______________________________________________ Soot-list mailing
> list Soot-list at sable.mcgill.ca 
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSlQldAAoJEGELVLHCizSf8KAIAJL2LSC7nVwUogotTgZtF1N9
2ISxT64aZpyf3AQe7qmGLpHHLZG+uyltbOwfQQnJ4AQy0dutffeMhmC/i3Zj9vbZ
6jwooUK+0kH8BVViceMABlpOXFYKabpELQQ3HwLb9mgNMJI8NnzIydlZiQQxCR+s
Pg03TEw1xK3K4mHK4jz7CMbQXwyH8et72YEcQaqCNA/lnWUO6OD5tgk2t7brp0HI
qa9tNlJ5WBoD/EEZgfGpqQmtuzA/gfVp7Hh20SDRgcJ2kihkk+ARmglel/evjvaQ
4QJrZiebVbIv1T33Y1W29VpzdeXg1xv8gFEJ+fhCxaCwvkOFyhY4vYLpWwuYBOM=
=Ecih
-----END PGP SIGNATURE-----
-------------- next part --------------
Soot exclusions: [java., sun., javax., com.sun., com.ibm., org.xml., org.w3c., apple.awt., com.apple., org.hibernate, org.postgresql, com.mysql, oracle, org.slf4j, org.apache.commons.logging, ch.qos.logback, org.apache.log4j, org.eclipse.jdt.internal.compiler, org.apache.tomcat.dbcp, org.apache.catalina, org.apache.coyote, org.objectweb.asm, net.sf.cglib, org.hibernate, java.lang.management, bsh, net.sf.saxon, ij., org.apache.fop, org.apache.xmlgraphics, org.apache.commons.io, java.lang.annotation, java.lang.instrument, java.lang.invoke, java.lang.management, java.lang.reflect, java.util.ResourceBundle, java.util.Calendar, java.util.Currency, java.util.Currency, java.util.Formatter, java.util.FormattableFlags, java.util.GregorianCalendar, java.util.ListResourceBundle, java.util.Locale, java.util.PropertyResourceBundle, java.util.Random, java.util.ServiceLoader, java.util.SimpleTimeZone, java.util.Timer, java.util.TimerTask, java.util.TimeZone, java.util.concurrent.locks, java.util.jar, java.util.logging, java.util.spi, java.util.zip] 
GregorianCalendar method: void <init>() body: true 
GregorianCalendar method: void <init>(java.util.TimeZone) body: true 
GregorianCalendar method: void <init>(java.util.Locale) body: true 
GregorianCalendar method: void <init>(java.util.TimeZone,java.util.Locale) body: true 
GregorianCalendar method: void <init>(int,int,int) body: true 
GregorianCalendar method: void <init>(int,int,int,int,int) body: true 
GregorianCalendar method: void <init>(int,int,int,int,int,int) body: true 
GregorianCalendar method: void <init>(int,int,int,int,int,int,int) body: true 
GregorianCalendar method: void setGregorianChange(java.util.Date) body: true 
GregorianCalendar method: void setGregorianChange(long) body: true 
GregorianCalendar method: java.util.Date getGregorianChange() body: true 
GregorianCalendar method: boolean isLeapYear(int) body: true 
GregorianCalendar method: boolean equals(java.lang.Object) body: true 
GregorianCalendar method: int hashCode() body: true 
GregorianCalendar method: void add(int,int) body: true 
GregorianCalendar method: void roll(int,boolean) body: true 
GregorianCalendar method: void roll(int,int) body: true 
GregorianCalendar method: int getMinimum(int) body: true 
GregorianCalendar method: int getMaximum(int) body: true 
GregorianCalendar method: int getGreatestMinimum(int) body: true 
GregorianCalendar method: int getLeastMaximum(int) body: true 
GregorianCalendar method: int getActualMinimum(int) body: true 
GregorianCalendar method: int getActualMaximum(int) body: true 
GregorianCalendar method: long getYearOffsetInMillis() body: true 
GregorianCalendar method: java.lang.Object clone() body: true 
GregorianCalendar method: java.util.TimeZone getTimeZone() body: true 
GregorianCalendar method: void setTimeZone(java.util.TimeZone) body: true 
GregorianCalendar method: boolean isWeekDateSupported() body: true 
GregorianCalendar method: int getWeekYear() body: true 
GregorianCalendar method: void setWeekDate(int,int,int) body: true 
GregorianCalendar method: int getWeeksInWeekYear() body: true 
GregorianCalendar method: void computeFields() body: true 
GregorianCalendar method: int computeFields(int,int) body: true 
GregorianCalendar method: int getWeekNumber(long,long) body: true 
GregorianCalendar method: void computeTime() body: true 
GregorianCalendar method: long getFixedDate(sun.util.calendar.BaseCalendar,int,int) body: true 
GregorianCalendar method: java.util.GregorianCalendar getNormalizedCalendar() body: true 
GregorianCalendar method: sun.util.calendar.BaseCalendar getJulianCalendarSystem() body: true 
GregorianCalendar method: sun.util.calendar.BaseCalendar getCutoverCalendarSystem() body: true 
GregorianCalendar method: boolean isCutoverYear(int) body: true 
GregorianCalendar method: long getFixedDateJan1(sun.util.calendar.BaseCalendar$Date,long) body: true 
GregorianCalendar method: long getFixedDateMonth1(sun.util.calendar.BaseCalendar$Date,long) body: true 
GregorianCalendar method: sun.util.calendar.BaseCalendar$Date getCalendarDate(long) body: true 
GregorianCalendar method: sun.util.calendar.BaseCalendar$Date getGregorianCutoverDate() body: true 
GregorianCalendar method: sun.util.calendar.BaseCalendar$Date getLastJulianDate() body: true 
GregorianCalendar method: int monthLength(int,int) body: true 
GregorianCalendar method: int monthLength(int) body: true 
GregorianCalendar method: int actualMonthLength() body: true 
GregorianCalendar method: int yearLength(int) body: true 
GregorianCalendar method: int yearLength() body: true 
GregorianCalendar method: void pinDayOfMonth() body: true 
GregorianCalendar method: long getCurrentFixedDate() body: true 
GregorianCalendar method: int getRolledValue(int,int,int,int) body: true 
GregorianCalendar method: int internalGetEra() body: true 
GregorianCalendar method: void readObject(java.io.ObjectInputStream) body: true 
GregorianCalendar method: void <clinit>() body: true 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exclbug.sig
Type: application/pgp-signature
Size: 287 bytes
Desc: not available
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20131126/d019e714/attachment.bin 


More information about the Soot-list mailing list