seedvault-app/seedvault

Restore of files that have been deleted may fail

Closed this issue · 3 comments

t-m-w commented

When testing restoration with #721, I encountered the following issue with a couple of files I had changed/deleted:

E ZipChunkRestore: Failed to restore zip entry for Pictures/Screenshots/Screenshot.png
E ZipChunkRestore: java.lang.IllegalStateException: Only owner is able to interact with pending/trashed item content://media/external/images/media/27
E ZipChunkRestore:         at android.os.Parcel.createExceptionOrNull(Parcel.java:3191)
E ZipChunkRestore:         at android.os.Parcel.createException(Parcel.java:3167)
E ZipChunkRestore:         at android.os.Parcel.readException(Parcel.java:3150)
E ZipChunkRestore:         at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:202)
E ZipChunkRestore:         at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:165)
E ZipChunkRestore:         at android.content.ContentProviderProxy.openAssetFile(ContentProviderNative.java:737)
E ZipChunkRestore:         at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1876)
E ZipChunkRestore:         at android.content.ContentResolver.openOutputStream(ContentResolver.java:1574)
E ZipChunkRestore:         at org.calyxos.backup.storage.UriUtilsKt.openOutputStream(UriUtils.kt:44)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.FileRestore.restoreFile(FileRestore.kt:134)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.FileRestore.restoreFile(FileRestore.kt:45)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.AbstractChunkRestore.restoreFile(AbstractChunkRestore.kt:49)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.ZipChunkRestore.restoreZipEntry(ZipChunkRestore.kt:87)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.ZipChunkRestore.restoreZipChunk(ZipChunkRestore.kt:64)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.ZipChunkRestore.access$restoreZipChunk(ZipChunkRestore.kt:20)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.ZipChunkRestore$restore$2$1.invokeSuspend(ZipChunkRestore.kt:40)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.ZipChunkRestore$restore$2$1.invoke(Unknown Source:8)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.ZipChunkRestore$restore$2$1.invoke(Unknown Source:4)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.AbstractChunkRestore.getAndDecryptChunk(AbstractChunkRestore.kt:37)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.ZipChunkRestore.restore(ZipChunkRestore.kt:39)
E ZipChunkRestore:         at org.calyxos.backup.storage.restore.Restore.restoreBackupSnapshot(Restore.kt:118)
E ZipChunkRestore:         at org.calyxos.backup.storage.api.StorageBackup$restoreBackupSnapshot$2.invokeSuspend(StorageBackup.kt:211)
E ZipChunkRestore:         at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E ZipChunkRestore:         at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
E ZipChunkRestore:         at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
E ZipChunkRestore:         at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
E ZipChunkRestore:         at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
E ZipChunkRestore:         at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
E ZipChunkRestore:         at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
E ZipChunkRestore:         at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
grote commented

This may actually be caused by a fix in #721 where we now restore the owner package name which we missed doing before.

We set the owner and the item we restore to pending. Then we don't own it and are not allowed to write into it. It may be possible to not set the owner initially and when setting the item to not pending also update the owner.

grote commented

@t-m-w should be fixed in #721 now. Please test.