From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 29 Oct 2021 15:24:41 +0000 (-0700) Subject: [3.9] bpo-45628: Check all parts of the suffix for an extension match. (GH-29310... X-Git-Tag: v3.9.8~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=317e0c99e3804310f4bee23e497d9d84b717d7f7;p=thirdparty%2FPython%2Fcpython.git [3.9] bpo-45628: Check all parts of the suffix for an extension match. (GH-29310) (GH-29313) --- diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 7f1f10551c30..f8040c498c10 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -368,8 +368,13 @@ class TimedRotatingFileHandler(BaseRotatingHandler): for fileName in fileNames: if fileName[:plen] == prefix: suffix = fileName[plen:] - if self.extMatch.match(suffix): - result.append(os.path.join(dirName, fileName)) + # See bpo-45628: The date/time suffix could be anywhere in the + # filename + parts = suffix.split('.') + for part in parts: + if self.extMatch.match(part): + result.append(os.path.join(dirName, fileName)) + break if len(result) < self.backupCount: result = [] else: