[Bug 2024325] Re: [SRU] trac crashes while importing a library in Ubuntu 20.04 (ImportError: cannot import name 'soft_unicode' from 'jinja2.utils')

Robie Basak 2024325 at bugs.launchpad.net
Mon Feb 5 12:20:12 UTC 2024


** Description changed:

  [ Impact ]
  
  trac is completely unusable as it will fail with the below error
  whenever any user tries to run "tracd" or "trac-admin":
  
  Traceback (most recent call last):
-   File "/usr/bin/tracd", line 33, in <module>
-     sys.exit(load_entry_point('Trac==1.5.3', 'console_scripts', 'tracd')())
-   File "/usr/bin/tracd", line 25, in importlib_load_entry_point
-     return next(matches).load()
-   File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
-     module = import_module(match.group('module'))
-   File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
-     return _bootstrap._gcd_import(name[level:], package, level)
-   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
-   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
-   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
-   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
-   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
-   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
-   File "/usr/lib/python3/dist-packages/trac/web/standalone.py", line 35, in <module>
-     from trac.web.auth import BasicAuthentication, DigestAuthentication
-   File "/usr/lib/python3/dist-packages/trac/web/auth.py", line 29, in <module>
-     from trac.web.chrome import Chrome, INavigationContributor
-   File "/usr/lib/python3/dist-packages/trac/web/chrome.py", line 40, in <module>
-     from trac.mimeview.api import RenderingContext, get_mimetype
-   File "/usr/lib/python3/dist-packages/trac/mimeview/__init__.py", line 14, in <module>
-     from trac.mimeview.api import *
-   File "/usr/lib/python3/dist-packages/trac/mimeview/api.py", line 70, in <module>
-     from trac.resource import Resource
-   File "/usr/lib/python3/dist-packages/trac/resource.py", line 21, in <module>
-     from trac.util.presentation import classes
-   File "/usr/lib/python3/dist-packages/trac/util/presentation.py", line 26, in <module>
-     from jinja2.utils import soft_unicode
+   File "/usr/bin/tracd", line 33, in <module>
+     sys.exit(load_entry_point('Trac==1.5.3', 'console_scripts', 'tracd')())
+   File "/usr/bin/tracd", line 25, in importlib_load_entry_point
+     return next(matches).load()
+   File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
+     module = import_module(match.group('module'))
+   File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
+     return _bootstrap._gcd_import(name[level:], package, level)
+   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
+   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
+   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
+   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
+   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
+   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
+   File "/usr/lib/python3/dist-packages/trac/web/standalone.py", line 35, in <module>
+     from trac.web.auth import BasicAuthentication, DigestAuthentication
+   File "/usr/lib/python3/dist-packages/trac/web/auth.py", line 29, in <module>
+     from trac.web.chrome import Chrome, INavigationContributor
+   File "/usr/lib/python3/dist-packages/trac/web/chrome.py", line 40, in <module>
+     from trac.mimeview.api import RenderingContext, get_mimetype
+   File "/usr/lib/python3/dist-packages/trac/mimeview/__init__.py", line 14, in <module>
+     from trac.mimeview.api import *
+   File "/usr/lib/python3/dist-packages/trac/mimeview/api.py", line 70, in <module>
+     from trac.resource import Resource
+   File "/usr/lib/python3/dist-packages/trac/resource.py", line 21, in <module>
+     from trac.util.presentation import classes
+   File "/usr/lib/python3/dist-packages/trac/util/presentation.py", line 26, in <module>
+     from jinja2.utils import soft_unicode
  ImportError: cannot import name 'soft_unicode' from 'jinja2.utils' (/usr/lib/python3/dist-packages/jinja2/utils.py)
  
  [ Test Plan ]
  
  * Simple test:
-   - Execute "tracd --help" or "tracd"
-   - Execute "trac-admin --help" or "trac-admin"
-   - If its not fixed then both the commands will fail as the error above
-   - With fixed package both the commands will show the help message.
+   - Execute "tracd --help" or "tracd"
+   - Execute "trac-admin --help" or "trac-admin"
+   - If its not fixed then both the commands will fail as the error above
+   - With fixed package both the commands will show the help message.
  
  * More comprehensive test: (execue the following as root)
-   - mkdir -p /var/lib/trac
-   - trac-admin /var/lib/trac/myproject initenv
-   - Enter some project name when prompted
-   - Leave default sqlite DB (just press enter)
-   - echo -n "tracadmin:example.com:" > /var/lib/trac/myproject/users.htdigest
-   - trac-admin /var/lib/trac/myproject permission add tracadmin TRAC_ADMIN
-   - tracd --port 8080 --auth=*,/var/lib/trac/myproject/users.htdigest,example.com /var/lib/trac/myproject
-   - open http://127.0.0.1:8080 in browser, it should show the project name and clicking on that should show the welcome screen
+   - mkdir -p /var/lib/trac
+   - trac-admin /var/lib/trac/myproject initenv
+   - Enter some project name when prompted
+   - Leave default sqlite DB (just press enter)
+   - echo -n "tracadmin:example.com:" > /var/lib/trac/myproject/users.htdigest
+   - trac-admin /var/lib/trac/myproject permission add tracadmin TRAC_ADMIN
+   - tracd --port 8080 --auth=*,/var/lib/trac/myproject/users.htdigest,example.com /var/lib/trac/myproject
+   - open http://127.0.0.1:8080 in browser, it should show the project name and clicking on that should show the welcome screen
  
  [ Where problems could occur ]
  
  It is not changing any part of the code, its only importing the module
  with the new name and so there is minimum chance of any regression.
