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

Storage Bug #203

Open
DoofyOnABike opened this issue Apr 30, 2024 · 8 comments
Open

Storage Bug #203

DoofyOnABike opened this issue Apr 30, 2024 · 8 comments
Labels
bug Something isn't working Done.

Comments

@DoofyOnABike
Copy link

Hey, i’ve stumbled across a weird problem two times by now, on two different phones, so I figured it’s time to point it out.
I came across the problem when choosing a custom data storage location. I created a new folder “UrbanBiker” on my micro-sd card and inside of that I created another folder “tracks”, to keep it close to original and thinking that the app will now just save the zip files to that exact location “/microSD/UrbanBiker/tracks”. Turns out it doesn’t. What it does instead is create this folder structure “UrbanBiker/tracks” again, inside of my existing folder structure, so we are now at: “/UrbanBiker/tracks/UrbanBiker/tracks” and this… is where all hell breaks loose, because for some reason the app now starts creating “/UrbanBiker/tracks” indefinitely…
The problem could only be resolved by reinstalling the app and renaming the folders I had initially created. When choosing “/UrbanBiker/anyothername” everything works just fine.

@Scooty66
Copy link

Same happened her, this way unfortunately I managed to loose all my track data.
Good to have a backup of my 261 recorded track data only the last 20 seem to be completely lost.
But still not too happy....

@DoofyOnABike
Copy link
Author

Thats too bad. Luckily, I was able to recover all of my track data by shutting down the app, connecting my phone to a windows pc and searching for “.zip” inside of the multitude of folders that were created by UB. The track files were all there, but they were scattered throughout hundreds of sub folders.
An impressive demonstration of the importance of backups. Always remember to upload your data to strava, or to save them every now and then.

@DoofyOnABike DoofyOnABike closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
@DoofyOnABike DoofyOnABike reopened this Apr 30, 2024
@Sublimis Sublimis added the assessing Assessing implementation feasibility label Apr 30, 2024
@Sublimis
Copy link
Owner

Sublimis commented May 2, 2024

Hi guys. We're unable to reproduce this issue. Can you please provide more information, for example steps to reproduce or a short video (you can send this to our email). Also, what version of Android are you running and is it stock Android or some aftermarket rom? Thank you!

@DoofyOnABike
Copy link
Author

Sooooo… After your reply, I tried over and over to replicate the error on my main phone with some old data, but unfortunately, I couldn’t get it to happen myself… Then I tried to remember the exact steps that I did back when the bug first happened to me.
Step 1: Choose a new storage location.
Step 2: Revoke storage access for the old location. (I think this might be the problem?)
Step 3: Choose a different storage location and name it /UrbanBiker/tracks.
Step 4: Something doesn’t work?
Step 5: Try again. Harder this time.
Step 6: Watch Chaos unfold.
I did a little screen record to try and visualize it.

Streamable Link: https://streamable.com/yr4vjp

Now, mind you, this is still not exactly what happened to me the first time I came across the issue, because back then the data was still there, just scattered throughout the newly created folders. In a scenario like shown in the Video, all the data would still remain in the old folder /UrbanBiker/Fahrten and none of it would be copied into the new location. I’m guessing that the problem might have been, that stupid me pressed “revoke access” leaving Urban Biker unable to touch and copy any of the files??
Here is a list of the devices that I encountered the error with (all stock Android/MIUI Versions):
My “Bike Computer”: Cubot KingKong Mini 2 (Android 10)
Another phone I did some sensor tests on: Realme 9 5G (Android 14)
My phone, as seen in the video: Poco M3 Pro 5G (Android 14)
I cannot remember what exact version of Urban Biker I was using on my bike phone back when it first happened. But the Versions on both the Realme and my Poco where up to date, so version 8.04.

I hope I could be of any help…

@Sublimis Sublimis added bug Something isn't working pending We are currently working on this and removed assessing Assessing implementation feasibility labels May 2, 2024
@DoofyOnABike
Copy link
Author

Here’s some further information.
I freshly installed Urban Biker along with the old data and reenacted yesterday’s screen recording, but this time I checked the Urban Biker config.json to see how the data storage path changes.
Seems like after the first change UB has already forgotten where the data originated from:

grafik

After revoking the access, these two lines are gone altogether.
This is after the change back to the other directory and the folder structure /UrbanBiker/tracks

grafik

At this point Urban Biker doesn’t seem to know that there ever was any data.
And after changing the directory a third time to: /UrbanBiker/tracks/UrbanBiker/tracks

grafik

Now, I guess since the directory hasn’t changed this time, Urban Biker knows the last data storage path, but since there are only two empty folders at this location, UB keeps copying those??

So, my best guess would be that the App doesn’t like a change of directory? Changing the storage path from internal drive to microsd or vice versa, does seem to create some problems…

@Sublimis
Copy link
Owner

Sublimis commented May 3, 2024

No need for further information, the situation is quite clear, thank you for all the details :)

The app doesn't like selecting a new folder that is inside the old app data folder, because then it tries to move the parent folder into a child folder, which is impossible. This can be considered a rookie mistake on our part, we just never thought anyone would try something like that :) Instead of trying to define such an operation in a way that would be considered a valid request, we'll simply check for and deny the child-parent operation (well, checking it will not be an easy task, but the final result will). The only way the original parent-child operation could then be achieved will be to do the moving through a third (temporary) folder that is not a subfolder of the old one (a two-step operation), or to first revoke access to the old folder so that the move operation does not occur at all (but that way the application data won't be transferred).

@Sublimis
Copy link
Owner

Sublimis commented May 3, 2024

Also keep in mind the following important notes. The folders in question are considered "application data" folders -- although only "tracks" are currently stored there, in the future the folder may contain other data.

When you grant access to a folder to be used as the application data folder, the app can't see or access the parent folder for security reasons; It can only see the name of the assigned folder and its contents.

Therefore, when you grant access to a folder named tracks, the app has no way of knowing whether that folder is inside a folder named UrbanBiker or not (nor would it be able to access its contents), so it proceeds to create the desired folder structure UrbanBiker/tracks/ within the granted tracks folder.

On the other hand, if you grant access to a folder named UrbanBiker, the app will take that into account and will only create the subfolder structure (only tracks/ at this time).

@DoofyOnABike
Copy link
Author

Ahhhh, now I see, so the “data storage location” will not only be used for the zip files of my rides but also for any other data that might be added in the future.
In that case I will change my data location to a simple “UrbanBiker” folder. :)
Thanks for all the info and I take great pride in the fact that I managed to do something literally so stupid, that it broke parts of your app. I guess you’re either born a dumbest assumable user or you live long enough to see yourself become one. :D

@Sublimis Sublimis added Done. and removed pending We are currently working on this labels May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Done.
Projects
None yet
Development

No branches or pull requests

3 participants