From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id WBNqNPkmrWUc9AAA62LTzQ:P1 (envelope-from ) for ; Sun, 21 Jan 2024 15:15:22 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id WBNqNPkmrWUc9AAA62LTzQ (envelope-from ) for ; Sun, 21 Jan 2024 15:15:21 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=lF0ItJ2K; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705846521; a=rsa-sha256; cv=none; b=BuEZc1oOdMdncvj0dtmFJmRbjJ/YnqtIK5q29rbcjsQqPCrnhOiR0KXOynPyGP6x/MEf6Y wn7pePFGaYuibH74INOV75bvfnCJDxy+NSf2KVCdUnjhHWa01AAdwcxDIaYQNf5XUwQHme d+3vI8ecsWhc0x5UcuIrQFISO1E0IKwPzJeUFBTbeulOOKjZ1gXjmcY0JfK+rIrAe0wDs9 9peJibymUIrgbWOjjDeXR5aIAWgDaHetlw7BmXDZQpdq11SSctHjz0N15ai/f7W/+8XP0N 2MWSXEAt9yiuO7LvAdNwb0iU+b7kXEIvVtIctAA7p5zPmoGApS6ngqUn2Xlpmw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=lF0ItJ2K; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1705846521; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: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:dkim-signature; bh=YBak83qGsVcl4xRuH2FK8JrBMV49823uQX60qaFWeE0=; b=iwR2jrFf701VJhpA4mqHVloMkzb/mzjqVAGh1+V/UDGp3P6Pou1qiU+KUgL1FwEfZDi+BX uvoMDSjucdft42DOm2im/oHiuZ1VflISavgyIUbE4IgiTJxZASm7mKWbuQb5tjbz16TjDU a7zICZDytQk3fdrkNpUKKupHliu4t9egzNDuXGe8mCLT389CxLr4IYRPpgc18lg5PGNJEM VrDaqeZDIBPGc4qScfYnwIXKE0IcMB0eDcYi31FLgUI3f0jSz4aAasctpXRJmUE7WMhhCy IbDxy6a8xHUoCA9+HNGxxtGtzptYq1BLmo3ilNkvfbGGFGGynphZyosLa80sbg== 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 89B3970576 for ; Sun, 21 Jan 2024 15:15:21 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRYbF-0001rh-B2; Sun, 21 Jan 2024 09:15:01 -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 1rRYbE-0001rT-7h for guix-patches@gnu.org; Sun, 21 Jan 2024 09:15:00 -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 1rRYbD-00038D-VC for guix-patches@gnu.org; Sun, 21 Jan 2024 09:14:59 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rRYbG-0002u9-RR; Sun, 21 Jan 2024 09:15:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67260] [PATCH v5 2/6] 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: Sun, 21 Jan 2024 14:15:02 +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.170584649111094 (code B ref 67260); Sun, 21 Jan 2024 14:15:02 +0000 Received: (at 67260) by debbugs.gnu.org; 21 Jan 2024 14:14:51 +0000 Received: from localhost ([127.0.0.1]:36803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRYb4-0002sq-Mf for submit@debbugs.gnu.org; Sun, 21 Jan 2024 09:14:51 -0500 Received: from mail-ej1-x642.google.com ([2a00:1450:4864:20::642]:47233) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRYav-0002rq-Uv for 67260@debbugs.gnu.org; Sun, 21 Jan 2024 09:14:45 -0500 Received: by mail-ej1-x642.google.com with SMTP id a640c23a62f3a-a26ed1e05c7so242733766b.2 for <67260@debbugs.gnu.org>; Sun, 21 Jan 2024 06:14:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705846472; x=1706451272; 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=YBak83qGsVcl4xRuH2FK8JrBMV49823uQX60qaFWeE0=; b=lF0ItJ2Kb6ZfifICRDGjPTxD3Um90HBfgUg3msuAzkS1eEsyFCjpzTbkTZE/tE68lv tv6lu6fUuhZRVJ3aTnzQYRRl+QxuPFDsUzseeG9TdstfwxDhKfcT55O/TRYSCDLIICOH xEm9gLVlmb9B5Tsvpk3gDQwk6XVvSRRTrzeVZlt3RuIwEbC1ShTH5cFCEvEDPBdMqvQq oGz9L4EzEbI4xDYzkBlduA1dECC1xIVjZhTadA5h9QMbf1+ACsamhQRcDo+uIlL4Ovc3 RK+h0Rt4KxNME9rT34LCCKWwdmGxoMsqhLE74nS4wdM6BYoQLIWuP6KIv97Ene9b9x8n CtXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705846472; x=1706451272; 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=YBak83qGsVcl4xRuH2FK8JrBMV49823uQX60qaFWeE0=; b=KCsRWwvlFHqpVEeW3/s7lSoecKeD9GzBx+CfQT2juFeaDhwCdKPWM/Gud0k4nsgujW LWsT3wT7dCUvDHVXQVtw2PltgiCIOaQEpDzJLzKsBxRr2F94akB2FHnuwOCfpyD7Y33e Yp7xphyY8FL8qy4d7+I3oiv4PNgMbNBdg1Oe3K8BW5a3TmldphvpFnp8ufl3YfJIBzHk mHtCxAVjz8L28QvSlppmpGi+TPYXZsAZlqOYulGSI41ZkgexO7q1+2Of5L5nLvO6d/sD V6AuoMXW242wpcbnM/ft8F+Z3hJd0eOD7D1XLN7K38z7tC3oJN4dPOKrk/ltIIbx3zM1 bf/Q== X-Gm-Message-State: AOJu0Yyb4H5HCcYU5T1U2GZFxmoOQ1Jf/LIwdUClyNgn1IOTM38eDKi/ jYLgEn+/R3glzuhSDnoiIGH8/hwXYbUQlIlsx+ukEFqClyrEJ1EM1DX9EG8GsDA= X-Google-Smtp-Source: AGHT+IH5pVyfYgS7+oUtrebL7jedlg3RaMa7V1kSo6f4ouJ/LJJY+fFDCaSHDUBoZqtiXc7C+1Lafw== X-Received: by 2002:a17:907:f90:b0:a28:32ff:8709 with SMTP id kb16-20020a1709070f9000b00a2832ff8709mr879749ejc.15.1705846472520; Sun, 21 Jan 2024 06:14:32 -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 f1-20020a170906c08100b00a28fdd21763sm12410228ejz.134.2024.01.21.06.14.31 for <67260@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 06:14:32 -0800 (PST) Message-ID: <388d3766e6908331c0704687141f33aeae7ee969.1705846445.git.liliana.prikler@gmail.com> In-Reply-To: <24d0c763983a33d62027d70af67118b9821bdc26.1705846445.git.liliana.prikler@gmail.com> References: <24d0c763983a33d62027d70af67118b9821bdc26.1705846445.git.liliana.prikler@gmail.com> From: Liliana Marie Prikler Date: Sun, 21 Jan 2024 13:12:42 +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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Spam-Score: -4.07 X-Migadu-Queue-Id: 89B3970576 X-Migadu-Spam-Score: -4.07 X-TUID: DqxHPqj58+VM * 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 | 197 ++++++++++++++++++ 3 files changed, 199 insertions(+) create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch diff --git a/gnu/local.mk b/gnu/local.mk index 3d1afd4555..7e6a0c5006 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1121,6 +1121,7 @@ dist_patch_DATA = \ %D%/packages/patches/emacs-kv-fix-tests.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 e4119ec21d..182de0204d 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -111,6 +111,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..714b707e47 --- /dev/null +++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch @@ -0,0 +1,197 @@ +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. It also breaks grafts, as hardcoded store file +names get rewritten; thus changing the file hash. + +Index: emacs-29.1/src/comp.c +=================================================================== +--- emacs-29.1.orig/src/comp.c ++++ emacs-29.1/src/comp.c +@@ -4396,26 +4396,18 @@ DEFUN ("comp-el-to-eln-rel-filename", Fc + Scomp_el_to_eln_rel_filename, 1, 1, 0, + doc: /* Return the relative name of the .eln file for FILENAME. + FILENAME must exist, and if it's a symlink, the target must exist. +-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. */) ++FILENAME is resolved relative to `load-path' and only the suffix of ++the first matching path is kept. If FILENAME is not found to be relative ++to any directory `load-path', it is used as-is to construct the return ++value. Further, if the NATIVE_COMP_BOGUS_DIRS environment variable is set, ++the first matching prefix mentioned in it will be stripped as well. */) + (Lisp_Object filename) + { + CHECK_STRING (filename); + +- /* Resolve possible symlinks in FILENAME, so that path_hash below +- always compares equal. (Bug#44701). */ +- filename = Fexpand_file_name (filename, Qnil); +- char *file_normalized = realpath (SSDATA (ENCODE_FILE (filename)), NULL); +- if (file_normalized) +- { +- filename = DECODE_FILE (make_unibyte_string (file_normalized, +- strlen (file_normalized))); +- xfree (file_normalized); +- } ++ Lisp_Object rel_name = filename; + ++ filename = Fexpand_file_name (filename, Qnil); + if (NILP (Ffile_exists_p (filename))) + xsignal1 (Qfile_missing, filename); + +@@ -4423,64 +4415,53 @@ 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 +- starting from the source filename, IOW have a relation +- +- /absolute/path/filename.el + content -> +- eln-cache/filename-path_hash-content_hash.eln. ++ Lisp_Object tail = Vload_path; ++ Lisp_Object name_len = Flength (filename); + +- '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. +- +- 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. */ +- +- if (NILP (loadsearch_re_list)) ++ FOR_EACH_TAIL_SAFE (tail) + { +- 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)); +- } +- +- 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))) ++ Lisp_Object len = Flength (XCAR (tail)); ++ if (XFIXNUM (name_len) < XFIXNUM (len)) ++ continue; ++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len, ++ XCAR (tail), make_fixnum (0), len, ++ Qnil))) + { +- filename = +- Freplace_match (build_string ("//"), Qt, Qt, filename, Qnil); ++ filename = Fsubstring (filename, Fadd1 (len), 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)); ++ ++ if (Ffile_name_absolute_p (filename)) ++ filename = rel_name; ++ ++ Lisp_Object bogus_dirs = ++ Fgetenv_internal (build_string ("NATIVE_COMP_BOGUS_DIRS"), Qnil); ++ ++ if (!NILP (bogus_dirs)) ++ { ++ tail = CALL2I (split-string, bogus_dirs, build_string (":")); ++ ++ FOR_EACH_TAIL_SAFE (tail) ++ { ++ Lisp_Object len = Flength (XCAR (tail)); ++ if (XFIXNUM (name_len) < XFIXNUM (len)) ++ continue; ++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len, ++ XCAR (tail), make_fixnum (0), len, ++ Qnil))) ++ { ++ filename = Fsubstring (filename, Fadd1 (len), Qnil); ++ break; ++ } ++ } ++ } ++ ++ if (suffix_p (filename, ".gz")) ++ filename = Fsubstring (filename, Qnil, make_fixnum (-3)); ++ ++ return concat2(Fsubstring (filename, Qnil, make_fixnum (-3)), ++ build_string (NATIVE_ELISP_SUFFIX)); + } + + DEFUN ("comp-el-to-eln-filename", Fcomp_el_to_eln_filename, +@@ -4494,13 +4475,7 @@ If BASE-DIR is non-nil, use it as the di + non-absolute BASE-DIR is interpreted as relative to `invocation-directory'. + If BASE-DIR is omitted or nil, look for the first writable directory + in `native-comp-eln-load-path', and use as BASE-DIR its subdirectory +-whose name is given by `comp-native-version-dir'. +-If FILENAME specifies a preloaded file, the directory for the .eln +-file is the \"preloaded/\" subdirectory of the directory determined +-as described above. FILENAME is considered to be a preloaded file if +-the value of `comp-file-preloaded-p' is non-nil, or if FILENAME +-appears in the value of the environment variable LISP_PRELOADED; +-the latter is supposed to be used by the Emacs build procedure. */) ++whose name is given by `comp-native-version-dir'. */) + (Lisp_Object filename, Lisp_Object base_dir) + { + Lisp_Object source_filename = filename; +@@ -4541,19 +4516,7 @@ the latter is supposed to be used by the + + if (!file_name_absolute_p (SSDATA (base_dir))) + base_dir = Fexpand_file_name (base_dir, Vinvocation_directory); +- +- /* In case the file being compiled is found in 'LISP_PRELOADED' or +- `comp-file-preloaded-p' is non-nil target for output the +- 'preloaded' subfolder. */ +- Lisp_Object lisp_preloaded = +- Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil); + base_dir = Fexpand_file_name (Vcomp_native_version_dir, base_dir); +- if (comp_file_preloaded_p +- || (!NILP (lisp_preloaded) +- && !NILP (Fmember (CALL1I (file-name-base, source_filename), +- Fmapcar (intern_c_string ("file-name-base"), +- CALL1I (split-string, lisp_preloaded)))))) +- base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir); + + return Fexpand_file_name (filename, base_dir); + } +Index: emacs-29.1/src/Makefile.in +=================================================================== +--- emacs-29.1.orig/src/Makefile.in ++++ emacs-29.1/src/Makefile.in +@@ -553,6 +553,7 @@ shortlisp := $(filter-out ${shortlisp_fi + ## We don't really need to sort, but may as well use it to remove duplicates. + shortlisp := loaddefs.el loadup.el $(sort ${shortlisp}) + export LISP_PRELOADED = ${shortlisp} ++export NATIVE_COMP_BOGUS_DIRS + lisp = $(addprefix ${lispsource}/,${shortlisp}) + + ## Construct full set of libraries to be linked. -- 2.41.0