Skip to content

[FW][FIX] *: adapt for noble#160853

Closed
fw-bot wants to merge 9 commits intoodoo:masterfrom
odoo-dev:master-15.0-noble-xdo-mMMI-fw
Closed

[FW][FIX] *: adapt for noble#160853
fw-bot wants to merge 9 commits intoodoo:masterfrom
odoo-dev:master-15.0-noble-xdo-mMMI-fw

Conversation

@fw-bot
Copy link
Copy Markdown
Contributor

@fw-bot fw-bot commented Apr 7, 2024

This pr backports some fixed for python3.11 and introduces new fixes for Ubuntu Noble, such as timezones.

Forward-Port-Of: #160842
Forward-Port-Of: #151989

@robodoo
Copy link
Copy Markdown
Contributor

robodoo commented Apr 7, 2024

Pull request status dashboard.

@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented Apr 7, 2024

@Xavier-Do this PR targets master and is the last of the forward-port chain containing:

To merge the full chain, use

@fw-bot r+

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added the forwardport This PR was created by @fw-bot label Apr 7, 2024
@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented Apr 7, 2024

@Xavier-Do ci/runbot failed on this forward-port PR

@C3POdoo C3POdoo added the RD research & development, internal work label Apr 7, 2024
pimodoo and others added 8 commits April 11, 2024 08:26
When python expression is evaluated in odoo form an action or qweb, we
are checking the opcodes generated by the evaluation of this code. We do
such a verification, because the code from actions and templates can be
written by someone having not access to the server and we don't want to
let them perform actions out of the scope of their database.

In python 3.11, some opcodes from previous versions of Python have been
renamed, grouped or sepcified. There are also new ones that have been
introduce.

In this PR, we are whitelisting the new ones that are needed by odoo to
properly work in this version of Python.

X-original-commit: 81e4f9a
see lxml/lxml@cc5ddbb

X-original-commit: 2d13fa9
Co-authored-by: Xavier Morel (xmo) <xmo@odoo.com>
In latest versions of werkzeug, the `werkzeug.urls` module has been
reduced to remove feature present in urllib.parse. This commit vendored
the old version to avoid breaking compatibility with older versions of
odoo on ubuntu Noble, without adapting the whole codebase. This
should/may be removed in stable by adaptaing eveything to urlib.

This version of the lib was minimalized to avoid redondunce with feature
still present in werkzeug.urls. Some unused features in odoo are still
vendored for ease but are not exposed on the werkzeug.urls for now.

X-original-commit: 0dc85a2
Some of the non canononical timezones are not present in Ubuntu Noble,
it would be a better practice to only use canonical timezones in data
and tests.

Note that this is not a real fix for all cases since the database that
ran on Ubuntu Jammy and are moved to an ubuntu Noble server will have
the issue with timezones already in database.

One of the possible fix would be to manage that during upgrades, but
this isn't a verry flexible solution since upgrade are meant to manage
chyange of version, not change of server. If an old 17.0 versions needs
to be moved to a Noble server, this won't work.

Another solution would be to install package like tzdata-legacy that may
keep the old timezones but it is not the only think since TAI-10 are
also in this package. This solution is not ideal because non canonical
timezone will still be shown in the dropdown. We would need to filter
them.

A last solution would be to add the support for those old timezones by
monkeypatching the lib. This way, only new timezones would be shown but
non canonical one won't crash when used. This is not ideal either
because we may need to keep this for a while. But in combination with
the upgrade solution, it may work proprely.

X-original-commit: e9b62b4
In ubuntu noble, some timezone where removed leading to errors when
trying to assign/access them.

This was partially fixed in the code by removing all references to old
timezones but one issue remains: if a database contains timezones that
are not defined in the os, the resolution will fail and break at runtime

This patches proposes to alter timezone to fallback on the new canonical
timezone if the timezone was removed.

This list was generated by checking all symlink in /usr/share/zoneinfo
in ubuntu 22.04 that disapeared in ubuntu 24.04

This solutions will work when moving a database from one server to
another, even without migration.

