[R] Sweave & xtable [problem solved/workaround -> bug in xtable or textConnection?]
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Mon Dec 23 01:12:02 CET 2002
Hedderik van Rijn <hedderik at cmu.edu> writes:
> Whereas this code snippet "silently" truncates the string, without
> warning:
>
> con <- textConnection("output","w");
> sink(file=con);
> cat(paste(rep("123456789!",1000),collapse=""))
> sink()
> close(con)
>
> I'm not sure which function (if any) to blame, but I definitely think
> that either cat or textConnection should have made sure that a warning
> "came through". As you mentioned, it is naive to assume an arbitrary
> line-length, but if the above code is not incorrect, my opinion is
> that it should warn users of incorrect output, or state it in the help
> pages.
The warning should be inside "output", shouldn't it? It actually isn't
there, so perhaps it is getting appended to the already overlong
string??
As I was trying to dig deeper, I ran into the following interesting
segfault on RH8.0:
> con <- textConnection("output","w");
> sink(file=con);
> cat(paste(rep("123456789!",1000),collapse=""))
> sink()
> close(con)
>
> output
[1]
"123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!123456789!!
123456789"
> cat(paste(rep("123456789!",1000),collapse=""))
Program received signal SIGSEGV, Segmentation fault.
0x4207a4cb in strlen () from /lib/i686/libc.so.6
(The cat(...) call being obtained with up-arrow command recall)
Apparently this is not quite reproducible and might depend on stuff in
the workspace, but it looks suspicious. Will have a better look.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list