한국어 시스템에서 appstream 프리징 현상.

Yi Soo An@Google의 이미지

해당 이슈에 대한 OS 환경, 디버깅 정보는 이미 공식 레포에 이슈화 해놓은게 있어서 링크로 대체를 하겠습니다.
https://github.com/elementary/appcenter/issues/588

appcenter라는 어플리케이션이 초기에 개발되고 eOS에 탑재된 시점부터 버그가 있어왔다고 합니다.
링크 내용대로 디버깅을 해보니 as_pool_search 이후로 프리징이 생기고 있는데
해당 문제는 '오직' 한국어로 시스템 언어 설정을 하면 생기고 기타 언어에서는 전혀 생기지 않습니다.

appcenter뿐만 아니라 appstreamcli (0.11.3) 버전에서도 동일한 증상이 있었으나 0.11.8 컴파일후 테스트에서는 전혀 생기지 않았구요.
한국어 관련된 문제같은데 제 선에선 도저히 실마리를 못 찾겠네요..

* 분류가 여기가 맞는진 모르겠네요.

bushi의 이미지

버그 같은데요.
어딘가에 있는 근본적인 버그가 잠재적이었던 버그를 현실화시킨 건지,
아니면 단순히 번역 실수가 잠재적이었던 버그를 현실화 시킨 것인지는 애매합니다.

as_str_replace("calligra", "", "") 처럼 호출되었고, for 문에서 무한루프 돌고 있습니다.

