Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build Commits: 293435a3 by Pier Angelo Vendrame at 2026-11-19T13:39:09+01:00 Bug 41931: Refactor our patch to hfsplus-tools. With the toolchain update, our patch to hfsplus-tools did not build anymore because of a type mismatch. So, we took this opportunity to improve it, and use the volume creation time rather than the volume name to generate the UUID. That way, different releases will have a different UUID, which seems more correct for its purpose. The creation time was already there, but it used the current time. It worked because we use faketime for the DMG creation, but faketime is the last resort, having a CLI argument or an environment variable is a better solution, therefore we update our patch also to introduce one. Sadly, it is not enough to remove the dependency on faketime because other tools have the same behavior. - - - - - 4 changed files: - projects/browser/ddmg.sh - projects/hfsplus-tools/newfs_hfs.diff - tools/signing/ddmg.sh - tools/signing/functions Changes: ===================================== projects/browser/ddmg.sh ===================================== @@ -20,7 +20,7 @@ directories=$(find "$src_dir" -type d | wc -l) # Give some room to breathe size=$(echo $(($fileblocks + $directories)) | awk '{print int($1 * 1.1)}') dd if=/dev/zero of="$hfsfile" bs=4096 count=$size -newfs_hfs -v "[% c('var/display_name') %]" "$hfsfile" +newfs_hfs -v "[% c('var/display_name') %]" -t [% c('timestamp') %] "$hfsfile" pushd [% src %] ===================================== projects/hfsplus-tools/newfs_hfs.diff ===================================== @@ -23,16 +23,64 @@ diff '--color=auto' -Naur diskdev_cmds-540.1.linux3_orig/newfs_hfs.tproj/makehfs #include <sys/vmmeter.h> #endif -@@ -571,8 +571,10 @@ - /* Adjust free blocks to reflect everything we have allocated. */ +@@ -572,7 +572,18 @@ InitVH(hfsparams_t *defaults, UInt64 sec hp->freeBlocks -= blocksUsed; -- /* Generate and write UUID for the HFS+ disk */ + /* Generate and write UUID for the HFS+ disk */ - GenerateVolumeUUID(&newVolumeUUID); -+ /* Use a deterministic UUID for reproducibility */ -+ memset(&newVolumeUUID, 0, sizeof(newVolumeUUID)); -+ strncpy(&newVolumeUUID, defaults->volumeName, sizeof(newVolumeUUID)); -+ ++ /* ++ * createDate is a 32-bit integer, so spread its value around with ++ * https://rosettacode.org/wiki/Pseudo-random_numbers/Splitmix64 ++ */ ++ { ++ uint64_t z = defaults->createDate + 0x9e3779b97f4a7c15; ++ z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9; ++ z = (z ^ (z >> 27)) * 0x94d049bb133111eb; ++ z = z ^ (z >> 31); ++ newVolumeUUID.value[0] = (uint32_t)(z >> 32); ++ newVolumeUUID.value[1] = (uint32_t)z; ++ } finderInfoUUIDPtr = (VolumeUUID *)(&hp->finderInfo[24]); finderInfoUUIDPtr->v.high = OSSwapHostToBigInt32(newVolumeUUID.v.high); finderInfoUUIDPtr->v.low = OSSwapHostToBigInt32(newVolumeUUID.v.low); +diff '--color=auto' -rupN diskdev_cmds-540.1.linux3.orig/newfs_hfs.tproj/newfs_hfs.c diskdev_cmds-540.1.linux3/newfs_hfs.tproj/newfs_hfs.c +--- diskdev_cmds-540.1.linux3_orig/newfs_hfs.tproj/newfs_hfs.c 2026-11-18 09:58:18.436848140 +0100 ++++ diskdev_cmds-540.1.linux3/newfs_hfs.tproj/newfs_hfs.c 2026-11-18 10:21:37.246871550 +0100 +@@ -191,7 +191,7 @@ main(argc, argv) + progname = *argv; + + +- while ((ch = getopt(argc, argv, "G:J:D:M:N:PU:hsb:c:i:n:v:")) != EOF) ++ while ((ch = getopt(argc, argv, "G:J:D:M:N:PU:hsb:c:i:n:v:t:")) != EOF) + switch (ch) { + case 'G': + gGroupID = a_gid(optarg); +@@ -286,6 +286,10 @@ main(argc, argv) + #endif + break; + ++ case 't': ++ createtime = (time_t)strtoull(optarg, NULL, 10); ++ break; ++ + case '?': + default: + usage(); +@@ -763,7 +767,8 @@ hfs_newfs(char *device) + #endif + + dip.sectorOffset = 0; +- time(&createtime); ++ if (!createtime) ++ time(&createtime); + + /* Check to see if the disk is too big */ + u_int64_t secsize = (u_int64_t) dip.sectorSize; +@@ -1270,6 +1275,7 @@ void usage() + fprintf(stderr, "\t\tc=size (catalog b-tree)\n"); + fprintf(stderr, "\t\ta=size (attributes b-tree)\n"); + fprintf(stderr, "\t-v volume name (in ascii or UTF-8)\n"); ++ fprintf(stderr, "\t-t creation time (UNIX timestamp)\n"); + + fprintf(stderr, " examples:\n"); + fprintf(stderr, "\t%s -v Untitled /dev/rdisk0s7 \n", progname); ===================================== tools/signing/ddmg.sh ===================================== @@ -28,6 +28,7 @@ hfsfile="$dmg_tmpdir/tbb-uncompressed.dmg" export LD_PRELOAD=$faketime_path export FAKETIME="$browser_release_date" +release_timestamp=$(date -u -d "$browser_release_date" +%s) echo "Starting: " $(basename $dest_file) @@ -37,7 +38,7 @@ directories=$(find "$src_dir" -type d | wc -l) # Give some room to breathe size=$(echo $(($fileblocks + $directories)) | awk '{print int($1 * 1.1)}') dd if=/dev/zero of="$hfsfile" bs=4096 count=$size -newfs_hfs -v "$volume_label" "$hfsfile" +newfs_hfs -v "$volume_label" -t "$release_timestamp" "$hfsfile" cd $src_dir ===================================== tools/signing/functions ===================================== @@ -92,7 +92,7 @@ function setup_dmg_tools { "You can build it with:" \ " ./rbm/rbm build --target no_containers libdmg-hfsplus" \ "See var/deps in projects/libdmg-hfsplus/config for the list of build dependencies" - local hfstools_file="$script_dir/../../out/hfsplus-tools/hfsplus-tools-540.1.linux3-2acaa4.tar.zst" + local hfstools_file="$script_dir/../../out/hfsplus-tools/hfsplus-tools-540.1.linux3-722a62.tar.zst" test -f "$hfstools_file" || \ exit_error "$hfstools_file is missing." \ "You can build it with:" \ View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/29... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/29... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
Pier Angelo Vendrame (@pierov)