Macaulay2 / M2

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

Nauty error: Sorry, this program doesn't support digraphs yet #1408

Closed d-torrance closed 4 years ago

d-torrance commented 4 years ago

This is from a build of the development branch on Ubuntu 20.10 using the Ubuntu nauty package.

/<<BUILDDIR>>/macaulay2-16.0.1+git11929.74c3aa6/M2/usr-dist/common/share/doc/Macaulay2/Nauty/example-output/_relabel__Bipartite.errors:0:1: (output file) error: Macaulay2 exited with status code 1
/tmp/M2-367-0/0_relabel__Bipartite.m2:0:1: (input file)
M2: *** Error 1
currentString:1:1:(3):[2]: error: 1 error(s) occurred running examples for package Nauty:

_relabel__Bipartite.errors
**************************
-- -*- M2-comint -*- hash: 284388156

i1 : R = QQ[a..f];

i2 : G = graph flatten apply({a,c,e}, v->v*{b,d,f})

o2 = Graph{edges => {{a, b}, {b, c}, {a, d}, {c, d}, {b, e}, {d, e}, {a, f}, {c, f}, {e, f}}}
           ring => R
           vertices => {a, b, c, d, e, f}

o2 : Graph

i3 : relabelBipartite G
stdio:3:1:(3): error: callNauty: nauty terminated with the error [>E Sorry, this program doesn't support digraphs yet.].

make[3]: *** [Makefile:92: /<<BUILDDIR>>/macaulay2-16.0.1+git11929.74c3aa6/M2/usr-dist/x86_64-Linux-Ubuntu-20.10/lib/x86_64-linux-gnu/Macaulay2/Nauty/.installed] Error 1

Full build log at https://launchpadlibrarian.net/488677476/buildlog_ubuntu-groovy-amd64.macaulay2_16.0.1+git11929.74c3aa6-0ppa11681~ubuntu20.10.1_BUILDING.txt.gz:

I'm very confused as to what's happening here, as I don't have any problems with Nauty on Debian unstable, and the diff between the Debian and Ubuntu packages is very small and only affects the CI tests.

DanGrayson commented 4 years ago

How would I get Ubuntu 20.10? It doesn't exist yet.

d-torrance commented 4 years ago

It's under development and won't be officially released until October. But you can still get it: http://cdimage.ubuntu.com/daily-live/current/HEADER.html

I don't have it installed myself, but I'm using it for some test builds on Launchpad since it's the only Ubuntu release with flint 2.6.0.

DanGrayson commented 4 years ago

Hmm, strange that there's no server iso.

DanGrayson commented 4 years ago

Can I upgrade to 20.10 by pointing the sources file to the right (experimental) locations?

DanGrayson commented 4 years ago

Hmm, never mind -- I want a fresh install, anyway. I have to keep 20.04 around, after all.

DanGrayson commented 4 years ago

On that branch, the configure script still insists on building nauty. Do you have a personal branch where it doesn't do that?

d-torrance commented 4 years ago

Yeah, the Debian packaging is using the following patch, which prepends nauty- to all the binaries and modifies configure.ac so BUILD_nauty is no if the Debian package is found (which it should always be, because it's one of the build dependencies): https://salsa.debian.org/science-team/macaulay2/-/blob/master/debian/patches/use-debian-nauty.patch

DanGrayson commented 4 years ago

Thanks. I assume you'll submit that upstream, and when you do, you should also have a line appending the file to FILE_PREREQS. See the other uses of it.

d-torrance commented 4 years ago

Yup! nauty's next on my list of findProgram/runProgram updates.

DanGrayson commented 4 years ago

Okay, I've got the same error report...

d-torrance commented 4 years ago

Mysteriously, this evening's build of the Nauty examples worked with no problems...

https://launchpadlibrarian.net/488739565/buildlog_ubuntu-groovy-amd64.macaulay2_16.0.1+git11933.07675df-0ppa11683~ubuntu20.10.1_BUILDING.txt.gz

: installing package Nauty
/usr/bin/install -c -d Nauty-temporary
make: Entering directory `/<<BUILDDIR>>/macaulay2-16.0.1+git11933.07675df/M2/Macaulay2/packages/Nauty-temporary'
cd Nauty-temporary && /<<BUILDDIR>>/macaulay2-16.0.1+git11933.07675df/M2/usr-dist/x86_64-Linux-Ubuntu-20.10/bin/M2  -q --stop --silent -e errorDepth=3 -e debugLevel=0  -e "installPackage(\"Nauty\", RemakeAllDocumentation => false, IgnoreExampleErrors => false, RerunExamples => false, CheckDocumentation => true, UserMode => false, Verbose => false, InstallPrefix => \"/<<BUILDDIR>>/macaulay2-16.0.1+git11933.07675df/M2/usr-dist/\", SeparateExec => true, DebuggingMode => true); exit 0"
--making example results for stringToGraph
--making example results for Comparison of Graph6 and Sparse6 formats
--making example results for stringToEdgeIdeal
--making example results for removeIsomorphs
--making example results for graph6ToSparse6
--making example results for countGraphs
--making example results for graphComplement
--making example results for newEdges
--making example results for buildGraphFilter
--making example results for graphToString
--making example results for Example: Checking for isomorphic graphs
--making example results for generateRandomGraphs
--making example results for neighborhoodComplements
--making example results for Example: Generating and filtering graphs
--making example results for isPlanar
--making example results for onlyPlanar
--making example results for generateRandomRegularGraphs
--making example results for relabelGraph
--making example results for generateBipartiteGraphs
--making example results for areIsomorphic
--making example results for removeEdges
--making example results for addEdges
--making example results for sparse6ToGraph6
--making example results for generateGraphs
--making example results for filterGraphs
--making example results for relabelBipartite
make: Leaving directory `/<<BUILDDIR>>/macaulay2-16.0.1+git11933.07675df/M2/Macaulay2/packages/Nauty-temporary'
ls -l Nauty-temporary
total 0
DanGrayson commented 4 years ago

What could have changed?

d-torrance commented 4 years ago

I have no idea. They were based on different commits from development, but the differences don't seem to have touched anything that would affect nauty:

profzoom@orange:~/src/macaulay2/M2$ git diff --stat 74c3aa6 07675df
 .github/actions/package-review/action.yml | 29 +++++++++++++++++++++++
 .github/workflows/package-review.yml      | 39 +++++++++++++++++++++++++++++++
 .github/workflows/test_build.yml          |  4 +++-
 M2/BUILD/mahrud/package-review.sh         | 26 +++++++++++++++++++++
 M2/Macaulay2/m2/files.m2                  |  9 +++----
 M2/Macaulay2/m2/html.m2                   |  2 +-
 M2/Macaulay2/m2/run.m2                    |  2 +-
 7 files changed, 104 insertions(+), 7 deletions(-)
DanGrayson commented 4 years ago

The programs behave differently, so we can ignore M2 and focus on the difference:

debian10$ nauty-biplabg --version
Nauty&Traces version 2.6041 (64 bits)

debian10$ nauty-biplabg < /dev/null
>A biplabg
>Z  0 graphs read from stdin; 0 written to stdout; 0.00 sec.

ubuntu2010$ nauty-biplabg --version
Nauty&Traces version 2.6041 (64 bits)

ubuntu2010$ nauty-biplabg </dev/null
>A biplabg
>E Sorry, this program doesn't support digraphs yet.
d-torrance commented 4 years ago

I think this is a bug in nauty. Here's the corresponding code in the source for biplabg:


int
main(int argc, char *argv[])
{
        char *infilename,*outfilename;
        FILE *infile,*outfile;
        boolean badargs,quiet;
    int j,m,n,argnum;
    int codetype,outcode;
    graph *g;
    nauty_counter nin,nout;
        char *arg,sw;
    double t;

[...snip...]

    NODIGRAPHSYET(codetype);

    if (infilename && infilename[0] == '-') infilename = NULL;
    infile = opengraphfile(infilename,&codetype,FALSE,1);
    if (!infile) exit(1);
    if (!infilename) infilename = "stdin";

The NODIGRAPHSYET macro is defined in a header file and is responsible for our error message:

#define NODIGRAPHSYET(code) if (((code)&DIGRAPH6)) \
  gt_abort(">E Sorry, this program doesn't support digraphs yet.\n")

It doesn't appear that codetype is initialized until that call to opengraphfile, so if we're unlucky, it might find that DIGRAPH6 bit in whatever piece of memory it's pointing to at the time.

d-torrance commented 4 years ago

Maybe we should just disable this particular test for now?

d-torrance commented 4 years ago

Yeah, it's been fixed in nauty 2.7, which hasn't been packaged for Debian/Ubuntu yet:

    if (infilename && infilename[0] == '-') infilename = NULL;
    infile = opengraphfile(infilename,&codetype,FALSE,1);
    if (!infile) exit(1);
    if (!infilename) infilename = "stdin";

    NODIGRAPHSYET(codetype);
d-torrance commented 4 years ago

Maybe we should just disable this particular test for now?

Hrm, it's not a test, but an example.

DanGrayson commented 4 years ago

Good catch! We could insist on finding version 2.7 or greater, and hasten the arrival of 2.7 into the distributions.

d-torrance commented 4 years ago

Most distributions already have 2.7: https://repology.org/project/nauty/versions

The Debian-based ones are falling behind! It's not a package I've worked on in the past, but maybe I can help out. I'll see what I can do.

DanGrayson commented 4 years ago

We should probably insist on 2.7.

d-torrance commented 4 years ago

We should probably insist on 2.7.

I just tacked on a new commit to #1413 doing this.

d-torrance commented 4 years ago

FYI, nauty 2.7 was uploaded to Debian unstable this morning (https://tracker.debian.org/news/1171618/accepted-nauty-27r1ds-1-source-into-unstable/). The feature freeze for Ubuntu 20.10 is in two days, so hopefully it will migrate in time.