+ 
+ [racb] We're adjusting imports of soft_unicode/soft_str. Problems might
+ manifest in module imports, or in the assumption that one of these is an
+ exact replacement of the other.
  
  [ Other Info ]
  
  - The Ubuntu patch is a combination of portions of two upstream but related changes.
  - One of the upstream changes mentions about an AssertionError for jinja, so it will be great if this can be tested by a real user of trac. The testplan only checks the server starts and is working.
  
  [ Original Bug Description ]
  
  Trac 1.5.3 which comes with Ubuntu 20.04 crashes because of problems
  with a library. The problem was fixed upstream:
  https://trac.edgewall.org/ticket/13404

-- 
You received this bug notification because you are a member of Ubuntu
Sponsors, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/2024325

Title:
  [SRU] trac crashes while importing a library in Ubuntu 20.04
  (ImportError: cannot import name 'soft_unicode' from 'jinja2.utils')

Status in trac package in Ubuntu:
  Fix Released
Status in trac source package in Jammy:
  Confirmed

Bug description:
  [ Impact ]

  trac is completely unusable as it will fail with the below error
  whenever any user tries to run "tracd" or "trac-admin":

  Traceback (most recent call last):
    File "/usr/bin/tracd", line 33, in <module>
      sys.exit(load_entry_point('Trac==1.5.3', 'console_scripts', 'tracd')())
    File "/usr/bin/tracd", line 25, in importlib_load_entry_point
      return next(matches).load()
    File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
      module = import_module(match.group('module'))
    File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 883, in exec_module
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "/usr/lib/python3/dist-packages/trac/web/standalone.py", line 35, in <module>
      from trac.web.auth import BasicAuthentication, DigestAuthentication
    File "/usr/lib/python3/dist-packages/trac/web/auth.py", line 29, in <module>
      from trac.web.chrome import Chrome, INavigationContributor
    File "/usr/lib/python3/dist-packages/trac/web/chrome.py", line 40, in <module>
      from trac.mimeview.api import RenderingContext, get_mimetype
    File "/usr/lib/python3/dist-packages/trac/mimeview/__init__.py", line 14, in <module>
      from trac.mimeview.api import *
    File "/usr/lib/python3/dist-packages/trac/mimeview/api.py", line 70, in <module>
      from trac.resource import Resource
    File "/usr/lib/python3/dist-packages/trac/resource.py", line 21, in <module>
      from trac.util.presentation import classes
    File "/usr/lib/python3/dist-packages/trac/util/presentation.py", line 26, in <module>
      from jinja2.utils import soft_unicode
  ImportError: cannot import name 'soft_unicode' from 'jinja2.utils' (/usr/lib/python3/dist-packages/jinja2/utils.py)

  [ Test Plan ]

  * Simple test:
    - Execute "tracd --help" or "tracd"
    - Execute "trac-admin --help" or "trac-admin"
    - If its not fixed then both the commands will fail as the error above
    - With fixed package both the commands will show the help message.

  * More comprehensive test: (execue the following as root)
    - mkdir -p /var/lib/trac
    - trac-admin /var/lib/trac/myproject initenv
    - Enter some project name when prompted
    - Leave default sqlite DB (just press enter)
    - echo -n "tracadmin:example.com:" > /var/lib/trac/myproject/users.htdigest
    - trac-admin /var/lib/trac/myproject permission add tracadmin TRAC_ADMIN
    - tracd --port 8080 --auth=*,/var/lib/trac/myproject/users.htdigest,example.com /var/lib/trac/myproject
    - open http://127.0.0.1:8080 in browser, it should show the project name and clicking on that should show the welcome screen

  [ Where problems could occur ]

  It is not changing any part of the code, its only importing the module
  with the new name and so there is minimum chance of any regression.

  [racb] We're adjusting imports of soft_unicode/soft_str. Problems
  might manifest in module imports, or in the assumption that one of
  these is an exact replacement of the other.

  [ Other Info ]

  - The Ubuntu patch is a combination of portions of two upstream but related changes.
  - One of the upstream changes mentions about an AssertionError for jinja, so it will be great if this can be tested by a real user of trac. The testplan only checks the server starts and is working.

  [ Original Bug Description ]

  Trac 1.5.3 which comes with Ubuntu 20.04 crashes because of problems
  with a library. The problem was fixed upstream:
  https://trac.edgewall.org/ticket/13404

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/trac/+bug/2024325/+subscriptions




More information about the Ubuntu-sponsors mailing list