From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: 67260@debbugs.gnu.org
Cc: andrew@trop.in, cox.katherine.e+guix@gmail.com,
liliana.prikler@gmail.com
Subject: [bug#67260] [PATCH emacs-team 2/2] gnu: emacs: Don't hash file names in native compilation.
Date: Sat, 18 Nov 2023 14:38:46 +0100 [thread overview]
Message-ID: <f38d16e04962f76bc74503a105065c1a30d51ff7.1700314926.git.liliana.prikler@gmail.com> (raw)
In-Reply-To: <cover.1700314926.git.liliana.prikler@gmail.com>
* 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,
--
2.41.0
next prev parent reply other threads:[~2023-11-18 14:51 UTC|newest]
Thread overview: 96+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-18 13:42 [bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling Liliana Marie Prikler
2023-11-18 13:38 ` Liliana Marie Prikler [this message]
2023-11-18 15:44 ` Andrew Tropin
2023-11-18 15:51 ` Liliana Marie Prikler
2023-11-22 12:09 ` Mekeor Melire
2023-11-22 17:39 ` Liliana Marie Prikler
2023-11-25 11:13 ` [bug#67260] [PATCH emacs-team v3 1/3] gnu: emacs: Build trampolines Liliana Marie Prikler
2023-11-25 11:13 ` [bug#67260] [PATCH emacs-team v3 2/3] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2023-11-25 11:13 ` [bug#67260] [PATCH emacs-team v3 3/3] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-01-18 5:55 ` [bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling Suhail via Guix-patches via
2024-01-21 12:12 ` [bug#67260] [PATCH v5 1/6] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v5 3/6] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v5 4/6] gnu: emacs-org: Fix native builds Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v5 5/6] gnu: emacs-magit: " Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v5 2/6] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-01-21 14:09 ` [bug#67260] [PATCH v5 6/6] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-01-22 4:16 ` Suhail via Guix-patches via
2024-01-22 4:36 ` Suhail via Guix-patches via
2024-01-22 20:21 ` [bug#67260] [PATCH v7 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v7 2/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v7 6/7] gnu: emacs-org: Fix native builds Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v7 3/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v7 7/7] gnu: emacs-magit: Fix native builds Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v7 5/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-01-21 14:09 ` [bug#67260] [PATCH v7 4/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-01-22 20:21 ` [bug#67260] [PATCH v8 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v8 2/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v8 5/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v8 3/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v8 7/7] gnu: emacs-magit: Fix native builds Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v8 6/7] gnu: emacs-org: " Liliana Marie Prikler
2024-01-21 14:09 ` [bug#67260] [PATCH v8 4/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-01-22 20:21 ` [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v6 2/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v6 3/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v6 4/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v6 6/7] gnu: emacs-magit: Fix native builds Liliana Marie Prikler
2024-01-21 12:12 ` [bug#67260] [PATCH v6 5/7] gnu: emacs-org: " Liliana Marie Prikler
2024-01-21 14:09 ` [bug#67260] [PATCH v6 7/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-01-25 23:53 ` [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Suhail via Guix-patches via
2024-01-26 7:49 ` Suhail via Guix-patches via
2024-01-26 8:20 ` Suhail via Guix-patches via
2024-01-26 22:45 ` Suhail via Guix-patches via
2024-01-27 15:36 ` Suhail via Guix-patches via
2024-01-27 16:24 ` Suhail via Guix-patches via
2024-01-27 17:15 ` Suhail via Guix-patches via
2024-01-27 19:39 ` Suhail via Guix-patches via
2024-01-28 0:13 ` Suhail via Guix-patches via
2024-01-28 0:18 ` Suhail via Guix-patches via
2024-01-28 16:17 ` Suhail via Guix-patches via
2024-02-13 18:30 ` [bug#67260] [PATCH v7 " Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v7 3/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v9 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v7 6/7] gnu: emacs-org: Fix native builds Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v7 4/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v7 2/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v7 7/7] gnu: emacs-magit: Fix native builds Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v7 5/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-14 0:56 ` [bug#67260] [PATCH emacs-team v9*] Think ahead when compiling Suhail via Guix-patches via
2024-02-14 8:41 ` [bug#67260] [PATCH emacs-team v9*] Test for AOT native-comp Suhail via Guix-patches via
2024-02-16 15:09 ` [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v10 2/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v10 6/7] gnu: emacs-org: Fix native builds Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v10 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v10 4/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v10 5/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v10 7/7] gnu: emacs-magit: Fix native builds Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v10 3/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-02-17 14:49 ` [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things Suhail via Guix-patches via
2024-02-17 15:15 ` Liliana Marie Prikler
2024-02-18 0:56 ` Suhail via Guix-patches via
2024-02-18 9:19 ` Liliana Marie Prikler
2024-02-19 21:42 ` Suhail via Guix-patches via
2024-02-20 17:51 ` Liliana Marie Prikler
2024-02-20 18:41 ` Suhail via Guix-patches via
2024-02-24 8:04 ` [bug#67260] [PATCH emacs-team v11 0/7] You thought it was term/internal.el, but it was me, Dio! Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v11 1/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v11 4/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v11 5/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v11 2/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v11 6/7] gnu: emacs-org: Fix native builds Liliana Marie Prikler
2024-02-13 18:30 ` [bug#67260] [PATCH emacs-team v11 7/7] gnu: emacs-magit: " Liliana Marie Prikler
2024-02-24 6:18 ` [bug#67260] [PATCH emacs-team v11 3/7] gnu: emacs: Check integrity of native-compiled files Liliana Marie Prikler
2024-03-04 7:13 ` [bug#67260] [PATCH emacs-team v11 0/7] You thought it was term/internal.el, but it was me, Dio! Andrew Tropin via Guix-patches via
2024-03-04 19:59 ` Liliana Marie Prikler
2024-03-01 17:35 ` Suhail via Guix-patches via
2024-03-01 19:40 ` bug#67260: " Liliana Marie Prikler
2024-03-07 8:55 ` [bug#67260] " Andrew Tropin via Guix-patches via
2024-03-07 17:52 ` Liliana Marie Prikler
2024-03-08 9:20 ` Andrew Tropin via Guix-patches via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f38d16e04962f76bc74503a105065c1a30d51ff7.1700314926.git.liliana.prikler@gmail.com \
--to=liliana.prikler@gmail.com \
--cc=67260@debbugs.gnu.org \
--cc=andrew@trop.in \
--cc=cox.katherine.e+guix@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).