owncloud / owncloud/android

[BUG] Copy/Move a folder with content to a different oC account using the document provider doesn't work as expected

Open
#2,658 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Document Provider Type:bug
Dominant language
Kotlin
Stars
4.2k
Forks
3.1k
Avg merge
1d 12h
Merged PRs (30d)
7

Description

Updated: 2020-08-10

Steps to reproduce
  1. Login with two different accounts in the ownCloud app.
  2. Open Files app or other app supporting the document provider.
  3. Select an ownCloud account from the side menu.
  4. Long press a folder with subfolders and files inside and press copy/move to in the three-dots menu.
  5. Select a different ownCloud account as destination to copy/move the files.
Actual behaviour
  • Folder, subfolders and containing files are not totally copied. Sometimes some items are missing, other times the operation is not performed. Behaviour is not stable
Expected behaviour
  • Folder, subfolders and containing files are properly copied.
Environment data

Android version: 11

Device model: Pixel2 Android11, Nexus6P Android 7

ownCloud app version: f911f01

ownCloud Android app log
2021-08-10 16:56:12.162 29439-30091/com.owncloud.android.debug E/DatabaseUtils: Writing exception to parcel
    android.os.ParcelableException: java.io.FileNotFoundException: Remote Operation failed
        at android.provider.DocumentsProvider.call(DocumentsProvider.java:1069)
        at android.content.ContentProvider.call(ContentProvider.java:2448)
        at android.content.ContentProvider$Transport.call(ContentProvider.java:517)
        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:295)
        at android.os.Binder.execTransactInternal(Binder.java:1154)
        at android.os.Binder.execTransact(Binder.java:1123)
     Caused by: java.io.FileNotFoundException: Remote Operation failed
        at com.owncloud.android.providers.DocumentsStorageProvider.checkOperationResult(DocumentsStorageProvider.kt:404)
        at com.owncloud.android.providers.DocumentsStorageProvider.deleteDocument(DocumentsStorageProvider.kt:333)
        at android.provider.DocumentsProvider.callUnchecked(DocumentsProvider.java:1170)
        at android.provider.DocumentsProvider.call(DocumentsProvider.java:1067)
        at android.content.ContentProvider.call(ContentProvider.java:2448) 
        at android.content.ContentProvider$Transport.call(ContentProvider.java:517) 
        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:295) 
        at android.os.Binder.execTransactInternal(Binder.java:1154) 
        at android.os.Binder.execTransact(Binder.java:1123) 
2021-08-10 16:56:12.163 29404-30083/? E/CopyJob: Failed to copy content://org.owncloud.documents/document/6
    com.android.documentsui.services.ResourceException: Failed to delete file content://org.owncloud.documents/document/6 due to an exception.
        at com.android.documentsui.services.Job.deleteDocument(Job.java:290)
        at com.android.documentsui.services.MoveJob.processDocument(MoveJob.java:186)
        at com.android.documentsui.services.CopyJob.processDocumentThenUpdateProgress(CopyJob.java:386)
        at com.android.documentsui.services.CopyJob.start(CopyJob.java:243)
        at com.android.documentsui.services.Job.run(Job.java:162)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: java.io.FileNotFoundException: Remote Operation failed
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
        at android.os.ParcelableException.readFromParcel(ParcelableException.java:56)
        at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:82)
        at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:79)
        at android.os.Parcel.readParcelable(Parcel.java:3281)
        at android.os.Parcel.createExceptionOrNull(Parcel.java:2368)
        at android.os.Parcel.createException(Parcel.java:2357)
        at android.os.Parcel.readException(Parcel.java:2340)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
        at android.content.ContentProviderProxy.call(ContentProviderNative.java:732)
        at android.content.ContentProviderClient.call(ContentProviderClient.java:603)
        at android.content.ContentResolver.call(ContentResolver.java:2395)
        at android.provider.DocumentsContract.deleteDocument(DocumentsContract.java:1460)
        at com.android.documentsui.services.Job.deleteDocument(Job.java:281)
        at com.android.documentsui.services.MoveJob.processDocument(MoveJob.java:186) 
        at com.android.documentsui.services.CopyJob.processDocumentThenUpdateProgress(CopyJob.java:386) 
        at com.android.documentsui.services.CopyJob.start(CopyJob.java:243) 
        at com.android.documentsui.services.Job.run(Job.java:162) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 
2021-08-10 16:56:12.172 29404-29404/? E/FileOperationService: Job failed to process docs: [DocumentInfo{docId=6, userId=0, name=Images, mimeType=vnd.android.document/directory, isContainer=true, isDirectory=true, isArchive=false, isInArchive=false, isPartial=false, isVirtual=false, isDeleteSupported=true, isCreateSupported=true, isMoveSupported=true, isRenameSupported=true, isMetadataSupported=false, isBlockedFromTree=false} @ content://org.owncloud.documents/document/6].

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with DocumentsStorageProvider.kt, especially deleteDocument and checkOperationResult at the locations shown in the log, then reproduce the cross-account copy/move flow through the Android document provider. Trace the Remote Operation failed result and verify that folders, subfolders, and files are all copied or moved without the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.