Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1764520

Summary: [abrt] ibus-typing-booster: makedirs(): os.py:221:makedirs:FileExistsError: [Errno 17] File exists: '/home/liting/.local/share/ibus-typing-booster/data'
Product: [Fedora] Fedora Reporter: 1419004855
Component: ibus-typing-boosterAssignee: Mike FABIAN <mfabian>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 30CC: anish.developer, i18n-bugs, mfabian
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/b9a2a100b17f3b7f1803270935b2fa7a64b2d80f
Whiteboard: abrt_hash:b46ec76f84c8b3b39dc8714416fdf9384c0a26db;VARIANT_ID=workstation;
Fixed In Version: ibus-typing-booster-2.7.3-1.fc30 ibus-typing-booster-2.7.3-1.fc31 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-12 08:56:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: cgroup
none
File: cpuinfo
none
File: environ
none
File: mountinfo
none
File: namespaces
none
File: open_fds none

Description 1419004855 2019-10-23 08:50:53 UTC
Description of problem:
I deleted my /home/user/.config directory and I could not use my Chinese input source after that

Version-Release number of selected component:
ibus-typing-booster-2.6.0-1.fc30

Additional info:
reporter:       libreport-2.10.0
cmdline:        /usr/bin/python3 /usr/share/ibus-typing-booster/engine/main.py --xml
crash_function: makedirs
exception_type: FileExistsError
executable:     /usr/share/ibus-typing-booster/engine/main.py
interpreter:    python3-3.7.3-1.fc30.x86_64
kernel:         5.0.9-301.fc30.x86_64
runlevel:       N 5
type:           Python3
uid:            1000

Truncated backtrace:
os.py:221:makedirs:FileExistsError: [Errno 17] File exists: '/home/liting/.local/share/ibus-typing-booster/data'

Traceback (most recent call last):
  File "/usr/share/ibus-typing-booster/engine/main.py", line 33, in <module>
    import factory
  File "/usr/share/ibus-typing-booster/engine/factory.py", line 32, in <module>
    import hunspell_table
  File "/usr/share/ibus-typing-booster/engine/hunspell_table.py", line 45, in <module>
    import itb_emoji
  File "/usr/share/ibus-typing-booster/engine/itb_emoji.py", line 73, in <module>
    USER_DATADIR = itb_util.xdg_save_data_path('ibus-typing-booster/data')
  File "/usr/share/ibus-typing-booster/engine/itb_util.py", line 3188, in xdg_save_data_path
    return xdg.BaseDirectory.save_data_path(*resource)
  File "/usr/lib/python3.7/site-packages/xdg/BaseDirectory.py", line 70, in save_data_path
    os.makedirs(path)
  File "/usr/lib64/python3.7/os.py", line 221, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/home/liting/.local/share/ibus-typing-booster/data'

Local variables in innermost frame:
name: '/home/liting/.local/share/ibus-typing-booster/data'
mode: 511
exist_ok: False
head: '/home/liting/.local/share/ibus-typing-booster'
tail: 'data'
cdir: '.'

Comment 1 1419004855 2019-10-23 08:50:56 UTC
Created attachment 1628200 [details]
File: backtrace

Comment 2 1419004855 2019-10-23 08:50:57 UTC
Created attachment 1628201 [details]
File: cgroup

Comment 3 1419004855 2019-10-23 08:50:59 UTC
Created attachment 1628202 [details]
File: cpuinfo

Comment 4 1419004855 2019-10-23 08:51:01 UTC
Created attachment 1628203 [details]
File: environ

Comment 5 1419004855 2019-10-23 08:51:03 UTC
Created attachment 1628204 [details]
File: mountinfo

Comment 6 1419004855 2019-10-23 08:51:04 UTC
Created attachment 1628205 [details]
File: namespaces

Comment 7 1419004855 2019-10-23 08:51:06 UTC
Created attachment 1628206 [details]
File: open_fds

