forked from erwint/libdmg-hfsplus
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[attribute] When updating attribution, zero out the anchor/sentinel p…
…rior to placing the new value in This ensures that attribution codes that are shorter than the anchor/sentinel will not be mangled.
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Make sure we have a fresh build: | ||
|
||
$ export BUILDDIR=$TESTDIR/../build | ||
$ cd $BUILDDIR | ||
$ make 2> /dev/null >/dev/null | ||
$ cd $CRAMTMP | ||
|
||
Prepare content and the attribution code: | ||
$ mkdir stagedir | ||
$ echo "content-a" >> stagedir/a | ||
$ sentinel="__MOZILLA__attribution-code" | ||
$ attribution_code="short" | ||
|
||
Create the filesystem with the sentinel value in the attribute: | ||
|
||
$ mkdir output | ||
$ cp $TESTDIR/empty.hfs output/short.hfs | ||
$ $BUILDDIR/hfs/hfsplus output/short.hfs add stagedir/a a | ||
$ $BUILDDIR/hfs/hfsplus output/short.hfs setattr a attr-key "$sentinel" | ||
|
||
Build a DMG: | ||
|
||
$ $BUILDDIR/dmg/dmg build output/short.hfs output/short.dmg "$sentinel" >/dev/null | ||
|
||
Now attribute: | ||
|
||
$ $BUILDDIR/dmg/dmg attribute output/short.dmg output/short-attributed.dmg "__MOZILLA__" "$attribution_code" >/dev/null | ||
|
||
Extract the HFS from the attributed DMG, and check to see if the code is correct: | ||
|
||
$ $BUILDDIR/dmg/dmg extract output/short-attributed.dmg output/short-attributed.hfs >/dev/null | ||
$ $BUILDDIR/hfs/hfsplus output/short-attributed.hfs getattr a attr-key | tr -d '\0' | ||
short (no-eol) |