1 Racket uses checksums to test if it needs to recompile its source
2 files to bytecode. If Racket is updated by grafting, the source and
3 bytecode files get updated, but the checksum stays the same. Since
4 the checksum no longer matches the source file, Racket tries to
5 regenerate the bytecode and write it to the store, causing errors
6 because the store is immutable. This patch makes Racket ignore
7 checksums for files in the store.
9 See <https://debbugs.gnu.org/30680> for details.
11 diff -ruN racket-6.12/collects/compiler/cm.rkt racket-6.12-patched/collects/compiler/cm.rkt
12 --- racket-6.12/collects/compiler/cm.rkt 1969-12-31 19:00:00.000000000 -0500
13 +++ racket-6.12-patched/collects/compiler/cm.rkt 2018-08-12 06:36:46.061142149 -0400
24 (list src-hash recorded-hash)))
26 +(define (store-reference? path)
27 + (let ([store-prefix (or (getenv "NIX_STORE") "/gnu/store")])
28 + (string-prefix? (path->string path) store-prefix)))
31 (if (path-has-extension? p #".rkt")
32 (path-replace-extension p #".ss")
34 (trace-printf "newer src... ~a > ~a" path-time path-zo-time)
35 ;; If `sha1-only?', then `maybe-compile-zo' returns a #f or thunk:
36 (maybe-compile-zo sha1-only? deps path->mode roots path orig-path read-src-syntax up-to-date collection-cache new-seen)]
37 - [(different-source-sha1-and-dep-recorded path deps)
38 + [(and (not (store-reference? path))
39 + (different-source-sha1-and-dep-recorded path deps))
40 => (lambda (difference)
41 (trace-printf "different src hash... ~a" difference)
42 ;; If `sha1-only?', then `maybe-compile-zo' returns a #f or thunk: