input buffer overflow, can't enlarge buffer because scanner uses REJECT

gtags -v したら、下記エラーメッセージを出力して処理が止まってしまいました。

(snip)
[31363] extracting tags of path/to/file/xxx.php
[31364] extracting tags of path/to/file/yyy.php
input buffer overflow, can't enlarge buffer because scanner uses REJECT

エラーメッセージでググってみると、下記サイトがヒット。
http://www.stack.nl/~dimitri/doxygen/faq.html

一度に256K 以上の入力文字にマッチする 場合に起こるとか。ファイルがでかすぎる、と。
解決策として、「ファイル分割」か「ファイル自体を無視」の二択が紹介されているので、今回は後者で対処。

gtags.conf を修正します。
自分の debian 環境では、/usr/share/gtags/gtags.conf にありました。
念のため、home ディレクトリにコピって作業。

cp /usr/share/gtags/gtags.conf ~/conf/
emacs ~/conf/gtags.conf

デフォルトではこんなカンジ。

default:\
        :tc=gtags:tc=htags:
#---------------------------------------------------------------------
# Configuration for gtags(1)
# See gtags(1).
#---------------------------------------------------------------------
common:\
        :skip=GPATH,GTAGS,GRTAGS,GSYMS,HTML/,HTML.pub/,html/,tags,TAGS,ID,y.tab.c,y.tab.h,cscope.out,cscope.po.out,cscope.in.out,SCCS/,RCS/,CVS/,CVSROOT/,{arch}/,autom4te.cache/:

この :skip に、問題となったファイルを追記。今回はフォルダごとまるっと追記。

default:\
        :tc=gtags:tc=htags:
#---------------------------------------------------------------------
# Configuration for gtags(1)
# See gtags(1).
#---------------------------------------------------------------------
common:\
        :skip=GPATH,GTAGS,GRTAGS,GSYMS,HTML/,HTML.pub/,html/,tags,TAGS,ID,y.tab.c,y.tab.h,cscope.out,cscope.po.out,cscope.in.out,SCCS/,RCS/,CVS/,CVSROOT/,{arch}/,autom4te.cache/, path/to/file/

この gtags.conf を使用して、再度 gtags -v 実施。

gtags -v --gtagsconf ~/conf/gtags.conf

これで、先ほど止まった箇所(path/to/file/)を華麗にパスして処理継続してくれるはず。
その先で詰まったら、また同様に無視する対象を gtags.conf に追記。



ちなみに、、、今回問題となったと思われるファイル。

$ wc -l path/to/file/yyy.php 
65598 path/to/file/yyy.php 

うん。でかいな。