bugGNU Octave - Bugs: bug #53337, Need an option to truncate a file...

 
 

bug #53337: Need an option to truncate a file after rewriting it with shorter contents

Submitter:  Philip Nienhuis <philipnienhuis>
Submitted:  Tue 13 Mar 2018 05:29:22 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Duplicate Assigned to:  None
Originator Name:  Philip Nienhuis Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 13 Mar 2018 11:04:10 PM UTC, comment #2: 

Didn't look that far back (2014!)

Philip Nienhuis <philipnienhuis>
Group Member
Tue 13 Mar 2018 06:28:16 PM UTC, comment #1: 

This looks like bug #41517. Please close as a duplicate if you agree.

Mike Miller <mtmiller>
Group Member
Tue 13 Mar 2018 05:29:22 PM UTC, original submission:  

While fixing bug #53298 I stumbled upon the fact that when overwriting files with new contents that are shorter than previous contents, trailing cruft is preserved after the last write action.
Workarounds include overwriting the trailing cruft with spaces, or writing to another file and renaming it afterwards. Both workarounds look overly involved.

It would be easier if there were a way to truncate a file.

Options:

- a dedicated function, say ftrunc(), that by default truncates at the current file pointer or accepts a position where the file should be truncated.

- an option for fclose() to truncate the file during the closing action.

Philip Nienhuis <philipnienhuis>
Group 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 philipnienhuis (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-26 mtmiller Carbon-CopyRemoved 80942 -
    2018-03-13 philipnienhuis StatusNone Duplicate
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code