From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gEgQBBTYbmBkbAAAgWs5BA (envelope-from ) for ; Thu, 08 Apr 2021 12:16:52 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id oOWkORPYbmBhEQAA1q6Kng (envelope-from ) for ; Thu, 08 Apr 2021 10:16:51 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2364A276A0 for ; Thu, 8 Apr 2021 12:16:50 +0200 (CEST) Received: from localhost ([::1]:53454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lURiS-0007ZN-2z for larch@yhetil.org; Thu, 08 Apr 2021 06:16:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lURfo-0004Hg-2L for bug-guix@gnu.org; Thu, 08 Apr 2021 06:14:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34495) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lURfm-0000Hr-78 for bug-guix@gnu.org; Thu, 08 Apr 2021 06:14:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lURfm-00005q-23 for bug-guix@gnu.org; Thu, 08 Apr 2021 06:14:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#33848: Store references in SBCL-compiled code are "invisible" Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 08 Apr 2021 10:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33848 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Mark H Weaver Received: via spool by 33848-submit@debbugs.gnu.org id=B33848.1617876830333 (code B ref 33848); Thu, 08 Apr 2021 10:14:02 +0000 Received: (at 33848) by debbugs.gnu.org; 8 Apr 2021 10:13:50 +0000 Received: from localhost ([127.0.0.1]:46041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lURfa-00005I-4u for submit@debbugs.gnu.org; Thu, 08 Apr 2021 06:13:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46538) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lURfY-00004y-9z for 33848@debbugs.gnu.org; Thu, 08 Apr 2021 06:13:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37374) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lURfP-00005Z-UQ; Thu, 08 Apr 2021 06:13:40 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=58442 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lURfP-00057c-Gj; Thu, 08 Apr 2021 06:13:39 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87r2e8jpfx.fsf@gnu.org> <87o9979gfn.fsf@gnu.org> <87tvizgghs.fsf@ambrevar.xyz> <87k1juaomo.fsf@gnu.org> <87muoqhk62.fsf@ambrevar.xyz> <87zhsq8wkj.fsf@gnu.org> <87d0pmhbgn.fsf@ambrevar.xyz> <87r2e28tkv.fsf@gnu.org> <874laygkiy.fsf@ambrevar.xyz> <87lfa5eymf.fsf@ambrevar.xyz> <87tuoscsk9.fsf@gnu.org> <87im57b8u7.fsf@ambrevar.xyz> <87czvebky2.fsf@netris.org> <87eefu30a4.fsf@gnu.org> <87im56l6es.fsf@yamatai> <87wntm8j18.fsf@ambrevar.xyz> <87a6qil4b1.fsf@yamatai> <87a6qiz5b3.fsf@ambrevar.xyz> <871rbtc3j5.fsf@netris.org> <87r1js9udv.fsf@netris.org> <87h7kj7j7x.fsf@netris.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 Germinal an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 08 Apr 2021 12:13:37 +0200 In-Reply-To: <87h7kj7j7x.fsf@netris.org> (Mark H. Weaver's message of "Tue, 06 Apr 2021 07:19:51 -0400") Message-ID: <87ft01axta.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pierre Neidhardt , 33848@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1617877011; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=Le1lwvjm90Wn1ritxa22KijCis8ovMS1Tvk5r16si4A=; b=KXciJ+tL1BV23hzvz4MIGZUcfNQws2U6BMqQL/8FjtGBrtfPSpHAr1bguC74Mcp96QIAXg bjt9kcWQguu39Pd+t5jBMim9Annq9mQ900l70R49mF5NQ/i4JeyM30vn0HNRsI3q/aA7nV Ci1b07aYJG/Pkiq9ZwoB1J9Boe3ScJ3HG2L6RFfQw0vQ4qTnNldy646xgpBYVXkEnx3Dcm YxD2QYyqB9J0qizIbuqThOoeGn6nFwiUtkEA+MKQClCjTGPLg9W2UKSH3zpwK62iMhPAv/ tHE1HFnXKBBVznAVcicGfuUnUlul3jfAfOioXPQrJgQ5/RxX7rheF7CtgfyHmA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1617877011; a=rsa-sha256; cv=none; b=MLO9PDpUB5U9jkcfwoDYvZyMtVDl18CL8d3mUOZoN0ELHr21hxSvVF/04FTMrZWBU7jV1R hGBB6+eLyCGELUpiiAVPmO+ttz/u8fc4YdDOH75pQvrU/gkoMob59CvhO2j4uLP74+V63g KudWm0kFrvkrDmDa7dsJdgWgWussqkxTGP1bRbokfjAA7UrCHQ/Dspw4cmsdEK90Yj/zfw kyp64qEopxCUAdQTvIZOvBwl5NCPn7w03OVkkaWVEJhSzcHhpPc5HLHInpmyTtUbAORR7c zeO4os9UrrmM8p/aQ7LCGbcm6xw+Vue+7NIUMZpLC/Lc7C+lR7M8eR8mlgLNqA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: -2.94 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 2364A276A0 X-Spam-Score: -2.94 X-Migadu-Scanner: scn0.migadu.com X-TUID: XX+yWrwMz0AS Hi Mark, Mark H Weaver skribis: > From 6eec36e66d20d82fe02c6de793422875477b90d8 Mon Sep 17 00:00:00 2001 > From: Mark H Weaver > Date: Fri, 2 Apr 2021 18:36:23 -0400 > Subject: [PATCH] DRAFT: grafts: Support rewriting UTF-16 and UTF-32 store > references. > > * guix/build/graft.scm (replace-store-references): Add support for > finding and rewriting UTF-16 and UTF-32 store references. > * tests/grafts.scm: Add tests. Please add a =E2=80=9CFixes=E2=80=9D line in the commit log. I=E2=80=99m not reviewing the code in depth and I trust your judgment. The risks of bugs I can think of are: missed ASCII references (a regression, whereby some ASCII references would not get rewritten), and unrelated UTF-{16,32}-base32-looking references getting rewritten. I guess the latter is very unlikely because only sequences found in the replacement table may be rewritten, right? The former should be caught by =E2=80=98tests/grafts.scm=E2=80=99 but we co= uld also check the closure of real-world systems, for instance, to make sure it doesn=E2=80=99t refer to ungrafted things. Do you know how this affects performance? Some superficial comments: > +(define (possible-utf16-hash? buffer i w) > + (and (<=3D (* 2 hash-length) (- i w)) > + (let loop ((j (+ 1 (- i (* 2 hash-length))))) > + (or (>=3D j i) > + (and (zero? (bytevector-u8-ref buffer j)) > + (loop (+ j 2))))))) > + > +(define (possible-utf32-hash? buffer i w) > + (and (<=3D (* 4 hash-length) (- i w)) > + (let loop ((j (+ 1 (- i (* 4 hash-length))))) > + (or (>=3D j i) > + (and (zero? (bytevector-u8-ref buffer j)) > + (zero? (bytevector-u8-ref buffer (+ j 1))) > + (zero? (bytevector-u8-ref buffer (+ j 2))) > + (loop (+ j 4))))))) > + > +(define (insert-nuls char-size bv) Perhaps add short docstrings for clarity. > +(for-each > + (lambda (char-size1) > + (for-each > + (lambda (char-size2) > + (for-each > + (lambda (gap) > + (for-each > + (lambda (offset) > + (test-equal (format #f "replace-store-references, char-sizes = ~a ~a, gap ~s, offset ~a" > + char-size1 char-size2 gap offset) > + (string-append (make-string offset #\=3D) > + (nul-expand (string-append "/gnu/store/" > + (make-string 32 #= \6) > + "-BlahBlaH") > + char-size1) > + gap > + (nul-expand (string-append "/gnu/store/" > + (make-string 32 #= \8) > + "-SoMeTHiNG") > + char-size2) > + (list->string (map integer->char (iota 77 33= )))) > + > + ;; Create input data where the right-hand-size of the dash = ("-something" > + ;; here) goes beyond the end of the internal buffer of > + ;; 'replace-store-references'. > + (let* ((content (string-append (make-string offset #\= =3D) > + (nul-expand (string-appe= nd "/gnu/store/" > + = (make-string 32 #\5) > + = "-blahblah") > + char-size1) > + gap > + (nul-expand (string-appe= nd "/gnu/store/" > + = (make-string 32 #\7) > + = "-something") > + char-size2) > + (list->string > + (map integer->char (iot= a 77 33))))) > + (replacement (alist->vhash > + `((,(make-string 32 #\5) > + . ,(string->utf8 (string-append > + (make-string 32 #= \6) > + "-BlahBlaH"))) > + (,(make-string 32 #\7) > + . ,(string->utf8 (string-append > + (make-string 32 #= \8) > + "-SoMeTHiNG")))))= )) > + (call-with-output-string > + (lambda (output) > + ((@@ (guix build graft) replace-store-references) > + (open-input-string content) output > + replacement > + "/gnu/store")))))) > + ;; offsets to test > + (map (lambda (i) (- buffer-size (* 40 char-size1) i)) > + (iota 30)))) > + ;; gaps > + '("" "-" " " "a"))) > + ;; char-size2 values to test > + '(1 2))) > + ;; char-size1 values to test > + '(1 2 4)) For clarity, perhaps you can define a top-level procedure for the test and call it from =E2=80=98for-each=E2=80=99. Modulo these very minor issues, it looks like it=E2=80=99s ready to go! Thank you, Ludo=E2=80=99.