osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.59k stars 1.01k forks source link

Importing settings-backup (osf) that have certain content types does nothing #20718

Open Switch123456789 opened 2 weeks ago

Switch123456789 commented 2 weeks ago

Description

If I pick a backup to import, nothing happens. I tried many different backups, created some for the purpose of testing the feature but osmand literally does nothing.

Steps to reproduce

Import a backup.

Actual result

Nothing happens

Expected result

Osmand proceeds with the restore-process.

Your Environment (required)

OsmAnd Version: 4.8.6
Android version: 14 (IodeOS)
Device model: Fairphone 5
yuriiurshuliak commented 2 weeks ago

Please provide us with the .osf file you're trying to import that results in a failure, and kindly compress it into a zip format.

albansuser commented 2 weeks ago

I have found that only the export/import of "Settings" works. If "My Places" or "Resources" are included, the export/import fails.

My comments relate to the 4.9 nightlies. The problem has existed for some time.

JF78770 commented 2 weeks ago

I recently moved to Android 14, Osmand 4.8.6 and I got same issue I had not seen before. I confirm albanuser comment. Same issue if I go through Settings/Import or through Favorite Places/Import. I can read "Load the datas", after that the windows with "Settings, My Places, Resources" does not open. I tried with same file to import on iPad, it worked well in Apple world.

Switch123456789 commented 2 weeks ago

