From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: No Wayman Newsgroups: gmane.emacs.bugs Subject: bug#64226: 30.0.50; emacs-lisp-native-compile-and-load permission error Date: Sat, 01 Jul 2023 15:14:16 -0400 Message-ID: <87bkgvwe05.fsf@gmail.com> References: <87bkh734u7.fsf@gmail.com> <83pm5n33zz.fsf@gnu.org> <87bkh7ts5r.fsf@gmail.com> <83o7l7327u.fsf@gnu.org> <87bkh731f1.fsf@gmail.com> <83h6qz2zaa.fsf@gnu.org> <877crv2yaw.fsf@gmail.com> <83cz1n2xjp.fsf@gnu.org> <83leg0qb8n.fsf@gnu.org> <87fs67wsto.fsf@gmail.com> <83r0prprki.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28787"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.11.7; emacs 30.0.50 Cc: acorallo@gnu.org, 64226@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 01 22:53:28 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFhax-0007JZ-Qm for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Jul 2023 22:53:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFhaa-00018s-43; Sat, 01 Jul 2023 16:53:04 -0400 Original-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 1qFhaY-00018j-3e for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2023 16:53:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFhaX-0003PO-Rl for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2023 16:53:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qFhaX-0005f3-OD for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2023 16:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: No Wayman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Jul 2023 20:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64226 X-GNU-PR-Package: emacs Original-Received: via spool by 64226-submit@debbugs.gnu.org id=B64226.168824476421730 (code B ref 64226); Sat, 01 Jul 2023 20:53:01 +0000 Original-Received: (at 64226) by debbugs.gnu.org; 1 Jul 2023 20:52:44 +0000 Original-Received: from localhost ([127.0.0.1]:58779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qFhaG-0005eP-3I for submit@debbugs.gnu.org; Sat, 01 Jul 2023 16:52:44 -0400 Original-Received: from mail-qk1-f169.google.com ([209.85.222.169]:61823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qFhaE-0005eA-3K for 64226@debbugs.gnu.org; Sat, 01 Jul 2023 16:52:42 -0400 Original-Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-7653bd3ff2fso323566985a.3 for <64226@debbugs.gnu.org>; Sat, 01 Jul 2023 13:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688244756; x=1690836756; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=aLNzTvSKhqjUhMT2MTP8ZEPKbg8FYLOyi2Hc+OdcqbA=; b=QQioad6Vgq58m0TwmZxEGn0vBY9myDdlYC3yV+QB68qJIMtlm+dls7xMwy+FVWlVvM Cs3V+tddd+wEQqugxNi0Q+Xx4xjLxQGqHb2CvekztpoXUilA84ttzrWAEhu0WvWueEBa BnH5lHQZMiwt/0WXAWuWqeM6UIyi6Kh+4fzWnl/wjrqoyHXm2uhTzrjqGDH/mdzFFjzg T8b4NqRYSwVZ6nNx923iv2u+yAUxLNzHMhnSrUE8ZzZSwTvQxGFMx0DR0ifS1hHtKcmb r8dui4Kx9qry5w10uLPE619/Gh6WRD567re9bFmuKJvdmD1GlXESWUo7FTgkLrf5/kCH gonQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688244756; x=1690836756; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aLNzTvSKhqjUhMT2MTP8ZEPKbg8FYLOyi2Hc+OdcqbA=; b=Mj/b9S4d/hOIDbizkCLgg6hpfCkYDcMmP49qr68F+AgJtvm0a7OT7n5JO9/f4EIzDu sk4bj7K9fPe4NXy7nrIN09fC8Hre/cnFROHNwM8hqXhQHEW8r18tuP/iq3UqZCdNliHu YB2OHJg+ZeOyGRpRllOOVUa6lEZG+pD0unFVTLH9KFzuJszE9imq/I9zrSKVD/thS8Ka WrbClGUmUFydC8eKjfHhAYuj3LC+yLQPVU5/sbkI6PiwfheEaMCdLqSsC9+rxDzM87bD PFn3A2VAzJdj5vPs5qFVyU5+mDSXhGKMrM6mUUele7PBv/ZDmFUzRXT/6nUuf62yuiUN 66ag== X-Gm-Message-State: ABy/qLawpQrJLkQkHr0grF/bhIZKQ1PzRYfnkmisHEz2rBF9f+pWwGEQ NQ49i6leGKWEVCAQB/MiOv6/2BLUibMCcA== X-Google-Smtp-Source: APBJJlGBEihnGw6V3R8eoZEr21sK1TCodFG2Xl86EDwrps4WiWf9Q0aplW7KmcQwebtEgd5W5VM9Dw== X-Received: by 2002:a05:620a:40d6:b0:765:8a18:e3c0 with SMTP id g22-20020a05620a40d600b007658a18e3c0mr8545857qko.57.1688244755823; Sat, 01 Jul 2023 13:52:35 -0700 (PDT) Original-Received: from laptop ([2601:84:847f:c697:2d4:9eff:feb6:970c]) by smtp.gmail.com with ESMTPSA id s6-20020a05620a16a600b007675209bcf1sm1341278qkj.61.2023.07.01.13.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jul 2023 13:52:35 -0700 (PDT) In-reply-to: <83r0prprki.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264430 Archived-At: Eli Zaretskii writes: > perhaps you could describe how to > reproduce starting from "emacs -Q" (and loading any packages or > features you need for the minimal reproduction recipe). The way > you > were showing the problem until now obviously depends on your > local > setup, which is impossible to reproduce without knowing the > details. The instructions I gave here: https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-06/msg01224.html reproduce the error on my end from emacs -Q with a minimal file. To be crystal clear: 1. Save the following file to $HOME/test.el (or any path where the user has write permissions): --8<---------------cut here---------------start------------->8--- ;; -*- lexical-binding: t; -*- (defun +test () (message "PASS")) --8<---------------cut here---------------end--------------->8--- 2. emacs -Q $HOME/test.el 3. M-x emacs-lisp-native-compile-compile-and-load 4. Error is printed to message buffer. I'm not sure how I can meaningfully pare it down from there. > The main aspect of this which is completely unclear is: how come > Emacs > tries to write in the /usr/lib tree when compiling Lisp files > from > your home directory. This is not supposed to happen: Emacs > should > write to the eln-cache subdirectory of your ~/.emacs.d/ > directory. That makes sense to me and I agree. It looks like the critical path is in the file `comp-spill-lap-function' method. The comp-ctxt-output slot is set to (car (last native-comp-eln-load-path)). I don't know enough about the native-comp machinery to say whether or not this is the appropriate solution, but let-binding `native-compile-target-directory' to the car of native-comp-eln-load-path in emacs-lisp-native-compile-and-load compiles in the correct directory and avoids the error: (defun emacs-lisp-native-compile-and-load () "Native-compile synchronously the current file (if it has changed). Load the compiled code when finished. Use `emacs-lisp-byte-compile-and-load' in combination with `native-comp-jit-compilation' set to t to achieve asynchronous native compilation." (interactive nil emacs-lisp-mode) (emacs-lisp--before-compile-buffer) (let ((byte+native-compile t) (native-compile-target-directory (car native-comp-eln-load-path)) (byte-to-native-output-buffer-file nil)) (when-let ((eln (native-compile buffer-file-name))) (load (file-name-sans-extension (comp-write-bytecode-file eln)))))) I'll leave the work of a proper patch to someone who is more familiar with the system.