Ximin Luo: > Ximin Luo: >> Bill Allombert: >>> On Tue, Dec 06, 2016 at 01:01:00PM +0000, Ximin Luo wrote: >>>> Bill Allombert: >>>> Hi all, >>>> >>>> Sorry I only just briefly scanned through the thread now. However I >>>> found this post relating to gzip, pipes and python: >>>> >>>> https://blog.nelhage.com/2010/02/a-very-subtle-bug/ >>>> >>>> which summarises the bug report here: https://bugs.python.org/issue1652 >>> >>> Yes, this is exactly the problem, and it seems it has been fixed in python >>> 3, >>> but not in python 2.7. >>> >> >> Ok, good to know! The blog post also contains a work-around near the end, >> which is to add >> >> preexec_fn=lambda: signal.signal(signal.SIGPIPE, signal.SIG_DFL) >> >> as a parameter to the relevant Popen call. Presumably in this case it's >> wherever Sage calls GAP. Jerome, could you test? >> > > Hi Bill, > > I'm not sure if the above bug is the cause of this issue. I tried to > reproduce it without Sage: > > $ apt-cache policy gap > gap: > Installed: 4r8p6-1 > Candidate: 4r8p6-1+sage17 > Version table: > 4r8p6-1+sage17 500 > 500 https://debian-science.alioth.debian.org/apt sid-sage/ Packages > *** 4r8p6-1 500 > 500 http://httpredir.debian.org/debian testing/main amd64 Packages > 500 http://httpredir.debian.org/debian unstable/main amd64 Packages > 100 /var/lib/dpkg/status > > $ python -c 'import subprocess; subprocess.Popen(["gap", "-q"], > stdin=subprocess.PIPE).communicate("?SymmetricGroup")' > > gzip: stdout: Broken pipe > Help: several entries match this topic - type ?2 to get match [2] > > [1] Reference: SymmetricGroup > [2] Reference: SymmetricGroup (for a degree) > [3] Reference: SymmetricGroup (for a domain) > > $ python -c 'import signal, subprocess; subprocess.Popen(["gap", "-q"], > stdin=subprocess.PIPE, preexec_fn=lambda: signal.signal(signal.SIGPIPE, > signal.SIG_DFL)).communicate("?SymmetricGroup")' > Help: several entries match this topic - type ?2 to get match [2] > > [1] Reference: SymmetricGroup > [2] Reference: SymmetricGroup (for a degree) > [3] Reference: SymmetricGroup (for a domain) > > So as you can see, the bug is only to do with the extra "Broken pipe" error > messages.
And in fact, if I patch src/sysfiles.c to say "gzip 2>/dev/null -cd " instead of "gunzip " then the "Broken pipe" messages go away. The below Sage/GAP error still occurs, though: > However Sage fails in a different way: > > $ ./sage -c 'gap.help('SymmetricGroup', pager=False)' >> /usr/lib/python2.7/dist-packages/ptyprocess/ptyprocess.py(220)spawn() > -> if use_native_pty_fork: > (Pdb) c >> /usr/lib/python2.7/dist-packages/ptyprocess/ptyprocess.py(220)spawn() > -> if use_native_pty_fork: > (Pdb) c > #W corrupted 'manual.six': ##W (in stream: > InputTextFile(/usr/share/gap/doc/t\ > ut/manual.six)) > #W corrupted 'manual.six': ##W (in stream: > InputTextFile(/usr/share/gap/doc/c\ > hanges/manual.six)) > #W corrupted 'manual.six': ##W (in stream: > InputTextFile(/usr/share/gap/pkg/G\ > APDoc/example/manual.six)) > Help: no matching entry found > -- GPG: ed25519/56034877E1F87C35 GPG: rsa4096/1318EFAC5FBBDBCE https://github.com/infinity0/pubkeys.git