On May 20, 7:12 am, Maciek Sykulski <
macie...@gmail.com> wrote:
> Hi All,
>
> I've compiled from source sage-5.0 on Gentoo on the following machine:
> Linux 3.2.6 #3 SMP Thu Feb 16 17:40:05 CET 2012 x86_64 Intel(R)
> Xeon(R) CPU X5690 @ 3.47GHz GenuineIntel GNU/Linux
>
> Everything seems to work fine except for this:
> When an input cell with some R code contains a syntax error and the
> input is longer than 1023 characters, the cell evaluates without
> printing any message at all.
Confirmed. It's not confined to the notebook. Example:
sage: Ri=R() #make an R interpreter
sage: Ri.eval("#1"**3+"\n]")
'\nError: unexpected \']\' in "]"'
sage: Ri.eval("#1"**1000+"\n]")
''
I don't think this bug is new in 5.0, though. I also observe it in
4.8. The difference in behaviour probably comes from the fact that
sage's "expect" interfaces (this is used for R) prefer to communicate
long input via files rather than via the child's stdin. It reminds me
of
http://trac.sagemath.org/sage_trac/ticket/11401
which was merged in 4.7.2. Note that the API of Expect.eval got
changed a little (the parameters allow_use_file and split_lines got
changed). It's quite likely that the default settings for these
parameters don't work well for the R interface. In that case, the
right solution is to make sure that these defaults get overridden in
the R interface, which probably inherits from expect.
When I made the change I tried to ensure other interfaces weren't
adversely affected, but apparently this particular issue is not
doctested. The file of interest is:
sage/interfaces/r.py
The eval method there explicitly calls Expect.eval, so putting in the
right defaults should be straightforward. Setting split_lines=True
should get you back the original behaviour, but note that for the R
interface too, this might well cause grammatical input be delivered to
R in an ungrammatical way. Some more testing will be required.