android-password-store / Android-Password-Store

Android application compatible with ZX2C4's Pass command line application
https://passwordstore.app
GNU General Public License v3.0
2.58k stars 263 forks source link

Can't read stores from SAF-backed volumes #1109

Closed nicoe closed 2 years ago

nicoe commented 4 years ago

As explained in #845 I am experiencing some issues when using a non git-store that is synced using nextcloud. I start the onboarding process (the new one thanks to the snapshot builds made by @Skrilltrax (v 1.12)) and the symptoms are the same as in #845: I have to choose the directory, I choose the right one, there's a request for the acces rights (which I obviously grant) and then I am back on the onboarding welcome screen.

I am using Lineage OS if it matters in any way.

msfjarvis commented 4 years ago

@Skrilltrax managed to locate a possible cause for this problem, this APK has the fix implemented. Can you check if it resolves your problem?

nicoe commented 4 years ago

Unfortunately not :(. Let me know how I can help as I feel useless … -- (°> Nicolas Évrard ( ) Liège `¯

msfjarvis commented 4 years ago

Unfortunately not :(. Let me know how I can help as I feel useless

I am completely stumped as to how you still have this problem. Here's what I just did to confirm the fix:

  1. Export my passwords to an external directory
  2. Uninstall the app
  3. Use a file browser to delete the .git directory from my exported passwords
  4. Installed the APK I sent you
  5. Started the app, selecting Let's go > Create local repo > SD Card, then picking the directory I previously exported to.

The onboarding flow then completes and I'm sent to my password list.

If you have the ability to get a log from your device then you can try that, otherwise I'm afraid this is going to stay broken for you because we can't fix what we can neither understand nor reproduce.

nicoe commented 4 years ago

I know, the process is really straightforward so I don't understand what's wrong. I suspect something in the way the configuration is stored on my device (I have to select on each reboot the launcher app I want to use because my preference is not saved … but only this preference not all the others!).

The onboarding flow then completes and I'm sent to my password list.

If you have the ability to get a log from your device then you can try that,

How can I access the debug log of PasswordStore ?

otherwise I'm afraid this is going to stay broken for you because we can't fix what we can neither understand nor reproduce.

I completely understand that, if I can't understand / reproduce a bug I can not fix it either.

Thanks for all the time you spent helping me. -- (°> Nicolas Évrard ( ) Liège `¯

msfjarvis commented 4 years ago

How can I access the debug log of PasswordStore ?

In the app's settings you'll find an option to enable debug logging towards the bottom of the page. Once that is enabled, force stop the app and then follow the steps here to set up debugging on your phone. Then in the same window as the guide, type adb logcat -c, followed by adb logcat > log.txt and replicate the issue on the app. Once that's done, press Ctrl + C to stop the log recording process. Send over the log.txt file when done.

qhga commented 4 years ago

Hey, I am not sure if this helps, but I have a similar setup to @nicoe and also a similar problem:

Setup: Device: Xiaomi Mi Mix 2s (polaris) OS: Lineage 17.1 (2020-08-26 microG) <- Had the same issues with Lineage 16 (also microG and non microG) Password Store version: 1.12 <- Had the same issue with other version and the version with the fix @msfjarvis provided above Method to sync the repository: nextcloud

What doesn't work:

  1. Install the Password Store app
  2. Open the app and click on "LET'S GO"
  3. Select "CREATE LOCAL REPO"
  4. Select "SD-CARD"
  5. Select the Password Folder inside the Nextcloud emulated storage
  6. Press "ALLOW" when asked to Allow access to "pw" in "Nextcloud"
  7. The App presents me with the screen from step 1 ("LET'S GO")
  8. If I select "LET'S GO"again, everything repeats with a slight difference after step 4. where I am presented with a dialog: Directory already selected. Do you want to use "/storage/emulated/0/-1977561642/9"?

What does work:

  1. Copy the folder with the passwords from the emulated Nextcloud storage to the sd-card e.g. Downloads, Documents, etc.
  2. Do steps 2. - 6. from the What doesn't work section above but select the folder you copied in step 1. (on sd-card)
  3. Now everything works as expected

So maybe there is some sort of issue with emulated storages or especially with the one for Nextcloud. I don't know if this is something @msfjarvis is already aware of or if this even is intended behaviour. In any case, I hope I could at least provide a bit more insight.

If you require a debug log, let me know!!

Have a great day and thanks for developing this app!!

msfjarvis commented 4 years ago

Thanks, that's extremely helpful! I'm confident the problem stems from this part:

  1. Select the Password Folder inside the Nextcloud emulated storage

We do not use the Storage Access Framework for accessing files, which means selection of storage providers like Google Drive and Nextcloud that implement it will not work. If you can send over a debug log, I'll be able to confirm this.

msfjarvis commented 4 years ago

Going over the wiki, the First time setup page clearly says that selecting Nextcloud as a provider is 'wrong', which bolsters my theory that this is a SAF related situation. If and when #957 is merged, this should start working.

qhga commented 4 years ago

@msfjarvis Here is the log, hope that further confirms your suspicion. Have a good one!

09-25 13:34:43.186 30222 30222 W System.err: java.lang.IllegalStateException: Failed to create directory!
09-25 13:34:43.186 30222 30222 W System.err:    at com.zeapo.pwdstore.ui.onboarding.fragments.RepoLocationFragment.createRepository(RepoLocationFragment.kt:21)
09-25 13:34:43.186 30222 30222 W System.err:    at com.zeapo.pwdstore.ui.onboarding.fragments.RepoLocationFragment.initializeRepositoryInfo(RepoLocationFragment.kt:6)
09-25 13:34:43.186 30222 30222 W System.err:    at com.zeapo.pwdstore.ui.onboarding.fragments.RepoLocationFragment.access$initializeRepositoryInfo(RepoLocationFragment.kt:1)
09-25 13:34:43.186 30222 30222 W System.err:    at -$$LambdaGroup$js$4kz_IcHu2S3Qb0B20v_4EP_TU9c.onClick(java-style lambda group:13)
09-25 13:34:43.186 30222 30222 W System.err:    at androidx.appcompat.app.AlertController$ButtonHandler.handleMessage(AlertController.java:3)
09-25 13:34:43.186 30222 30222 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:107)
09-25 13:34:43.186 30222 30222 W System.err:    at android.os.Looper.loop(Looper.java:214)
09-25 13:34:43.186 30222 30222 W System.err:    at android.app.ActivityThread.main(ActivityThread.java:7356)
09-25 13:34:43.186 30222 30222 W System.err:    at java.lang.reflect.Method.invoke(Native Method)
09-25 13:34:43.186 30222 30222 W System.err:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
09-25 13:34:43.186 30222 30222 W System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)
09-25 13:34:43.187 30222 30222 D RepoLocationFragment: Failed to delete local repository: /storage/emulated/0/-1977561642/9
msfjarvis commented 4 years ago

