[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rust reprodubility -- .rmeta and shadow-rs

From: Maxime Devos
Subject: Rust reprodubility -- .rmeta and shadow-rs
Date: Sun, 26 Jun 2022 09:54:29 +0200
User-agent: Evolution 3.38.3-1


There was some mail about irreproducibility in Rust, but I couldn't
find it anymore.  Anyway, I found a potential cause: rust-shadow-rs
embeds timestamps (even though it nominally respects
SOURCE_DATE_EPOCH???) and the ordering of definitions it generates is
based on a hash map (and hence, irreproducible).

The crate id is based on a hash over the source code, so this
irreproducibility can cause build failures if substitutes are used.

By removing the time stamp and sorting the definitions, 'nushell'
successfully built on whereas it previously failed to
build on but built successfully locally (with
antioxidant), and IIRC the (antioxidated) 'rust-nu-command' is now

Anyway, here the patch I used:

     ,#~((add-after 'unpack 'fixup-source-date-epoch
           (lambda _
             ;; TODO: it nominally supports SOURCE_DATE_EPOCH, yet something 
things go wrong,
             ;; as the still contains the unnormalised time stamp ...
             ;; For now, do a work-around.
             (substitute* '("src/" "src/")
                (object->string "[timestamp expunged for reproducibility]"))
                "\"[timestamp expunged for reproducibility]\".to_string()")
               (("time\\.to_rfc3339_opts\\(SecondsFormat::Secs, true)")
                "\"[timestamp expunged for reproducibility]\".to_string()")
                "\"[timestamp expunged for reproducibility]\".to_string()"))))
         (add-after 'unpack 'more-reproducibility ;; by default, it uses a 
hashmap, leading to an irreproducible ordering in and hence an 
irreproducible .rmeta (TODO: upstream?)
           (lambda _
             (substitute* "src/" ; sort
               (("\\(k, v\\) in self\\.map\\.clone\\(\\)")
                "(k, v) in 
               (("self\\.write_const\\(k, v\\)") "self.write_const(k, 

Maybe that was the cause?


Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]