From 90477825c2c2b6057c4cc922af678782d9c48fe5 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Fri, 17 Jun 2022 18:50:16 -0400 Subject: [PATCH] Make globinclude sort files before loading `Path.glob` gives no guarantee about the order results are returned in. This means that if files included by `globinclude` override each other, the resulting config was non-deterministic. Resolve this by sorting the results from `glob` to give consistent, well-defined order. --- kitty/conf/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/conf/utils.py b/kitty/conf/utils.py index 769ce5306..afe658bb9 100644 --- a/kitty/conf/utils.py +++ b/kitty/conf/utils.py @@ -185,7 +185,7 @@ def parse_line( val = os.path.expandvars(os.path.expanduser(val.strip())) if key == 'globinclude': from pathlib import Path - vals = tuple(map(lambda x: str(os.fspath(x)), Path(base_path_for_includes).glob(val))) + vals = tuple(map(lambda x: str(os.fspath(x)), sorted(Path(base_path_for_includes).glob(val)))) elif key == 'envinclude': from fnmatch import fnmatchcase for x in os.environ: