octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59238] load variables from file: the next sav


From: Rik
Subject: [Octave-bug-tracker] [bug #59238] load variables from file: the next saving operation produces a faulty file
Date: Tue, 20 Oct 2020 14:42:14 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36

Follow-up Comment #15, bug #59238 (project octave):

@Markus: Thanks, that confirms what I was thinking and what you have
deciphered as well.

The string in Octave is 15 characters long.  When Octave writes this data to a
file it does so in binary format and records the length.  For our test string,
the output is


# type: string
# elements: 1
# length: 15


However, there is some unnecessary newline processing and "\n" is being
converted to CRLF.  Since the string had three newlines in it the actual
length written to the files was 18 characters.

If you read this back in with the specified length of 15 then you truncate 3
characters from the string.

In my test, I simply hacked the length to 18 to see if that was enough to have
it read the whole string, which it is.

One solution would be to find out where the "\n" -> CRLF expansion is
happening and suppress it so that only one character is ever written. 
Otherwise, we have to adjust both the length of the string as stored in the
file and have code in the load routine to unconvert CRLF back to "\n".  That
sounds harder, but I haven't looked at it deeply.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59238>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]