Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after downloading new Version of Firefox #62

Closed
jelemux opened this issue Jul 25, 2021 · 13 comments
Closed

Error after downloading new Version of Firefox #62

jelemux opened this issue Jul 25, 2021 · 13 comments

Comments

@jelemux
Copy link

jelemux commented Jul 25, 2021

App Version: 74.3.1 from FDroid
OS: LineageOS 18.1

After the download of any of the included browsers finishes (except beta of course which doesn't download at all because of that other bug), I always get the following error:

java.lang.NullPointerException
	at de.marmaro.krt.ffupdater.security.FingerprintValidator.checkApkFile(FingerprintValidator.kt:32)
	at de.marmaro.krt.ffupdater.InstallActivity$State$8$fingerprint$1.invokeSuspend(InstallActivity.kt:279)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
@Tobi823
Copy link
Owner

Tobi823 commented Jul 26, 2021

Looks like that the APK files are not downloaded or damaged.

Do FFUpdater and the (system) "Download Manager" have the "Files and media" permission?

@Tobi823
Copy link
Owner

Tobi823 commented Jul 26, 2021

First, the system "Download Manager" will download the APK file (for installing/updating a browser) to Android/data/de.marmaro.krt.ffupdater/files/Download.

When the "Download Manager" is finished, this APK file will be moved to Android/data/de.marmaro.krt.ffupdater/cache/Download/.

Can you check if these folders are empty/not empty. If they are not empty, check if the APK files are valid:

  • Firefox Release should be 70-72 MB big
  • you can calculate the sha256 checksum with sha256sum (Linux/Mac) or rightclick > CRC SHA > SHA-256 (Windows + 7zip installed)

You can access these folders if you connect your smartphone to your computer and use the Windows/Linux/... file manager.

@Markus00000
Copy link

Similar issue here with a different exception:

java.lang.IllegalArgumentException: file must exists
        at de.marmaro.krt.ffupdater.security.FingerprintValidator.checkApkFile(FingerprintValidator.kt:32)
        at de.marmaro.krt.ffupdater.InstallActivity$State$8$fingerprint$1.invokeSuspend(InstallActivity.kt:279)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
  • FFUpdater version: 74.3.5
  • OS: LineageOS 18.1 (Android 11)

FFUpdater did not have the “files and media” permission as it never made a request. After adding the permission manually, I get the same exception.

Checking the permissions of Download Manager requires going to “Settings -> Apps & notifications -> See all apps -> Show system (found in the menu)”. Download Manager has no permissions and never requested any.

/sdcard/Android/data/de.marmaro.krt.ffupdater/cache is empty.

/sdcard/Android/data/de.marmaro.krt.ffupdater/files/Download contains FIREFOX_RELEASE__2021_08_18__<hash>.

Regardless of the “files and media” permission, the Download directory will contain FIREFOX_RELEASE__2021_08_18__<hash> after the exception occurred.

Download URL: https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/mobile.v2.fenix.release.latest.arm64-v8a/artifacts/public/build/arm64-v8a/t arget.apk

The file downloaded by FFUpdater has the same checksum as when I download the file on my computer.

@Tobi823
Copy link
Owner

Tobi823 commented Aug 18, 2021

@Markus00000 can you try this version? (I have to compress it as an .zip-archiv because GitHub only allows certain file types) You have to uninstall the version by F-Droid because the APK file is signed by me and not F-Droid (see https://github.com/Tobi823/ffupdater#temporary-builds)
ffupdater-release.zip

FFUpdater did not have the “files and media” permission as it never made a request. After adding the permission manually, I get the same exception.

FYI: this is intended. Apps can always write to "/sdcard/Android/data/their-name/" without asking for file permissions.
I (as a app developer) don't want these files permissions because theoretically these permissions could be misused by a potential security flaw. (Principle of least privilege)

@Tobi823
Copy link
Owner

Tobi823 commented Aug 18, 2021

My suspicion: This could be a timing issue. Maybe the APK file is not completely downloaded and my code performs the (newly added) sanity check if the file exists.

@Markus00000
Copy link

Thanks for your work so far! Here is the new stack trace:

java.lang.IllegalArgumentException: getPackageArchiveInfo() must successful parse file
        at de.marmaro.krt.ffupdater.security.FingerprintValidator.checkApkFile(FingerprintValidator.kt:35)
        at de.marmaro.krt.ffupdater.InstallActivity$State$8$fingerprint$1.invokeSuspend(InstallActivity.kt:279)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

@Tobi823
Copy link
Owner

Tobi823 commented Aug 30, 2021

I think your are not the only one who has problems with the DownloadManager https://notabug.org/Tobiwan/ffupdater/issues/79

I'm going to use the DownloadManager differently now, so I don't have to rely on exactly how the file is saved.

@Tobi823
Copy link
Owner

Tobi823 commented Aug 30, 2021

@Markus00000 I think (and hope 🙈 ) that my fix is working for you - can you try it?

@Tobi823
Copy link
Owner

Tobi823 commented Aug 30, 2021

ffupdater-release.zip

@Markus00000
Copy link

Another exception:

java.io.FileNotFoundException: /storage/emulated/0/Android/data/de.marmaro.krt.ffupdater/cache/Download/org.mozilla.firefox.apk: open failed: ENOENT (No such file or directory)
        at libcore.io.IoBridge.open(IoBridge.java:492)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
        at de.marmaro.krt.ffupdater.download.ApkCache.copyToCache(ApkCache.kt:28)
        at de.marmaro.krt.ffupdater.InstallActivity$State$8$fingerprint$1.invokeSuspend(InstallActivity.kt:268)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
        at libcore.io.Linux.open(Native Method)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
        at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
        at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7550)
        at libcore.io.IoBridge.open(IoBridge.java:478)
        ... 10 more

@Tobi823
Copy link
Owner

Tobi823 commented Aug 31, 2021

Found the error and fixed it.

Can you try it again?
ffupdater-release.zip

@Markus00000
Copy link

This latest build seems to work. I was able to download and re-install the current version of Firefox.

Thank you!

@Tobi823
Copy link
Owner

Tobi823 commented Sep 3, 2021

Should be fixed in version 74.4.0. This version should be available on F-Droid in the next days. My self-signed version is available on https://github.com/Tobi823/ffupdater#temporary-builds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants