bugGNU Octave - Bugs: bug #62588, End of file isn't cleared on save...

 
 

bug #62588: End of file isn't cleared on save when removing characters

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Mon 06 Jun 2022 12:15:10 PM UTC
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 7.1.0 Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Tue 07 Jun 2022 05:08:46 PM UTC, comment #4: 

I just asked on discourse for the exact code that conflicts before reading jwe's new comment in this bug report. I am going to merge stable to default.

Torsten Lilge <ttl>
Project Member
Tue 07 Jun 2022 12:19:09 PM UTC, comment #3: 

@Torsten:  After this change I see a conflict when trying to merge stable to default and it's not clear to me what the proper resolution is.  It seems that libgui/src/m-editor/file-editor-tab.cc is significantly different on stable and default now.  Could you please merge stable to default and resolve the conflict?

John W. Eaton <jwe>
Project Administrator
Mon 06 Jun 2022 06:32:23 PM UTC, comment #2: 

Thanks for the quick fix.
Works for me now.

Closing report.

Markus Mützel <mmuetzel>
Project Member
Mon 06 Jun 2022 05:25:28 PM UTC, comment #1: 

This should be fixed with changeset http://hg.savannah.gnu.org/hgweb/octave/rev/7ea420f2c722

While changing the open mode from WriteOnly to ReadWrite in order to avoid cleared files in case of some write failures I missed the case where a shorter contents is written to a longer file.

Torsten Lilge <ttl>
Project Member
Mon 06 Jun 2022 12:15:10 PM UTC, original submission:  

When removing characters in a file using the built-in editor, the file isn't shrunk to the new size. Instead, the tail of the file is duplicated.

Steps to reproduce:
1. Create some file with the following content and save it as `test_editor_tail.m`:

This a file with arbitrary content to reproduce the error.

>> system('cat test_editor_tail.m')
This a file with arbitrary content to reproduce the error.
ans = 0

2. Delete some part of the file and save it again:

This a file to reproduce the error.

>> system('cat test_editor_tail.m')
This a file to reproduce the error.
o reproduce the error.
ans = 0

For some reason, the file appears as expected in the built-in editor. But actually, the file size didn't change and the trailing characters remain at the end of the stored file.

"Force newline at end when saving file" and "Remove trailing spaces when saving file" is activated in case that should matter.

This is a regression from Octave 7.1.0 on the stable branch.
Tested on Linux. But it's probably an issue on any platform.

CC'ing Torsten because he might hopefully have an idea of what might be going on.

Markus Mützel <mmuetzel>
Project Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by mmuetzel (Submitted the item)
  • -email is unavailable- added by mmuetzel
  •  

    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 project members can vote.

     

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-06-06 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-06-06 ttl StatusNone Ready For Test
    2022-06-06 mmuetzel Carbon-Copy- Added ttl

    Back to the top


    Powered by Savane 3.9