bugGNU Octave - Bugs: bug #36464, strread() format strings...

 
 

bug #36464: strread() format strings containing %[^] markers

Submitted by:  Júlio Hoffimann Mendes <juliohm>
Submitted on:  Mon 14 May 2012 12:08:14 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: Philip Nienhuis <philipnienhuis>
Originator Name: juliohmOpen/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.

 

Mon 25 Jun 2012 08:39:33 PM UTC, comment #5:

Error msg for this and other unsupported ML-compatible specifiers in this changeset:
http://hg.savannah.gnu.org/hgweb/octave/rev/d5aee269b770

Closing this report

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Mon 28 May 2012 09:10:02 PM UTC, comment #4:

I've submitted a patch for bug #33875 (where it actually belongs) and asked Rik to review it (a.o. as there's lots of regexp stuff included).
%[..] etc. pattern matching specifiers work now, with some limitations imposed by strread's general setup.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Tue 15 May 2012 11:58:41 AM UTC, comment #3:

Progress report:

While again looking into %[...] specifiers again last evening, it soon dawned upon me what the issue was last summer when I first tried to implement this.

Due to the way strread.m has been set up, the data file is split up into columns before the actual regular expressions constituted by %[...] format specifiers are processed.
While splitting up, multiple contiguous whitespaces are folded into one, incl. those within data fields coresponding to %[...] specifiers. Worse yet, data fields can be split into multiple data columns if they contain whitespace and/or delimiter chars.

This implies that %[...] (and for that matter, "..." (%q) fields) containing whitespace and delimiters may come out severely if not completely garbled. That is, provided strread hasn't lost track and gave up long before even reaching EOF.
Same goes for %[^....].

Only %[...] and %[^...] conversion specifiers (which merely skip character strings) have a chance of working somewhat reliably.

So, I think implementing %[...] and %q specifiers can be done, but without guarantee that the corresponding text output isn't mangled.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Mon 14 May 2012 09:41:00 PM UTC, comment #2:

Patch (diff -u) to detect unsupported format conversion specifiers attached.

(Sorry no changeset)

(file #25857)

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Mon 14 May 2012 07:37:18 PM UTC, comment #1:

Several other format conversion specifiers supported by ML are not supported (yet) in strread (see bug #33875). But that shouldn't lead to an error & aborting strread.m

IMO the most urgent fix is to scan the format string for those unsupported format specifiers and emit an error message if found.

Implementing %[] probably is a bit too convoluted now; I might look into it later.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Mon 14 May 2012 12:08:14 PM UTC, original submission:

The command above should produce 2 as output, but seems that %[^] greedy markers are not implemented in GNU Octave yet.

Júlio Hoffimann Mendes <juliohm>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #25857:  strread_36464.diff added by philipnienhuis (733B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by philipnienhuis (Posted a comment)
  • -unavailable- added by juliohm (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 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 25 Jun 2012 08:39:33 PM UTCphilipnienhuisStatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Mon 14 May 2012 09:41:00 PM UTCphilipnienhuisAttached File-=>Added strread_36464.diff, #25857
      StatusConfirmed=>Patch Submitted
    Mon 14 May 2012 07:37:18 PM UTCphilipnienhuisItem GroupFeature Request=>Incorrect Result
      StatusNone=>Confirmed
      Assigned toNone=>philipnienhuis
      Operating SystemGNU/Linux=>Any

    Back to the top


    Powered by Savane 3.1-cleanup1