From 99fb574dfd4014ab3349765134def862710c5a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 26 Nov 2023 17:12:40 +0100 Subject: [PATCH] Limit size of database cache dump to 40 chars Each backend has their limit. 40 chars is picked as limit to match the size of mercurial hash. Closes #12754 (grafted from 3055098129d4afbf82af5fa527e3d3e357ea7021) --HG-- branch : 6.0 --- trytond/trytond/tests/test_tryton.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trytond/trytond/tests/test_tryton.py b/trytond/trytond/tests/test_tryton.py index 0ffbf1cd79..9737dd7c60 100644 --- a/trytond/trytond/tests/test_tryton.py +++ b/trytond/trytond/tests/test_tryton.py @@ -2,6 +2,7 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. import doctest +import hashlib import inspect import operator import os @@ -112,7 +113,8 @@ def backup_db_cache(name): def _db_cache_file(path, name): - return os.path.join(path, '%s-%s.dump' % (name, backend.name)) + hash_name = hashlib.shake_128(name.encode('utf8')).hexdigest(40 // 2) + return os.path.join(path, '%s-%s.dump' % (hash_name, backend.name)) def _sqlite_copy(file_, restore=False):