{"id":887,"date":"2024-12-12T16:50:31","date_gmt":"2024-12-12T08:50:31","guid":{"rendered":"https:\/\/www.orztip.com\/?p=887&#038;article_title="},"modified":"2024-12-12T16:50:31","modified_gmt":"2024-12-12T08:50:31","slug":"ibus-libpinyin-unresponsive","status":"publish","type":"post","link":"https:\/\/www.orztip.com\/?p=887&article_title=ibus-libpinyin-unresponsive","title":{"rendered":"\u5982\u4f55\u89e3\u51b3Debian\/Ubuntu\u4e0bibus-libpinyin\u65f6\u4e0d\u65f6\u5361\u6b7b\u65e0\u54cd\u5e94\u95ee\u9898"},"content":{"rendered":"\n<p><strong>\u6545\u969c\u8868\u73b0<\/strong><\/p>\n\n\n\n<p>\u5728Debian 12\u548cUbuntu 22.04\u53ca\u4ee5\u4e0a\u7248\u672c\u4e2d\uff0c\u5982\u679c\u4f7f\u7528ibus-libpinyin\uff0c\u4f1a\u6709\u6982\u7387\u6027\u51fa\u73b0\u8f93\u5165\u5361\u6b7b\u65e0\u54cd\u5e94\uff0c\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\u624d\u4f1a\u6709\u6587\u5b57\u8f93\u51fa\u3002<\/p>\n\n\n\n<p>ibus-libpinyin\u4e0a\u9762\u4e5f\u6709\u4eba\u63d0\u4e86\u8fd9\u4e2aissue\uff1a<a href=\"https:\/\/github.com\/libpinyin\/ibus-libpinyin\/issues\/429\">https:\/\/github.com\/libpinyin\/ibus-libpinyin\/issues\/429<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p><strong>\u7528\u5982\u4e0b\u547d\u4ee4\uff0c\u5220\u9664\u5f53\u524d\u767b\u5f55\u7528\u6237\u4e0bibus-libpinyin\u4ea7\u751f\u7684\u6240\u6709.tmp\u7f13\u5b58\u6587\u4ef6\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm -rf ~\/.cache\/ibus\/libpinyin\/*.tmp<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u6709\u5174\u8da3\u77e5\u9053\u95ee\u9898\u6839\u6e90\u7684\u8bdd\uff0c\u53ef\u4ee5\u7ee7\u7eed\u9605\u8bfb\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u6392\u67e5\u8fc7\u7a0b<\/strong><\/p>\n\n\n\n<p>\u4ecestrace ibus-engine-libpinyin\u8fdb\u7a0b\u53d1\u73b0\uff0c\u4f3c\u4e4e\u662f\u4e00\u4e9b__db.*.tmp\u6587\u4ef6\u5bfc\u81f4\u7684\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>unlink(\"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\") = -1 ENOENT (No such file or directory)\nunlink(\"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\") = -1 ENOENT (No such file or directory)\ngetpid()                                = 29864\nopenat(AT_FDCWD, \"\/sys\/devices\/system\/cpu\/online\", O_RDONLY|O_CLOEXEC) = 18\nread(18, \"0-15\\n\", 1024)                = 5\nclose(18)                               = 0\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\nnewfstatat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/user_pinyin_index.bin.tmp\", 0xxxxxxxxxxxxx, 0) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, \"\/home\/devreporter\/.cache\/ibus\/libpinyin\/__db.user_pinyin_index.bin.tmp\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)\npselect6(0, NULL, NULL, NULL, {tv_sec=1, tv_nsec=1000}, NULL) = 0 (Timeout)\n\/\/......\uff08\uff09\nwrite(2, \"BDB0002 __fop_file_setup:  Retry\"..., 53) = 53\nwrite(2, \"\\n\", 1)                       = 1<\/code><\/pre>\n\n\n\n<p>\u627e\u5230gnu\u51fa\u5904\uff0c\u662f\u8fd9\u4e48\u8bf4\u7684\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>If both O_CREAT and O_EXCL are set, then open fails if the specified file already exists. This is guaranteed to never clobber an existing file.<\/p>\n<\/blockquote>\n\n\n\n<p>\u518d\u7ec6\u770b~\/.cache\/ibus\/libpinyin\u76ee\u5f55\uff0c\u8fd9\u91cc\u9762\u7684\u6587\u4ef6\u8c8c\u4f3c\u662fBerkeley DB\uff0c\u90a3\u4e48\u8fd9\u4e9b__db*.tmp\u6587\u4ef6\u600e\u6837\u6765\u7684\u5462\uff1f<\/p>\n\n\n\n<p>\u9605\u8bfblibpinyin\u5e93\u6e90\u4ee3\u7801\u540e\uff0c\u53d1\u73b0\u201c.tmp\u201d\u540e\u7f00\u662f\u8fd9\u4e48\u6765\u7684\uff0c\u5148\u770bpinyin.cpp\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>struct _pinyin_context_t{\n    \/\/\u5ffd\u7565\n    \/* default tables. *\/\n    FacadeChewingTable2 * m_pinyin_table;\n    \/\/\u5ffd\u7565\n};\n\nbool pinyin_save(pinyin_context_t * context){\n    \/\/\u5ffd\u7565\n    bool retval = _write_files(context) &amp;&amp; _rename_files(context);\n    \/\/\u5ffd\u7565\n}\n\nstatic bool _write_files(pinyin_context_t * context){\n    \/\/\u5ffd\u7565\n    \/* save user pinyin table *\/\n    gchar * tmpfilename = g_build_filename\n        (context->m_user_dir, USER_PINYIN_INDEX \".tmp\", NULL);\n    unlink(tmpfilename);\n\n    context->m_pinyin_table->store(tmpfilename);\n\n    g_free(tmpfilename);\n\n    \/\/\u5ffd\u7565\n\n}\n\n<\/code><\/pre>\n\n\n\n<p>\u201ccontext->m_pinyin_table->store(tmpfilename)\u201d\u8c03\u7528\u7684\u662fFacadeChewingTable2::store\u65b9\u6cd5\uff0c\u5728\u6587\u4ef6storage\/facade_chewing_table2.h\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class FacadeChewingTable2{\nprivate:\n    \/\/\u5ffd\u7565\n    ChewingLargeTable2 * m_user_chewing_table;\n    \/\/\u5ffd\u7565\n    bool store(const char * new_user_filename) {\n        if (NULL == m_user_chewing_table)\n            return false;\n        return m_user_chewing_table->store_db(new_user_filename);\n    }\n    \/\/\u5ffd\u7565\n}\n<\/code><\/pre>\n\n\n\n<p>\u5c5e\u6027m_user_chewing_table\u7684ChewingLargeTable2\u662f\u5728storage\/chewing_large_table2.h\u4e2d\u5b9a\u4e49\u7684\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#ifdef HAVE_BERKELEY_DB\n#include \"chewing_large_table2_bdb.h\"\n#endif\n\n#ifdef HAVE_KYOTO_CABINET\n#include \"chewing_large_table2_kyotodb.h\"\n#endif<\/code><\/pre>\n\n\n\n<p>\u56e0\u4e3a\u786e\u5b9a\u662fBerkeley DB\uff0c\u90a3\u4e48\u76f4\u63a5\u770bstorage\/chewing_large_table2_bdb.cpp\u4e2d\u7684store_db\u65b9\u6cd5\u5373\u53ef\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bool ChewingLargeTable2::store_db(const char * new_filename) {\n    DB * tmp_db = NULL;\n\n    int ret = unlink(new_filename);\n    if (ret != 0 &amp;&amp; errno != ENOENT)\n        return false;\n\n    ret = db_create(&amp;tmp_db, NULL, 0);\n    assert(0 == ret);\n\n    if (NULL == tmp_db)\n        return false;\n\n    ret = tmp_db->open(tmp_db, NULL, new_filename, NULL,\n                       DB_BTREE, DB_CREATE, 0600);\n    if (ret != 0)\n        return false;\n\n    if (!copy_bdb(m_db, tmp_db))\n        return false;\n\n    if (tmp_db != NULL) {\n        tmp_db->sync(m_db, 0);\n        tmp_db->close(tmp_db, 0);\n    }\n\n    return true;\n}\n<\/code><\/pre>\n\n\n\n<p>\u4ecestrace\u60c5\u51b5\u6765\u770b\uff0c\u5e94\u8be5\u662f\u201ctmp_db->open\u201d\u51fa\u6545\u969c\u4e86\uff0c\u90a3\u201c__db.\u201d\u53c8\u662f\u54ea\u91cc\u6765\u7684\u5462\uff1fOracle\u8bba\u575b\u91cc\u9762\u6709\u4eba\u95ee\u7c7b\u4f3c\u95ee\u9898\u30102\u3011\uff0c\u6709\u4eba\u7ed9\u4e86\u4e2a\u7b54\u6848\uff1a\u201cShared memory regions\u201d\u30103\u3011\uff0c\u4f46\u6587\u6863\u91cc\u9762\u8bf4\u7684\u662fDB_ENV\uff0c\u611f\u89c9\u548c\u8fd9\u4e2a\u95ee\u9898\u65e0\u5173\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Shared memory regions\uff1a&#8230;&#8230; Any files created in the filesystem to back the regions are created in the environment home directory specified to the\u00a0<a href=\"https:\/\/docs.oracle.com\/cd\/E17275_01\/html\/api_reference\/C\/envopen.html\">DB_ENV->open()<\/a>\u00a0call. These files are named __db.### (for example, __db.001, __db.002 and so on).\u00a0<\/p>\n<\/blockquote>\n\n\n\n<p>\u4f46\u65e0\u8bba\u5982\u4f55\uff0c<strong>\u95ee\u9898\u786e\u5b9a\u4e86\uff0c\u7528\u6237\u7f13\u5b58\u76ee\u5f55\u201c\u3010\u7528\u6237home\u76ee\u5f55\uff0c\u6bd4\u5982\/home\/xxxxx\u3011\/.cache\/ibus\/libpinyin\u201d\u4e0b\u9762\u610f\u5916\u5b58\u5728\u4e86\u5404\u79cd.tmp\u6587\u4ef6\uff0c\u7136\u540e\u963b\u585e\u4e86\u540e\u7eed\u8bfb\u5199\u6d41\u7a0b\u3002<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u53c2\u8003\u6587\u6863<\/strong><\/p>\n\n\n\n<p>\u30101\u3011<a href=\"https:\/\/www.gnu.org\/software\/libc\/manual\/html_node\/Open_002dtime-Flags.html\">https:\/\/www.gnu.org\/software\/libc\/manual\/html_node\/Open_002dtime-Flags.html<\/a><\/p>\n\n\n\n<p>\u30102\u3011<a href=\"https:\/\/forums.oracle.com\/ords\/apexds\/post\/what-is-db-file-7859\">https:\/\/forums.oracle.com\/ords\/apexds\/post\/what-is-db-file-7859<\/a><\/p>\n\n\n\n<p>\u30103\u3011<a href=\"https:\/\/docs.oracle.com\/cd\/E17275_01\/html\/programmer_reference\/env_region.html\">https:\/\/docs.oracle.com\/cd\/E17275_01\/html\/programmer_reference\/env_region.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u89e3\u51b3\u65b9\u6cd5\uff1a\u5220\u9664\u5f53\u524d\u767b\u5f55\u7528\u6237\u4e0bibus-libpinyin\u4ea7\u751f\u7684\u6240\u6709.tmp\u7f13\u5b58\u6587\u4ef6<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,25,6],"tags":[163,14,162],"_links":{"self":[{"href":"https:\/\/www.orztip.com\/index.php?rest_route=\/wp\/v2\/posts\/887"}],"collection":[{"href":"https:\/\/www.orztip.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.orztip.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.orztip.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.orztip.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=887"}],"version-history":[{"count":11,"href":"https:\/\/www.orztip.com\/index.php?rest_route=\/wp\/v2\/posts\/887\/revisions"}],"predecessor-version":[{"id":898,"href":"https:\/\/www.orztip.com\/index.php?rest_route=\/wp\/v2\/posts\/887\/revisions\/898"}],"wp:attachment":[{"href":"https:\/\/www.orztip.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.orztip.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.orztip.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}