bugGNU Octave - Bugs: bug #34558, strread does not honor \n as...

 
 

bug #34558: strread does not honor \n as single-quoted delimiter

Submitter:  Michael Goffioul <goffioul>
Submitted:  Sat 15 Oct 2011 11:20:35 AM UTC
   
 
Category:  Interpreter Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 17 Oct 2011 02:47:32 AM UTC, comment #4: 

2nd changeset is attached. This one calles do_string_escape() for single-quoted strings only.

(file #24159)

Ben Abbott <bpabbott>
Group Member
Sun 16 Oct 2011 05:29:31 PM UTC, comment #3: 

Please will somebody also make this patch apply to
- whitespace
- endofline
arguments in strread?

(I'm sorry, I have a (hopefully temporary) dominant arm/shoulder muscle dysfunction after neck hernia surgery last week and for at least the next weeks I can spend only very short periods behind my keyboard each day :-( )

I'll have a look if this is also warranted for the format string (I can imagine one can have literals comprising \t or \0 etc there).

BTW MG's if clause should look more like

if (strcmp (typeinfo (delim), "sq_string"))


Philip Nienhuis <philipnienhuis>
Group Member
Sat 15 Oct 2011 08:28:37 PM UTC, comment #2: 

I think John's proposal was better:


 if (typeinfo (delim, "sq_string"))
   delim = sprintf (strrep (delim, "%", "%%"));
 endif


Michael Goffioul <goffioul>
Sat 15 Oct 2011 08:10:55 PM UTC, comment #1: 

I've attached a trivial changeset.

Any problems with this?

(file #24155)

Ben Abbott <bpabbott>
Group Member
Sat 15 Oct 2011 11:20:35 AM UTC, original submission:  

The function strread does not honor \n as a delimiter when it is single-quoted.


octave-qt.exe:5> strread(sprintf('1\n2\n3'), '%d', 'delimiter', '\n')
ans = 123


While in Matlab, we see:


>> strread(sprintf('1\n2\n3'), '%d', 'delimiter', '\n')

ans =

    1
    2
    3


Michael Goffioul <goffioul>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #24159:  changeset.patch added by bpabbott (1KiB - application/octet-stream - 2nd changeset)
file #24155:  changeset.patch added by bpabbott (739B - application/octet-stream - 1st chagneset)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by philipnienhuis (Posted a comment)
  • -email is unavailable- added by bpabbott (Updated 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 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-10-19 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
        Summarystrread does not honor \\n as single-quoted delimiter strread does not honor \n as single-quoted delimiter
    2011-10-17 bpabbott Attached File- Added changeset.patch, #24159
        Summarystrread does not honor \\n as single-quoted delimiter strread does not honor \n as single-quoted delimiter
    2011-10-16 philipnienhuis Summarystrread does not honor \\n as single-quoted delimiter strread does not honor \n as single-quoted delimiter
    2011-10-15 goffioul Summarystrread does not honor \\n as single-quoted delimiter strread does not honor \n as single-quoted delimiter
    2011-10-15 bpabbott Attached File- Added changeset.patch, #24155
        StatusNone Patch Submitted
        Summarystrread does not honor \\n as single-quoted delimiter strread does not honor \n as single-quoted delimiter
    2011-10-15 goffioul Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code