IvanVolosyuk / diskusage

Automatically exported from code.google.com/p/diskusage
GNU General Public License v2.0
357 stars 63 forks source link

Error running binary #37

Closed ByteHamster closed 8 years ago

ByteHamster commented 8 years ago

The scan binary on the internal storage can not be executed on my device because the execute permission is missing. Every time I start the app, the permission is removed. If I start the app and then change the permission using a file manager, the app works fine.

IvanVolosyuk commented 8 years ago

That's strange. Something is removing the permission. May be I should have a check somehow that the file is executable, but that's is not exposed in Java API.

On Sat, Jul 30, 2016, 10:28 PM ByteHamster notifications@github.com wrote:

The scan binary on the internal storage can not be executed on my device because the execute permission is missing. Every time I start the app, the permission is removed. If I start the app and then change the permission using a file manager, the app works fine.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/IvanVolosyuk/diskusage/issues/37, or mute the thread https://github.com/notifications/unsubscribe-auth/AG8PHZdIwWCPBAiNVyQM2x8It7AqLSjzks5qa0NsgaJpZM4JYy_U .

ByteHamster commented 8 years ago

If I can help you in any way by providing logs or testing new versions, don't hesitate to ask. Are apps allowed to run chmod on their own files using a shell?

IvanVolosyuk commented 8 years ago

This is what I do: https://github.com/IvanVolosyuk/diskusage/blob/master/src/com/google/android/diskusage/datasource/fast/NativeScannerStream.java#L120

On Mon, Aug 1, 2016 at 7:47 PM ByteHamster notifications@github.com wrote:

If I can help you in any way by providing logs or testing new versions, don't hesitate to ask. Are apps allowed to run chmod on their own files using a shell?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/IvanVolosyuk/diskusage/issues/37#issuecomment-236536888, or mute the thread https://github.com/notifications/unsubscribe-auth/AG8PHRyK__1uekwiUmYp_rWmXhKkQT7jks5qbcCrgaJpZM4JYy_U .

ByteHamster commented 8 years ago

https://github.com/IvanVolosyuk/diskusage/blob/59c5ccf0966bb62cb4e8cd95453bc58540f9452e/src/com/google/android/diskusage/datasource/fast/NativeScannerStream.java#L103

Looks like this is removing the permission. That would exactly match that fact that I need to start the scan once before it helps to set the permission manually.

ByteHamster commented 8 years ago

There is a method called file.setExecutable(). Maybe this helps to set the permission. I don't exactly know if the method is available on Android, but the Oracle Java has it ;)

ByteHamster commented 8 years ago

Just tried to compile the app and add setExecutable() - I am not able to compile. The import android.content.pm.IPackageStatsObserver is not found. Additionally, I don't have the ndk set up. Actually, I have to study for an assignment, so fixing the build for me looks like too much work. It would be nice if you could add the method and send me the apk to try out.

IvanVolosyuk commented 8 years ago

https://drive.google.com/open?id=0B8b6GsDnUyViR2pQc0RMSnNMWFk

ByteHamster commented 8 years ago

Okay, that's what happens:

The scan works (yay!) but only the first time you use it. If you go back and select another folder to scan, there is the same exception as before you implemented setExecutable. The strange thing is, even though executing works, the execute permission is NOT set on the binary file in /data. I don't really know why the setExecutable method even works then. But it does (at least once), which is great. Thank you very much! If that does not break anything, it would be great if you could run setExecutable every time a scan is started to make it possible to go back and select another folder. Anyway, I am really happy that I can now use the app, as I have not found an alternative that does its job as convenient as DiskUsage. Thanks again for this great app and for your willingness to help me!

ByteHamster commented 8 years ago

By the way, do you know why the most recent version on F-Droid is 3.4.2 from 2013? I thought they build it automatically, directly from GitHub, as soon as you change the versionCode.

ildar commented 8 years ago

Wrong. They check git tags.