|
Namazu for hns による簡易全文検索 詳しくは 詳細指定/ヘルプを参照して下さい |
|||||||||||||||||||||||||||||||||||||||||||||
2011年05月08日(日) 旧暦 [n年日記] [更新:"2011/05/09 00:28:02"]#1 [pkgsrc] readRuleFile kinput2 segmentation fault の続き
gdb で起動しても、
debug information がない
ので、細かいところまで見えない。それで kinput2 を作り直して見ているが、
で、kinput2 にも一か所変更が必要で、debug flag も付けてやっと出来て、 起動した結果が、 t-105@makoto 10:37:53/110508(..inputmethod/kinput2)% \ gdb ./work/kinput2-v3.1/cmd/kinput2 GNU gdb 6.5 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64--netbsd"... (gdb) set args -wnn (gdb) run Starting program: /export/pkgsrc/inputmethod/kinput2/work/kinput2-v3.1/cmd/kinput2 -wnn Program received signal SIGSEGV, Segmentation fault. 0x000000000042affd in newMode (rule=0x7f7ffb7192c0, files=0x7f7fffffc340, srec=0x7f7fffffcbf0, frec=0x7f7fffffcbd0, fnrec=0x7f7fffffc3a0, ac=5, av=0x7f7fffffcc10) at cconv.c:1285 1285 cdp->key = inkey; (gdb) bt #0 0x000000000042affd in newMode (rule=0x7f7ffb7192c0, files=0x7f7fffffc340, srec=0x7f7fffffcbf0, frec=0x7f7fffffcbd0, fnrec=0x7f7fffffc3a0, ac=5, av=0x7f7fffffcc10) at cconv.c:1285 #1 0x000000000042a732 in readRuleFile (rule=0x7f7ffb7192c0, file=0x7f7ffb706f10 "ccdef.kinput2") at cconv.c:1126 #2 0x000000000042d6fd in ccParseRule (deffile=0x7f7ffb706f10 "ccdef.kinput2", errprint=0x404984 <XtWarning@plt>) at cconv.c:2266 #3 0x000000000042640c in ccInitialize (obj=0x7f7ffb76f120) at CcWnn.c:811 #4 0x0000000000426343 in Initialize (req=0x7f7fffffd030, new=0x7f7ffb76f120, args=0x0, num_args=0x7f7fffffcfb4) at CcWnn.c:788 #5 0x00007f7ffd01b229 in CallInitialize () from /usr/pkg/lib/libXt.so.6 #6 0x00007f7ffd01bc8e in xtCreate () from /usr/pkg/lib/libXt.so.6 #7 0x00007f7ffd01c5dc in _XtCreateWidget () from /usr/pkg/lib/libXt.so.6 #8 0x00007f7ffd01c9ae in XtCreateWidget () from /usr/pkg/lib/libXt.so.6 #9 0x00000000004057fe in main (ac=1, av=0x7f7fffffd700) at kinput2.c:268 (gdb) quit The program is running. Exit anyway? (y or n) ykinput2-v3.1/lib/cconv.c: 1280 if ((cdp = cdalloc(&cdbuf)) == NULL) { 1281 return -1; 1282 } 1283 1284 /* ルールのストア */ 1285 cdp->key = inkey; 1286 cdp->mask = modmask; 1287 cdp->context = *context ? wstrsave(srec, wrev(context)) : 0; 683 /* データ構造 */ 684 /* 変換ルール */ 685 typedef struct convdesc { 686 ulong key; /* 入力キー */ 687 ushort mask; /* modifier mask (of X KeyEvent) */ 688 ushort context; /* context文字列 (逆順に格納される) */ 689 ushort result; /* 変換結果文字列 */ 690 ushort function; /* function ベクタのインデックス */次の部分の計算が int 型が 64 bit の時に、おかしいのではないかと思う。 1799 行の条件が一致した時に、おかしくなる。 その行の条件が一致しない場合を 10 回実行した後、11 回目に一致して、その次の行に行く。 750#define CDSIZE 10 751#define MORECDSIZE 30 1787 static ConvDesc *cdalloc(crec) 1788 _cdbufRec *crec; 1789 { 1790 ConvDesc *ret; 1791 1792 if (crec->cdbuf == NULL) { 1793 crec->cdbuf = (ConvDesc *)Malloc(CDSIZE * sizeof(ConvDesc)); 1794 if (crec->cdbuf == NULL) 1795 return NULL; 1796 crec->cdend = crec->cdbuf + CDSIZE; 1797 crec->cdp = crec->cdbuf; 1798 } 1799 if (crec->cdp >= crec->cdend) { 1800 int size = crec->cdend - crec->cdbuf + MORECDSIZE; 1801 fprintf(stderr, "%s: %s:%d %x \n",__func__, __FILE__,__LINE__, size); 1802 int offset = crec->cdp - crec->cdbuf; 1803 ConvDesc *cdp; 1804 1805 cdp = (ConvDesc *)Realloc(crec->cdbuf, size * sizeof(ConvDesc)); 1806 if (cdp == NULL) { 1807 return NULL; 1808 } 1809 crec->cdp = cdp + offset; 1810 crec->cdbuf = cdp; 1811 crec->cdend = cdp + size; 1812 fprintf(stderr, "%s: %s:%d %x %x \n",__func__, __FILE__,__LINE__, crec->cdp, cdp); 1813 } 1814 ret = crec->cdp++; 1815 fprintf(stderr, "%s: %s:%d %x %x \n",__func__, __FILE__,__LINE__, crec->cdp); 1816 return ret; 1817 }Linux の src.rpm を見に行ったら、#include "stdlib.h" を入れなさいとあって、そう したら、動くようになった(ような気がする) tgif でローマ字が入るようになったが、変換や確定が効かない。 PATH とか permission が目茶苦茶なのだけれど、 wnnenvrc を(ここを読んでいる)というところに置いて、 kihon.h などを wnn 処理から読書き出来るようにしたら、 (tgif の日本語入力時に) 確定出来るようになった。(変換はまだ出来ない。空白を入力すると、空白文字が入力される)。 ( つっこみ )
#2 [Emacs] backup file name under pkgsrc/*/*/work
最近 (?) pkgsrc に用意された
*1
機能で mkpatches というものがある。
これを使うには
pkgtools/pkgdiff で make package-install しておく。
mkpatches と入力すると work 以下を調べて hoge と hoge.orig があると、patches/patch-hoge を作ってくれる というものだ。通常 emacs で編集していると backup は ~ の文字が付く。 でも pkgsrc の work の下の時には .orig を付けてくれた方が手間が少なくなる。 それで、次のようなものを init file 例えば ~/.emacs に設定して見た。 (defun my-backup-file-name (fpath) "Return a new file path of a given file path." (let ((bpath fpath)) (if (string-match "pkgsrc" fpath) (setq bpath (concat fpath ".orig")) (setq bpath (concat fpath "~")) ) bpath ) ) (setq make-backup-file-name-function 'my-backup-file-name)簡単な確認は取れた。後は様々な場合にうまく働くかだ。 あるいはもう少し精度良く (defun my-backup-file-name (fpath) "Return a new file path of a given file path." (let ((bpath fpath)) (if (and (string-match "pkgsrc" fpath) (string-match "work" fpath)) (setq bpath (concat fpath ".orig")) (setq bpath (concat fpath "~")) ) bpath ) ) (setq make-backup-file-name-function 'my-backup-file-name)とするのが良いかも知れない。 既に .orig があった時のことは、まだ考慮していない。 elisp で、(filename がある時には) をどう表現するのかは、 (まだ)思い着かない。 M-x apropos RET exists RET して見たら、次の関数が見つかった。 file-exists-p is a built-in function in `C source code'. (file-exists-p FILENAME) Return t if file FILENAME exists (whether or not you can read it.) See also `file-readable-p' and `file-attributes'. This returns nil for a symlink to a nonexistent file. Use `file-symlink-p' to test for such links.という訳で、.orig が既にある時には ~ を付けることにする版 (defun my-backup-file-name (fpath) "Return a new file path of a given file path." (let ((bpath fpath) (opath (concat fpath ".orig")) ) (if (and (string-match "pkgsrc" fpath) (string-match "work" fpath) (not (file-exists-p opath)) ) (setq bpath opath) (setq bpath (concat fpath "~")) ) bpath ) ) (setq make-backup-file-name-function 'my-backup-file-name)のうちの、 How to set emacs so that all backups are placed into one backup folder の部分。
*1: 多分 2011/02/02 以降なら、これらの話に合うと思う。
( Read More... (2) | つっこみ )
Comments related this article
|
最近の日記 2024年03月10日 ・停電 (瞬電) 2024年03月03日 ・the second try on bare-metal ・useradd 2024年02月29日 ・opendkim and senmail 2024年01月24日 ・chat/iam 0.0.8 2024年01月21日 ・uselocale vs setlocale (textproc/R-readxl) | ||