The all_timezone is not modified on purpose to avoid breaking existing
logic. This list may be used to define if a timezone is known by
postgress, define selection fiels, .... we don"t want to increase the
list in those case.

Some other logic using all_timezone may need to be updated but This
will be done in master.

X-original-commit: e531d8e
The main purpose of this test is to ensure that line return are removed,
but all other special character are kept once the file is saved.

Unfortunately, werkzeug versions have different strategies on how to
quote the filename, removing less special character in latest versions
like after pallets/werkzeug@babfc93

This also changes after the changes that removed werkzeug urls methods
replacing them by urllib, making the behaviour different again.

This commit makes the test more robust by checking that the filename
correspond to the expeted one once unquoted, not comparing the quoted
versions.

X-original-commit: 52a2675
@Xavier-Do Xavier-Do force-pushed the master-15.0-noble-xdo-mMMI-fw branch from edc1908 to 43d4c5b Compare April 11, 2024 06:26
@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented Apr 11, 2024

@Xavier-Do this PR was modified / updated and has become a normal PR. It should be merged the normal way (via @robodoo)

@C3POdoo C3POdoo requested review from a team, HydrionBurst and xmo-odoo and removed request for a team April 11, 2024 06:28
@C3POdoo C3POdoo requested review from a team, BastienFafchamps and aab-odoo April 11, 2024 06:28
@Xavier-Do
Copy link
Copy Markdown
Contributor

@robodoo override=ci/style
@robodoo override=ci/security
(see previous pr)

@Xavier-Do
Copy link
Copy Markdown
Contributor

pylint version was upgrade, should be ok now
@robodoo r+

The test test_tz_legacy will fail if the taget does not exist on the
operating system. This is breaking in some versions of the tz-data
package. Don't make this test fail if the target is missing.

closes odoo#160868

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
@Xavier-Do
Copy link
Copy Markdown
Contributor

@robodoo r+
just added a commit that conflicted from #161405

robodoo pushed a commit that referenced this pull request Apr 11, 2024
When python expression is evaluated in odoo form an action or qweb, we
are checking the opcodes generated by the evaluation of this code. We do
such a verification, because the code from actions and templates can be
written by someone having not access to the server and we don't want to
let them perform actions out of the scope of their database.

In python 3.11, some opcodes from previous versions of Python have been
renamed, grouped or sepcified. There are also new ones that have been
introduce.

In this PR, we are whitelisting the new ones that are needed by odoo to
properly work in this version of Python.

X-original-commit: 81e4f9a
Part-of: #160853
robodoo pushed a commit that referenced this pull request Apr 11, 2024
see lxml/lxml@cc5ddbb

X-original-commit: 2d13fa9
Part-of: #160853
Co-authored-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this pull request Apr 11, 2024
robodoo pushed a commit that referenced this pull request Apr 11, 2024
In latest versions of werkzeug, the `werkzeug.urls` module has been
reduced to remove feature present in urllib.parse. This commit vendored
the old version to avoid breaking compatibility with older versions of
odoo on ubuntu Noble, without adapting the whole codebase. This
should/may be removed in stable by adaptaing eveything to urlib.

This version of the lib was minimalized to avoid redondunce with feature
still present in werkzeug.urls. Some unused features in odoo are still
vendored for ease but are not exposed on the werkzeug.urls for now.

X-original-commit: 0dc85a2
Part-of: #160853
robodoo pushed a commit that referenced this pull request Apr 11, 2024
Some of the non canononical timezones are not present in Ubuntu Noble,
it would be a better practice to only use canonical timezones in data
and tests.

Note that this is not a real fix for all cases since the database that
ran on Ubuntu Jammy and are moved to an ubuntu Noble server will have
the issue with timezones already in database.

One of the possible fix would be to manage that during upgrades, but
this isn't a verry flexible solution since upgrade are meant to manage
chyange of version, not change of server. If an old 17.0 versions needs
to be moved to a Noble server, this won't work.

