[Git][reproducible-builds/reprotest][main] 2 commits: Fix fileordering test for all filesystems including the likes of ZFS which...

Holger Levsen (@holger) gitlab at salsa.debian.org
Mon Sep 21 10:37:03 UTC 2026



Holger Levsen pushed to branch main at Reproducible Builds / reprotest


Commits:
8e4beb65 by cen.is.imba at gmail.com at 2026-09-21T12:33:57+02:00
Fix fileordering test for all filesystems including the likes of ZFS which could return a different order across two builds due to build being done in a different dir. (MR: !28)

(cherry picked from commit b4d0dab986465fc7e5b30dc85abd3e2d12faa903)
Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
0f77715a by Holger Levsen at 2026-09-21T12:36:07+02:00
d/copyright: fix old FSF address, thanks lintian.

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


2 changed files:

- debian/copyright
- tests/mock_build.py


Changes:

=====================================
debian/copyright
=====================================
@@ -45,9 +45,7 @@ License: GPL-2+
  GNU General Public License for more details.
  .
  You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
  .
  On Debian systems, the complete text of the GNU General
  Public License version 3 can be found in "/usr/share/common-licenses/GPL-2".


=====================================
tests/mock_build.py
=====================================
@@ -36,13 +36,46 @@ if __name__ == '__main__':
     if 'build_path' in captures:
         output.append(os.getcwd())
     if 'fileordering' in captures:
-        # Ensure this temporary directory is created in the disorders
+        # Ensure this temporary directory is created in the disorderfs
         # mount point by passing the dir argument.
         with tempfile.TemporaryDirectory(dir=str(pathlib.Path.cwd())) as temp:
             test_file_order = pathlib.Path(temp)
             for i in range(20):
                 str((test_file_order/str(i)).touch())
-            output.extend(p.name for p in test_file_order.iterdir())
+            '''
+            Reprotest does one control build and one experiment build (with disorderfs).
+            When disorderfs is enabled, we expect the outputs to differ and the test passes.
+
+            When disorderfs is disabled, it is wrong to assume that native-fs will return
+            the same order across different directories. It might be deterministic on ext4
+            but there are other filesystems which might not be.
+
+            ZFS will return the same order when calling iterdir multiple times from
+            within THE SAME directory, however, each build uses a different dir.
+            Build 1 could be in /tmp/tmp8f2k9x3a/ and build 2 in /tmp/tmpz7y1w4b2/.
+            Due to ZFS internals, the order returned from these different dirs might differ.
+
+            To avoid this issue, instead of simply returning the filenames we return a result of
+            whether two iterdir calls returned files in the same positions. Disorderfs
+            will naturally scramble this but others will not.
+
+            Example ZFS:
+            Build 1 (in /tmp/tmp8f2k9x3a/):
+              1st iterdir() -> 3, 1, 0, 2
+              2nd iterdir() -> 3, 1, 0, 2
+              Output: 0, 1, 2, 3
+
+            Build 2 (in /tmp/tmpz7y1w4b2/):
+              1st iterdir() -> 2, 0, 3, 1  # different dir, different native order
+              2nd iterdir() -> 2, 0, 3, 1
+              Output: 0, 1, 2, 3
+
+            Build 1 output == Build 2 output, success.
+
+            ext4 just returns the same order on each iterdir and across each build so that's also fine.
+            '''
+            positions = {p.name: i for i, p in enumerate(test_file_order.iterdir())}
+            output.extend(positions[p.name] for p in test_file_order.iterdir())
     if 'domain_host' in captures:
         output.append(platform.node())
     if 'home' in captures:



View it on GitLab: https://salsa.debian.org/reproducible-builds/reprotest/-/compare/5e49f8d13325a0d25d3066270540f922c21c7aa2...0f77715a5c1829db43f3571db200b9bdbbc189f4

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/reprotest/-/compare/5e49f8d13325a0d25d3066270540f922c21c7aa2...0f77715a5c1829db43f3571db200b9bdbbc189f4
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20260921/964e3b63/attachment.htm>


More information about the rb-commits mailing list