osu
osu copied to clipboard
First-time setup crashes if case doesn't match between osu!stable's BeatmapDirectory and the actual songs directory
Type
Crash to desktop
Bug description
A friend ran into this issue when trying to set up lazer because he decided to install his osu!stable beatmaps to another directory, but the directory's case was different between his config and the name of the folder itself, which worked fine on stable because it was on a case-insensitive filesystem. This is a strange and rare scenario, but it shouldn't outright crash the game.
The provided logs are from my reproduction of the issue where my osu!stable user config has BeatmapDirectory = D:\oSuSoNgS
while the folder itself is at D:\osusongs
.
2022-08-28 04:55:52 [error]: An unhandled error has occurred.
2022-08-28 04:55:52 [error]: System.AggregateException: One or more errors occurred. ("D:\osusongs\1033730 Demetori - Warabe Matsuri ~ Innocent Treasures" does not start with "D:\oSuSoNgS" and is probably malformed)
2022-08-28 04:55:52 [error]: ---> System.ArgumentException: "D:\osusongs\1033730 Demetori - Warabe Matsuri ~ Innocent Treasures" does not start with "D:\oSuSoNgS" and is probably malformed
2022-08-28 04:55:52 [error]: at osu.Framework.Platform.NativeStorage.<>c__DisplayClass9_0.<getRelativePaths>b__0(String path)
2022-08-28 04:55:52 [error]: at System.Linq.Utilities.<>c__DisplayClass2_0`3.<CombineSelectors>b__0(TSource x)
2022-08-28 04:55:52 [error]: at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
2022-08-28 04:55:52 [error]: at osu.Game.Database.LegacyBeatmapImporter.GetStableImportPaths(Storage storage)+MoveNext()
2022-08-28 04:55:52 [error]: at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
2022-08-28 04:55:52 [error]: at osu.Game.Database.LegacyModelImporter`1.<>c__DisplayClass5_0.<GetAvailableCount>b__0()
2022-08-28 04:55:52 [error]: at System.Threading.Tasks.Task`1.InnerInvoke()
2022-08-28 04:55:52 [error]: at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
Screenshots or videos
No response
Version
2022.821.0
Logs
network.log performance.log runtime.log updater.log database.log
Sentry issue: OSU-3HR
Likely fixable by replacing the misguided framework-side .StartsWith()
calls on paths with Path.GetRelativePath()
or similar. Needs testing on multiple platforms, however.
I think making the checks ignore case is probably fine. The main goal is to protect against escaping the root path of the parent Storage
. Actual non-existent directories should throw elsewhere (in the case of actual file sensitive disks).
@khang06 I am trying to reproduce this issue to verify the fix linked above but am unable to. Are you able to provide more detailed reproduction steps? A video, perhaps? I'm trying the obvious way but it works just fine here even without the fix.
Exact details of the filesystem in question could possibly also help.
Here you go: https://user-images.githubusercontent.com/11239786/187543547-77ec202e-0dc7-4942-9d1f-86f3c1e2251e.mp4
My osu!stable user folder is in my C: drive in the default location. Both C: and D: are NTFS and I'm on Windows 11 22000.856 (which could be unclear from the video since I use ExplorerPatcher to make it look like Windows 10). My friend's crash was from a more convoluted setup in which he replaced his Songs
folder on stable with a junction to a folder on another drive, but his junction's folder name was songs
instead of Songs
, causing a crash because he didn't change BeatmapDirectory
in his config.
Interesting that you got it to trigger via the setup screen, I was trying to do it via the "import beatmaps" button in maintenance settings. Will have another try tomorrow and see what falls out...
I tried using that button when trying to reproduce this too. IIRC it looked like it didn't do anything, but it silently throws an exception which should still be in runtime.log