https://bugzilla.redhat.com/show_bug.cgi?id=1770072
--- Comment #12 from Mike FABIAN <mfabian(a)redhat.com> ---
I think this will fix it:
$ git show
commit 5f0a46a5dbf4f99fb1eae2fd80831f60616007e9 (HEAD -> release-2.7.3)
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Tue Nov 12 17:47:37 2019 +0900
Fix race condition in itb_util.xdg_save_data_path()
Resolves: rhbz#1770072
(
https://bugzilla.redhat.com/show_bug.cgi?id=1770072)
Resolves: rhbz#1713963
(
https://bugzilla.redhat.com/show_bug.cgi?id=1713963)
Resolves: rhbz#1764520
(
https://bugzilla.redhat.com/show_bug.cgi?id=1764520)
Resolves: rhbz#1768016
(
https://bugzilla.redhat.com/show_bug.cgi?id=1768016)
[abrt] ibus-typing-booster: makedirs(): os.py:221:makedirs:FileExistsError:
[Errno 17] Fil
e exists: '/home/uncle/.local/share/ibus-typing-booster/data'
diff --git a/engine/itb_util.py b/engine/itb_util.py
index 0494a08..c53fc9b 100644
--- a/engine/itb_util.py
+++ b/engine/itb_util.py
@@ -3500,17 +3500,23 @@ def xdg_save_data_path(*resource):
Compatibility function for systems which do not have pyxdg.
(For example openSUSE Leap 42.1)
'''
- if IMPORT_XDG_BASEDIRECTORY_SUCCESSFUL:
- return xdg.BaseDirectory.save_data_path(*resource)
+ # if IMPORT_XDG_BASEDIRECTORY_SUCCESSFUL:
+ # return xdg.BaseDirectory.save_data_path(*resource)
+ #
+ # xdg.BaseDirectory.save_data_path(*resource) unfortunately
+ # can fail because it calls os.makedirs() without the exist_ok=True
+ # option, and then os.makedirs() can fail in a race condition
+ # (see:
https://bugs.python.org/issue1675)
+ #
# Replicate implementation of xdg.BaseDirectory.save_data_path
- # here:
+ # here (and add the exist_ok=True parameter to os.makedirs()):
xdg_data_home = os.environ.get('XDG_DATA_HOME') or os.path.join(
os.path.expanduser('~'), '.local', 'share')
resource = os.path.join(*resource)
assert not resource.startswith('/')
path = os.path.join(xdg_data_home, resource)
if not os.path.isdir(path):
- os.makedirs(path)
+ os.makedirs(path, exist_ok=True)
return path
class KeyvalsToKeycodes:
lines 1-45/45 (END)
--
You are receiving this mail because:
You are on the CC list for the bug.