>> ice-9/boot-9.scm:106:20: string contains #\nul character: > Yes, that is expected. ‘substitute*’ is for textual files. > ‘fold-port-matches’ from (guix build utils) can be used for binary files > (see ‘remove-store-references’ for an example use.) Here’s what I’m trying to use: (use-modules (srfi srfi-14) (guix build utils) (rnrs bytevectors) (rnrs io ports)) (define (binary-substitute file old new) "Replace an OLD string with a NEW one in FILE." (with-atomic-file-replacement file (lambda (in out) (format #t "replacing '~a' with '~a' in '~a'...~%" old new file) (fold-port-matches (lambda (match result) (put-bytevector out (string->utf8 new)) #t) #f old in (lambda (char result) (put-u8 out (char->integer char)) result))))) If you compile this program: #include int main() { printf("Hello, world!\n"); return 0; } and try to replace “Hello” with “Hallo,” it will work. If strings are not equally sized, ‘a.out’ will crash with a segfault. I’m not sure how to proceed and fail to find any howtos. Is there a tool that I could use?