Skip to content

Sort hash tables and directory entries more deterministically

Simon McVittie requested to merge wip/smcv/deterministic-order into main

This will be helpful if we want to make log files or other output more easily comparable when there are items that appear in arbitrary order.

Helps: steamrt/tasks#187

/cc @Sonicadvance1 - you might find this useful for comparing logs between dissimilar devices and narrowing down which one of several differences might contribute to causing steamrt/tasks#187.

@denittis: This is ready for review, but it's relatively intrusive and so I'm not intending to include it in the next round of betas.


  • pv-runtime: Add an option to make log output etc. more deterministic

  • pv-environ: Reuse a generic sorting function

  • pv-runtime: Optionally delete unwanted files in lexicographic order

    This makes it easier to diff two log files.

  • pv-runtime: Optionally select library-related data deterministically

    If we don't have any better way to choose an implementation, using lexicographic order makes it a little easier to compare log files.

  • pv-runtime: Optionally process gconv modules in deterministic order

    This makes it a little easier to compare log files.

  • pv-runtime: Optionally sort DRI search paths deterministically

    This makes it a little easier to compare log files.

  • utils: Add a variant of GLnxDirFdIterator which can sort filenames

  • tests: Test directory iteration

  • pv-bwrap: When binding a /usr directory, sort lexicographically

    We expect that the number of files and directories directly below /usr or in the root filesystem is small, so they are sorted unconditionally.

  • graphics-drivers: Use shared implementation of sorted directory iteration

  • direct-input-device: Sort hidraw and evdev devices "naturally"

    We discover input devices that were already plugged in during initialization in an arbitrary order, but for better reproducibility, we might as well sort them "naturally" (hidraw0 < hidraw2 < hidraw10). GNU versionsort() provides the desired order.

  • pv-wrap: Optionally process filesystems in a deterministic order

    This will make it easier to compare log files from different runs.

  • pv-runtime: Optionally GC old directories in deterministic order

  • pv-runtime: Set a deterministic order for directory listings if requested

  • pv-runtime: Optionally GC old directories in deterministic order

  • pv-runtime: Optionally set up merged-/usr symlinks in deterministic order

  • pv-runtime: Optionally bind-mount runtime in deterministic order

  • pv-runtime: Optionally iterate final directory tree in deterministic order

Edited by Simon McVittie

Merge request reports

Loading