Bug 1713963

Summary: [abrt] ibus-typing-booster: makedirs(): os.py:221:makedirs:FileExistsError: [Errno 17] File exists: '/home/uncle/.local/share/ibus-typing-booster/data'
Product: [Fedora] Fedora Reporter: Satyendra Singh <satyendrax>
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:a57581355f40a89196828c901bccde0c5db8a7c4;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:08 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 Satyendra Singh 2019-05-26 07:02:04 UTC
Version-Release number of selected component:
ibus-typing-booster-2.6.1-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-3.fc30.x86_64
kernel:         5.0.17-300.fc30.x86_64
runlevel:       N 5
type:           Python3
uid:            1000

Truncated backtrace:
os.py:221:makedirs:FileExistsError: [Errno 17] File exists: '/home/uncle/.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/uncle/.local/share/ibus-typing-booster/data'

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

Comment 1 Satyendra Singh 2019-05-26 07:02:09 UTC
Created attachment 1573535 [details]
File: backtrace

Comment 2 Satyendra Singh 2019-05-26 07:02:11 UTC
Created attachment 1573536 [details]
File: cgroup

Comment 3 Satyendra Singh 2019-05-26 07:02:12 UTC
Created attachment 1573537 [details]
File: cpuinfo

Comment 4 Satyendra Singh 2019-05-26 07:02:15 UTC
Created attachment 1573538 [details]
File: environ

Comment 5 Satyendra Singh 2019-05-26 07:02:17 UTC
Created attachment 1573539 [details]
File: mountinfo

Comment 6 Satyendra Singh 2019-05-26 07:02:19 UTC
Created attachment 1573540 [details]
File: namespaces

Comment 7 Satyendra Singh 2019-05-26 07:02:21 UTC
Created attachment 1573541 [details]
File: open_fds

Comment 8 Mike FABIAN 2019-07-08 09:59:44 UTC
I can reproduce this problem only when ~/.local/share/ibus-typing-booster/data exists and is a file, not a directory.

Here ~/.local/share/ibus-typing-booster/data is a directory:

    mfabian@taka:~
    $ ls -l ~/.local/share/ibus-typing-booster/data
    total 0
    mfabian@taka:~
    $ ls -ld ~/.local/share/ibus-typing-booster/data
    drwxr-xr-x. 2 mfabian mfabian 4096 Jul  8 11:39 /home/mfabian/.local/share/ibus-typing-booster/data/
    mfabian@taka:~

Now start the command line from this bug report:

    mfabian@taka:~
    $ /usr/bin/python3 /usr/share/ibus-typing-booster/engine/main.py --xml
    <engines>
        <engine>
            <name>typing-booster</name>
            <longname>Typing Booster</longname>
            <language>t</language>
            <license>GPL</license>
            <author>Mike FABIAN &lt;mfabian&gt;, Anish Patil &lt;anish.developer&gt;</author>
            <icon>/usr/share/ibus-typing-booster/icons/ibus-typing-booster.svg</icon>
            <layout>default</layout>
            <description>A completion input method to speedup typing.</description>
            <symbol>🚀</symbol>
            <setup>/usr/libexec/ibus-setup-typing-booster</setup>
            <icon_prop_key>InputMode</icon_prop_key>
        </engine>
    </engines>
    mfabian@taka:~

Works.

Remove the directory to test the case if nothing exists:

    $ rmdir ~/.local/share/ibus-typing-booster/data
    mfabian@taka:~
    $ /usr/bin/python3 /usr/share/ibus-typing-booster/engine/main.py --xml
    <engines>
        <engine>
            <name>typing-booster</name>
            <longname>Typing Booster</longname>
            <language>t</language>
            <license>GPL</license>
            <author>Mike FABIAN &lt;mfabian&gt;, Anish Patil &lt;anish.developer&gt;</author>
            <icon>/usr/share/ibus-typing-booster/icons/ibus-typing-booster.svg</icon>
            <layout>default</layout>
            <description>A completion input method to speedup typing.</description>
            <symbol>🚀</symbol>
            <setup>/usr/libexec/ibus-setup-typing-booster</setup>
            <icon_prop_key>InputMode</icon_prop_key>
        </engine>
    </engines>
    mfabian@taka:~
    $ ls -ld ~/.local/share/ibus-typing-booster/data
    drwxr-xr-x. 2 mfabian mfabian 4096 Jul  8 11:57 /home/mfabian/.local/share/ibus-typing-booster/data/
    mfabian@taka:~
    $ 

Works and the directory is created in the process.

Now remove the directory again and create a file instead of the directory:

    mfabian@taka:~
    $ rmdir ~/.local/share/ibus-typing-booster/data
    mfabian@taka:~
    $ touch  ~/.local/share/ibus-typing-booster/data
    mfabian@taka:~
    $ ls -l ~/.local/share/ibus-typing-booster/data
    -rw-r--r--. 1 mfabian mfabian 0 Jul  8 11:40 /home/mfabian/.local/share/ibus-typing-booster/data
    mfabian@taka:~
    $ /usr/bin/python3 /usr/share/ibus-typing-booster/engine/main.py --xml
    Traceback (most recent call last):
      File "/usr/share/ibus-typing-booster/engine/main.py", line 33, in <module>
        import factory
      File "/local/mfabian/src/ibus-typing-booster/engine/factory.py", line 32, in <module>
        import hunspell_table
      File "/local/mfabian/src/ibus-typing-booster/engine/hunspell_table.py", line 45, in <module>
        import itb_emoji
      File "/local/mfabian/src/ibus-typing-booster/engine/itb_emoji.py", line 73, in <module>
        USER_DATADIR = itb_util.xdg_save_data_path('ibus-typing-booster/data')
      File "/local/mfabian/src/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/mfabian/.local/share/ibus-typing-booster/data'
    mfabian@taka:~
    $ 

The error in this bug occurs.

So the error reported here only can occur if ~/.local/share/ibus-typing-booster/data already exists and is a file, not a directory. How could this ever happen in practice? Do I need to add extra code to handle that case???

Comment 9 Mike FABIAN 2019-11-12 08:56:08 UTC

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

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

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

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

Comment 13 Fedora Update System 2019-11-26 16:32:27 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 14 Fedora Update System 2019-11-27 00:31:46 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 15 Fedora Update System 2019-11-27 01:07:20 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 16 Fedora Update System 2019-12-05 01:10:35 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 17 Fedora Update System 2019-12-05 01:39:39 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.