From 22a309d154b8c80ffdfdfe4ba38ac5738abbe258 Mon Sep 17 00:00:00 2001 From: Pawel Marczewski Date: Wed, 15 Jan 2020 11:17:47 +0100 Subject: [PATCH] qubes-session-autostart: handle error when reading a directory Fixes QubesOS/qubes-issues#5043. --- misc/qubes-session-autostart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/misc/qubes-session-autostart b/misc/qubes-session-autostart index 1dfcd4b..1fa5765 100644 --- a/misc/qubes-session-autostart +++ b/misc/qubes-session-autostart @@ -60,7 +60,16 @@ def process_autostart(environments): # handle only "most important" entry processed_entries = {} for path in xdg.BaseDirectory.load_config_paths('autostart'): - for entry_name in os.listdir(path): + try: + entries = os.listdir(path) + except Exception as e: + print( + "Failed to process path '{}': {}".format(path, str(e)), + file=sys.stderr + ) + continue + + for entry_name in entries: if entry_name in processed_entries: continue