From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48978: 28.0.50; native-comp: Error: File error Creating file with prefix Date: Sun, 13 Jun 2021 16:36:12 +0300 Message-ID: <83k0mx7upf.fsf@gnu.org> References: <8735tm26fm.fsf@gmail.com> <83wnqy6xp9.fsf@gnu.org> <87tum1aobt.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34825"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48978@debbugs.gnu.org To: No Wayman , Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 13 15:37:11 2021 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 1lsQIY-0008n0-Ub for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Jun 2021 15:37:11 +0200 Original-Received: from localhost ([::1]:43326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsQIX-0000fN-4h for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Jun 2021 09:37:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsQIQ-0000e8-H5 for bug-gnu-emacs@gnu.org; Sun, 13 Jun 2021 09:37:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lsQIQ-000376-8y for bug-gnu-emacs@gnu.org; Sun, 13 Jun 2021 09:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lsQIP-0003hc-Ty for bug-gnu-emacs@gnu.org; Sun, 13 Jun 2021 09:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Jun 2021 13:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48978 X-GNU-PR-Package: emacs Original-Received: via spool by 48978-submit@debbugs.gnu.org id=B48978.162359138714187 (code B ref 48978); Sun, 13 Jun 2021 13:37:01 +0000 Original-Received: (at 48978) by debbugs.gnu.org; 13 Jun 2021 13:36:27 +0000 Original-Received: from localhost ([127.0.0.1]:43013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsQHq-0003gl-LV for submit@debbugs.gnu.org; Sun, 13 Jun 2021 09:36:27 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsQHp-0003gX-5G for 48978@debbugs.gnu.org; Sun, 13 Jun 2021 09:36:25 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:41486) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsQHj-0002gu-Pg; Sun, 13 Jun 2021 09:36:19 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2528 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsQHj-0005Xj-DY; Sun, 13 Jun 2021 09:36:19 -0400 In-Reply-To: <87tum1aobt.fsf@gmail.com> (message from No Wayman on Sun, 13 Jun 2021 08:51:09 -0400) 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" Xref: news.gmane.io gmane.emacs.bugs:208436 Archived-At: > From: No Wayman > Cc: 48978@debbugs.gnu.org > Date: Sun, 13 Jun 2021 08:51:09 -0400 > > > What happens if you do the following from the shell prompt: > > > > $ emacs -batch -l comp -f batch-native-compile > > /usr/share/emacs/28.0.50/lisp/progmodes/etags.el > > Here we get the rest of the file-error: > > Debugger entered--Lisp error: (file-error > "/usr/share/emacs/28.0.50/lisp/progmodes/etags.el" "Creating file > with prefix" "Permission denied" > "/usr/share/emacs/28.0.50/lisp/progmodes/etags.elc") > signal(file-error > ("/usr/share/emacs/28.0.50/lisp/progmodes/etags.el" "Creating > file with prefix" "Permission denied" > "/usr/share/emacs/28.0.50/lisp/progmodes/etags.elc")) > comp--native-compile("/usr/share/emacs/28.0.50/lisp/progmodes/etags.el") > batch-native-compile() > command-line-1(("-l" "comp" "-f" "batch-native-compile" > "/usr/share/emacs/28.0.50/lisp/progmodes/etags.el")) > command-line() > normal-top-level() > > Which is obviously a permissions error. > > > Also, is /usr/share/emacs/28.0.50/lisp/progmodes writable by > > your > > user? > > Permissions for the directory are as follows: > > drwxr-xr-x 2 root root 4.0K Jun 13 08:48 > /usr/share/emacs/28.0.50/lisp/progmodes/ > > ^Looks like that's the problem! Yes, that's what I thought was happening. > I'm using an AUR script to install Emacs. > I see now there was a recent change to that script which modifies > the permissions of directories: > > https://aur.archlinux.org/cgit/aur.git/commit/?h=emacs-git&id=dca21d899ec2b1390526a300c7a617a22165dbda > > Willing to bet that's the cause of the error here. > I'll contact the maintainer of that installation script. > Thanks for the response and sorry for the noise (though, I do > think there may be a bug with the way that file-error is being > reported). It isn't noise: Emacs shouldn't really try creating files in that directory, not when native-compiling in the background. Andrea, this happens because native-compilation calls byte-compilation, which then attempts to create the temporary .elc file in the same directory where the .el file lives. I show the backtrace which leads to this issue below. Do we really need that temporary file for the purposes of native-compilation, or could we disable its creation? If the latter, I think we should, because in general there's no reason to assume the /usr/share tree is writable by unprivileged users. Here's the backtrace I promised: Thread 1 hit Breakpoint 2, Fmake_temp_file_internal (prefix=XIL(0x8000000008cb8990), dir_flag=XIL(0), suffix=XIL(0x8000000005aa61ec), text=XIL(0)) at fileio.c:692 692 CHECK_STRING (prefix); (gdb) pp prefix "d:/gnu/git/emacs/native-comp/lisp/progmodes/etags.elc" (gdb) pp suff suffix suffix_len suffix_p suffixes (gdb) pp suffix "" (gdb) bt #0 Fmake_temp_file_internal (prefix=XIL(0x8000000008cb8990), dir_flag=XIL(0), suffix=XIL(0x8000000005aa61ec), text=XIL(0)) at fileio.c:692 #1 0x7140f8a7 in F6d616b652d74656d702d66696c65_make_temp_file_0 ( par_0=-9223372036742191384, par_1=0, par_2=0, par_3=0) from d:\gnu\git\emacs\native-comp\native-lisp\28.0.50-19bbbe78\preloaded\files-1e8937b2-855151cb.eln #2 0x012624c7 in funcall_subr (subr=0x5ec187c, numargs=1, args=0x82d6d8) at eval.c:3122 #3 0x01261e51 in Ffuncall (nargs=2, args=0x82d6d0) at eval.c:3039 #4 0x071273ba in F627974652d636f6d70696c652d66696c65_byte_compile_file_0 ( par_0=-9223372036743223960, par_1=0) from d:\gnu\git\emacs\native-comp\native-lisp\28.0.50-19bbbe78\bytecomp-12882072-407267f8.eln #5 0x0126240c in funcall_subr (subr=0xfe4668, numargs=1, args=0x82d908) at eval.c:3116 #6 0x01261e51 in Ffuncall (nargs=2, args=0x82d900) at eval.c:3039 #7 0x012ce32c in exec_byte_code (bytestr=XIL(0x8000000006abb530), vector=XIL(0xa000000000ff3488), maxdepth=make_fixnum(16), args_template=make_fixnum(257), nargs=1, args=0x82e280) at bytecode.c:632 #8 0x01262996 in fetch_and_exec_byte_code (fun=XIL(0xa000000000ff35f0), syms_left=make_fixnum(257), nargs=1, args=0x82e278) at eval.c:3163 #9 0x01262f13 in funcall_lambda (fun=XIL(0xa000000000ff35f0), nargs=1, arg_vector=0x82e278) at eval.c:3244 #10 0x01261ec1 in Ffuncall (nargs=2, args=0x82e270) at eval.c:3043 #11 0x012603c8 in Fapply (nargs=3, args=0x82e270) at eval.c:2622 #12 0x012622f9 in funcall_subr (subr=0x1732a80 , numargs=3, args=0x82e270) at eval.c:3094 #13 0x01261e51 in Ffuncall (nargs=4, args=0x82e268) at eval.c:3039 #14 0x012ce32c in exec_byte_code (bytestr=XIL(0x8000000005ed74a4), vector=XIL(0xa000000008c00e90), maxdepth=make_fixnum(14), args_template=make_fixnum(385), nargs=1, args=0x82e8b0) at bytecode.c:632 #15 0x01262996 in fetch_and_exec_byte_code (fun=XIL(0xa000000008c0b2f0), syms_left=make_fixnum(385), nargs=1, args=0x82e8a8) at eval.c:3163 #16 0x01262f13 in funcall_lambda (fun=XIL(0xa000000008c0b2f0), nargs=1, arg_vector=0x82e8a8) at eval.c:3244 #17 0x01261ec1 in Ffuncall (nargs=2, args=0x82e8a0) at eval.c:3043 #18 0x06ecfb72 in F636f6d702d7370696c6c2d6c6170_comp_spill_lap_0 ( par_0=-9223372036743223960) from d:\gnu\git\emacs\native-comp\native-lisp\28.0.50-19bbbe78\comp-7672a6ed-b8d99e2f.eln #19 0x012623dd in funcall_subr (subr=0x8c0b320, numargs=1, args=0x82ead8) at eval.c:3114 #20 0x01261e51 in Ffuncall (nargs=2, args=0x82ead0) at eval.c:3039 #21 0x06f2b5aa in F636f6d702d2d6e61746976652d636f6d70696c65_comp__native_compile_0 (par_0=-9223372036743223960, par_1=0, par_2=0) from d:\gnu\git\emacs\native-comp\native-lisp\28.0.50-19bbbe78\comp-7672a6ed-b8d99e2f.eln #22 0x01262454 in funcall_subr (subr=0x6793e30, numargs=1, args=0x82ed00) at eval.c:3119 #23 0x01261e51 in Ffuncall (nargs=2, args=0x82ecf8) at eval.c:3039 #24 0x06f2cd3d in F62617463682d6e61746976652d636f6d70696c65_batch_native_compile_0 () from d:\gnu\git\emacs\native-comp\native-lisp\28.0.50-19bbbe78\comp-7672a6ed-b8d99e2f.eln #25 0x012623c1 in funcall_subr (subr=0x8c11638, numargs=0, args=0x82efd8) at eval.c:3112 #26 0x01261e51 in Ffuncall (nargs=1, args=0x82efd0) at eval.c:3039 #27 0x06845ee1 in F636f6d6d616e642d6c696e652d31_command_line_1_0 ( par_0=-4611686018316439424) from d:\gnu\git\emacs\native-comp\native-lisp\28.0.50-19bbbe78\preloaded\startup-bbc6ea72-6a9af975.eln #28 0x012623dd in funcall_subr (subr=0x5efb2ec, numargs=1, args=0x82f3e8) at eval.c:3114 #29 0x01261e51 in Ffuncall (nargs=2, args=0x82f3e0) at eval.c:3039 #30 0x0683b3a1 in F636f6d6d616e642d6c696e65_command_line_0 () from d:\gnu\git\emacs\native-comp\native-lisp\28.0.50-19bbbe78\preloaded\startup-bbc6ea72-6a9af975.eln #31 0x012623c1 in funcall_subr (subr=0x5e7f38c, numargs=0, args=0x82f638) at eval.c:3112 #32 0x01261e51 in Ffuncall (nargs=1, args=0x82f630) at eval.c:3039 #33 0x0683621d in F6e6f726d616c2d746f702d6c6576656c_normal_top_level_0 () from d:\gnu\git\emacs\native-comp\native-lisp\28.0.50-19bbbe78\preloaded\startup-bbc6ea72-6a9af975.eln #34 0x0125f90f in eval_sub (form=XIL(0xc000000005f5e48c)) at eval.c:2511 #35 0x0125edc3 in Feval (form=XIL(0xc000000005f5e48c), lexical=XIL(0)) at eval.c:2343 #36 0x01164957 in top_level_2 () at keyboard.c:1103 #37 0x0125bde1 in internal_condition_case (bfun=0x1164924 , handlers=XIL(0x90), hfun=0x11640d5 ) at eval.c:1478 #38 0x011649d1 in top_level_1 (ignore=XIL(0)) at keyboard.c:1111 #39 0x0125ab24 in internal_catch (tag=XIL(0xeee0), func=0x116495d , arg=XIL(0)) at eval.c:1198 #40 0x01164829 in command_loop () at keyboard.c:1072 #41 0x01163b65 in recursive_edit_1 () at keyboard.c:720 #42 0x01163dd3 in Frecursive_edit () at keyboard.c:789 #43 0x0115f470 in main (argc=7, argv=0xa44140) at emacs.c:2298 Lisp Backtrace: "make-temp-file" (0x82d6d8) "byte-compile-file" (0x82d908) 0xff35f0 PVEC_COMPILED "apply" (0x82e270) "comp-spill-lap-function" (0x82e8a8) "comp-spill-lap" (0x82ead8) "comp--native-compile" (0x82ed00) "batch-native-compile" (0x82efd8) "command-line-1" (0x82f3e8) "command-line" (0x82f638) "normal-top-level" (0x82f728)