From bd71b8e315feb8d29eab1ad92fc297a8272388d0 Mon Sep 17 00:00:00 2001
From: Torsten Grote <t@grobox.de>
Date: Thu, 16 May 2019 14:21:45 -0300
Subject: [PATCH] Remove deterministic filesystem and make it non-deterministic
 instead

---
 .gitlab-ci.yml |  2 +-
 README.md      | 12 +++++++++---
 reproduce.py   |  4 ++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8c06f42..a76cae4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -30,7 +30,7 @@ test_success:
   script:
   # Consider adding the cap and the device directly to the CI config
   # https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-docker-section
-    - docker run --cap-add SYS_ADMIN --device /dev/fuse ${TEST_IMAGE} ./reproduce.py release-1.0.12
+    - docker run --cap-add SYS_ADMIN --device /dev/fuse ${TEST_IMAGE} ./reproduce.py release-1.1.7
   except:
     - triggers
 
diff --git a/README.md b/README.md
index 6019ef2..cde0aee 100644
--- a/README.md
+++ b/README.md
@@ -88,6 +88,12 @@ You can find a list of tags in Briar's
 [source code repository](https://code.briarproject.org/akwizgran/briar/tags).
 
 The `SYS_ADMIN` capability and the `fuse` device are required,
-so the container can build the app inside a `disorderfs`.
-We hope to be able to drop this requirement
-once this [upstream issue](https://issuetracker.google.com/issues/110237303) is fixed.
\ No newline at end of file
+so the container can build the app inside a `disorderfs` which shuffles the filesystem.
+
+## Historical Changes
+
+* Before version `1.1.7`, Briar needed a deterministic files system
+  to work around an [Android build system bug](https://issuetracker.google.com/issues/110237303)
+  which broke reproducibility.
+  An [old version of briar-reproducer](https://code.briarproject.org/briar/briar-reproducer/tags/pre-1.1.7)
+  can be used to verify these releases.
diff --git a/reproduce.py b/reproduce.py
index cc3acbc..211254b 100755
--- a/reproduce.py
+++ b/reproduce.py
@@ -27,10 +27,10 @@ def main():
     reference_apk = "briar-%s.apk" % version
     check_call(['wget', '--no-verbose', url, '-O', reference_apk])
 
-    # use deterministic file system for building the app
+    # use non-deterministic file system for building the app to detect issues
     if not os.path.exists(BUILD_DIR):
         os.makedirs(BUILD_DIR)
-    check_call(['disorderfs', '--sort-dirents=yes', '--reverse-dirents=no', REPO_DIR, BUILD_DIR])
+    check_call(['disorderfs', '--shuffle-dirents=yes', REPO_DIR, BUILD_DIR])
 
     # build the app
     check_call(["./gradlew", "--no-daemon", GRADLE_TASK], cwd=BUILD_DIR)
-- 
GitLab