50 lines
2.1 KiB
Diff
50 lines
2.1 KiB
Diff
From 7034f592314a79903c8ce5958de4deba2c13ae22 Mon Sep 17 00:00:00 2001
|
|
From: Mike FABIAN <mfabian@redhat.com>
|
|
Date: Mon, 6 Jan 2020 19:09:56 +0100
|
|
Subject: [PATCH] Add exist_ok=True in os.makedirs(path, exist_ok=True) to
|
|
avoid failure due to race condition
|
|
|
|
Resolves: rhbz#1786652 (https://bugzilla.redhat.com/show_bug.cgi?id=1786652)
|
|
|
|
[abrt] ibus-table: makedirs(): os.py:221:makedirs:FileExistsError: [Errno 17] File exists: '/home/username/.local/share/ibus-table'
|
|
---
|
|
engine/ibus_table_location.py | 4 ++--
|
|
engine/tabsqlitedb.py | 2 +-
|
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/engine/ibus_table_location.py b/engine/ibus_table_location.py
|
|
index dee718d..036b372 100644
|
|
--- a/engine/ibus_table_location.py
|
|
+++ b/engine/ibus_table_location.py
|
|
@@ -73,7 +73,7 @@ def _init():
|
|
IBUS_TABLE_LOCATION['data_home'] = os.path.join(
|
|
IBUS_TABLE_LOCATION['data_home'], 'ibus-table')
|
|
if not os.access(IBUS_TABLE_LOCATION['data_home'], os.F_OK):
|
|
- os.makedirs(IBUS_TABLE_LOCATION['data_home'])
|
|
+ os.makedirs(IBUS_TABLE_LOCATION['data_home'], exist_ok=True)
|
|
|
|
# $XDG_CACHE_HOME defines the base directory relative to which user
|
|
# specific non-essential data files should be stored. If
|
|
@@ -89,7 +89,7 @@ def _init():
|
|
IBUS_TABLE_LOCATION['cache_home'] = os.path.join(
|
|
IBUS_TABLE_LOCATION['cache_home'], 'ibus-table')
|
|
if not os.access(IBUS_TABLE_LOCATION['cache_home'], os.F_OK):
|
|
- os.makedirs(IBUS_TABLE_LOCATION['cache_home'])
|
|
+ os.makedirs(IBUS_TABLE_LOCATION['cache_home'], exist_ok=True)
|
|
|
|
class __ModuleInitializer:
|
|
def __init__(self):
|
|
diff --git a/engine/tabsqlitedb.py b/engine/tabsqlitedb.py
|
|
index d9a8de2..60038a7 100644
|
|
--- a/engine/tabsqlitedb.py
|
|
+++ b/engine/tabsqlitedb.py
|
|
@@ -298,7 +298,7 @@ def __init__(
|
|
shutil.rmtree(old_tables_path)
|
|
os.symlink(tables_path, old_tables_path)
|
|
else:
|
|
- os.makedirs(tables_path)
|
|
+ os.makedirs(tables_path, exist_ok=True)
|
|
user_db = path.join(tables_path, user_db)
|
|
if not path.exists(user_db):
|
|
sys.stderr.write(
|