From patchwork Sat Feb 24 06:18:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liliana Marie Prikler X-Patchwork-Id: 60959 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 5474E27BBEA; Sat, 24 Feb 2024 08:15:51 +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 CA25327BBE9 for ; Sat, 24 Feb 2024 08:15:49 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdnC9-0002OF-V2; Sat, 24 Feb 2024 03:15:41 -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 1rdnC8-0002NX-LF for guix-patches@gnu.org; Sat, 24 Feb 2024 03:15:40 -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 1rdnC8-0004yN-Dc for guix-patches@gnu.org; Sat, 24 Feb 2024 03:15:40 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdnCT-0005yw-Mr; Sat, 24 Feb 2024 03:16:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67260] [PATCH emacs-team v11 3/7] gnu: emacs: Check integrity of native-compiled files. 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, 24 Feb 2024 08:16: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: Suhail , 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.170876253122904 (code B ref 67260); Sat, 24 Feb 2024 08:16:01 +0000 Received: (at 67260) by debbugs.gnu.org; 24 Feb 2024 08:15:31 +0000 Received: from localhost ([127.0.0.1]:36934 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdnBy-0005xC-Jm for submit@debbugs.gnu.org; Sat, 24 Feb 2024 03:15:31 -0500 Received: from mail-lf1-f53.google.com ([209.85.167.53]:59816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdnBw-0005wo-D7 for 67260@debbugs.gnu.org; Sat, 24 Feb 2024 03:15:29 -0500 Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-512bb2ed1f7so1448000e87.3 for <67260@debbugs.gnu.org>; Sat, 24 Feb 2024 00:15:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708762438; x=1709367238; darn=debbugs.gnu.org; h=cc:to:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=kCcZhNvi2kr7UPM68gWZP09wXI0LF0GQvbLryvANNnw=; b=Uk8QW5FN4gzt25azxHcP8q4gTWBu3ERrQv0+B27w6l12Bqhh8X7uMuCItoGOW0Z3uH C/ZL0LjFSIaDUvp9k1veQbciRL6CBbHgxCZIuzbhKLCev1KruO8joIonlKCxR8vJ9Tv9 ZABum8bTRwroP6DVImakwbhsVut5jbZQ0gGLpKOs2QitmV3lacdJKcUpZhHptV9Zee4Z EyHKG2OaFbBXC2fO4I9O3veXsTOcd199plQlwplzgnyGA2nRKnv3S3ObF33ZnvWQkcPa le6rDyu8vHAZbkqbgY/uxpCI/SFyFru+jFJgUq9NE2wu6rW0cK7qFID9mKriiuVmkzQu 6Umg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708762438; x=1709367238; h=cc:to:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kCcZhNvi2kr7UPM68gWZP09wXI0LF0GQvbLryvANNnw=; b=rKf1KWh6VWE4rqFmLocbbu8Zh3ObrGgf4LpISpifCN9JuvCpynThGaJgSdQDsMuzTQ 5tTObHRXuKmvmqziIVOP8QjwOnRGdS+Hf08T3yA6X84GQPbfzfjid/53vZAKe7UHTM+j hOC+/nV+NkgD5ILbevRKY1DieE9XpyKwv5QClqlUWytpPhXODi8ekZMTRnSKwGVuZm74 5JmH8byis5S0Kuchod0IYIemfguXQkotVoUuGke4vXQe2mQh/SIAqYnTH0E3gZXjmZV2 XOWS9eZ15UEYsQBM319e8VvScZlongN1flNsSU+usnntDC1rQcogn0ukUpv03uprtWQA thRg== X-Gm-Message-State: AOJu0YydoLrYAEEDwuX++lG/9+X15Se1jQ/irn5+J9Km2OLeJzi1VpBX FFOw5SqnJ6HLJPFpSx6fJZN+9rv+Vl8KdOKvbqHyr9cGhYtDhtznfM5KcFrn X-Google-Smtp-Source: AGHT+IHCX+ONVXTB1GZ3MXl+g+WZGBCR3ll1wnOzQpb2bnPATxSBppWBH6HKqYGQM2kUwoa5smWqJQ== X-Received: by 2002:ac2:4256:0:b0:512:9d0e:2ca5 with SMTP id m22-20020ac24256000000b005129d0e2ca5mr1027732lfl.39.1708762437972; Sat, 24 Feb 2024 00:13:57 -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 fk2-20020a056402398200b00565aed6c2a8sm160945edb.29.2024.02.24.00.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 00:13:57 -0800 (PST) Message-ID: <35fc3027f372eddbd21a2c6b5a591453591a6825.1708761863.git.liliana.prikler@gmail.com> In-Reply-To: References: From: Liliana Marie Prikler Date: Sat, 24 Feb 2024 07:18:52 +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 In the previous commit, we've added a patch that potentially messes with how built-in (especially preloaded) Lisp libraries are loaded. Thus, we might want to assert that these files still load fine, as reported when querying the builtin documentation of functions provided by them. * gnu/packages/aux-files/emacs/comp-integrity.el: New file. * gnu/Makefile.am (dist_noinst_DATA): Register it here. * gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘validate-comp-integrity’. --- Makefile.am | 1 + .../aux-files/emacs/comp-integrity.el | 126 ++++++++++++++++++ gnu/packages/emacs.scm | 13 +- 3 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/aux-files/emacs/comp-integrity.el diff --git a/Makefile.am b/Makefile.am index d3b9532c7a..6837c4c87c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -421,6 +421,7 @@ dist_noinst_DATA = \ # Auxiliary files for packages. AUX_FILES = \ gnu/packages/aux-files/chromium/master-preferences.json \ + gnu/packages/aux-files/emacs/comp-integrity.el \ gnu/packages/aux-files/emacs/guix-emacs.el \ gnu/packages/aux-files/findclass.php \ gnu/packages/aux-files/guix.vim \ diff --git a/gnu/packages/aux-files/emacs/comp-integrity.el b/gnu/packages/aux-files/emacs/comp-integrity.el new file mode 100644 index 0000000000..ed6a348fed --- /dev/null +++ b/gnu/packages/aux-files/emacs/comp-integrity.el @@ -0,0 +1,126 @@ +(require 'ert) + +(eval-when-compile + (require 'help-fns) + + (defmacro expect-help (fun result &optional feature) + `(progn + (eval-when-compile (when ',feature + (require ',feature))) + + (ert-deftest ,(intern (concat "expect-" (symbol-name fun) + "-" (symbol-name result))) + () + (should + (eq ',result + (let ((desc (substring-no-properties + (with-output-to-string + (help-fns-function-description-header ',fun))))) + (cond ((string-search "native-compiled" desc) 'native) + ((string-search "byte-compiled" desc) 'byte) + ((string-search "built-in" desc) 'built-in) + (t nil)))))))) + + (defmacro expect-native (fun &optional feature) + `(progn (expect-help ,fun native ,feature))) + + (defmacro expect-builtin (fun &optional feature) + `(progn (expect-help ,fun built-in ,feature)))) + +(expect-native abbrev-mode) +(expect-native backquote-process) +(expect-native mode-line-widen) +(expect-native buffer-menu) +(expect-native button-mode) +(expect-native byte-run-strip-symbol-positions) +(expect-native case-table-get-table) +(expect-native cconv-convert) +(expect-native use-default-char-width-table) +(expect-native cl-generic-p) +(expect-native cl-struct-define) +(expect-native x-setup-function-keys) +(expect-native encode-composition-rule) +(expect-native custom-declare-face) +(expect-native minibuffer-prompt-properties--setter) +(expect-native custom-add-choice) +(expect-native debug-early) +(expect-native display-table-slot disp-table) +(expect-native dnd-open-file) +(expect-native dos-mode25 dos-fns) +(expect-native find-file-text dos-w32) +(expect-native dynamic-setting-handle-config-changed-event) +(expect-native easy-menu-item-present-p) +(expect-native eldoc-mode) +(expect-native electric-indent-mode) +(expect-native elisp-mode-syntax-propertize) +(expect-native getenv) +(expect-native epa-file-find-file-hook) +(expect-native face-list) +(expect-native find-file-noselect) +(expect-native fill-region) +(expect-native font-lock-change-mode) +(expect-native font-lock-add-keywords) +(expect-native fontset-plain-name) +(expect-native format-read) +(expect-native frame-edges) +(expect-native fringe-mode) +(expect-native help-quick) +(expect-native image-type) +(expect-native indent-region) +(expect-native indian-compose-regexp) +(expect-native msdos-setup-keyboard term/internal) +(expect-native isearch-abort) +(expect-native iso-transl-set-language) +(expect-native jit-lock-mode) +(expect-native jka-compr-build-file-regexp) +(expect-native keymap-global-set) +(expect-native forward-sexp) +(expect-native lisp-string-in-doc-position-p) +(expect-native ls-lisp-set-options ls-lisp) +(expect-native macroexp-compiling-p) +(expect-native map-y-or-n-p) +(expect-native menu-find-file-existing) +(expect-native completion-boundaries) +(expect-native egyptian-shape-grouping) +(expect-native mouse-double-click-time) +(expect-native convert-define-charset-argument) +(expect-native coding-system-change-eol-conversion) +(expect-native store-substring mule-util) +(expect-native mouse-wheel-change-button) +(expect-native advice-function-mapc) +(expect-native comment-string-strip) +(expect-native obarray-make) +(expect-native oclosure-type) +(expect-native forward-page) +(expect-native sentence-end) +(expect-native show-paren-function) +(expect-native pgtk-dnd-init-frame pgtk-dnd) +(expect-native prog-context-menu) +(expect-native regexp-opt) +(expect-native get-register) +(expect-native query-replace-descr) +(expect-native rfn-eshadow-setup-minibuffer) +(expect-native read-multiple-choice) +(expect-native scroll-bar-scale) +(expect-native gui-select-text) +(expect-native seq-first) +(expect-native hack-read-symbol-shorthands) +(expect-native next-error-find-buffer) +(expect-native exit-splash-screen) +(expect-native buffer-local-boundp) +(expect-native syntax-propertize-multiline) +(expect-native tab-bar-mode) +(expect-native tabulated-list-put-tag) +(expect-native text-mode) +(expect-native timer-activate) +(expect-native tool-bar-mode) +(expect-native tooltip-mode) +(expect-native tty-color-desc) +(expect-native ucs-normalize-hfs-nfd-comp-p ucs-normalize) +(expect-native uniquify-item-p) +(expect-native vc-mode) +(expect-native emacs-version) +(expect-native define-widget) +(expect-native window-right) +(expect-native x-dnd-init-frame) +(expect-native x-handle-no-bitmap-icon) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 182de0204d..f0200ad27c 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -380,7 +380,18 @@ (define-public emacs-no-x "-B" #$(this-package-input "libgccjit") "/lib/gcc/")))))) (add-after 'build 'build-trampolines (lambda* (#:key make-flags #:allow-other-keys) - (apply invoke "make" "trampolines" make-flags))))))) + (apply invoke "make" "trampolines" make-flags))) + (add-after 'validate-runpath 'validate-comp-integrity + (lambda* (#:key outputs #:allow-other-keys) + (if #$(%current-target-system) + (display "Cannot validate native-comp on cross builds.\n") + (invoke + (string-append (assoc-ref outputs "out") "/bin/emacs") + "--batch" + "--load" + #$(local-file + (search-auxiliary-file "emacs/comp-integrity.el")) + "-f" "ert-run-tests-batch-and-exit")))))))) (inputs (modify-inputs (package-inputs emacs-minimal) (prepend gnutls