>>>> "Y" == Yoshiki Hayashi
<yoshiki(a)xemacs.org> writes:
Y> Raymond Toy <toy(a)rtp.ericsson.se> writes:
> Could there be a GC bug in file_truename or some process I/O
stuff?
Y> I read some filelock related codes and found one GC bug. I
Y> removed call to compute-buffer-file-name because its return
Y> value is just discarded. If you set it to buffer filename
Y> there, you'll get /full/path/to/.emacs when you find-file
Y> ~/.emacs instead of .emacs
Perhaps it is supposed to be used to initialize the buffer file
truename, not the buffer file name.
Y> 2000-11-09 Yoshiki Hayashi <yoshiki(a)xemacs.org>
Y> * fileio.c (Finsert_file_contents_internal): UNGCPRO before return.
Y> Remove unused call to compute-buffer-file-name.
Y> - return Fsignal (Qfile_error,
Y> - list2 (build_translated_string("not a regular file"),
Y> - filename));
Y> + RETURN_UNGCPRO
Y> + (Fsignal (Qfile_error,
Y> + list2 (build_translated_string("not a regular file"),
Y> + filename)));
Y> }
I believe this is correct, although this will only cause a problem if
Fsignal actually returns, for example by using `r' from the debugger.
So this is probably not Raymond's problem.
For bonus points: write a program that will find all the places in
the code that a naked return (without RETURN_UNGCPRO) is being called
from within a GCPRO'ed region of code.
Y> - /* XEmacs addition: */
Y> - /* This function used to be in C, ostensibly so that
Y> - it could be called here. But that's just silly.
Y> - There's no reason C code can't call out to Lisp
Y> - code, and it's a lot cleaner this way. */
Y> - if (!NILP (Ffboundp (Qcompute_buffer_file_truename)))
Y> - call1 (Qcompute_buffer_file_truename, make_buffer (buf));
I suggest you do some more thinking here.
Obviously someone intended for the function
compute-buffer-file-truename (in files.el) to be called. Your job is
to figure out WHY. Perhaps the value is to be used, or perhaps
compute-buffer-file-truename is being called for side-effect.
If you were to remove the above code, then the code it called in
files.el should be removed as well. My guess is that it is in lisp so
that the user can easily modify it.
Martin