gdb) set args search Calligra
(gdb) run
Starting program: /usr/bin/appstreamcli search Calligra
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffed40d700 (LWP 3306)]
[New Thread 0x7fffecc0c700 (LWP 3307)]
^C
Thread 1 "appstreamcli" received signal SIGINT, Interrupt.
0x00007ffff6fa004b in as_str_replace (str=str@entry=0x555557364bb0 "calligra", 
    old=0x555555772940 "", new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:454
454		for (r = ret, p = str; (q = strstr(p, old)) != NULL; p = q + oldlen) {
Missing separate debuginfos, use: dnf debuginfo-install gvfs-client-1.30.4-1.fc25.x86_64 pcre-8.40-7.fc25.x86_64
(gdb) l 454
449			retlen = strlen(str);
450	
451		if ((ret = malloc(retlen + 1)) == NULL)
452			return NULL;
453	
454		for (r = ret, p = str; (q = strstr(p, old)) != NULL; p = q + oldlen) {
455			/* this is undefined if q - p > PTRDIFF_MAX */
456			ptrdiff_t l = q - p;
457			memcpy(r, p, l);
458			r += l;
(gdb) p r
$1 = (gchar *) 0x55555742cef0 "0\370\024WUU"
(gdb) p ret
$2 = (gchar *) 0x55555742cef0 "0\370\024WUU"
(gdb) p p
$3 = (const gchar *) 0x555557364bb0 "calligra"
(gdb) p q
$4 = <optimized out>
(gdb) p old
$5 = (const gchar *) 0x555555772940 ""
(gdb) p p
$6 = (const gchar *) 0x555557364bb0 "calligra"
(gdb) p oldlen
$7 = 0
(gdb) n
456			ptrdiff_t l = q - p;
(gdb) p q
$8 = (const gchar *) 0x555557364bb0 "calligra"
(gdb) p l
$9 = 0
(gdb) p p
$10 = (const gchar *) 0x555557364bb0 "calligra"
(gdb) p new
$11 = (const gchar *) 0x7ffff6fbf897 ""

bushi의 이미지

처음부터 따라가보면,

(gdb) b as_str_replace
Function "as_str_replace" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (as_str_replace) pending.
(gdb) set args search Calligra
(gdb) run
Starting program: /usr/bin/appstreamcli search Calligra
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffed40d700 (LWP 15836)]
[New Thread 0x7fffecc0c700 (LWP 15837)]
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x55555742cf70 "calligra", old=0x555555771bf0 "app", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
Missing separate debuginfos, use: dnf debuginfo-install gvfs-client-1.30.4-1.fc25.x86_64 pcre-8.40-7.fc25.x86_64
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x555557365420 "calligra", old=0x555555771c30 "앱", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x55555742cf70 "calligra", old=0x555555771e00 "application", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x555557365420 "calligra", 
    old=0x555555772800 "애플리케이션", new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x55555742cf70 "calligra", old=0x555555772820 "package", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x555557365420 "calligra", old=0x555555772840 "꾸러미", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x55555742cf70 "calligra", old=0x555555772860 "program", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x555557365420 "calligra", old=0x555555772880 "프로그램", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x55555742cf70 "calligra", old=0x5555557728a0 "programme", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x555557365420 "calligra", old=0x5555557728c0 "suite", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x55555742cf70 "calligra", old=0x5555557728e0 "모음", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x555557365420 "calligra", old=0x555555772900 "tool", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x55555742cf70 "calligra", old=0x555555772920 "도구", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x555557365420 "calligra", old=0x555555772940 "", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
^C
bushi의 이미지

비교를 위해 ja_KP.utf-8 로 해보면,

(gdb) run
Starting program: /usr/bin/appstreamcli search Calligra
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffed40d700 (LWP 19982)]
[New Thread 0x7fffecc0c700 (LWP 19983)]
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x55555ab6ce80 "calligra", old=0x555555770550 "app", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
Missing separate debuginfos, use: dnf debuginfo-install gvfs-client-1.30.4-1.fc25.x86_64 pcre-8.40-7.fc25.x86_64
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x5555557f8470 "calligra", old=0x555555770590 "application", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x55555ab6ce80 "calligra", old=0x5555557706a0 "package", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x5555557f8470 "calligra", old=0x5555557706c0 "program", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x55555ab6ce80 "calligra", old=0x5555557706e0 "programme", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x5555557f8470 "calligra", old=0x555555770700 "suite", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
 
Thread 1 "appstreamcli" hit Breakpoint 1, as_str_replace (
    str=str@entry=0x55555ab6ce80 "calligra", old=0x555555770720 "tool", 
    new=new@entry=0x7ffff6fbf897 "")
    at /usr/src/debug/AppStream-0.10.6/src/as-utils.c:437
437	{
(gdb) c
Continuing.
Identifier: stage.desktop [desktop-application]
名前: Stage
要約: Presentation
パッケージ: calligra-stage
ホームページ: <a href="http://www.calligra.org/stage/
アイコン:" rel="nofollow">http://www.calligra.org/stage/
アイコン:</a> stage.png
...
...
bushi의 이미지

> 어딘가에 있는 근본적인 버그가 잠재적이었던 버그를 현실화시킨 건지,
> 아니면 단순히 번역 실수가 잠재적이었던 버그를 현실화 시킨 것인지는 애매합니다.
>

한국어 번역 실수인 곳은 다음과 같습니다. (0.10.6 버전 기준으로)

[schoi0@SEL-SCHOI0-D2 vxworks-7]$ msgunfmt /usr/share/locale/ko/LC_MESSAGES/appstream.mo | tail -5
 
msgid "app;application;package;program;programme;suite;tool"
msgstr ""
"app;앱;application;애플리케이션;package;꾸러미;program;프로그램;programme;"
"suite;모음;tool;도구;"

맨 끝의 ';' 가 불필요하게 붙어있습니다. "...;도구;" 가 아니라 "...;도구" 여야 맞죠. 원문을 지키려면.
저 변역된 문장이 appstream 파서에 전달되는 바람에 맨 끝의 ';' 가 "" 단어를 만들어버렸고,
이 "" 라는 단어가 as_str_replace() 에 전달된 거.
Yi Soo An@Google의 이미지

감사합니다. 방금 다시 테스트하였고 올바르게 동작됨을 확인하였습니다.
bushi님 덕분에 실마리를 찾을 수 있게되어 매우 기쁘네요 ㅎ
해당 문제에 대한 workaround 및 버그는 곧 PR 하도록 하겠습니다.
다시 한번 감사드립니다.

---------------
Happy Hacking!

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.