Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
338 stars 228 forks source link

SpecialFanoFourfolds test code problem #2714

Open DanGrayson opened 1 year ago

DanGrayson commented 1 year ago

Test code should not try to run xterm. It's not available on every system, and even if it is, X11 might not be running.

i1 : --/home/dan/src/M2.git/M2/Macaulay2/packages/SpecialFanoFourfolds.m2:3558: location of test code                                             
      -- Test 6 (1/3) -- associated K3 surfaces                                                                                                   
     f = last building associatedK3surface(specialCubicFourfold "quartic scroll",Verbose=>true);
-- the fourfold has been successfully recognized                                                                                                  
-- detected degree of the curves of the congruence: 1                                                                                             
-- writing Singular code on file: /tmp/M2-156812-0/0/input.singular                                                                               
-- running Singular                                                                                                                               
running: cd /tmp/M2-156812-0/0/ && /usr/bin/xterm -e Singular -qc 'execute(read("input.singular"));'
/usr/bin/xterm: Xt error: Can't open display:
/usr/bin/xterm: DISPLAY is not set

stdio:3:19:(3):[1]: error: xterm returned an error

Can't M2 do these computations? Do we really need Singular to do them?

giovannistagliano commented 1 year ago

Okay, in fact the problem seems to be with X11. Certainly M2 can do these calculations. Singular=>true is optional but is the default choice when available. To fix it just add Singular=>false or alternately change Verbose=>true to Verbose=>false. Let me know if I need to open a pull-request.

DanGrayson commented 1 year ago

I think Singular=>false should be the default, since Singular may not be installed on the system, either. If the user installs Singular, then the user can request its use.

Could you take care of fixing that?

giovannistagliano commented 1 year ago

Actually, Singular (as well as xterm) is only used if it's installed, but I didn't take care of X11. I tried to fix the test here https://github.com/Macaulay2/M2/pull/2715.

DanGrayson commented 1 year ago

What's the reason for having xterm run Singular for you, instead of running Singular directly?

giovannistagliano commented 1 year ago

I chose to use xterm just to get some messages from Singular during the computation. When Verbose is set to false xterm is not used.

DanGrayson commented 1 year ago

Why not just redirect stderr to stdio on the command line to get those messages?

giovannistagliano commented 1 year ago

Yes I figured there was a better solution. I'll look at improving the code. Thanks.