bytecode-viewer
bytecode-viewer copied to clipboard
Can't open an apk if the current directory is not in the same filesystem as the home directory
According to strace, dex2jar outputs into a file in the current directory, which is then moved into ~/.Bytecode-Viewer, but the move fails if the current directory is not on the same filesystem. This failure is silently ignored and results in a FileNotFoundException.
Log:
https://the.bytecode.club - Created by @Konloch - Bytecode Viewer 2.9.22, Fat-Jar: true
Start up took 3 seconds
I: Using Apktool 2.3.0 on calvliYOzSFHBpmjErwIgSPSSLBpYZQw.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/tbodt/.Bytecode-Viewer/bcv_temp/ocdLychdqhWT/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
dex2jar /home/tbodt/.Bytecode-Viewer/bcv_temp/calvliYOzSFHBpmjErwIgSPSSLBpYZQw.apk -> ./calvliYOzSFHBpmjErwIgSPSSLBpYZQw-dex2jar.jar
java.io.FileNotFoundException: /home/tbodt/.Bytecode-Viewer/bcv_temp/zBTpKnEbpgWhomIeHFodTVblq.jar (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at the.bytecode.club.bytecodeviewer.util.JarUtils.loadClasses(JarUtils.java:168)
at the.bytecode.club.bytecodeviewer.BytecodeViewer$8.run(BytecodeViewer.java:961)
I had a similar issue. I attached strace and found that there is an issue when the application tries to move the file from local directory ./
(where the application is executed) to /home/<username>/.Bytecode-Viewer/bcv_temp/
.
strace output snippet:
...
9781 rename("xxxxxxxxx-dex2jar.jar", "/home/<username>/.Bytecode-Viewer/bcv_temp/xxxxxxxxx.jar" <unfinished ...>
19696 <... gettid resumed>) = 19696
19781 <... rename resumed>) = -1 EXDEV (Invalid cross-device link)
...
Proposed Solutions: If you want a quick and easy solution, move the main application into a folder within the main OS that supports the functionality (probably support of linking).
Another solution would be to change the code and have the temporary file created in /home/<username>/.Bytecode-Viewer/bcv_temp/
or /tmp/
instead of ./
.
anything on this? still happens in 2022 on every file
anything on this? still happens in 2022 on every file
Hello, could you include your operating system and JRE/JDK version? I will look into this for you
ArchLinux 5.17.4-arch1-1 x86_64, tried with java 8 and 9 using archlinux-java