Yeah that confirms it :(

The SAF migration is presenting challenges at every step so there's no definite timeline for it yet, but I'll definitely verify Nextcloud works whenever that work is ready to ship.

nicoe commented 4 years ago

Indeed I tested by going directly to the directory instead of using the Nextcloud provider and it works.

Thanks @phga and the PasswordStore team, I overlooked the wiki sorry about that. -- (°> Nicolas Évrard ( ) Liège `¯

posidonius commented 4 years ago

I am experiencing the same problem under Android 10 trying to set up from a Nextcloud repository.

First I tried F-Droid v 1.11.3. I also tried Play Store v 1.13.1.

Neither work. In both cases, I am stuck in a loop at the welcome screen where I am asked to set up a local repository.

I have tried giving the app required permissions before opening it, clearing data/cache between apps, and uninstall/reinstalling it several times.

It never recognizes the repo downloaded from Nextcloud.

I have selected the Nextcloud directory from the system files (not the Nextcloud app) as instructed in the documentation so that's not the problem.

Addendum: The repo is stored on a SD card.

msfjarvis commented 4 years ago

Can you move the repo to your device storage and try again? I'm not entirely convinced SD Card access works below Android 11.

posidonius commented 4 years ago

Thanks very much for your help! Yes, I did that and it solves the problem (F-Droid v 1.11.3)!

The app is misleading because when choosing local repository, it prompts with 2 options: 1) SD Card; and 2) hidden app folder.

It might be a good idea to change the "SD Card" label to "internal storage" or something like that.

msfjarvis commented 4 years ago

Thanks very much for your help! Yes, I did that and it solves the problem (F-Droid v 1.11.3)!

The app is misleading because when choosing local repository, it prompts with 2 options: 1) SD Card; and 2) hidden app folder.

It might be a good idea to change the "SD Card" label to "internal storage" or something like that.

We will, thanks for confirming.

alanthehat commented 3 years ago

Here (assuming it's worked) is a screen-capture of a week-old Realme 7 (Android 10) which used the 'clone phone' app suggested by the setup screens to install Password Store from a Samsung J500FN where Password Store is working just fine. Password Store doesn't work here.

The Realme has no plugged-in sdcard or cloud account.

Both Password Store & OpenKeychain have been granted all the permissions I can find (permissions are scattered across many menus so I may have missed something)

alanthehat commented 3 years ago

screen-cap transcoded to GIF: https://drive.google.com/file/d/11OtIsrCWRuOVf5ITOdNkKRCjU-J4qdvq/view?usp=drivesdk

alanthehat commented 3 years ago

screen-cap as original mp4: https://drive.google.com/file/d/11VELMBhNAdu_CQd_LJByRKiPppg60YN0/view?usp=drivesdk

msfjarvis commented 3 years ago

You're on an extremely outdated version of the app. Please refer to the repository's README for Google Play and F-Droid links to the current version.

alanthehat commented 3 years ago

Ah, that explains it.

Upon investigation I find that Password Store occurs not once but twice in F-Droid. I now have 2 installed copies, one seemingly functional & the other still broken.

Usually there is some indication that a new repository has been started, a link to the new one is common along with words like 'deprecated', 'old' or 'replaced' in the description, often at the top where it can be read without tapping [more], commonly also in the one-line description that apears on the search page.

msfjarvis commented 3 years ago

Usually there is some indication that a new repository has been started, a link to the new one is common along with words like 'deprecated', 'old' or 'replaced' in the description, often at the top where it can be read without tapping [more], commonly also in the one-line description that apears on the search page.

We know, and we did have the old version archived. How F-Droid handles it is out of our hands.

msfjarvis commented 2 years ago

I've started an RFC to eliminate the ability to use stores from public storage in the next release of Password Store. If anyone here would like to give it a read and offer their opinion, I'd be grateful.

msfjarvis commented 2 years ago

RFC has been accepted, this issue is no longer relevant.