Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 836206 - app-admin/salt broken because of changes in >=dev-python/jinja-3.1
Summary: app-admin/salt broken because of changes in >=dev-python/jinja-3.1
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Patrick McLean
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-26 16:51 UTC by Carlos Konstanski
Modified: 2023-01-30 16:46 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Konstanski 2022-03-26 16:51:24 UTC
A very recent upgrade to dev-python/jinja-3.1.x has caused app-admin/salt to break. The salt team is aware of this issue. Here is a link to the github issue: https://github.com/saltstack/salt/issues/61848

Salt will need a version bump as soon as they fix it.

```Traceback (most recent call last):
  File "/usr/bin/salt-call", line 98, in <module>
    exec(data, new_globals)
  File "<string>", line 33, in <module>
  File "/usr/lib/python3.9/site-packages/salt/scripts.py", line 437, in salt_call
    import salt.cli.call
  File "/usr/lib/python3.9/site-packages/salt/cli/call.py", line 6, in <module>
    import salt.cli.caller
  File "/usr/lib/python3.9/site-packages/salt/cli/caller.py", line 14, in <module>
    import salt.loader
  File "/usr/lib/python3.9/site-packages/salt/loader.py", line 26, in <module>
    import salt.config
  File "/usr/lib/python3.9/site-packages/salt/config/__init__.py", line 103, in <module>
    _DFLT_IPC_WBUFFER = _gather_buffer_space() * 0.5
  File "/usr/lib/python3.9/site-packages/salt/config/__init__.py", line 91, in _gather_buffer_space
    import salt.grains.core
  File "/usr/lib/python3.9/site-packages/salt/grains/core.py", line 32, in <module>
    import salt.modules.cmdmod
  File "/usr/lib/python3.9/site-packages/salt/modules/cmdmod.py", line 31, in <module>
    import salt.utils.templates
  File "/usr/lib/python3.9/site-packages/salt/utils/templates.py", line 20, in <module>
    import salt.utils.jinja
  File "/usr/lib/python3.9/site-packages/salt/utils/jinja.py", line 28, in <module>
    from jinja2 import BaseLoader, Markup, TemplateNotFound, nodes
ImportError: cannot import name 'Markup' from 'jinja2' (/usr/lib/python3.9/site-packages/jinja2/__init__.py)```

Reproducible: Always
Comment 1 Larry the Git Cow gentoo-dev 2022-03-27 01:00:21 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79dacb355a17541cc945d0fd8f76ac1c08cc28b8

commit 79dacb355a17541cc945d0fd8f76ac1c08cc28b8
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-03-27 00:58:52 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-03-27 01:00:09 +0000

    app-admin/salt: add patch for newer Jinja
    
    Bug: https://bugs.gentoo.org/836206
    Signed-off-by: Sam James <sam@gentoo.org>

 app-admin/salt/files/salt-3003.3-jinja.patch | 155 ++++++++++++++++++++
 app-admin/salt/salt-3003.3-r1.ebuild         | 203 +++++++++++++++++++++++++++
 2 files changed, 358 insertions(+)
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-27 01:01:16 UTC
I've only patched 3003.3 (in -r1).
Comment 3 Sebastian Pipping gentoo-dev 2023-01-30 16:28:55 UTC
I believe we are done here:

  # grep jinja *.ebuild
  salt-3004.2-r2.ebuild:  >=dev-python/jinja-3.0[${PYTHON_USEDEP}]
  salt-3004.2-r2.ebuild:  "${FILESDIR}/salt-3004.2-jinja-3.patch"
  salt-3005.1.ebuild:     >=dev-python/jinja-3.0.3[${PYTHON_USEDEP}]
  salt-3005.1-r1.ebuild:  >=dev-python/jinja-3.0.3[${PYTHON_USEDEP}]
  salt-3005-r1.ebuild:    >=dev-python/jinja-3.0.3[${PYTHON_USEDEP}]

Closing, please re-open as needed.

@sam thanks for the patch!
Comment 4 Sebastian Pipping gentoo-dev 2023-01-30 16:40:36 UTC
Turned out mistaken, "from jinja2 import Markup" is still in there and doesn't work with jinja2 3.1, reopening...

  # python3.9 -c 'from jinja2 import Markup'
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  ImportError: cannot import name 'Markup' from 'jinja2' (/usr/lib/python3.9/site-packages/jinja2/__init__.py)
Comment 5 Sebastian Pipping gentoo-dev 2023-01-30 16:46:55 UTC
Second try.  "from jinja2 import Markup" is part of this combo by now:

  # grep -Rw -B4  'from jinja2.*Markup' salt-3005.1/
  salt-3005.1/tests/pytests/unit/utils/jinja/test_jinja.py-try:
  salt-3005.1/tests/pytests/unit/utils/jinja/test_jinja.py-    from markupsafe import Markup
  salt-3005.1/tests/pytests/unit/utils/jinja/test_jinja.py-except ImportError:
  salt-3005.1/tests/pytests/unit/utils/jinja/test_jinja.py-    # jinja < 3.1
  salt-3005.1/tests/pytests/unit/utils/jinja/test_jinja.py:    from jinja2 import Markup
  --
  salt-3005.1/salt/utils/jinja.py-try:
  salt-3005.1/salt/utils/jinja.py-    from markupsafe import Markup
  salt-3005.1/salt/utils/jinja.py-except ImportError:
  salt-3005.1/salt/utils/jinja.py-    # jinja < 3.1
  salt-3005.1/salt/utils/jinja.py:    from jinja2 import Markup

So as long as markupsafe is around, we're good.  Is it around?:

  # grep markupsafe *.ebuild
  salt-3004.2-r2.ebuild:  dev-python/markupsafe[${PYTHON_USEDEP}]
  salt-3005.1.ebuild:     >=dev-python/markupsafe-2.0.1[${PYTHON_USEDEP}]
  salt-3005.1-r1.ebuild:  >=dev-python/markupsafe-2.0.1[${PYTHON_USEDEP}]
  salt-3005-r1.ebuild:    >=dev-python/markupsafe-2.0.1[${PYTHON_USEDEP}]

This^^ makes sure it is around.  Closing, please re-open as needed.