Loading ...
Sorry, an error occurred while loading the content.

Re: [jasspa] Crash while executing 'read-file'

Expand Messages
  • Steven Phillips
    Pedro, I ve reproduced the issue, now looking for the cause and a fix - thanks for reporting this. Steve
    Message 1 of 5 , Feb 18, 2010
    • 0 Attachment
      Pedro,

      I've reproduced the issue, now looking for the cause and a fix - thanks for reporting this.

      Steve

      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

    • azynheira
      Hi Steve, Do you need any firemen to help putting out the fire on this one? :-) Kind Regards, Pedro
      Message 2 of 5 , Mar 4, 2010
      • 0 Attachment
        Hi Steve,
        Do you need any firemen to help putting out the fire on this one? :-)

        Kind Regards,
        Pedro


        --- In jasspa@yahoogroups.com, Steven Phillips <bill@...> wrote:
        >
        > Pedro,
        >
        > I've reproduced the issue, now looking for the cause and a fix - thanks
        > for reporting this.
        >
        > Steve
        >
        > 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
        > >
        > >
        >
      • Steven Phillips
        Pedro, 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
        Message 3 of 5 , Mar 4, 2010
        • 0 Attachment
          Pedro,

          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.

          Steve

          azynheira wrote:
           

          Hi Steve,
          Do you need any firemen to help putting out the fire on this one? :-)

          Kind Regards,
          Pedro

          --- In jasspa@yahoogroups. com, Steven Phillips <bill@...> wrote:
          >
          > Pedro,
          >
          > I've reproduced the issue, now looking for the cause and a fix - thanks
          > for reporting this.
          >
          > Steve
          >
          > 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
          > >
          > >
          >

        • azynheira
          Hello Steve, Thanks for your reply. :-) I would see 3) was well, but I just have one comment, is in the case that the macro is already coded and working and
          Message 4 of 5 , Mar 4, 2010
          • 0 Attachment
            Hello Steve,
            Thanks for your reply. :-)

            I would see 3) was well, but I just have one comment, is in the case that the macro is already coded and working and it's being ran by the user.

            In the case we have the error situation then ME will crash in all its glory and the user has not way to escape.

            Maybe some wrapper macros should be included ...


            Regards,
            Pedro


            --- In jasspa@yahoogroups.com, Steven Phillips <bill@...> wrote:
            >
            > Pedro,
            >
            > 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.
            >
            > Steve
            >
            > azynheira wrote:
            > >
            > >
            > > Hi Steve,
            > > Do you need any firemen to help putting out the fire on this one? :-)
            > >
            > > Kind Regards,
            > > Pedro
            > >
            > > --- In jasspa@yahoogroups.com <mailto:jasspa%40yahoogroups.com>,
            > > Steven Phillips <bill@> wrote:
            > > >
            > > > Pedro,
            > > >
            > > > I've reproduced the issue, now looking for the cause and a fix - thanks
            > > > for reporting this.
            > > >
            > > > Steve
            > > >
            > > > 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
            > > > >
            > > > >
            > > >
            > >
            > >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.