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

 
 

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

Submitter:  Júlio Hoffimann Mendes <juliohm>
Submitted:  Mon 14 May 2012 12:08:14 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  philipnienhuis
Originator Name:  juliohm Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group Member
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>
Group Member
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>
Group Member
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>
Group Member
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>
Group Member
Mon 14 May 2012 12:08:14 PM UTC, original submission:  


strread('1 2 3 4 5 6',"%*n%n%*[^\n]")


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 Files:
   
   
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
  • -email is unavailable- added by philipnienhuis (Posted a comment)
  • -email is unavailable- added by juliohm (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-06-25 philipnienhuis StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2012-05-14 philipnienhuis Attached File- Added strread_36464.diff, #25857
        StatusConfirmed Patch Submitted
    2012-05-14 philipnienhuis Item GroupFeature Request Incorrect Result
        StatusNone Confirmed
        Assigned toNone philipnienhuis
        Operating SystemGNU/Linux Any

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code