[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#48978: 28.0.50; native-comp: Error: File error Creating file with pr
From: |
Eli Zaretskii |
Subject: |
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@gmail.com>
> 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 <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)