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

Data Storage folder change deletes all data - permission issue #16301

Closed
frederikb96 opened this issue Jan 22, 2023 · 12 comments
Closed

Data Storage folder change deletes all data - permission issue #16301

frederikb96 opened this issue Jan 22, 2023 · 12 comments
Assignees
Labels
Milestone

Comments

@frederikb96
Copy link

Description

If changing the data storage folder from the default one to a manual folder and confirming the move action, all your data gets deleted if you have not the correct permission to access the new folder.

How to reproduce?

  1. Only have the file permission for Media only and not for all files
  2. Have your data in the default location like sdcard/Android/data
  3. Change the location in the Osmand settings to a manual folder like sdcard/osm
  4. Confirm the dialog to move files
  5. All files are getting moved and you get a success message and restart app
  6. All your data is lost because it got not actually moved because you did not have the permission for the new folder and not got asked for it

Your Environment

OsmAnd Version: 4.3.5
Android/iOS version: 12
Device model: FP4

@TheSnoozer
Copy link
Contributor

Sounds related to #14916, #16043 and #16059.

TLDR: Anroid has become very restrictive with file access permissions for apps.

@scaidermern
Copy link
Contributor

Sounds related to #14916, #16043 and #16059.

TLDR: Anroid has become very restrictive with file access permissions for apps.

True. However, this is not an excuse for OsmAnd to delete all your data.

OsmAnd should try if the specified storage location is writable before moving files.

@vshcherb
Copy link
Member

So far we never reproduced the data lost and yes there is a check. Try to change to the previous folder and your data should be back.

@vshcherb vshcherb added the Observed Needs more clarification, feedback, or research label Jan 23, 2023
@vshcherb vshcherb added this to the 4.3-android milestone Jan 23, 2023
@frederikb96
Copy link
Author

I can confirm that this also happened to me once the first time when changing from data to obb. I was able to change back and my data was still there.
But another time as described in my initial post, I was not able to recover my data. I did immediately revert the storage location and also checked the old location for any files, there were none anymore. I also checked the file system storage and it represented that there was much more available space now, since all data got deleted.

If it is not reproducible, there must be some other factors which let to my situation, which I do not know anymore. So the issue can be closed in that case since at least other users should normally not come into my situation in that case and this was the reason I created the issue.

@Rowin63
Copy link

Rowin63 commented Jan 24, 2023

I can confirm that this also happened to me once the first time when changing from data to obb. I was able to change back and my data was still there. But another time as described in my initial post, I was not able to recover my data. I did immediately revert the storage location and also checked the old location for any files, there were none anymore. I also checked the file system storage and it represented that there was much more available space now, since all data got deleted.

If it is not reproducible, there must be some other factors which let to my situation, which I do not know anymore. So the issue can be closed in that case since at least other users should normally not come into my situation in that case and this was the reason I created the issue.

Oh yes, also other users did come to your situation and lose all data. Exactly what happened and described in my (closed) case #16043.

@scaidermern
Copy link
Contributor

So far we never reproduced the data lost and yes there is a check.

Maybe this check needs to be improved then? For example copy a (dummy) file, then try to read it (and ideally check the size or checksum). Only if this is successful then start to copy the data.

Yes, sounds a little bit exaggerated but it seems like the current check is not enough.

@vshcherb vshcherb added and-bugs and removed Observed Needs more clarification, feedback, or research labels Jan 24, 2023
@vshcherb
Copy link
Member

We need to:

  • Create test file and write 4 bytes and close and read and delete it only if success start copying process
  • Check code that we don't delete file if copying or moving is not true

Chumva added a commit that referenced this issue Jan 26, 2023
@vshcherb
Copy link
Member

Indeed we do investigation how did it happen https://github.com/osmandapp/OsmAnd/pull/15186/commits and how we overlooked in code review / testing.

I'm sorry it happened and caused the lost of user data, we will proceed with urgent fix.

@frederikb96
Copy link
Author

Thank you very much :)

@Zirochkabila
Copy link
Contributor

OsmAnd~ 4.4.0#14157mqta, released: 2023-02-07

When transferring files to another folder, if there is not enough space in the import folder or not all files have been transferred, an error is displayed informing you that there is not enough space in the folder and that all files could not be transferred.
Only the transferred files are displayed on the map
But if you return to the previous type of memory, all files are restored

@Zirochkabila
Copy link
Contributor

@frederikb96 can you confirm?

@frederikb96
Copy link
Author

I do not know since this is a different szenario

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants