From patchwork Sat Nov 18 13:38:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liliana Marie Prikler X-Patchwork-Id: 56606 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CF88727BBEA; Sat, 18 Nov 2023 14:51:17 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 94C7F27BBE2 for ; Sat, 18 Nov 2023 14:51:11 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4Mf3-0004kO-4b; Sat, 18 Nov 2023 09:51:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r4Mf0-0004jw-MB for guix-patches@gnu.org; Sat, 18 Nov 2023 09:51:02 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r4Mf0-0003Pb-E6 for guix-patches@gnu.org; Sat, 18 Nov 2023 09:51:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r4Mez-00021O-L4; Sat, 18 Nov 2023 09:51:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67260] [PATCH emacs-team 2/2] gnu: emacs: Don't hash file names in native compilation. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, cox.katherine.e+guix@gmail.com, liliana.prikler@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 18 Nov 2023 14:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67260 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67260@debbugs.gnu.org Cc: andrew@trop.in, cox.katherine.e+guix@gmail.com, liliana.prikler@gmail.com X-Debbugs-Original-Xcc: andrew@trop.in, cox.katherine.e+guix@gmail.com, liliana.prikler@gmail.com Received: via spool by 67260-submit@debbugs.gnu.org id=B67260.17003190557753 (code B ref 67260); Sat, 18 Nov 2023 14:51:01 +0000 Received: (at 67260) by debbugs.gnu.org; 18 Nov 2023 14:50:55 +0000 Received: from localhost ([127.0.0.1]:47991 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4Met-00020z-1I for submit@debbugs.gnu.org; Sat, 18 Nov 2023 09:50:55 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:55336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4Mep-00020h-3I for 67260@debbugs.gnu.org; Sat, 18 Nov 2023 09:50:53 -0500 Received: by mail-wm1-x344.google.com with SMTP id 5b1f17b1804b1-40838915cecso3880065e9.2 for <67260@debbugs.gnu.org>; Sat, 18 Nov 2023 06:50:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700319044; x=1700923844; darn=debbugs.gnu.org; h=mime-version:to:subject:date:from:references:in-reply-to:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Sad4wUVKHvTTFjE+YLtLDIsXleZ32l4H4dUbEoKk2ZY=; b=YJ6qcNG9z0SG+hkG7Nc/thKvTd7ANBdIpnR8vpNNTslcKOCbQIOwM7j02opNsqiEO5 qU77NbYl20issGzhT/I4lkbHSC3mMoym+LsZvWdv3ElQamoNGcggjHgK0omx5AP5G9dh 1sfX9bdR7E7UJyKIjMTnlq6B06rQt4urufpL/EDurlizAn3rXGzr2OPw5VcpUYB+DaI0 VBhF2ml2ywzSWgu3663mUR5RyuzoQ+JoKj9rq5iq2oEGLD77MnRg+vTlmog26EdgH95i zt8cOSsQdR8ou77qGfUS8PiZnCNwKh8MMN3hsQnc1WlbXjc/Z44F+9GkP45IXCqCm1C0 JYQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700319044; x=1700923844; h=mime-version:to:subject:date:from:references:in-reply-to:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Sad4wUVKHvTTFjE+YLtLDIsXleZ32l4H4dUbEoKk2ZY=; b=EjivkUvjIUlyX6JdXHdPW22qq1lXDKnioZQQDgheMHDSlUe3P+UXyZ6Z/QJPffXfzM 9RcOBoqaY/Xaj14z9f8Zc3MUH7ZQeLqcRy/QpnSMQuQZmLZ4RHWNxmrsJNzlG5P7+rec 0DX9U643TC/F4LOkFaRiiD7kPsGJOhoiTsX+9PUKfnOYK7Jp0u+Gz1weqHPtyJAgGwk0 D5z+ROGJHFF1H5lbSO5IKCHZOQSVHQy19NCy7zVKer3rkJczTEQ9PEX0DvADdvUqsp7E vNkzvOOwRcjJySZHueFRd5rkcDhWkONT0DLAc/EPovZehtv0LjMS9te0ofRL6QyA+ymY f2vw== X-Gm-Message-State: AOJu0Yy2WOa4NMbWgeSYxIJqK9Ll55V48ngr2ZSbUSKFHxGT9RbcgTLn mRKOlRZhZp22U5FWQ5QPVuLyCAxFPDO4lw== X-Google-Smtp-Source: AGHT+IE/etGdnHB+jST5O9NgLxKm0D+rEBxTvg9mSN/2Hkej1tYOr5YJLTrRiEI7fevhnKgRBA8lTQ== X-Received: by 2002:a05:600c:19c9:b0:408:59d4:f3d8 with SMTP id u9-20020a05600c19c900b0040859d4f3d8mr1998893wmq.18.1700319043913; Sat, 18 Nov 2023 06:50:43 -0800 (PST) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id k18-20020a05600c0b5200b004065e235417sm10729115wmr.21.2023.11.18.06.50.42 for <67260@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 06:50:42 -0800 (PST) Message-ID: In-Reply-To: References: From: Liliana Marie Prikler Date: Sat, 18 Nov 2023 14:38:46 +0100 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/patches/emacs-native-comp-fix-filenames.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it here. * gnu/packages/emacs.scm (emacs-minimal)[source]: Use it here. Change-Id: I2b7f6b45742a985760f0097bb53910f068e3d8e5 --- gnu/local.mk | 1 + gnu/packages/emacs.scm | 1 + .../emacs-native-comp-fix-filenames.patch | 93 +++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch diff --git a/gnu/local.mk b/gnu/local.mk index 8d817379a7..e878551b37 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1111,6 +1111,7 @@ dist_patch_DATA = \ %D%/packages/patches/emacs-highlight-stages-add-gexp.patch \ %D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \ %D%/packages/patches/emacs-native-comp-driver-options.patch \ + %D%/packages/patches/emacs-native-comp-fix-filenames.patch \ %D%/packages/patches/emacs-next-exec-path.patch \ %D%/packages/patches/emacs-next-native-comp-driver-options.patch \ %D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \ diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 55eab48c25..822d15cc94 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -110,6 +110,7 @@ (define-public emacs-minimal (patches (search-patches "emacs-exec-path.patch" "emacs-fix-scheme-indent-function.patch" "emacs-native-comp-driver-options.patch" + "emacs-native-comp-fix-filenames.patch" "emacs-pgtk-super-key-fix.patch")) (modules '((guix build utils))) (snippet diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch new file mode 100644 index 0000000000..f461bc8a78 --- /dev/null +++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch @@ -0,0 +1,93 @@ +Upstream hashes both the absolute file name and the content of a file +to derive the name for the natively compiled files. This breaks the +staged install used in guix, as any $GUIX_PROFILE is distinct from +the build directory. + +Index: emacs-29.1/src/comp.c +=================================================================== +--- emacs-29.1.orig/src/comp.c ++++ emacs-29.1/src/comp.c +@@ -4399,8 +4399,8 @@ FILENAME must exist, and if it's a symli + If FILENAME is compressed, it must have the \".gz\" extension, + and Emacs must have been compiled with zlib; the file will be + uncompressed on the fly to hash its contents. +-Value includes the original base name, followed by 2 hash values, +-one for the file name and another for its contents, followed by .eln. */) ++Value includes the original base name, followed by a hash of its ++content, followed by .eln. */) + (Lisp_Object filename) + { + CHECK_STRING (filename); +@@ -4423,64 +4423,26 @@ one for the file name and another for it + filename = Fw32_long_file_name (filename); + #endif + +- Lisp_Object content_hash = comp_hash_source_file (filename); +- +- if (suffix_p (filename, ".gz")) +- filename = Fsubstring (filename, Qnil, make_fixnum (-3)); +- +- /* We create eln filenames with an hash in order to look-up these ++ /* We create eln filenames with a hash in order to look-up these + starting from the source filename, IOW have a relation + +- /absolute/path/filename.el + content -> +- eln-cache/filename-path_hash-content_hash.eln. ++ filename.el + content -> eln-cache/filename-content_hash.eln. + + 'dlopen' can return the same handle if two shared with the same + filename are loaded in two different times (even if the first was + deleted!). To prevent this scenario the source file content is +- included in the hashing algorithm. ++ included in the hashing algorithm. */ + +- As at any point in time no more then one file can exist with the +- same filename, should be possible to clean up all +- filename-path_hash-* except the most recent one (or the new one +- being recompiled). +- +- As installing .eln files compiled during the build changes their +- absolute path we need an hashing mechanism that is not sensitive +- to that. For this we replace if match PATH_DUMPLOADSEARCH or +- *PATH_REL_LOADSEARCH with '//' before computing the hash. */ ++ Lisp_Object content_hash = comp_hash_source_file (filename); ++ Lisp_Object separator = build_string ("-"); + +- if (NILP (loadsearch_re_list)) +- { +- Lisp_Object sys_re = +- concat2 (build_string ("\\`[[:ascii:]]+"), +- Fregexp_quote (build_string ("/" PATH_REL_LOADSEARCH "/"))); +- Lisp_Object dump_load_search = +- Fexpand_file_name (build_string (PATH_DUMPLOADSEARCH "/"), Qnil); +-#ifdef WINDOWSNT +- dump_load_search = Fw32_long_file_name (dump_load_search); +-#endif +- loadsearch_re_list = list2 (sys_re, Fregexp_quote (dump_load_search)); +- } ++ if (suffix_p (filename, ".gz")) ++ filename = Fsubstring (filename, Qnil, make_fixnum (-3)); + +- Lisp_Object lds_re_tail = loadsearch_re_list; +- FOR_EACH_TAIL (lds_re_tail) +- { +- Lisp_Object match_idx = +- Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil); +- if (BASE_EQ (match_idx, make_fixnum (0))) +- { +- filename = +- Freplace_match (build_string ("//"), Qt, Qt, filename, Qnil); +- break; +- } +- } +- Lisp_Object separator = build_string ("-"); +- Lisp_Object path_hash = comp_hash_string (filename); + filename = concat2 (Ffile_name_nondirectory (Fsubstring (filename, Qnil, + make_fixnum (-3))), + separator); +- Lisp_Object hash = concat3 (path_hash, separator, content_hash); +- return concat3 (filename, hash, build_string (NATIVE_ELISP_SUFFIX)); ++ return concat3 (filename, content_hash, build_string (NATIVE_ELISP_SUFFIX)); + } + + DEFUN ("comp-el-to-eln-filename", Fcomp_el_to_eln_filename,