orgzly / orgzly-android

Outliner for taking notes and managing to-do lists
https://www.orgzly.com
GNU General Public License v3.0
2.7k stars 305 forks source link

Local repositories sync is not working(It seems permission denied) #913

Open eniehack opened 2 years ago

eniehack commented 2 years ago

Local repositories sync (not Dropbox, enabled auto-sync) is not working. It seems that access right to files are denied. Also, disabling auto-sync does not change the permission error; checking the permissions(please see pictures below, too) in Orgzly does the same.

Sorry my poor English.

environment

pictures

Screenshot_20220126-022615

Screenshot_20220126-022619

logcat output

E MediaProvider: Permission to access file: /storage/emulated/0/orgmodes/notes.org is denied
W System.err: java.io.FileNotFoundException: /storage/emulated/0/orgmodes/notes.org: open failed: EACCES (Permission denied)
W System.err:   at libcore.io.IoBridge.open(IoBridge.java:575)
W System.err:   at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
W System.err:   at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
W System.err:   at k6.g.b(MiscUtils.java:2)
W System.err:   at e5.d.c(DirectoryRepo.java:5)
W System.err:   at q4.y.K1(DataRepository.kt:4)
W System.err:   at com.orgzly.android.sync.SyncService$a.g(SyncService.kt:17)
W System.err:   at com.orgzly.android.sync.SyncService$c.a(SyncService.kt:46)
W System.err:   at com.orgzly.android.sync.SyncService$c.doInBackground(SyncService.kt:1)
W System.err:   at android.os.AsyncTask$3.call(AsyncTask.java:394)
W System.err:   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W System.err:   at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
W System.err:   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W System.err:   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W System.err:   at java.lang.Thread.run(Thread.java:920)
W System.err: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
W System.err:   at libcore.io.Linux.open(Native Method)
W System.err:   at libcore.io.ForwardingOs.open(ForwardingOs.java:567)
W System.err:   at libcore.io.BlockGuardOs.open(BlockGuardOs.java:273)
W System.err:   at libcore.io.ForwardingOs.open(ForwardingOs.java:567)
W System.err:   at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7725)
W System.err:   at libcore.io.IoBridge.open(IoBridge.java:561)
W System.err:   ... 14 more
johnlepikhin commented 2 years ago

EDIT: resolved by deleting all local notebooks. After that Orgzly automatically re-added them. For some reasons it lost links to files.

Probably related issue after updating to the latest version:

Local repos sync also not working, forced sync throws exception:

01-26 11:48:19.423 14986 15021 W System.err:    at s4.y.g0(DataRepository.kt:13)
01-26 11:48:19.423 14986 15021 W System.err:    at l6.f.a(BookForceLoad.kt:1)
01-26 11:48:19.423 14986 15021 W System.err:    at l6.z0.b(UseCaseRunner.kt:3)
01-26 11:48:19.423 14986 15021 W System.err:    at com.orgzly.android.ui.main.e.A2(SyncFragment.java:1)
01-26 11:48:19.423 14986 15021 W System.err:    at com.orgzly.android.ui.main.e.q2(Unknown Source:0)
01-26 11:48:19.423 14986 15021 W System.err:    at n5.d0.run(Unknown Source:4)
01-26 11:48:19.423 14986 15021 W System.err:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
01-26 11:48:19.423 14986 15021 W System.err:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
01-26 11:48:19.423 14986 15021 W System.err:    at java.lang.Thread.run(Thread.java:920)
01-26 11:48:19.426 14986 15021 W System.err: java.io.IOException: Force-loading failed: No link set
01-26 11:48:19.426 14986 15021 W System.err:    at s4.y.g0(DataRepository.kt:17)
01-26 11:48:19.426 14986 15021 W System.err:    at l6.f.a(BookForceLoad.kt:1)
01-26 11:48:19.426 14986 15021 W System.err:    at l6.z0.b(UseCaseRunner.kt:3)
01-26 11:48:19.427 14986 15021 W System.err:    at com.orgzly.android.ui.main.e.A2(SyncFragment.java:1)
01-26 11:48:19.427 14986 15021 W System.err:    at com.orgzly.android.ui.main.e.q2(Unknown Source:0)
01-26 11:48:19.427 14986 15021 W System.err:    at n5.d0.run(Unknown Source:4)
01-26 11:48:19.427 14986 15021 W System.err:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
01-26 11:48:19.427 14986 15021 W System.err:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
01-26 11:48:19.427 14986 15021 W System.err:    at java.lang.Thread.run(Thread.java:920)

All notebooks from local repositories now looks like:

1

Android 12. I re-added permissions to media storage and tried to re-add local repositories in settings.

licaon-kter commented 2 years ago

Since https://github.com/orgzly/orgzly-android/commit/c010310db30a28615315cedc53bd98310001d4d2 I guess, this is a $hitty "for security" move by Google forcing apps to use their cloud and lock users out of their data...

For Play the dev needs to "ask for forgivenesspermission" but for F-Droid and the rest this should be fixed by the dev.

Ref: https://github.com/syncthing/syncthing-android/issues/1638