Comment 8 Mike FABIAN 2019-10-24 10:43:34 UTC
> File exists: '/home/liting/.local/share/ibus-typing-booster/data'

indicates that /home/liting/.local/share/ibus-typing-booster/data exists  *and* is a *File*, 
not a *directory*. It should either not exist or be a directory. 

I can reproduce this problem only if I create a file /home/liting/.local/share/ibus-typing-booster/data
manually. But I have no idea how that is possible without creating this file manually.
I wonder how that file can be created.

Can you please check whether the file has any contents and if yes what contents?
Maybe the contents would give a hint who created that file ...

Comment 9 1419004855 2019-10-24 11:19:31 UTC
[liting@localhost ibus-typing-booster]$ ls -l
total 0
drwxrwxr-x. 2 liting liting 6 Oct 23 16:41 data
It is an empty directory, and I am quite sure I did not create this directory manually.

Comment 10 Mike FABIAN 2019-10-24 13:07:31 UTC
Yes, this directory is created by ibus-typing-booster when it first runs. That is OK. As long as it is a directory, empty or not, it should not cause a problem.

Can you try this and see whether it behaves  differently on your system?:

    [mfabian@localhost ~]$ python3
    Python 3.7.4 (default, Aug 12 2019, 14:45:07) 
    [GCC 9.1.1 20190605 (Red Hat 9.1.1-2)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import xdg.BaseDirectory
    >>> xdg.BaseDirectory.save_data_path('ibus-typing-booster/data')
    '/home/mfabian/.local/share/ibus-typing-booster/data'
    >>> 

So this worked. Now I remove the empty directory:

    [mfabian@localhost ~]$ rmdir /home/mfabian/.local/share/ibus-typing-booster/data
    [mfabian@localhost ~]$ python3
    Python 3.7.4 (default, Aug 12 2019, 14:45:07) 
    [GCC 9.1.1 20190605 (Red Hat 9.1.1-2)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import xdg.BaseDirectory
    >>> xdg.BaseDirectory.save_data_path('ibus-typing-booster/data')
    '/home/mfabian/.local/share/ibus-typing-booster/data'
    >>> 

Still works. I remove the empty directory again:

    [mfabian@localhost ~]$ rmdir /home/mfabian/.local/share/ibus-typing-booster/data

And create a file in its place:

    [mfabian@localhost ~]$ touch /home/mfabian/.local/share/ibus-typing-booster/data

And try again:

    [mfabian@localhost ~]$ python3
    Python 3.7.4 (default, Aug 12 2019, 14:45:07) 
    [GCC 9.1.1 20190605 (Red Hat 9.1.1-2)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import xdg.BaseDirectory
    >>> xdg.BaseDirectory.save_data_path('ibus-typing-booster/data')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.7/site-packages/xdg/BaseDirectory.py", line 70, in save_data_path
        os.makedirs(path)
      File "/usr/lib64/python3.7/os.py", line 221, in makedirs
        mkdir(name, mode)
    FileExistsError: [Errno 17] File exists: '/home/mfabian/.local/share/ibus-typing-booster/data'
    >>> 

Now it fails with exactly the error message you are getting.

What happens on your system when you do the above simple tests in python3?

Comment 11 1419004855 2019-10-25 15:46:46 UTC
(base) [liting@localhost data]$ python3
Python 3.7.4 (default, Aug 13 2019, 20:35:49) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xdg.BaseDirectory
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'xdg

**************
After I install xdg:
>>> import xdg.BaseDirectory
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'xdg.BaseDirectory'

Comment 12 Mike FABIAN 2019-10-25 17:41:01 UTC
(In reply to 1419004855 from comment #11)
> (base) [liting@localhost data]$ python3
> Python 3.7.4 (default, Aug 13 2019, 20:35:49) 
> [GCC 7.3.0] :: Anaconda, Inc. on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import xdg.BaseDirectory
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ModuleNotFoundError: No module named 'xdg
> 
> **************
> After I install xdg:
> >>> import xdg.BaseDirectory
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ModuleNotFoundError: No module named 'xdg.BaseDirectory'

That is really wierd because the backtrace in your first comment contains:

>   File "/usr/lib/python3.7/site-packages/xdg/BaseDirectory.py", line 70, in save_data_path

Comment 13 Mike FABIAN 2019-10-25 17:42:21 UTC
Do you have this installed?:

$ rpm -qf /usr/lib/python3.7/site-packages/xdg/BaseDirectory.py
python3-pyxdg-0.26-5.fc31.noarch

Comment 14 1419004855 2019-10-26 01:53:44 UTC
I deactivate my Anaconda environment and everything looks exactly the same as that happenend in your machine.

[liting@localhost data]$ conda deactivate
[liting@localhost data]$ python3
Python 3.7.4 (default, Jul  9 2019, 16:32:37) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xdg.BaseDirectory
>>> xdg.BaseDirectory.save_data_path('ibus-typing-booster/data')
'/home/liting/.local/share/ibus-typing-booster/data'



[liting@localhost data]$ rmdir /home/liting/.local/share/ibus-typing-booster/data
[liting@localhost data]$ touch /home/liting/.local/share/ibus-typing-booster/data
[liting@localhost data]$ python3
Python 3.7.4 (default, Jul  9 2019, 16:32:37) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xdg.BaseDirectory
>>> xdg.BaseDirectory.save_data_path('ibus-typing-booster/data')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/xdg/BaseDirectory.py", line 70, in save_data_path
    os.makedirs(path)
  File "/usr/lib64/python3.7/os.py", line 221, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/home/liting/.local/share/ibus-typing-booster/data'

Comment 15 Mike FABIAN 2019-10-28 09:48:10 UTC
So now the problem occurs for you only when /home/liting/.local/share/ibus-typing-booster/data is a file, not a directory.

What is this anaconda environment? Does this cause the problem?

Comment 16 1419004855 2019-11-05 02:39:06 UTC
The python3-pyxdg-0.26-5.fc31.noarch is not installed in the Anaconda environment. 
It seems that the problem did not occur again and thank you for your help.

Comment 17 Mike FABIAN 2019-11-12 08:56:24 UTC

*** This bug has been marked as a duplicate of bug 1770072 ***

Comment 18 Mike FABIAN 2019-11-12 08:57:28 UTC
(In reply to 1419004855 from comment #16)
> The python3-pyxdg-0.26-5.fc31.noarch is not installed in the Anaconda
> environment. 
> It seems that the problem did not occur again and thank you for your help.

I think I finally understood the problem now, see 
https://bugzilla.redhat.com/show_bug.cgi?id=1770072

Comment 19 Fedora Update System 2019-11-25 10:07:35 UTC
FEDORA-2019-6398f828eb has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-6398f828eb

Comment 20 Fedora Update System 2019-11-25 10:08:03 UTC
FEDORA-2019-8eb6c00da1 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-8eb6c00da1

Comment 21 Fedora Update System 2019-11-25 10:08:43 UTC
FEDORA-2019-41b9e70195 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-41b9e70195

Comment 22 Fedora Update System 2019-11-26 16:32:28 UTC
ibus-typing-booster-2.7.3-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-6398f828eb

Comment 23 Fedora Update System 2019-11-27 00:31:47 UTC
ibus-typing-booster-2.7.3-1.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-41b9e70195

Comment 24 Fedora Update System 2019-11-27 01:07:21 UTC
ibus-typing-booster-2.7.3-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-8eb6c00da1

Comment 25 Fedora Update System 2019-12-05 01:10:37 UTC
ibus-typing-booster-2.7.3-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 26 Fedora Update System 2019-12-05 01:39:41 UTC
ibus-typing-booster-2.7.3-1.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.