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

Bug#833677: gnat-4.9: last call to the put procedure incorrectly appends a newline character to the string



Package: gnat-4.9
Version: 4.9.2-1
Severity: normal

Dear Maintainer,

I have a use case where I need an Ada program to emit a single string
to stdout _without_ a trailing newline character.  According to Ada
documentation I have read, the put procedure (as opposed to put_line) is the one to use for
this case.  Nevertheless, the trailing newline character is still emitted.

Here is example code to demonstrate this issue

irwin@raven> cat test_ada_eol.adb
with Ada.Text_IO; use Ada.Text_IO;

procedure test_ada_eol is
begin
    put("Hello");
end test_ada_eol;
						
After compiling test_ada_eol.adb with gnatmake, execution of the result yields
the following (unexpected) result

irwin@raven> ./test_ada_eol |od -a
0000000   H   e   l   l   o  nl
0000006

where the trailing nl is unexpected.  If I duplicate that put call
in test_ada_eol.adb, the result is

irwin@raven> ./test_ada_eol |od -a
0000000   H   e   l   l   o   H   e   l   l   o  nl
0000013

i.e., the first put does not emit a trailing nl to stdout as expected
from the documentation of the put procedure, but the last call to put
(incorrectly) appends nl.

-- System Information:
Debian Release: 8.5
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages gnat-4.9 depends on:
ii  gcc-4.9            4.9.2-10
ii  gnat-4.9-base      4.9.2-1
ii  libc6              2.19-18+deb8u4
ii  libc6-dev          2.19-18+deb8u4
ii  libcloog-isl4      0.18.2-1+b2
ii  libgcc1            1:4.9.2-10
ii  libgmp10           2:6.0.0+dfsg-6
ii  libgnat-4.9        4.9.2-1
ii  libgnatprj4.9      4.9.2-1
ii  libgnatvsn4.9      4.9.2-1
ii  libisl10           0.12.2-2
ii  libmpc3            1.0.2-1
ii  libmpfr4           3.1.2-2
ii  multiarch-support  2.19-18+deb8u4
ii  zlib1g             1:1.2.8.dfsg-2+b1

gnat-4.9 recommends no packages.

Versions of packages gnat-4.9 suggests:
ii  ada-reference-manual-2012  1:2012.2-3
ii  gnat-4.9-doc               4.9.1-3
pn  gnat-4.9-sjlj              <none>

-- no debconf information


Reply to: