From csardi.gabor at gmail.com  Tue Apr 10 23:27:53 2018
From: csardi.gabor at gmail.com (=?UTF-8?B?R8OhYm9yIENzw6FyZGk=?=)
Date: Tue, 10 Apr 2018 22:27:53 +0100
Subject: [Rd] possible bug: stderr() connection truncates output at 8191
 characters when R_Consolefile is not used
Message-ID: <CABtg=Km4=T8fPs7yJ=iKWkLpZ-KoaX+j4X-JRaV26suhpKAS7w@mail.gmail.com>

This is recent R-devel, but AFAICT all R versions are affected.
Also AFAICT, currently only happens on macOS with Aqua, and on
Windows, unless you are in RTerm. These do not use R_Consolefile

Code to reproduce:

x <- paste0(strrep(".", 8191), "MIA")
nchar(x)
#> [1] 8194

## This is fine:
cat(x, file = stdout())

## This truncates silently:
cat(x, file = stderr())

It happens because the vfprintf callback of stderr() is stderr_vfprintf [1],
and that just calls REvprintf [2], which truncates at 8191 characters [3], if
R_Consolefile is not used.

[1] https://github.com/wch/r-source/blob/fed0444824567e1c4edff234fc5c2fb1c99bbc84/src/main/connections.c#L5122
[2] https://github.com/wch/r-source/blob/fed0444824567e1c4edff234fc5c2fb1c99bbc84/src/main/connections.c#L2562
[3] https://github.com/wch/r-source/blob/fed0444824567e1c4edff234fc5c2fb1c99bbc84/src/main/printutils.c#L972



[Rd] possible bug: stderr() connection truncates output at 8191 characters when R_Consolefile is not used
=?UTF-8?B?R8OhYm9yIENzw6FyZGk=?=