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

Multiuser support: Filesystem operations malfunction when using the app in secondary users #2479

Closed
4 tasks done
violet-octagon opened this issue Dec 4, 2024 · 5 comments · Fixed by #2482
Closed
4 tasks done
Assignees
Labels
Milestone

Comments

@violet-octagon
Copy link

⚠️ This issue respects the following points: ⚠️

  • This is a bug. Not a question or feature request.
  • The topic is not already reported at Issues. (I've searched it).
  • Markor is up to date. See Releases for the latest version. Updates are available from F-Droid and GitHub.
  • The bug is still present in the latest development version (git master). (Please download and try the test version of Markor, named Marder. Don't worry; Markor and Marder appear as completely separate applications. You can install both side-by-side, and Markor settings are not touched. In case the issue is resolved there, you don't need to create a bug report. The change will be part of the next Markor update.)

Description

Not to be patronizing, but I thought this issue could be easy to misunderstand, so I just wanted to state what I mean by the terminology I use (derived from here):

  • System user, meaning the user that must exist on single-user phones; the primary user. On my phone, its data is stored in /storage/emulated/0/.
  • Secondary user, meaning an additional user besides the owner. On my phone, the secondary user I use Markor in has its data stored in /storage/emulated/10/.
  • Symlinks, meaning those shortcuts to certain parts of the filesystem that can be seen if you tap on the "Go to" folder button at the right of the top navigation bar. Alternatively, you can find the symlinks by going up directories until you reach "storage".

When using Markor in a secondary user, navigation through folders malfunctions. Also, copy/move operations to symlinks malfunction. This may be related to #2350. Some specifics:

  1. In the filesystem browser, when tapping "..", Markor will usually go all the way up to "storage" and show the symlinks. I expected Markor to go to the parent directory. A workaround is using the system back button, which will cause Markor to correctly go to the parent directory (if the last action you took was going to a child directory).
  2. The "Download" symlink in "storage" and the "0" symlink in "storage/emulated" are crossed out and inaccessible. I didn't expect Markor to be able to access /storage/emulated/0/Download or /storage/emulated/0/ in the secondary profile. Instead, I expected Markor to have symlinks for /storage/emulated/10/Download and /storage/emulated/10.
  3. Strange things happen when data is copied to "AppData (storage-emulated-#-Android-data-net.gsantner.markor)" (which I'll call "the public directory" from now on). Specifically:
  • In Markor, all copied files and directories will appear in the public directory and can be accessed.
  • In the system files app, the public directory usually appears to have nothing. Occasionally, some files that were copied will appear, but will be broken. If a directory was copied, that directory and its contents will not appear.
  • Through MTP, the public directory will contain a "cache" directory and a "files" directory, as expected. Inside the "files" directory, some files that were copied will appear, but will be broken. If a directory was copied, the directory will appear, but it will appear to be empty.

When I say these files are broken and aren't accessible, I mean that trying to open them with another app doesn't work. My PC displays errors when attempting to read/copy/move/delete the files through MTP. This doesn't just happen with note files, this also happens with image files.

Markor is storing the data somewhere. According to Android, storage gets taken up when Markor copies these broken files. I expected files and directories copied to the public directory to show up and be accessible by the system files app and through MTP.


Where this issue doesn't manifest:

  • When using Markor in the system user. I'm not sure if Markor works correctly in other profiles (Private Space, Work, Restricted, Clone) or the Guest user.
  • In Marder, copy operations to symlinks work correctly. Files copied to the public directory (/storage/emulated/#/Android/data/net.gsantner.markor_test) can be read by the system files app and through MTP. The other problems are still present in Marder, though.
  • I don't remember this being an issue on the v2.12.# releases from July 2024. Though, I didn't test those when making this issue.

I want this bug resolved because most of my notes are stored in Markor's data partition in a secondary user. Resolving this issue would make it possible to copy files from the data partition to somewhere another computer can access the files via MTP, and it would restore intended behavior when browsing though the filesystem. Right now, in secondary users, it isn't possible to accees or make a backup copy of files in the data partition or the public directory, nor is it possible to enter /storage/emulated/#/ in Markor if you didn't already have save locations for the Notebook/To-Do/QuickNote set there.

Steps to reproduce

  1. In a secondary user, open Markor and enter a directory. Tap "..". You will be at "storage" and not the parent directory. To workaround this issue, open Markor and enter a directory. Then, you can use the system back button to go to the parent directory. However, if your last action was going to a symlink, then the system back button will take you there.
  2. In a secondary user, open Markor and go to storage by tapping "..". Try tapping on "Download", or tap on "emulated" then try tapping on "0".
  3. In a secondary user, open Markor. Try copying a file and a directory with a file inside of it to the public directory. Then, try accessing the copied data in the system files app and through MTP.

Information

Android version: 15 (AP3A.241105.007)
Device: Google Pixel 7 Pro
Custom ROM: GrapheneOS
App Version: 2.13.1

Source

GitHub Releases

Format / File type

Not specific

Additional info / Log

-
@gsantner
Copy link
Owner

gsantner commented Dec 4, 2024

Thanks. You are probably the first one to try Markor this way, or at least wants to create a issue.

Need to say, have never tried that multi user mode, and know nobody using it explicitly to be honest.

So yes there are probably some /storage/emulated/0/ things to be adapted.

PRs are welcome.

@harshad1
Copy link
Collaborator

harshad1 commented Dec 8, 2024

Ahhh. I didn't anticipate this either. Thanks for making an issue.

I am actually in the process of setting up multi user on my tablet for my wife. Will investigate.

@harshad1
Copy link
Collaborator

@violet-octagon Could you test the branch from the PR I posted. There should be a non-conflicting APK linked there.

(This is still work in progress)

@violet-octagon
Copy link
Author

violet-octagon commented Dec 14, 2024

I tested it. Here are the expected behaviors I noticed:

  1. Symlinks to /storage/emulated/#/ now work in secondary users. I can access /storage/emulated/10/ and child directories, like /storage/emulated/10/Download.
  2. Files are intact when copied to the public directory in secondary users and can then be accessed by other apps and through MTP.

Here are the problems I noticed:

  1. The ".." button still usually makes Marder go all the way up to "storage". I'm having trouble narrowing down what conditions cause Marder to do this; sometimes it works as intended and goes to the parent directory, but usually it doesn't. (When I was making this issue last week, the older version of Marder had this problem. When I tested older Marder today, it still had this problem. When I uninstalled older Marder and installed the APK you just posted, the problem was gone. But then, after changing the save location for the notebook, the problem surfaced again, and persisted after a reinstall.) This happens in the system user and secondary users. This can happen when browsing in the copy/move prompt.
  2. Using the system back button while browsing the filesystem causes Marder to go to "__GO_BACK__". No directories or files are shown, just ¯\_(ツ)_/¯. This happens while browsing any directory if you have done multiple actions (such as viewing a file or going into a directory) since opening the app. If you have done 0 or 1 actions, you can use the system back button once or twice, and the app will close immediately. However, if you are taken to this "__GO_BACK__" screen, using the system back button will close the app (possibly after multiple attempts). Sometimes the app crashes immediately upon reopening it after closing the app like this. This happens in the system user and secondary users.
  3. The copy/move prompt doesn't show the ".." button initially if there are no child directories in the directory you're trying to copy a file from. A workaround is pressing the home icon in the button right, which will take you to your notebook save location and reveal the ".." button. This happens in the system user and secondary users.

@harshad1
Copy link
Collaborator

Thanks. Could you test this again now

@gsantner gsantner linked a pull request Dec 22, 2024 that will close this issue
@gsantner gsantner added the bug label Dec 22, 2024
@gsantner gsantner changed the title Filesystem operations malfunction when using the app in secondary users Multiuser support: Filesystem operations malfunction when using the app in secondary users Dec 22, 2024
@gsantner gsantner added this to the Markor v2.14 milestone Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants