[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51158] save function corrupts text / binary f
From: |
Tasos Papastylianou |
Subject: |
[Octave-bug-tracker] [bug #51158] save function corrupts text / binary files when appending as binary / text respectively |
Date: |
Thu, 1 Jun 2017 17:52:20 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0 |
URL:
<http://savannah.gnu.org/bugs/?51158>
Summary: save function corrupts text / binary files when
appending as binary / text respectively
Project: GNU Octave
Submitted by: tpapastylianou
Submitted on: Thu 01 Jun 2017 09:52:19 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Unexpected Error
Status: None
Assigned to: None
Originator Name: Tasos Papastylianou <poacheR>
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.2.1
Operating System: GNU/Linux
_______________________________________________________
Details:
Consider the following code:
a = 1;
save -text binfile a
save -text textfile a
save -binary binfile a
a = 2;
save -text -append binfile a
save -binary -append textfile a
clear
load textfile a
a % -- a = 1
load binfile a % -- error: load: trouble reading binary file 'binfile'
On linux I could check what kind of file it is before appending, e.g.:
system('file textfile') % -- textfile: data
system('file binfile') % -- binfile: Octave binary data (little endian)
but obviously, this is not a portable solution.
Proposal: If save is called with the append option, it should first check that
the file type specified is the same as the target, otherwise exit with an
error.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51158>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #51158] save function corrupts text / binary files when appending as binary / text respectively,
Tasos Papastylianou <=