If the backup includes: Colors, Favorites or TTS from the sources-category, this happens. Everything else works (I don't have every kind of data). This is a backup of only the colors, I can't import it.

trldp commented 1 week ago

I seem to have a similar issue when importing an export only containing a track (see the file in attachment below). Running adb logcat gives the following exception:

09-04 21:03:13.529 31468  4251 E net.osmand: java.util.zip.ZipException: Invalid zip entry path: /tracks/220822.gpx
09-04 21:03:13.529 31468  4251 E net.osmand:    at com.android.internal.os.SafeZipPathValidatorCallback.onZipEntryAccess(SafeZipPathValidatorCallback.java:52)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1684)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.zip.ZipFile$Source.<init>(ZipFile.java:1436)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.zip.ZipFile$Source.get(ZipFile.java:1389)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:769)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.zip.ZipFile.<init>(ZipFile.java:283)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.zip.ZipFile.<init>(ZipFile.java:239)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.zip.ZipFile.<init>(ZipFile.java:187)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.zip.ZipFile.<init>(ZipFile.java:156)
09-04 21:03:13.529 31468  4251 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.updateFilesInfo(SettingsImporter.java:86)
09-04 21:03:13.529 31468  4251 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.getItemsFromJson(SettingsImporter.java:66)
09-04 21:03:13.529 31468  4251 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.processItems(SettingsImporter.java:106)
09-04 21:03:13.529 31468  4251 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.collectItems(SettingsImporter.java:37)
09-04 21:03:13.529 31468  4251 E net.osmand:    at net.osmand.plus.settings.backend.backup.ImportFileTask.doInBackground(ImportFileTask.java:103)
09-04 21:03:13.529 31468  4251 E net.osmand:    at net.osmand.plus.settings.backend.backup.ImportFileTask.doInBackground(ImportFileTask.java:24)
09-04 21:03:13.529 31468  4251 E net.osmand:    at android.os.AsyncTask$3.call(AsyncTask.java:394)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.lang.Thread.run(Thread.java:1012)
09-04 21:03:13.529 31468  4251 E net.osmand: SettingsHelper Failed to collect items from: Export.osf {AsyncTask #9}
09-04 21:03:13.529 31468  4251 E net.osmand: java.lang.IllegalArgumentException: No items
09-04 21:03:13.529 31468  4251 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.processItems(SettingsImporter.java:109)
09-04 21:03:13.529 31468  4251 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.collectItems(SettingsImporter.java:37)
09-04 21:03:13.529 31468  4251 E net.osmand:    at net.osmand.plus.settings.backend.backup.ImportFileTask.doInBackground(ImportFileTask.java:103)
09-04 21:03:13.529 31468  4251 E net.osmand:    at net.osmand.plus.settings.backend.backup.ImportFileTask.doInBackground(ImportFileTask.java:24)
09-04 21:03:13.529 31468  4251 E net.osmand:    at android.os.AsyncTask$3.call(AsyncTask.java:394)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
09-04 21:03:13.529 31468  4251 E net.osmand:    at java.lang.Thread.run(Thread.java:1012)

I'm running

OsmAnd Version: 4.8.6
Android version: 14 (LineageOS 21-20240816-NIGHTLY-instantnoodlep)
Device model: OnePlus 8 Pro

Export.osf.zip

DmitryAlexei commented 1 week ago

@trldp @Switch123456789 All your backups can be imported to OsmAnd~ 4.9.0#3122m, released: 2024-09-03 Android 13 One UI 5.1 The issue might be related to your operating system. Please try nightly and see if it is working for you.

Switch123456789 commented 1 week ago

Please try nightly and see if it is working for you.

I did, unfortunately it is still not working, even with a fresh install 4.9.0#3125m and default settings. I tried backups from 4.8.6 and 4.9.0#3125m.

Jasper-Ben commented 1 week ago

Same issue here with same/similar error message when trying to migrate to FP5 running calyxos:

java.util.zip.ZipException: Invalid zip entry path: /tracks/Sun 17 Sep 2023_1.gpx
09-05 14:27:47.740  6972 17235 E net.osmand:    at com.android.internal.os.SafeZipPathValidatorCallback.onZipEntryAccess(SafeZipPathValidatorCallback.java:52)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1684)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.zip.ZipFile$Source.<init>(ZipFile.java:1436)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.zip.ZipFile$Source.get(ZipFile.java:1389)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:769)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.zip.ZipFile.<init>(ZipFile.java:283)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.zip.ZipFile.<init>(ZipFile.java:239)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.zip.ZipFile.<init>(ZipFile.java:187)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.zip.ZipFile.<init>(ZipFile.java:156)
09-05 14:27:47.740  6972 17235 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.updateFilesInfo(SettingsImporter.java:86)
09-05 14:27:47.740  6972 17235 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.getItemsFromJson(SettingsImporter.java:66)
09-05 14:27:47.740  6972 17235 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.processItems(SettingsImporter.java:106)
09-05 14:27:47.740  6972 17235 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.collectItems(SettingsImporter.java:37)
09-05 14:27:47.740  6972 17235 E net.osmand:    at net.osmand.plus.settings.backend.backup.ImportFileTask.doInBackground(ImportFileTask.java:103)
09-05 14:27:47.740  6972 17235 E net.osmand:    at net.osmand.plus.settings.backend.backup.ImportFileTask.doInBackground(ImportFileTask.java:24)
09-05 14:27:47.740  6972 17235 E net.osmand:    at android.os.AsyncTask$3.call(AsyncTask.java:394)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.lang.Thread.run(Thread.java:1012)
09-05 14:27:47.740  6972 17235 E net.osmand: SettingsHelper Failed to collect items from: Export_2024-09-05_20240905132137.osf {AsyncTask #26}
09-05 14:27:47.740  6972 17235 E net.osmand: java.lang.IllegalArgumentException: No items
09-05 14:27:47.740  6972 17235 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.processItems(SettingsImporter.java:109)
09-05 14:27:47.740  6972 17235 E net.osmand:    at net.osmand.plus.settings.backend.backup.SettingsImporter.collectItems(SettingsImporter.java:37)
09-05 14:27:47.740  6972 17235 E net.osmand:    at net.osmand.plus.settings.backend.backup.ImportFileTask.doInBackground(ImportFileTask.java:103)
09-05 14:27:47.740  6972 17235 E net.osmand:    at net.osmand.plus.settings.backend.backup.ImportFileTask.doInBackground(ImportFileTask.java:24)
09-05 14:27:47.740  6972 17235 E net.osmand:    at android.os.AsyncTask$3.call(AsyncTask.java:394)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
09-05 14:27:47.740  6972 17235 E net.osmand:    at java.lang.Thread.run(Thread.java:1012)

Device : FP5 Brand : Fairphone Manufacturer : Fairphone Model : FP5 Product : FP5 Build : AP2A.240805.005.24510030 Version : 14 App Version : OsmAnd~ Apk Version : 4.8.5 480503

Can I provide any more info to help?

sonora commented 1 week ago

@vshcherb , @Chumva I am not an expert here, but I think this smells of a Zip Slip issue, see https://developer.android.com/privacy-and-security/risks/zip-path-traversal, where Android mechanisms try to avert a perceived security risk. Potentially depends on Android version, which is why some setups may see an issue, while it is not reproducible for others...

readonly24 commented 1 week ago

I think it's Android version specific. I have two Android 12 smartphones which have no problem importing my osf file with settings and places. But i cannot import this osf file with my Android 14 tablet, then just nothing happens. Osmand is 4.8.5

mejo- commented 5 days ago

I experience the same problem with latest OsmAnd build from F-Droid. The export is done on Android 13, the import on Android 14. Unfortunately I cannot share the file due to a lot of personal information in it.

mejo- commented 5 days ago

Doing some tests, I was able to export + import all settings and everything from "my places" except tracks. Favourites and markers worked.

Boothy99 commented 4 days ago

I'm having a few issues recently relating to favourites.gpx file size being suddenly smaller, along with export & import of favourites being corrupted.... https://github.com/osmandapp/OsmAnd/issues/20799#issue-2515826223

Wondering if this is related?

AndySchroder commented 4 days ago

For me, this problem seems to be isolated to Tracks, A/V Notes, Colors, Rendering style, Voice Prompts (TTS), Topography maps, and Road maps. All other types of settings (including Standard maps) I'm trying to export/import don't result in the silent failure and do work (although some setting types are empty, so they aren't tested). I'm running version 4.8.5, which is the latest suggested available on F-Droid.

AndySchroder commented 4 days ago

Also, I read that "you can backup all your data from the previous device if you copy the folder specified in Settings → OsmAnd Settings → Data storage folder (by default it's Android/data/net.osmand.plus). Then, simply paste all the contents of this folder back to the Data storage folder directory." at https://osmand.net/docs/user/troubleshooting/setup/#how-to-copy-my-favorites-and-tracks-to-the-new-device . This does not work. Lots of stuff (but not all) is missing when I open up the app after copying this folder to the new phone.