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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
(fix) relink directory / migrate Linux/macOS <--> Windows #12878
Conversation
7615bd0
to
c81d538
Compare
@@ -144,7 +168,7 @@ DirectoryDAO::RemoveResult DirectoryDAO::removeDirectory( | |||
QList<RelocatedTrack> DirectoryDAO::relocateDirectory( | |||
const QString& oldDirectory, | |||
const QString& newDirectory) const { | |||
DEBUG_ASSERT(oldDirectory == mixxx::FileInfo(oldDirectory).location()); | |||
// DEBUG_ASSERT(oldDirectory == mixxx::FileInfo(oldDirectory).location()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can we accomlish the same validation, just without QFileInfo?
IIUC this guarantees that the string and location (string) are identical, if not we can check if it's only the prefix that differs and move on in that case.
Anyone has a smart QString trick handy for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, do we really need an extensive check here?
It's now the same path returned by DirectoryDAO::getRootDirStrings()
, so if it was changed on the roundtrip the query will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have omitted the rather complex check (with no actual benefit except debug output) and added a comment instead.
Any ideas to improve the situation are welcome.
c81d538
to
a545434
Compare
(updated the description with more findings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Good catch.
The issue:
When trying to relink a music directory with a database created in another OS (actually only Windows <--> Linux/macOS),
directory relocation will fail. This is due to the fact that mixxx::FileInfo (QFileInfo), which is part of the roundtrip
DirectoryDAO -> Library preferences -> ... -> DirectoryDAO, does unexpected things (no explicit documentation?) if the path string it's constructed from doesn't match the current OS' path schema:
C:\some\path
is considered relative and the the current working dir path is prepended/mixxx/build/dir/C:/some/path
same issue,
/home/Music
is missing "[drive letter]:" prefix and becomesC:/home/Music
(not found etc.)For both directions it fails with this DEBUG_ASSERT in DirectoryDAO::relocateDirectory and relocation will fail silently.
See #12715
For both directions I also hit this assertion in
mixxx::Fileinfo
), probably when trying to load cover arts.(note #12436 which adds some feedback to directory operations)
Simple fix:
avoid the string -> fileInfo -> string roundtrip and simply use QStrings for the entire display/relocation flow.
Just the 'oldDirectory' test needs to be fixed.
Or, does it? Actually it's now the same path returned by
DirectoryDAO::getRootDirStrings()
, so if it was changed on the roundtrip the query will fail 馃しNote for testing with a db from another OS:
You need to build with DEBUG_ASSERTIONS_FATAL=OFF, otherwise you'll hit them in fileinfo.h when the library tries to display cover art.
This also prevents building helpful migration tests.