JesusFreke / smali

smali/baksmali
6.35k stars 1.07k forks source link

baksmali fails on symlinks #198

Open JesusFreke opened 9 years ago

JesusFreke commented 9 years ago

Original issue 154 created by JesusFreke on 2012-11-17T16:13:57.000Z:

What seems to be the problem? Under modern Windows NT, a symbolic link causes baksmali to stop processing, because a system provided file enumeration routine provides size equal to zero for symbolic links. This probably occurs in your file.exists() or file.canRead()

Symbolic links are generated by a custom tool which replaces duplicate files. Baksmali reports an error: { Error occured while loading boot class path files. Aborting. org.jf.dexlib.Util.ExceptionWithContext: [...]/framework/android.policy.jar: file too short at org.jf.dexlib.Util.ExceptionWithContext.withContext(ExceptionWithContext.java:46) at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.java:220) } Note that android.policy.jar is a symbolic link to the same, 313 bytes long file, located in another backup directory.

After replacing the symlink with the real file, baksmali runs without errors.

What is the exact smali/baksmali command that you ran? java -jar /android/bin/baksmali.jar -x "file.odex" -d "android/backup/system2.1/framework" -o file.odex-smali

What version of smali/baksmali are you using? 1.2.2

JesusFreke commented 9 years ago

Comment #1 originally posted by JesusFreke on 2012-11-17T19:43:40.000Z:

Solution: don't use symbolic links :D

Joking aside, thanks for the report. I'll try and get this fixed at some point.

If you happen to have the inclination to fix this yourself, a patch would be muchly appreciated, especially since I don't have any windows system readily available to reproduce the issue or test a fix on.

AngelaRivo commented 5 years ago

Try to use long path tool. It will help you to shorten the file name and fix the error.