inducer / relate

RELATE is an Environment for Learning And TEaching

Home Page:http://documen.tician.de/relate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

odd error after rebuild ?

KlavsKlavsen opened this issue · comments

Hi - I am have an issue when building latest master inside docker.

with Ubuntu 20.04 and the npm that follows that AND I also tried to update to upstream nodejs+npm 16 - with no change:

+ poetry run python manage.py migrate
/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/social_django/fields.py:16: UserWarning: SOCIAL_AUTH_POSTGRES_JSONFIELD has been renamed to SOCIAL_AUTH_JSONFIELD_ENABLED and will be remo
ved in the next release.
  warnings.warn(
Traceback (most recent call last):
  File "manage.py", line 57, in <module>
    execute_from_command_line(sys.argv)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/core/management/base.py", line 414, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/core/management/base.py", line 460, in execute
    output = self.handle(*args, **options)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/core/management/base.py", line 98, in wrapped
    res = handle_func(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 91, in handle
    self.check(databases=[database])
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/core/management/base.py", line 487, in check
    all_issues = checks.run_checks(
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/core/checks/registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/core/checks/urls.py", line 14, in check_url_config
    return check_resolver(resolver)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/core/checks/urls.py", line 24, in check_resolver
    return check_method()
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/urls/resolvers.py", line 480, in check
    for pattern in self.url_patterns:
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/utils/functional.py", line 49, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/urls/resolvers.py", line 696, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/utils/functional.py", line 49, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/urls/resolvers.py", line 689, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
 File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/var/www/relate/relate/urls.py", line 558, in <module>
    path(r"saml2/", include("djangosaml2.urls")),
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/django/urls/conf.py", line 38, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/djangosaml2/urls.py", line 18, in <module>
    from . import views
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/djangosaml2/views.py", line 42, in <module>
    from saml2.client_base import LogoutError
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/saml2/client_base.py", line 14, in <module>
    from saml2.entity import Entity
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/saml2/entity.py", line 10, in <module>
    from saml2.metadata import ENDPOINTS
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/saml2/metadata.py", line 2, in <module>
    from saml2.algsupport import algorithm_support_in_metadata
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/saml2/algsupport.py", line 2, in <module>
    from saml2.sigver import get_xmlsec_binary
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/saml2/sigver.py", line 54, in <module>
    from saml2.xml.schema import node_to_schema
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/saml2/xml/schema/__init__.py", line 3, in <module>
    from xmlschema import XMLSchema as _XMLSchema
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/xmlschema/__init__.py", line 20, in <module>
    from .dataobjects import DataElement, DataElementConverter, DataBindingConverter
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/xmlschema/dataobjects.py", line 27, in <module>
    from . import validators
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/xmlschema/validators/__init__.py", line 38, in <module>
    from .schemas import XMLSchemaMeta, XMLSchemaBase, XMLSchema, XMLSchema10, XMLSchema11
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/xmlschema/validators/schemas.py", line 2137, in <module>
    class XMLSchema10(XMLSchemaBase):
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/xmlschema/validators/schemas.py", line 148, in __new__
    meta_schema = meta_schema_class.create_meta_schema(meta_schema_file)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/xmlschema/validators/schemas.py", line 763, in create_meta_schema
    meta_schema = meta_schema_class(source, XSD_NAMESPACE, global_maps=global_maps,
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/xmlschema/validators/schemas.py", line 357, in __init__
    self.source = XMLResource(source, base_url, allow, defuse, timeout)
 File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/xmlschema/resources.py", line 511, in __init__
    self.parse(source, lazy)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/xmlschema/resources.py", line 750, in parse
    self._parse_resource(resource, url, lazy)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/xmlschema/resources.py", line 722, in _parse_resource
    self._parse(resource)
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/xmlschema/resources.py", line 697, in _parse
    for event, node in ElementTree.iterparse(resource, events):
  File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1232, in iterator
    pullparser.feed(data)
  File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1274, in feed
    self._parser.feed(data)
  File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1693, in feed
    self.parser.Parse(data, 0)
  File "../Modules/pyexpat.c", line 481, in EntityDecl
  File "/root/.cache/pypoetry/virtualenvs/relate-courseware-oqAxzWoQ-py3.8/lib/python3.8/site-packages/defusedxml/ElementTree.py", line 124, in defused_entity_decl
    raise EntitiesForbidden(name, value, base, sysid, pubid, notation_name)
defusedxml.common.EntitiesForbidden: EntitiesForbidden(name='schemaAttrs', system_id=None, public_id=None)

Dockerfile currently looks like this:

FROM ubuntu:20.04
MAINTAINER Klavs Klavsen <klavs@enableit.dk>

WORKDIR /tmp

RUN apt-get update &&  \
    apt-get install -y \
    python3-pip \
    python3.8-venv \
    build-essential \ 
    postgresql-server-dev-all

RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install git gettext-base curl -y
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get update; DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs 

WORKDIR /var/www

RUN python3 -m venv relate-venv
RUN pip install poetry
RUN git clone https://github.com/inducer/relate.git
ENV VENV_PATH=/var/www/relate-venv
WORKDIR /var/www/relate
#RUN . /var/www/relate-venv/bin/activate && poetry install
RUN poetry install
RUN npm install ; npm run build
RUN poetry run pip install psycopg2
COPY local_settings_template.py /var/www/relate/local_settings_template.py 
COPY run-relate.sh /run-relate.sh
RUN chmod 755 /run-relate.sh

CMD ['/run-relate.sh']

if I add: RUN git checkout 2b2755b - it works perfectly fine

I tested with bcf963f - and that works too - so its the latest commit

I can reproduce that. Super weird.

OK, I figured out what the problem is: slixmpp enables defusedxml for all XML parsing in the standard library:

poezio/slixmpp@53dc984

That, in turn, breaks an XML parse that happens as part of SAML2 initialization.

I tried reporting this upstream, but I failed miserably. See the messages at poezio/slixmpp@53dc984. cc @poezio

Thanks for the report, I did not catch that issue. Defusedxml is not mandatory and will not be used if not available, but this shows the need for an option (e.g. SLIXMPP_DISABLE_DEFUSEDXML env var) to at least disable it.

Spam handling with gitlab is tricky, sorry for the inconvenience (we had a lot of spam issues & comments until spam handling was turned on, but it might be overzealous).