Another solution would be to install package like tzdata-legacy that may
keep the old timezones but it is not the only think since TAI-10 are
also in this package. This solution is not ideal because non canonical
timezone will still be shown in the dropdown. We would need to filter
them.

A last solution would be to add the support for those old timezones by
monkeypatching the lib. This way, only new timezones would be shown but
non canonical one won't crash when used. This is not ideal either
because we may need to keep this for a while. But in combination with
the upgrade solution, it may work proprely.

X-original-commit: e9b62b4
Part-of: #160853
robodoo pushed a commit that referenced this pull request Apr 11, 2024
In ubuntu noble, some timezone where removed leading to errors when
trying to assign/access them.

This was partially fixed in the code by removing all references to old
timezones but one issue remains: if a database contains timezones that
are not defined in the os, the resolution will fail and break at runtime

This patches proposes to alter timezone to fallback on the new canonical
timezone if the timezone was removed.

This list was generated by checking all symlink in /usr/share/zoneinfo
in ubuntu 22.04 that disapeared in ubuntu 24.04

This solutions will work when moving a database from one server to
another, even without migration.

The all_timezone is not modified on purpose to avoid breaking existing
logic. This list may be used to define if a timezone is known by
postgress, define selection fiels, .... we don"t want to increase the
list in those case.

Some other logic using all_timezone may need to be updated but This
will be done in master.

X-original-commit: e531d8e
Part-of: #160853
robodoo pushed a commit that referenced this pull request Apr 11, 2024
The main purpose of this test is to ensure that line return are removed,
but all other special character are kept once the file is saved.

Unfortunately, werkzeug versions have different strategies on how to
quote the filename, removing less special character in latest versions
like after pallets/werkzeug@babfc93

This also changes after the changes that removed werkzeug urls methods
replacing them by urllib, making the behaviour different again.

This commit makes the test more robust by checking that the filename
correspond to the expeted one once unquoted, not comparing the quoted
versions.

X-original-commit: 52a2675
Part-of: #160853
robodoo pushed a commit that referenced this pull request Apr 11, 2024
robodoo pushed a commit that referenced this pull request Apr 11, 2024
The test test_tz_legacy will fail if the taget does not exist on the
operating system. This is breaking in some versions of the tz-data
package. Don't make this test fail if the target is missing.

closes #160868

closes #160853

Related: odoo/enterprise#60224
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
@robodoo robodoo closed this Apr 11, 2024
@robodoo robodoo added the 17.3 label Apr 11, 2024
@chapital
Copy link
Copy Markdown

Hi, i testing noble, it have python 3.12, this have lxml 5.2.1 when we install odoo by default, but it requires also lxml-html-clean, but it still have issues with lxml, here are the error:

File "/usr/lib/python3/dist-packages/odoo/tools/mail.py", line 31, in
Apr 17 21:04:17 odooserver odoo[5508]: safe_attrs = clean.defs.safe_attrs | frozenset(
Apr 17 21:04:17 odooserver odoo[5508]: ^^^^^^^^^^
Apr 17 21:04:17 odooserver odoo[5508]: AttributeError: module 'lxml.html.clean' has no attribute 'defs'
Apr 17 21:04:17 odooserver systemd[1]: odoo.service: Main process exited, code=exited, status=1/FAILURE
Apr 17 21:04:17 odooserver systemd[1]: odoo.service: Failed with result 'exit-code'.

AttributeError: module 'lxml.html.clean' has no attribute 'defs'

Can you validate this, an if you have a solution please let me know.

Thanks

@Xavier-Do
Copy link
Copy Markdown
Contributor

This first set of changes was made for python 3.11, odoo is not adapted for python 3.12 yet

@Xavier-Do
Copy link
Copy Markdown
Contributor

So yes, I tried locally and it looks like ubuntu:Noble switched from lxml5.1.0 to 5.2.1 recently

In my case the import fail, in 15.0.

(I'm going to cry a little don't mind me)

@fw-bot fw-bot deleted the master-15.0-noble-xdo-mMMI-fw branch April 25, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

17.3 forwardport This PR was created by @fw-bot RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants