Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build

Commits:

8 changed files:

Changes:

  • projects/browser/ddmg.sh
    1
    +#!/bin/bash
    
    2
    +set -e
    
    3
    +
    
    1 4
     [% SET src = c('dmg_src', { error_if_undef => 1 }) -%]
    
    2 5
     find [% src %] -executable -exec chmod 0755 {} \;
    
    3 6
     find [% src %] ! -executable -exec chmod 0644 {} \;
    
    ... ... @@ -18,7 +21,14 @@ newfs_hfs -v "[% c("var/Project_Name") %]" "\$hfsfile"
    18 21
     
    
    19 22
     pushd [% src %]
    
    20 23
     
    
    21
    -hfsplus "\$hfsfile" addall .
    
    24
    +find -type d -mindepth 1 | sed -e 's/^\.\///' | sort | while read dirname; do
    
    25
    +  hfsplus "\$hfsfile" mkdir "/\$dirname"
    
    26
    +  hfsplus "\$hfsfile" chmod 0755 "/\$dirname"
    
    27
    +done
    
    28
    +find -type f | sed -e 's/^\.\///' | sort | while read filename; do
    
    29
    +  hfsplus "\$hfsfile" add "\$filename" "/\$filename"
    
    30
    +  hfsplus "\$hfsfile" chmod \$(stat --format '0%a' "\$filename") "/\$filename"
    
    31
    +done
    
    22 32
     # hfsplus does not play well with dangling links
    
    23 33
     hfsplus "\$hfsfile" symlink /Applications /Applications
    
    24 34
     # Show the volume icon
    

  • projects/hfsplus-tools/build
    ... ... @@ -8,7 +8,7 @@ export PATH="/var/tmp/dist/clang/bin:$PATH"
    8 8
     tar -xf diskdev_cmds-[% c("version") %].tar.gz
    
    9 9
     cd diskdev_cmds-[% c("version") %]
    
    10 10
     
    
    11
    -patch -p1 < $rootdir/only-newfs_include.diff
    
    11
    +patch -p1 < $rootdir/newfs_hfs.diff
    
    12 12
     
    
    13 13
     make -j[% c("num_procs") %]
    
    14 14
     
    

  • projects/hfsplus-tools/config
    ... ... @@ -16,6 +16,7 @@ input_files:
    16 16
       # The project uses a flag that is not supported by GCC
    
    17 17
       - name: clang
    
    18 18
         project: clang
    
    19
    -  # Build only newfs (we do not care of fsck), and remove a header that does not
    
    20
    -  # exist on Linux (at that path) and is not required on Linux either.
    
    21
    -  - filename: only-newfs_include.diff
    19
    +  # Build only newfs (we do not care of fsck), remove a header that does not
    
    20
    +  # exist on Linux (at that path) and is not required on Linux either, and make
    
    21
    +  # the UUID deterministic.
    
    22
    +  - filename: newfs_hfs.diff

  • projects/hfsplus-tools/only-newfs_include.diffprojects/hfsplus-tools/newfs_hfs.diff
    1 1
     diff '--color=auto' -Naur diskdev_cmds-540.1.linux3_orig/Makefile diskdev_cmds-540.1.linux3/Makefile
    
    2
    ---- diskdev_cmds-540.1.linux3_orig/Makefile	2023-01-13 10:01:32.474525600 +0100
    
    3
    -+++ diskdev_cmds-540.1.linux3/Makefile	2023-01-13 10:01:50.346876760 +0100
    
    2
    +--- diskdev_cmds-540.1.linux3_orig/Makefile	2023-01-17 11:36:56.341279443 +0100
    
    3
    ++++ diskdev_cmds-540.1.linux3/Makefile	2023-01-17 11:44:12.496479981 +0100
    
    4 4
     @@ -3,7 +3,7 @@
    
    5 5
      CC := clang
    
    6 6
      CFLAGS := -g3 -Wall -fblocks -I$(PWD)/BlocksRunTime -I$(PWD)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"$(VERSION)\"
    
    7 7
      LDFLAGS := -Wl,--build-id -L$(PWD)/BlocksRunTime
    
    8 8
     -SUBDIRS := BlocksRunTime newfs_hfs.tproj fsck_hfs.tproj
    
    9 9
     +SUBDIRS := newfs_hfs.tproj
    
    10
    -
    
    10
    + 
    
    11 11
      all clean:
    
    12 12
      	for d in $(SUBDIRS); do $(MAKE) -C $$d -f Makefile.lnx $@; done
    
    13 13
     diff '--color=auto' -Naur diskdev_cmds-540.1.linux3_orig/newfs_hfs.tproj/makehfs.c diskdev_cmds-540.1.linux3/newfs_hfs.tproj/makehfs.c
    
    14
    ---- diskdev_cmds-540.1.linux3_orig/newfs_hfs.tproj/makehfs.c	2023-01-13 10:01:32.474525600 +0100
    
    15
    -+++ diskdev_cmds-540.1.linux3/newfs_hfs.tproj/makehfs.c	2023-01-13 10:02:07.899221800 +0100
    
    14
    +--- diskdev_cmds-540.1.linux3_orig/newfs_hfs.tproj/makehfs.c	2023-01-17 11:36:56.341279443 +0100
    
    15
    ++++ diskdev_cmds-540.1.linux3/newfs_hfs.tproj/makehfs.c	2023-01-17 11:58:15.972059719 +0100
    
    16 16
     @@ -38,8 +38,8 @@
    
    17 17
      #endif
    
    18 18
      #include <sys/errno.h>
    
    ... ... @@ -22,4 +22,17 @@ diff '--color=auto' -Naur diskdev_cmds-540.1.linux3_orig/newfs_hfs.tproj/makehfs
    22 22
     +#include <sys/sysctl.h>
    
    23 23
      #include <sys/vmmeter.h>
    
    24 24
      #endif
    
    25
    -
    25
    + 
    
    26
    +@@ -571,8 +571,10 @@
    
    27
    + 	/* Adjust free blocks to reflect everything we have allocated. */
    
    28
    + 	hp->freeBlocks -= blocksUsed;
    
    29
    + 
    
    30
    +-	/* Generate and write UUID for the HFS+ disk */
    
    31
    +-	GenerateVolumeUUID(&newVolumeUUID);
    
    32
    ++	/* Use a deterministic UUID for reproducibility */
    
    33
    ++	memset(&newVolumeUUID, 0, sizeof(newVolumeUUID));
    
    34
    ++	strncpy(&newVolumeUUID, defaults->volumeName, sizeof(newVolumeUUID));
    
    35
    ++
    
    36
    + 	finderInfoUUIDPtr = (VolumeUUID *)(&hp->finderInfo[24]);
    
    37
    + 	finderInfoUUIDPtr->v.high = OSSwapHostToBigInt32(newVolumeUUID.v.high); 
    
    38
    + 	finderInfoUUIDPtr->v.low = OSSwapHostToBigInt32(newVolumeUUID.v.low); 

  • projects/libdmg-hfsplus/build
    ... ... @@ -9,6 +9,7 @@ export PATH="/var/tmp/dist/ninja:/var/tmp/dist/cmake/bin:$PATH"
    9 9
     mkdir /var/tmp/build
    
    10 10
     tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
    
    11 11
     cd /var/tmp/build/[% project %]-[% c('version') %]
    
    12
    +patch -p1 < "$rootdir/libdmg.patch"
    
    12 13
     cmake . -GNinja -DCMAKE_BUILD_TYPE=Release
    
    13 14
     ninja -j[% c("num_procs") %] -v
    
    14 15
     
    

  • projects/libdmg-hfsplus/config
    ... ... @@ -16,3 +16,4 @@ input_files:
    16 16
         project: cmake
    
    17 17
       - name: ninja
    
    18 18
         project: ninja
    
    19
    +  - filename: libdmg.patch

  • projects/libdmg-hfsplus/libdmg.patch
    1
    +From d1a5eca891f32103ccda80ee75e158dfc7ece70d Mon Sep 17 00:00:00 2001
    
    2
    +From: Mike Perry <mikeperry-git@torproject.org>
    
    3
    +Date: Thu, 6 Mar 2014 19:47:05 -0800
    
    4
    +Subject: [PATCH] Memset a UDIF header to ensure archive reproducibility.
    
    5
    +
    
    6
    +Some of the struct padding and fields contained unitialized memory, which
    
    7
    +caused two successive invocations to produce archives that differed in some
    
    8
    +bytes.
    
    9
    +---
    
    10
    + dmg/dmglib.c | 6 ++++--
    
    11
    + 1 file changed, 4 insertions(+), 2 deletions(-)
    
    12
    +
    
    13
    +diff --git a/dmg/dmglib.c b/dmg/dmglib.c
    
    14
    +index f481b1f..b74e50b 100644
    
    15
    +--- a/dmg/dmglib.c
    
    16
    ++++ b/dmg/dmglib.c
    
    17
    +@@ -108,7 +108,8 @@ int buildDmg(AbstractFile* abstractIn, AbstractFile* abstractOut) {
    
    18
    + 	ChecksumToken dataForkToken;
    
    19
    + 	
    
    20
    + 	UDIFResourceFile koly;
    
    21
    +-	
    
    22
    ++	memset(&koly, 0, sizeof(koly));
    
    23
    ++
    
    24
    + 	off_t plistOffset;
    
    25
    + 	uint32_t plistSize;
    
    26
    + 	uint32_t dataForkChecksum;
    
    27
    +@@ -284,7 +285,8 @@ int convertToDMG(AbstractFile* abstractIn, AbstractFile* abstractOut) {
    
    28
    + 	uint64_t numSectors;
    
    29
    + 	
    
    30
    + 	UDIFResourceFile koly;
    
    31
    +-	
    
    32
    ++	memset(&koly, 0, sizeof(koly));
    
    33
    ++
    
    34
    + 	char partitionName[512];
    
    35
    + 	
    
    36
    + 	off_t fileLength;
    
    37
    +-- 
    
    38
    +1.8.1.2
    
    39
    +

  • tools/signing/ddmg.sh
    ... ... @@ -42,7 +42,14 @@ cd $src_dir
    42 42
     # add it back again with the special command to do so.
    
    43 43
     rm -f Applications
    
    44 44
     
    
    45
    -hfsplus "$hfsfile" addall .
    
    45
    +find -type d -mindepth 1 | sed -e 's/^\.\///' | sort | while read dirname; do
    
    46
    +  hfsplus "$hfsfile" mkdir "/$dirname"
    
    47
    +  hfsplus "$hfsfile" chmod 0755 "/$dirname"
    
    48
    +done
    
    49
    +find -type f | sed -e 's/^\.\///' | sort | while read filename; do
    
    50
    +  hfsplus "$hfsfile" add "$filename" "/$filename"
    
    51
    +  hfsplus "$hfsfile" chmod $(stat --format '0%a' "$filename") "/$filename"
    
    52
    +done
    
    46 53
     hfsplus "$hfsfile" symlink /Applications /Applications
    
    47 54
     # Show the volume icon
    
    48 55
     hfsplus "$hfsfile" attr / C