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

Auto upload fails due to permission problem on some devices #434

Open
2 tasks done
SailReal opened this issue Apr 12, 2022 · 2 comments
Open
2 tasks done

Auto upload fails due to permission problem on some devices #434

SailReal opened this issue Apr 12, 2022 · 2 comments
Labels
type:bug Something isn't working
Milestone

Comments

@SailReal
Copy link
Member

SailReal commented Apr 12, 2022

Please agree to the following

Summary

Auto upload fails due to permission problem while reading the file during upload

System Setup

- Android: 12 (GrapheneOS) on Pixel 4a
- Cryptomator: 1.7.1 (F-Droid)

Cloud Type

No response

Steps to Reproduce

  1. Enable auto upload
  2. Create some pictures
  3. Unlock vault or have the vault in an unlocked state

Expected Behavior

Pictures gets uploaded

Actual Behavior

Upload fails due to permission exception while accessing the picture.

Reproducibility

Always

Relevant Log Output

AutoUploadNotification	Show storage permission required notification
AutoUploadService	Failed to auto upload image(s).
org.cryptomator.domain.exception.FatalBackendException: java.io.FileNotFoundException: /storage/emulated/0/Pictures/Icons/Tutanota_Icon.png: open failed: EACCES (Permission denied)
	at org.cryptomator.data.cloud.crypto.CryptoImplDecorator.writeShortNameFile(CryptoImplDecorator.kt:451)
	at org.cryptomator.data.cloud.crypto.CryptoImplVaultFormat7.write(CryptoImplVaultFormat7.kt:437)
	at org.cryptomator.data.cloud.crypto.CryptoCloudContentRepository.write(CryptoCloudContentRepository.kt:90)
	at org.cryptomator.data.cloud.crypto.CryptoCloudContentRepository.write(CryptoCloudContentRepository.kt:21)
	at org.cryptomator.data.repository.DispatchingCloudContentRepository.write(DispatchingCloudContentRepository.kt:149)
	at org.cryptomator.presentation.service.AutoUploadService.writeCloudFile(AutoUploadService.java:219)
	at org.cryptomator.presentation.service.AutoUploadService.upload(AutoUploadService.java:206)
	at org.cryptomator.presentation.service.AutoUploadService.upload(AutoUploadService.java:199)
	at org.cryptomator.presentation.service.AutoUploadService.upload(AutoUploadService.java:175)
	at org.cryptomator.presentation.service.AutoUploadService.lambda$startBackgroundImageUpload$1$org-cryptomator-presentation-service-AutoUploadService(AutoUploadService.java:109)
	at org.cryptomator.presentation.service.AutoUploadService$$ExternalSyntheticLambda1.run(Unknown Source:6)
	at java.lang.Thread.run(Thread.java:920)
Caused by: java.io.FileNotFoundException: /storage/emulated/0/Pictures/Icons/Tutanota_Icon.png: open failed: EACCES (Permission denied)
	at libcore.io.IoBridge.open(IoBridge.java:575)
	at java.io.FileInputStream.<init>(FileInputStream.java:160)
	at java.io.FileInputStream.<init>(FileInputStream.java:115)
	at android.content.ContentResolver.openInputStream(ContentResolver.java:1527)
	at org.cryptomator.presentation.util.ContentResolverUtil.openInputStream(ContentResolverUtil.kt:20)
	at org.cryptomator.presentation.presenter.UriBasedDataSource.open(UriBasedDataSource.kt:18)
	at org.cryptomator.domain.usecases.cloud.CancelAwareDataSource.open(CancelAwareDataSource.kt:22)
	at org.cryptomator.data.cloud.crypto.CryptoImplDecorator.writeShortNameFile(CryptoImplDecorator.kt:423)
	... 11 more
Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
	at libcore.io.Linux.open(Native Method)
	at libcore.io.ForwardingOs.open(ForwardingOs.java:567)
	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:273)
	at libcore.io.ForwardingOs.open(ForwardingOs.java:567)
	at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7756)
	at libcore.io.IoBridge.open(IoBridge.java:561)
	... 18 more

ErrorCode: KNRD:M7LU

Anything else?

I can not reproduce this on a Pixel 6 and Pixel 4 using GrapheneOS too.

According to https://developer.android.com/training/data-storage/shared/media when accessing the MediaStore and with Scoped storage enabled,

See

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

and

builder.addTriggerContentUri(JobInfo.TriggerContentUri(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, FLAG_NOTIFY_FOR_DESCENDANTS))
builder.addTriggerContentUri(JobInfo.TriggerContentUri(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, FLAG_NOTIFY_FOR_DESCENDANTS))
builder.addTriggerContentUri(JobInfo.TriggerContentUri(MediaStore.Images.Media.INTERNAL_CONTENT_URI, FLAG_NOTIFY_FOR_DESCENDANTS))
builder.addTriggerContentUri(JobInfo.TriggerContentUri(MediaStore.Video.Media.INTERNAL_CONTENT_URI, FLAG_NOTIFY_FOR_DESCENDANTS))
builder.addTriggerContentUri(JobInfo.TriggerContentUri(MEDIA_URI, FLAG_NOTIFY_FOR_DESCENDANTS))

So I have currently no idea what the problem is here 🤔

@SailReal SailReal added the type:bug Something isn't working label Apr 12, 2022
@SailReal SailReal added this to the Backlog milestone Apr 12, 2022
@kokolem
Copy link

kokolem commented Apr 16, 2022

I can not reproduce on Pixel 4a with CalyxOS (Android 12). Perhaps this is a Graphene specific issue?

@NeverUsedID
Copy link

NeverUsedID commented Sep 5, 2023

I can reproduce it on a pixel 7a with the Whatsapp Media folder. Deleting the folder does not help, as whatsapp recreates it after restart. Fast workaround would be to respect .nomedia file.

Logfile ist here: #177 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants