bugGNU Octave - Bugs: bug #59955, dlmwrite fails silently for...

 
 

bug #59955: dlmwrite fails silently for variables larger than 2^31 elements

Submitter:  None
Submitted:  Wed 27 Jan 2021 05:18:28 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 01 Feb 2021 06:20:25 PM UTC, comment #4: 

I pushed the changeset to the development branch here: http://hg.savannah.gnu.org/hgweb/octave/rev/b50ca5cbfb0f.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Fri 29 Jan 2021 05:32:19 PM UTC, comment #3: 

Thank you for the fix, Rik. It now works as expected for variables bigger than 2^31 elements and can be applied.

Anonymous
Thu 28 Jan 2021 07:53:49 PM UTC, comment #2: 

Attached is a patch that works for me.  The trouble is, as I expected, that some internal variables were declared to be of type "int" rather than "octave_idx_type".  All tests pass for me when running "make check" so I don't think this is a problem.  Marking as "Patch Submitted" and will let someone review/test before committing.

(file #50800)

Rik <rik5>
Group administrator
Thu 28 Jan 2021 05:38:31 PM UTC, comment #1: 

Confirmed.  Likely that dlmwrite (which is quite old code) is somehow using int or int32_t rather than octave_idx_type (which is configured as 64 or 32 bits).  The modified test I used was


## FAILS
foo = ones (2^31, 1, "uint8"); # larger than 2^31 elements, fails
## WORKS
foo = ones (2^31-1, 1, "uint8"); # larger than 2^31 elements, fails
dlmwrite ("large_dlmwrite.txt", foo);



Rik <rik5>
Group administrator
Wed 27 Jan 2021 05:18:28 PM UTC, original submission:  

This operation causes dlmwrite to write out a file that only has a single comma separator with no data. There is no error message about size limits etc. Perhaps dlmwrite can be made to reject variables larger than a certain size if that's appropriate? This is on Octave 7.0.0 compiled with --enable-64 on 64-bit Linux.


foo = ones (121e6, 18, "uint8"); # larger than 2^31 elements, fails
dlmwrite ("myfilename", foo);


However dlmwrite does work for variables that are larger than 2^31 bytes as long as they have fewer than 2^31 elements, e.g. a double array foo = ones (16e6, 18).

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #50800:  bug59955.cset added by rik5 (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-02-01 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2021-01-28 rik5 Attached File- Added bug59955.cset, #50800
        StatusConfirmed Patch Submitted
    2021-01-28 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code