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

From: No Wayman <[email-masked]>
Date: Sun, 13 Jun 2021 08:51:09 -0400

Eli Zaretskii <[email-masked]> 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).

Thanks,
Nick