bugGNU Octave - Bugs: bug #55364, File overwritten with empty file...

 
 

bug #55364: File overwritten with empty file if encoding fails

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Wed 02 Jan 2019 03:26:35 PM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 5.0.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 05 Jan 2019 10:40:43 AM UTC, comment #6: 

Thanks for reviewing. I'll close this as fixed then.

Markus Mützel <mmuetzel>
Group administrator
Fri 04 Jan 2019 09:13:38 PM UTC, comment #5: 

I think bug report can be closed.

The duplicate call of the save routine is obviously caused by the file selected signal, which is emitted twice when using native file dialogs on my system. With non-native dialogs everything work as expected. I currently don't see a way to tackle this down and fix this.

Torsten Lilge <ttl>
Group Member
Thu 03 Jan 2019 07:21:08 PM UTC, comment #4: 

@Markus: Thanks for fixing this data loss bug!

I am seeing that the dialog box is now popping up twice when using "save as" and am trying to debug this. Obviously, the save routine was always called twice in this case.

Torsten Lilge <ttl>
Group Member
Thu 03 Jan 2019 10:26:25 AM UTC, comment #3: 

I pushed the patches to stable here:
http://hg.savannah.gnu.org/hgweb/octave/rev/1e3c42fbf4d3
and here:
http://hg.savannah.gnu.org/hgweb/octave/rev/6323979ee312

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Wed 02 Jan 2019 05:05:43 PM UTC, comment #2: 

And here an additional patch which adds an option to ignore potential data loss due to non-encodable characters.

(file #45845)

Markus Mützel <mmuetzel>
Group administrator
Wed 02 Jan 2019 03:45:39 PM UTC, comment #1: 

The attached patch moves checking if the codec is valid to before opening the file for write.

(file #45843)

Markus Mützel <mmuetzel>
Group administrator
Wed 02 Jan 2019 03:26:35 PM UTC, original submission:  

Steps to reproduce:
1. Set the editor encoding to some codepage that cannot encode all characters (e.g. ISO-8859-6).
2. Open an existing file with e.g. only ASCII characters.
3. Add some characters that cannot be saved with the selected encoding (e.g. "äöü") and save the file.
4. An error message is displayed and the existing file is overwritten with an empty file.

In this case, the prior content of the file should be retained.

Also in light of bug #55306, it would be nice to leave the user the option to save the file even if not all characters can be encoded.

Markus Mützel <mmuetzel>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #45845:  bug55364_ignore_data_loss.patch added by mmuetzel (2KiB - application/octet-stream)
file #45843:  bug55364_invalid_codec.patch added by mmuetzel (2KiB - 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 ttl (Posted a comment)
  • -email is unavailable- added by mmuetzel (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-01-05 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-01-03 mmuetzel StatusPatch Submitted Ready For Test
    2019-01-02 mmuetzel Attached File- Added bug55364_ignore_data_loss.patch, #45845
    2019-01-02 mmuetzel Attached File- Added bug55364_invalid_codec.patch, #45843
        StatusNone Patch Submitted

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code