aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/cores
diff options
context:
space:
mode:
authorsvartmetal <svartmetal@yandex-team.com>2022-08-05 18:58:45 +0300
committersvartmetal <svartmetal@yandex-team.com>2022-08-05 18:58:45 +0300
commita4c409d856e041108842e2400ef0d5416380ada6 (patch)
tree0c52c1ef746d389a6a77d6d4ee5acabc50fa2a27 /library/python/cores
parent7b4f8921a24ccfcc22a3114c6b1b6222b14a836a (diff)
downloadydb-a4c409d856e041108842e2400ef0d5416380ada6.tar.gz
should escape core pattern path otherwise coredumps collection doesn't work
Diffstat (limited to 'library/python/cores')
-rw-r--r--library/python/cores/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/python/cores/__init__.py b/library/python/cores/__init__.py
index e3eea6ab5d..e99b8f65df 100644
--- a/library/python/cores/__init__.py
+++ b/library/python/cores/__init__.py
@@ -4,6 +4,7 @@ import os
import re
import glob
import socket
+import sys
import logging
import platform
import subprocess
@@ -93,7 +94,10 @@ def recover_core_dump_file(binary_path, cwd, pid, core_pattern=None):
oct(stat.S_ISVTX),
)
logger.debug("Search for core dump files match pattern '%s' in '%s'", pattern.mask, pattern.path)
- cores = glob.glob(os.path.join(pattern.path, pattern.mask))
+ escaped_pattern_path = pattern.path
+ if sys.version_info[0] == 3:
+ escaped_pattern_path = glob.escape(pattern.path)
+ cores = glob.glob(os.path.join(escaped_pattern_path, pattern.mask))
files = os.listdir(pattern.path)
logger.debug(
"Matched core dump files (%d/%d): [%s] (mismatched samples: %s)",