Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug due to a call to SSLContext() in src/sage/graphs/isgci.py #34211

Closed
dcoudert opened this issue Jul 22, 2022 · 27 comments
Closed

Fix bug due to a call to SSLContext() in src/sage/graphs/isgci.py #34211

dcoudert opened this issue Jul 22, 2022 · 27 comments

Comments

@dcoudert
Copy link
Contributor

sage: graph_classes._download_db()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-3914f28ce325> in <module>
----> 1 graph_classes._download_db()

/home/dcoudert/sage/local/var/lib/sage/venv-python3.10/lib64/python3.10/site-packages/sage/graphs/isgci.py in _download_db(self)
    829         import tempfile
    830         u = urlopen('https://www.graphclasses.org/data.zip',
--> 831                     context=SSLContext())
    832         with tempfile.NamedTemporaryFile(suffix=".zip") as f:
    833             f.write(u.read())

NameError: name 'SSLContext' is not defined

This bug was fixed in #33771, replacing the call to SSLContext() in src/sage/graphs/isgci.py with a call to default_context(), but this changes has been reverted in #33829.


Dependency on #34079 since it modifies this file.

CC: @fchapoton @dimpase @seblabbe

Component: graph theory

Author: David Coudert

Branch: 2302af6

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/34211

@dcoudert dcoudert added this to the sage-9.7 milestone Jul 22, 2022
@dcoudert
Copy link
Contributor Author

Branch: public/graphs/34211_bug_in_isgci

@dcoudert
Copy link
Contributor Author

Commit: 32f05b0

@dcoudert
Copy link
Contributor Author

New commits:

b6db584trac #34079: pycodestyle cleanup
b91db9etrac #34079: Merged with 9.7.beta5
b55efb1trac #34211: replace call to SSLContext with default_context
32f05b0trac #34211: some care

@dcoudert
Copy link
Contributor Author

comment:2

On the way, I found a new bug: If I do graph_classes._download_db() in a sage console, and then ./sage -t src/sage/graphs/isgci.py, I get errors like:

sage -t --warn-long 77.5 --random-seed=217922271289552033231623053257548326399 src/sage/graphs/isgci.py
**********************************************************************
File "src/sage/graphs/isgci.py", line 53, in sage.graphs.isgci
Failed example:
    Chordal.description()
Expected:
    Class of graphs : Chordal
    -------------------------
    id                             :  gc_32
    name                           :  chordal
    type                           :  base
    <BLANKLINE>
    Problems :
    -----------
    3-Colourability                :  Linear
    Clique                         :  Polynomial
    Clique cover                   :  Polynomial
    Cliquewidth                    :  Unbounded
    Cliquewidth expression         :  NP-complete
    Colourability                  :  Linear
    Cutwidth                       :  NP-complete
    Domination                     :  NP-complete
    Feedback vertex set            :  Polynomial
    Hamiltonian cycle              :  NP-complete
    Hamiltonian path               :  NP-complete
    Independent set                :  Linear
    Maximum bisection              :  Unknown
    Maximum cut                    :  NP-complete
    Minimum bisection              :  Unknown
    Recognition                    :  Linear
    Treewidth                      :  Polynomial
    Weighted clique                :  Polynomial
    Weighted feedback vertex set   :  Unknown
    Weighted independent set       :  Linear
Got:
    Class of graphs : Chordal
    -------------------------
    id                             : gc_32
    name                           : chordal
    parameter                      : [{'name': 'acyclic chromatic number', 'boundedness': 'Unbounded'}, {'name': 'bandwidth', 'boundedness': 'Unbounded'}, {'name': 'book thickness', 'boundedness': 'Unbounded'}, {'name': 'booleanwidth', 'boundedness': 'Unbounded'}, {'name': 'branchwidth', 'boundedness': 'Unbounded'}, {'name': 'carvingwidth', 'boundedness': 'Unbounded'}, {'name': 'chromatic number', 'boundedness': 'Unbounded'}, {'name': 'cliquewidth', 'boundedness': 'Unbounded'}, {'name': 'cochromatic number', 'boundedness': 'Unknown'}, {'name': 'cutwidth', 'boundedness': 'Unbounded'}, {'name': 'degeneracy', 'boundedness': 'Unbounded'}, {'name': 'diameter', 'boundedness': 'Unbounded'}, {'name': 'distance to block', 'boundedness': 'Unbounded'}, {'name': 'distance to clique', 'boundedness': 'Unbounded'}, {'name': 'distance to cluster', 'boundedness': 'Unbounded'}, {'name': 'distance to co-cluster', 'boundedness': 'Unbounded'}, {'name': 'distance to cograph', 'boundedness': 'Unbounded'}, {'name': 'distance to linear forest', 'boundedness': 'Unbounded'}, {'name': 'distance to outerplanar', 'boundedness': 'Unbounded'}, {'name': 'genus', 'boundedness': 'Unbounded'}, {'name': 'max-leaf number', 'boundedness': 'Unbounded'}, {'name': 'maximum clique', 'boundedness': 'Unbounded'}, {'name': 'maximum degree', 'boundedness': 'Unbounded'}, {'name': 'maximum independent set', 'boundedness': 'Unbounded'}, {'name': 'maximum induced matching', 'boundedness': 'Unbounded'}, {'name': 'maximum matching', 'boundedness': 'Unbounded'}, {'name': 'minimum clique cover', 'boundedness': 'Unbounded'}, {'name': 'minimum dominating set', 'boundedness': 'Unbounded'}, {'name': 'pathwidth', 'boundedness': 'Unbounded'}, {'name': 'rankwidth', 'boundedness': 'Unbounded'}, {'name': 'tree depth', 'boundedness': 'Unbounded'}, {'name': 'treewidth', 'boundedness': 'Unbounded'}, {'name': 'vertex cover', 'boundedness': 'Unbounded'}]
    speed                          : {'speed': 'Superfactorial-Theta'}
    type                           : base
    <BLANKLINE>
    Problems :
    -----------
    3-Colourability                : Linear
    Clique                         : Polynomial
    Clique cover                   : Polynomial
    Cochromatic colouring          : Unknown
    Colourability                  : Linear
    Domination                     : NP-complete
    Feedback vertex set            : Polynomial
    Graph isomorphism              : GI-complete
    Hamiltonian cycle              : NP-complete
    Hamiltonian path               : NP-complete
    Independent dominating set     : Linear
    Independent set                : Linear
    Maximum bisection              : Unknown
    Maximum cut                    : NP-complete
    Minimum bisection              : Unknown
    Monopolarity                   : Linear
    Polarity                       : Polynomial
    Recognition                    : Linear
    Weighted clique                : Polynomial
    Weighted feedback vertex set   : Unknown
    Weighted independent dominating set : Unknown
    Weighted independent set       : Linear
    Weighted maximum cut           : NP-complete
    book thickness decomposition   : Unknown
    booleanwidth decomposition     : Unknown
    cliquewidth decomposition      : Unknown
    cutwidth decomposition         : NP-complete
    treewidth decomposition        : Polynomial

@dcoudert
Copy link
Contributor Author

comment:3

Do you know how to clear the cache / database ?

@dcoudert
Copy link
Contributor Author

comment:4

It seems that we have to update file local/share/graphs/isgci_sage.xml (don't know how), update doctests accordingly, and decide what to do with parameter and speed in the description of the class (parameters added in 2015 and 2018, details can be found at https://www.graphclasses.org/classes/gc_61.html).

@dimpase
Copy link
Member

dimpase commented Aug 2, 2022

comment:6

isn't it updateable with graph_classes.update_db() ?

@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 2, 2022

comment:7

Yes it is, but I'm not sure if I should push an updated version of the database + corrected doctests in this ticket, or if there is another way to store a version of the database. I don't know where the default file that we have in local/share/graphs/isgci_sage.xml comes from and what's the normal procedure to update it.

@dimpase
Copy link
Member

dimpase commented Aug 2, 2022

comment:8

if you read the code you'll see it's downloaded, it's not stored anywhere in Sage git tree.

@dimpase
Copy link
Member

dimpase commented Aug 2, 2022

comment:9

many of these doctests are too verbose, replacing most of them with ... seems OK.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 3, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

9ec96bctrac #34211: Merged with 9.7.beta7
0a33cf3trac #34211: reduce verbosity of some doctests

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 3, 2022

Changed commit from 32f05b0 to 0a33cf3

@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 3, 2022

comment:11

I have reduced the verbosity of some doctests.

@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 4, 2022

comment:12

and we have green bot.

@dimpase
Copy link
Member

dimpase commented Aug 4, 2022

Reviewer: Dima Pasechnik

@dimpase
Copy link
Member

dimpase commented Aug 4, 2022

comment:13

lgtm

@dimpase
Copy link
Member

dimpase commented Aug 4, 2022

comment:14

should we actually turn these untested tests into optional (internet) tests? This would improve chances to timely catch upstream changes.

@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 6, 2022

comment:16

Should I just changed to # optional - internet or is it better to add # long time # optional - internet ?

@dimpase
Copy link
Member

dimpase commented Aug 8, 2022

comment:17

IMHO # optional - internet is good enough.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 8, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

310cc04trac #34211: Merged with 9.7.beta8
2302af6trac #34211: indicate optional doctests

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 8, 2022

Changed commit from 0a33cf3 to 2302af6

@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 8, 2022

comment:19

done

@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 8, 2022

Changed dependencies from #34079 to none

@dimpase
Copy link
Member

dimpase commented Aug 8, 2022

comment:20

ok

@vbraun
Copy link
Member

vbraun commented Aug 29, 2022

Changed branch from public/graphs/34211_bug_in_isgci to 2302af6

@seblabbe
Copy link
Contributor

comment:22

see #34612 for a follow-up ticket fixing a doctest failure

@seblabbe
Copy link
Contributor

Changed commit from 2302af6 to none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants