From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Weird Bug in Get_Line
Date: Wed, 26 Apr 2017 19:03:36 +0200
Date: 2017-04-26T19:03:36+02:00 [thread overview]
Message-ID: <odqjnb$g4k$1@dont-email.me> (raw)
In-Reply-To: <1896933e-e985-420b-a4fe-9cca76af9976@googlegroups.com>
On 04/26/2017 09:38 AM, Brian Kolden wrote:
> I came across an interesting issue in the Get_Line function. When piping in a
> file (using the linux cammand '<') GNAT "raises ADA.IO_EXCEPTIONS.END_ERROR :
> a-tigeli.adb:96".
>
> However, the interesting issue is this only happens for a very small number
> of line lengths. I've noticed the exception is only thrown on lines with
> length 500, 501, 1000, 1001. Lines bigger or smaller don't seem to raise the
> issue, even other multiples of 500. This only is effected when using a file
> as input, copying and pasting the line into the terminal does not seem to
> trigger it.
And also
> I forgot to mention the line has to be the very last line, otherwise there
> would be no EOF character to read. No newline character should be there, vim
> auto inserts one by default, for example. I was also able to trigger it on
> Redhat 5.11.0.9 running GNAT 4.1.2.
According to the ARM (A.10), Text_IO operates on "text files" as defined there.
Part of that definition is that "the end of a line is marked by a _line
terminator_" and "the end of a file is marked by the combination of a line
terminator immediately followed by a page terminator and then a _file
terminator_" [A.10(7)]. So technically, an implementation of Text_IO is not
required to work on files that aren't valid Text_IO text files, and the error is
that your file is not a valid Text_IO text file.
However, such an implementation of Text_IO is pretty useless on most systems,
and compiler writers usually try hard to make sure that Text_IO works on foreign
files. AdaCore certainly does. Still, if you produce files without a final line
terminator, it's usually a good idea to find out why and fix that.
--
Jeff Carter
"Hold your temper. Count ten.... Now let 'er go.
You got a good aim."
Never Give a Sucker an Even Break
105
next prev parent reply other threads:[~2017-04-26 17:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 7:38 Weird Bug in Get_Line Brian Kolden
2017-04-26 8:28 ` Brian Drummond
2017-04-26 8:42 ` Brian Kolden
2017-04-26 9:10 ` Brian Kolden
2017-04-26 10:58 ` Simon Wright
2017-04-26 17:03 ` Jeffrey R. Carter [this message]
2017-04-26 19:32 ` Brian Kolden
2017-04-26 20:44 ` Jeffrey R. Carter
2017-05-14 21:49 ` moy
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox