GNU bug report logs - #48978
28.0.50; native-comp: Error: File error Creating file with prefix

Previous Next

Package: emacs;

Reported by: No Wayman <iarchivedmywholelife <at> gmail.com>

Date: Sat, 12 Jun 2021 20:08:01 UTC

Severity: normal

Found in version 28.0.50

Done: Andrea Corallo <akrl <at> sdf.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48978 in the body.
You can then email your comments to 48978 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#48978; Package emacs. (Sat, 12 Jun 2021 20:08:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to No Wayman <iarchivedmywholelife <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 12 Jun 2021 20:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: No Wayman <iarchivedmywholelife <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; native-comp: Error: File error Creating file with prefix
Date: Sat, 12 Jun 2021 15:48:33 -0400
Recently upgraded and I'm getting the same error for all of the 
elisp files under /usr/share/emacs/28.0.50/lisp/*
e.g.

Warning (comp): /usr/share/emacs/28.0.50/lisp/progmodes/etags.el: 
Error: File error Creating file with prefix 

Happens regardless of whether Emacs is started with my init or 
with emacs -Q.
As soon as any package along that path is loaded, the errors kick 
in when JIT native compilation is attempted.
Inspecting ~/.emacs.d/eln-cache/28.0.50-d3c1e6c9 confirms the 
error, as none of those package have corresponding .eln files.

Happy to provide more information if necessary 


In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, 
cairo version 1.17.4, Xaw3d scroll bars)
of 2021-06-12 built on arch
Repository revision: 0afab352e02d7070a8ced2af53c1d01217400cdf
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 
11.0.12011000
System Description: Arch Linux

Configured using:
'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
--localstatedir=/var --mandir=/usr/share/man 
--with-gameuser=:games
--with-sound=alsa --with-modules --without-gconf 
--without-gsettings
--enable-link-time-optimization --with-native-compilation
--with-x-toolkit=lucid --with-xft --with-xaw3d
--without-compress-install
'--program-transform-name=s/\([ec]tags\)/\1.emacs/'
'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt 
-fexceptions
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
-fstack-clash-protection -fcf-protection -flto 
-fuse-linker-plugin'
LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON 
LCMS2
LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY 
INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS 
X11
XAW3D XDBE XIM XPM LUCID ZLIB
Important settings:
 value of $LANG: en_US.UTF-8
 locale-coding-system: utf-8-unix





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48978; Package emacs. (Sun, 13 Jun 2021 07:18:02 GMT) Full text and rfc822 format available.

Message #8 received at 48978 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: No Wayman <iarchivedmywholelife <at> gmail.com>
Cc: 48978 <at> debbugs.gnu.org
Subject: Re: bug#48978: 28.0.50;
 native-comp: Error: File error Creating file with prefix
Date: Sun, 13 Jun 2021 10:16:50 +0300
> From: No Wayman <iarchivedmywholelife <at> gmail.com>
> Date: Sat, 12 Jun 2021 15:48:33 -0400
> 
> Recently upgraded

You upgraded from which Emacs version?

> and I'm getting the same error for all of the elisp files under
> /usr/share/emacs/28.0.50/lisp/* e.g.
> 
> Warning (comp): /usr/share/emacs/28.0.50/lisp/progmodes/etags.el: 
> Error: File error Creating file with prefix 

This doesn't seem to be the complete error message which should be
emitted when that operation fails.  It should display the file name
and the error description after the text you show.

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

(The above assumes that the Emacs binary from this new version is on
PATH; if not, replace "emacs" with the full absolute file name of the
Emacs binary.)

If the above command also fails, please show the full error message it
displays.

Also, is /usr/share/emacs/28.0.50/lisp/progmodes writable by your
user?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48978; Package emacs. (Sun, 13 Jun 2021 13:26:01 GMT) Full text and rfc822 format available.

Message #11 received at 48978 <at> debbugs.gnu.org (full text, mbox):

From: No Wayman <iarchivedmywholelife <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 48978 <at> debbugs.gnu.org
Subject: Re: bug#48978: 28.0.50; native-comp: Error: File error Creating
 file with prefix
Date: Sun, 13 Jun 2021 08:51:09 -0400
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

> You upgraded from which Emacs version?

Apologies, I should've been more specific.
I was on 28.0.50's master branch from a couple weeks ago.
Don't have the exact commit on hand.

> This doesn't seem to be the complete error message which should 
> be
> emitted when that operation fails.  It should display the file 
> name
> and the error description after the text you show.


I agree the error message looks incomplete, but that's all that's 
being reported.
Here's a sample of the *Async-native-compile-log*:



Compiling 
/home/n/.emacs.d/straight/repos/straight.el/straight.el...
Compiling /usr/share/emacs/28.0.50/lisp/edmacro.el...
/usr/share/emacs/28.0.50/lisp/edmacro.el: Error: File error 
Creating file with prefix
Compiling /usr/share/emacs/28.0.50/lisp/kmacro.el...
/usr/share/emacs/28.0.50/lisp/kmacro.el: Error: File error 
Creating file with prefix
Compiling /usr/share/emacs/28.0.50/lisp/info.el...
/usr/share/emacs/28.0.50/lisp/info.el: Error: File error Creating 
file with prefix
Compiling 
/usr/share/emacs/28.0.50/lisp/emacs-lisp/radix-tree.el...
/usr/share/emacs/28.0.50/lisp/emacs-lisp/radix-tree.el: Error: 
File error Creating file with prefix
Compiling 
/usr/share/emacs/28.0.50/lisp/emacs-lisp/easy-mmode.el...
/usr/share/emacs/28.0.50/lisp/emacs-lisp/easy-mmode.el: Error: 
File error Creating file with prefix
Compiling /usr/share/emacs/28.0.50/lisp/emacs-lisp/pcase.el...
/usr/share/emacs/28.0.50/lisp/emacs-lisp/pcase.el: Error: File 
error Creating file with prefix


And so on for all the files along that path.
I've attached the full contents of the buffer as well.


> 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!

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).

[async-byte-log.txt (text/plain, attachment)]
[Message part 3 (text/plain, inline)]
Thanks,
Nick





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48978; Package emacs. (Sun, 13 Jun 2021 13:37:01 GMT) Full text and rfc822 format available.

Message #14 received at 48978 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: No Wayman <iarchivedmywholelife <at> gmail.com>, Andrea Corallo <akrl <at> sdf.org>
Cc: 48978 <at> debbugs.gnu.org
Subject: Re: bug#48978: 28.0.50; native-comp: Error: File error Creating
 file with prefix
Date: Sun, 13 Jun 2021 16:36:12 +0300
> From: No Wayman <iarchivedmywholelife <at> gmail.com>
> Cc: 48978 <at> 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 <Sapply>, 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 <top_level_2>,
      handlers=XIL(0x90), hfun=0x11640d5 <cmd_error>) 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 <top_level_1>, 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)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48978; Package emacs. (Mon, 14 Jun 2021 13:02:01 GMT) Full text and rfc822 format available.

Message #17 received at 48978 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: No Wayman <iarchivedmywholelife <at> gmail.com>, 48978 <at> debbugs.gnu.org
Subject: Re: bug#48978: 28.0.50; native-comp: Error: File error Creating
 file with prefix
Date: Mon, 14 Jun 2021 13:01:44 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: No Wayman <iarchivedmywholelife <at> gmail.com>
>> Cc: 48978 <at> 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?

Agree, I think we can (and should) disable its creation when
`byte+native-compile' is non-nil.

> 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.

Right I pushed dc4ac39b26, it should do the job.  Nick could you have a
look if the it solves the problem?

Thanks

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48978; Package emacs. (Mon, 14 Jun 2021 13:05:02 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, No Wayman <iarchivedmywholelife <at> gmail.com>,
 48978 <at> debbugs.gnu.org
Subject: Re: bug#48978: 28.0.50; native-comp: Error: File error Creating
 file with prefix
Date: Mon, 14 Jun 2021 13:04:44 +0000
Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> From: No Wayman <iarchivedmywholelife <at> gmail.com>
>>> Cc: 48978 <at> 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?
>
> Agree, I think we can (and should) disable its creation when
> `byte+native-compile' is non-nil.
>
>> 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.
>
> Right I pushed dc4ac39b26, it should do the job.  Nick could you have a
                 ^^^
                 663fb3b774

Wasn't quick enough and had to rebase sorry :)

Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48978; Package emacs. (Mon, 14 Jun 2021 13:05:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48978; Package emacs. (Mon, 14 Jun 2021 13:24:02 GMT) Full text and rfc822 format available.

Message #26 received at 48978 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andrea Corallo <akrl <at> sdf.org>
Cc: iarchivedmywholelife <at> gmail.com, 48978 <at> debbugs.gnu.org
Subject: Re: bug#48978: 28.0.50; native-comp: Error: File error Creating
 file with prefix
Date: Mon, 14 Jun 2021 16:23:46 +0300
> From: Andrea Corallo <akrl <at> sdf.org>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, No Wayman
>  <iarchivedmywholelife <at> gmail.com>,
>         48978 <at> debbugs.gnu.org
> Date: Mon, 14 Jun 2021 13:04:44 +0000
> 
> > Right I pushed dc4ac39b26, it should do the job.  Nick could you have a
>                  ^^^
>                  663fb3b774
> 
> Wasn't quick enough and had to rebase sorry :)

No one is fast enough when Lars is around ;-)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48978; Package emacs. (Mon, 14 Jun 2021 16:09:02 GMT) Full text and rfc822 format available.

Message #29 received at 48978 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andrea Corallo <akrl <at> sdf.org>
Cc: iarchivedmywholelife <at> gmail.com, 48978 <at> debbugs.gnu.org
Subject: Re: bug#48978: 28.0.50; native-comp: Error: File error Creating
 file with prefix
Date: Mon, 14 Jun 2021 19:08:11 +0300
> From: Andrea Corallo <akrl <at> sdf.org>
> Cc: No Wayman <iarchivedmywholelife <at> gmail.com>, 48978 <at> debbugs.gnu.org
> Date: Mon, 14 Jun 2021 13:01:44 +0000
> 
> > Do we really need that temporary file for the purposes of
> > native-compilation, or could we disable its creation?
> 
> Agree, I think we can (and should) disable its creation when
> `byte+native-compile' is non-nil.

You mean, when `byte+native-compile' is nil, right?

> Right I pushed dc4ac39b26, it should do the job.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48978; Package emacs. (Mon, 14 Jun 2021 21:18:02 GMT) Full text and rfc822 format available.

Message #32 received at 48978 <at> debbugs.gnu.org (full text, mbox):

From: No Wayman <iarchivedmywholelife <at> gmail.com>
To: Andrea Corallo <akrl <at> sdf.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 48978 <at> debbugs.gnu.org
Subject: Re: bug#48978: 28.0.50; native-comp: Error: File error Creating
 file with prefix
Date: Mon, 14 Jun 2021 17:15:33 -0400
Andrea Corallo <akrl <at> sdf.org> writes:

> Right I pushed dc4ac39b26, it should do the job. Nick could you 
> have a
> look if the it solves the problem?
>
> Thanks
>
>   Andrea


Rebuilt from current head of master and everything looks like it's 
working fine.

Thanks Andrea and Eli.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48978; Package emacs. (Tue, 15 Jun 2021 07:51:02 GMT) Full text and rfc822 format available.

Message #35 received at 48978 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: iarchivedmywholelife <at> gmail.com, 48978 <at> debbugs.gnu.org
Subject: Re: bug#48978: 28.0.50; native-comp: Error: File error Creating
 file with prefix
Date: Tue, 15 Jun 2021 07:50:24 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Andrea Corallo <akrl <at> sdf.org>
>> Cc: No Wayman <iarchivedmywholelife <at> gmail.com>, 48978 <at> debbugs.gnu.org
>> Date: Mon, 14 Jun 2021 13:01:44 +0000
>> 
>> > Do we really need that temporary file for the purposes of
>> > native-compilation, or could we disable its creation?
>> 
>> Agree, I think we can (and should) disable its creation when
>> `byte+native-compile' is non-nil.
>
> You mean, when `byte+native-compile' is nil, right?

Yes sorry.

>> Right I pushed dc4ac39b26, it should do the job.
>
> Thanks.

Welcome, thanks

  Andrea




Reply sent to Andrea Corallo <akrl <at> sdf.org>:
You have taken responsibility. (Tue, 15 Jun 2021 07:52:02 GMT) Full text and rfc822 format available.

Notification sent to No Wayman <iarchivedmywholelife <at> gmail.com>:
bug acknowledged by developer. (Tue, 15 Jun 2021 07:52:02 GMT) Full text and rfc822 format available.

Message #40 received at 48978-done <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: No Wayman <iarchivedmywholelife <at> gmail.com>
Cc: 48978-done <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#48978: 28.0.50; native-comp: Error: File error Creating
 file with prefix
Date: Tue, 15 Jun 2021 07:51:02 +0000
No Wayman <iarchivedmywholelife <at> gmail.com> writes:

> Andrea Corallo <akrl <at> sdf.org> writes:
>
>> Right I pushed dc4ac39b26, it should do the job. Nick could you have
>> a
>> look if the it solves the problem?
>>
>> Thanks
>>
>>   Andrea
>
>
> Rebuilt from current head of master and everything looks like it's
> working fine.
>
> Thanks Andrea and Eli.

Very nice, closing.

Thanks for reporting.

  Andrea




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 13 Jul 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 286 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.