-
Notifications
You must be signed in to change notification settings - Fork 121
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
Squashfs: fix error format when file larger than block size #287
Conversation
52b3567
to
0ae63bc
Compare
@deitch Hey, now it passes with your test case, so I include the 2 test commits |
I really would have enjoyed having you around when I was trying to figure out how squashfs worked under the covers. Happy to have you now, though. Can you rebase this on master, so it includes just your changes, not the first 2 commits? |
Due to SquashFS, the first field of both File inode and extended file inode is called 'blocks start', that means ``` The offset from the start of the archive to the first data block. ``` Link https://dr-emann.github.io/squashfs/squashfs.html#_file_inodes Signed-off-by: Xynnn007 <[email protected]>
The granularity of fragment data writing is block, so we don't need to return an unaligned fragment amount but 'sized chunks' everytime we write a fragmentdata block, the variable location should be added with a size of 'blocksize', which means that we have written a new fragment block. The variable `location` will be reused to tell new accumulated fragmentblocks position. Signed-off-by: Xynnn007 <[email protected]>
The variable fragmentData is used to record if the current fragment data is enough to occupy a block. Once a block is written, it should be cleared for a new round of loop. Signed-off-by: Xynnn007 <[email protected]>
Due to spec, frag index of file inode https://dr-emann.github.io/squashfs/squashfs.html#_file_inodes ``` An index into the Fragment Table which describes the fragment block that the tail end of this file is stored in. If not used, this is set to 0xFFFFFFFF. ``` Signed-off-by: Xynnn007 <[email protected]>
Signed-off-by: Xynnn007 <[email protected]>
Rebased. |
Great, thanks. I will rebase my test on it. |
@deitch Shall we cut another release for this? We downstream can depend on the bug fix |
Sure. |
What do you use it for downstream? |
v1.5.2 on its way |
https://dr-emann.github.io/squashfs/squashfs.html#_file_inodes
Due to SquashFS spec, file inode's 'blocks start' field means the offset from the beginning of the file.
This commit also fixes the fragmentData location calculation.
Finally, due to Spec, if a file does not have fragment data, its frag index should be all 0xF.
Fixes #282