[BUG] 2.23.0beta2 `exportCollectionPackage`: Failed to create file in '/data/local/tmp': Permission denied
https://ankidroid.org/acra/app/1/bug/359357/report/e0221922-b4d3-4674-886b-57439e6db04e
I don't believe this is new
net.ankiweb.rsdroid.BackendException$BackendCardTypeException: Failed to create file in '/data/local/tmp': Permission denied (os error 13) at path "/data/local/tmp/.tmpiWbHuw"
at net.ankiweb.rsdroid.exceptions.BackendIoException.<init>(BackendIoException.java:23)
at net.ankiweb.rsdroid.BackendException$Companion.fromError(BackendException.kt:197)
at net.ankiweb.rsdroid.BackendKt.unpackResult(Backend.kt:317)
at net.ankiweb.rsdroid.BackendKt.access$unpackResult(Backend.kt:1)
at net.ankiweb.rsdroid.Backend.runMethodRaw$lambda$1(Backend.kt:133)
at net.ankiweb.rsdroid.Backend.withBackend(Backend.kt:145)
at net.ankiweb.rsdroid.Backend.runMethodRaw(Backend.kt:132)
at anki.backend.GeneratedBackend.exportCollectionPackageRaw(GeneratedBackend.kt:2745)
at anki.backend.GeneratedBackend.exportCollectionPackage(GeneratedBackend.kt:2754)
at com.ichi2.anki.BackendExportingKt.exportCollectionPackage(BackendExporting.kt:131)
at com.ichi2.anki.BackendExportingKt.access$exportCollectionPackage(BackendExporting.kt:1)
at com.ichi2.anki.BackendExportingKt$exportCollectionPackage$2$1.invokeSuspend$lambda$0(BackendExporting.kt:59)
at com.ichi2.anki.CollectionManager.withCol$lambda$1(CollectionManager.kt:146)
at com.ichi2.anki.CollectionManager$withQueue$3.invokeSuspend(CollectionManager.java:128)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.java:113)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:823)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)
11-19 10:05:02.264 I/AnkiDroid( 6734): isLegacyStorage(): current dir: /data/local/tmp/external/AnkiDroid
11-19 10:05:02.264 I/AnkiDroid( 6734): scoped external dirs: /data/local/tmp/external
11-19 10:05:02.264 I/AnkiDroid( 6734): scoped internal dir: /data/user/0/com.ichi2.anki/files
11-19 10:05:02.264 I/AnkiDroid( 6734): isLegacyStorage(): current dir: /data/local/tmp/external/AnkiDroid
11-19 10:05:02.264 I/AnkiDroid( 6734): scoped external dirs: /data/local/tmp/external
11-19 10:05:02.264 I/AnkiDroid( 6734): scoped internal dir: /data/user/0/com.ichi2.anki/files
Hello David sir, I would like to work on this issue. I have prior experience in building android specific applications using both Java and Kotlin, so I believe this would be a relatively easy task for me. If you could assign this to me, I would love to give it a try and start working on it! Thank you.
Hi, thanks for the enthusiasm!
You'd be better off looking for a good first issue.
This one is potentially deep within our backend export logic and could be a struggle
https://github.com/ankidroid/Anki-Android/blob/b4a1400391afbd477e5c0efe44b3ce69c110eac3/AnkiDroid/src/main/java/com/ichi2/anki/export/ExportDialogFragment.kt#L313-L319
https://github.com/ankitects/anki/blob/5614d20bedcc4dd268136d389ad796b404a69d2c/rslib/src/backend/import_export.rs#L12-L22
https://github.com/ankitects/anki/blob/5614d20bedcc4dd268136d389ad796b404a69d2c/rslib/src/import_export/package/colpkg/export.rs#L46-L79
The path should have export in the name, so it feels another temp directory is being used.
https://github.com/ankidroid/Anki-Android/blob/b4a1400391afbd477e5c0efe44b3ce69c110eac3/AnkiDroid/src/main/java/com/ichi2/anki/export/ExportDialogFragment.kt#L431-L434
https://github.com/ankidroid/Anki-Android/blob/6c247c68dc69cee819894534d690d43a8456f34c/AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidApp.kt#L469-L470
This is caused by context.getExternalFilesDirs(null) = /data/local/tmp/external 👀
scoped external dirs is unusual:
11-19 10:05:02.264 I/AnkiDroid( 6734): isLegacyStorage(): current dir: /data/local/tmp/external/AnkiDroid
11-19 10:05:02.264 I/AnkiDroid( 6734): scoped external dirs: /data/local/tmp/external
11-19 10:05:02.264 I/AnkiDroid( 6734): scoped internal dir: /data/user/0/com.ichi2.anki/files
https://github.com/ankidroid/Anki-Android/blob/1be4ad397c6b3b3ad787f60b5bb8ae66e0e8d54d/AnkiDroid/src/main/java/com/ichi2/anki/servicelayer/ScopedStorageService.kt#L76-L87
https://github.com/ankidroid/Anki-Android/blob/cde85c7d77e0082c89ce24d5cb3ba80ff8eeade0/AnkiDroid/src/main/java/com/ichi2/anki/CollectionHelper.kt#L243
This looks like abuse from a malware detection platform: hxxps://koodous.com/
https://diaowenrui.github.io/paper/issre24-li.pdf lists:
1 MODEL : OnePlus8Pro
2 BRAND : OnePlus
3 DEVICE : OnePlus8Pro
4 TAGS : release-keys
5 FINGERPRINT : OnePlus/IN2023/OnePlus8Pro:11/QKR1.191246.002/2006701342:user/release-keys
All reports from OnePlus8Pro appear spoofed. Some have CPU_ABI: x86_64.
Crash reports are either this issue, or 'send troubleshooting report', some have a comment of [email protected]