2543Re: [jasspa] Re: Crash while executing 'read-file'
- Mar 4, 2010
Not as such, just been too busy to feedback my findings! And would you believe this is expected behaviour! (sort of :-)
ME is meant to be lean and mean so there's no bells and whistles - execute-buffer does literally execute the current buffer line by line and what does read-file do? Trashes the current buffer completely so execute-buffer goes off the rails. And this execute-buffer issue is not restricted to just read-file, and command that modifies the buffer has the potential to have the same effect, e.g. kill-region, yank, insert-string all have the potential to trigger this.
So What can be done?
1) Put lots of safe guards into ME to avoid this problem, i.e. ensure the buffer can't be trashed - but not only is this unlikely to ever be foolproof, its also low level hacking that will effect performance and its self defeating (execute-buffer will no longer work in the same way to any other macro processor creating just as many 'bugs' as it solves (although not as catastrophic)).
2) Remove this command entirely as its not safe - a macro version could be implemented which wrote the buffer out to a temporary file and used the safe execute-file instead.
3) Accept this issue. We should add a big note to the docs for this command warning of the dangers.
So I guess I'm ruling out (1) as impractical, what's you thoughts on the other 2? Personally I would go for 3, I have long since learnt that regularly saving all buffers is essential when developing macros - execute-buffer is not the only way of getting into trouble and I use execute-buffer regularly.
Do you need any firemen to help putting out the fire on this one? :-)
--- In jasspa@yahoogroups. com, Steven Phillips <bill@...> wrote:
> I've reproduced the issue, now looking for the cause and a fix - thanks
> for reporting this.
> azynheira wrote:
> > Hello,
> > I have found a weird problem, reproducible in Windows and Linux 2.6.
> > 1) Have a script with 'read-file foobar', this can be done via macro
> > call or directly. Make sure that 'foobar' file does not exist.
> > 2) Load that script into a buffer in Micro Emacs (I have tested with
> > latest 2009 version).
> > 3) Execute the buffer via "execute-buffer' - Cambum! There you go
> > anice and clean crash :-)
> > It only happens if the 'read-file' statement is inside a read buffer
> > and the buffer is executed not if the macro is executed via @script
> > notation.
> > Comments?
> > Regards,
> > Pedro
- << Previous post in topic Next post in topic >>