Opened 11 years ago
Closed 11 years ago
#11617 closed defect (fixed)
sending certain large strings to the gp PARI pexpect interface fails
Reported by: | was | Owned by: | was |
---|---|---|---|
Priority: | critical | Milestone: | sage-4.7.2 |
Component: | interfaces | Keywords: | |
Cc: | Merged in: | sage-4.7.2.alpha1 | |
Authors: | William Stein | Reviewers: | Mike Hansen |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
In Sage-4.7 (on Linux and OS X), we have:
sage: '***' in gp.eval('a='+str(range(10^3))) False sage: '***' in gp.eval('a='+str(range(10^4))) False sage: '***' in gp.eval('a='+str(range(10^5))) False sage: '***' in gp.eval('a='+str(range(10^6))) True
The "*" appearing in the output means that an error occurs. Looking further we find:
sage: print gp.eval('a='+str(range(10^6))) *** [...] at: read("/scratch/wstei *** ^-------------------- *** in function read: read("/scratch/wstei ... *** read: error opening input file: `/scratch/wstein/sage//temp/mod.math.washington.edu/17446//interface//tmp17449'.
Shockingly, looking at the file we are reading it we find that it contains:
sage: !more /scratch/wstein/sage//temp/mod.math.washington.edu/17446//interface//tmp17449 read("/scratch/wstein/sage//temp/mod.math.washington.edu/17446//interface//tmp17449")
So, instead of writing the long string we are supposed to read in, the file contains a single line asking to read in itself!
NOTE: This bug was originally observed by Zhibin Liang.
Attachments (1)
Change History (7)
comment:1 Changed 11 years ago by
- Description modified (diff)
comment:2 Changed 11 years ago by
Changed 11 years ago by
comment:3 Changed 11 years ago by
- Status changed from new to needs_review
This turns out to be an easy 1-line fix. The bug turned out to be caused because the "allow_use_file" option wasn't properly passed in the last recursive call to _eval_line in the _eval_line function. And I guess that option is important since the default (=True) isn't the right choice when sending the name of the command to read in the file itself. In particular, since
eval_using_file_cutoff=50
if the filename of the file to read in (plus the read command) exceeded 50 characters, we were in big trouble... but only in the case when the stack was automatically doubled. This example hit this threshold.
comment:4 Changed 11 years ago by
- Summary changed from sending any large string at all to the gp PARI pexpect interface fails to sending certain large strings to the gp PARI pexpect interface fails
comment:5 Changed 11 years ago by
- Reviewers set to Mike Hansen
- Status changed from needs_review to positive_review
Looks good to me.
comment:6 Changed 11 years ago by
- Merged in set to sage-4.7.2.alpha1
- Resolution set to fixed
- Status changed from positive_review to closed
Simpler input to give the problem: