bugGNU Octave - Bugs: bug #40894, unrecognised block comments in dos...

 
 

bug #40894: unrecognised block comments in dos format saved files

Submitted by:  John Donoghue <lostbard>
Submitted on:  Sat 14 Dec 2013 02:52:05 AM UTC  
 
Category: InterpreterSeverity: 4 - Important
Priority: 7 - HighItem Group: Incorrect Result
Status: FixedAssigned to: John W. Eaton <jwe>
Originator Name: John DOpen/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sun 15 Dec 2013 06:14:59 PM UTC, comment #8:

Checked in http://hg.savannah.gnu.org/hgweb/octave/rev/7af19113ec43

John Donoghue <lostbard>
Project Member
Sun 15 Dec 2013 04:08:31 PM UTC, comment #7:

Oh, that looks much better. Please check it in on the stable branch.

Thanks!

John W. Eaton <jwe>
Project AdministratorIn charge of this item.
Sun 15 Dec 2013 01:05:49 AM UTC, comment #6:

I played around with the parser for a while, and think I fixed the issue with a simple fix (attached)

(file #29922)

John Donoghue <lostbard>
Project Member
Sat 14 Dec 2013 01:35:48 PM UTC, comment #5:

I also tried the 1st patch which fixes the issue with a start %{.
It also works for all the examples below except:

John Donoghue <lostbard>
Project Member
Sat 14 Dec 2013 12:41:42 PM UTC, comment #4:

The 2nd patch fixes it for starting the file with a block comment.

However it appears that anything that is not valid statements
(ie: new lines, line comment) prior to the block comment also doesn't work:

and

and

and

Attempts run run 'test'

John Donoghue <lostbard>
Project Member
Sat 14 Dec 2013 05:33:49 AM UTC, comment #3:

Thanks for noticing that it is only failing at the beginning of the file. So I think I see what I was missing before. I'm guessing that the problem is that the pattern

that is matched at the beginning of a script or function file means that the next match can't be anchored by the beginning of line pattern ^. Thankfully, the only other patterns that use the line anchor are associated with exclusive start states so they won't be matched at the beginning of a file.

However, now I'm not sure YY_AT_BOL does what I thought, so the previous patch is probably not correct.

Maybe something like the second attached patch will work?

(file #29917)

John W. Eaton <jwe>
Project AdministratorIn charge of this item.
Sat 14 Dec 2013 04:36:47 AM UTC, comment #2:

We currently have two patterns to match comments in the lexer. They appear in the following order:

The flex docs say that when two patterns match and the text that they match is the same length, then the action that is used is supposed to be the one corresponding to the pattern that appears first in the lex input file. So unless I'm missing something, I think this may be a bug in flex. But it looks like we can also work around the problem with the attached patch. Please test it and let me know if it solves the problem for you.

I suppose that we should apply this change to the stable branch since block comments won't work for files with CRLF line endings and that seems like a fairly serious and obvious problem that will probably affect a lot of people. Does anyone object to making the change on the stable branch?

(file #29916)

John W. Eaton <jwe>
Project AdministratorIn charge of this item.
Sat 14 Dec 2013 03:34:29 AM UTC, comment #1:

A valid command before the block comment, and the block comment works as expected in both DOS and UNIX.

ie:

works as expected

John Donoghue <lostbard>
Project Member
Sat 14 Dec 2013 02:52:05 AM UTC, original submission:

In 3.8.0-rc1 .m file created:

If saved in DOS format (\r\n) the block comment isn't seen and 'test' will be run.
On saving the file in UNIX format, the block comment works as expected.

It does the same in Windows and Linux.

John Donoghue <lostbard>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #29922:  fix_dos_cr.patch added by lostbard (935B - application/octet-stream)
file #29917:  diffs.txt added by jwe (2KiB - text/plain)
file #29916:  diffs.txt added by jwe (4KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by lostbard (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 15 Dec 2013 06:14:59 PM UTClostbardStatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Sun 15 Dec 2013 01:05:49 AM UTClostbardAttached File-=>Added fix_dos_cr.patch, #29922
    Sat 14 Dec 2013 05:33:49 AM UTCjweAttached File-=>Added diffs.txt, #29917
    Sat 14 Dec 2013 04:37:38 AM UTCjweSeverity3 - Normal=>4 - Important
      Priority5 - Normal=>7 - High
      StatusNone=>Patch Submitted
      Assigned toNone=>jwe
    Sat 14 Dec 2013 04:36:46 AM UTCjweAttached File-=>Added diffs.txt, #29916

    Back to the top


    Powered by Savane 3.1-cleanup1