Fix #6: check path matches, rather than blindly selecting metadata#7
Open
joshbarrass wants to merge 1 commit intox1ppy:masterfrom
Open
Fix #6: check path matches, rather than blindly selecting metadata#7joshbarrass wants to merge 1 commit intox1ppy:masterfrom
joshbarrass wants to merge 1 commit intox1ppy:masterfrom
Conversation
Author
|
In my tests, I have tested:
If there are any other test cases that would be worth looking at, let me know and I will try them. |
powerarmorpatch
pushed a commit
to powerarmorpatch/freezetag
that referenced
this pull request
May 26, 2023
… audio data Author: joshbarrass x1ppy#7 reezetag seems to support tracks with identical audio but different metadata when thawing (each checksum is mapped to an array of files, and will then restore the correct metadata for each). However, when using the mount command, only the one file is restored properly; all subsequent files will be given this file's metadata.
|
@joshbarrass Added this to my fork. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6 by checking the path within each entry with a matching checksum to ensure it matches the path of the file we're currently opening. Tested and confirmed working on Linux, and should work on any Posix system. Needs testing on Windows.
More Detailed Explanation
Previously, it was assumed in freezefs that the first freezetag entry with a matching checksum corresponded to the correct metadata. However, this is not a valid assumption, and this edge case is correctly handled by the
thawcommand but not by themountcommand. To rectify this, thetarget_pathis generated from the path stored in thefrozen_entry, which is of the form/freezetag_root/path/to/file.ext. Correct me if this assumption is wrong, but from my testing it seems that any file referenced by a freezetag file, regardless of where it is stored on the real filesystem or where it is stored relative to the freezetag file, is added to the freezefs at its relative path from the root directory stored in the freezetag file (though one possible edge case I can think of is a freezetag file where the root is/). The first two components of this path,/andfreezetag_rootare removed, and the remaining parts,path,toandfile.extare joined intopath/to/file.ext. This matches the form of the path in each entry offreezetag.data.frozen.files, so we can compare the two paths whenever the checksum matches to ensure we are selecting the correct metadata.This solution will need testing on Windows, as I am not sure whether joining the parts of the path using the
/character is appropriate. I am not sure exactly how thefreezetag.data.frozen.filespaths are represented on a Windows system. It may be necessary to join the paths usingos.path.sepinstead. Unfortunately, I do not have a Windows computer to hand with the correct environment to test this myself, so if someone else could test this, that would be great.