Open wangawen opened 5 years ago
After edit source file autoload/gutentags/gtags_cscope.vim line 91 :
let l:cmd += ['--incremental', '"'.l:db_path.'"']
to let l:cmd += ['--incremental', '--skip-unreadable', '"'.l:db_path.'"']
.
This issue can be solved. But I don't know why.
And I have another questions : How to use g:gutentags_exclude_filetypes?
I want to skip the file of symbol link, and I try to use let g:gutentags_exclude_filetypes = ['l']
but it seems didn't work.
I'm not familiar with gtags but maybe some files had encoding it doesn't handle, or maybe permissions it couldn't access? Either way we should add a gutentags_gtags_extra_args
so people can add custom extra arguments.
Look for :help gutentags_exclude_filetypes
. This is for Vim file types, though, so probably not what you want. All it does is check the &filetype
of the currently opened Vim buffer and uses that to decide if it shoud do anything at all.
I encounter the same thing, here is my log gtags version is 6.6.3
gutentags: gtags-cscope job failed, returned: 1 gutentags: Tracing is enabled. "read_and_write.cpp" 18L, 222C 已写入 gutentags: Wildignore options file is up to date. gutentags: Running: ['/home/dawn/.vim/bundles/vim-gutentags/plat/unix/update_tags.sh', '-e', 'ctags', '-t', '/home/dawn/.cache/tags/home-dawn- MyGit-apue_learn-.tags', '-p', '/home/dawn/MyGit/apue_learn', '-s', '/home/dawn/MyGit/apue_learn/chapter_1/Figure1.5_input_output/read_and_wri te.cpp', '-o', '/home/dawn/.vim/bundles/vim-gutentags/res/ctags_recursive.options', '-O', '--fields=+niazS --extra=+q --c++-kinds=+px --c-kind s=+px', '-x', '@/home/dawn/.cache/tags/_wildignore.options', '-l', '/home/dawn/.cache/tags/home-dawn-MyGit-apue_learn-.tags.log'] gutentags: In: /home/dawn/MyGit/apue_learn gutentags: Running: ['gtags', '--incremental', '--skip-unreadable', '/home/dawn/.cache/tags/home-dawn-MyGit-apue_learn-'] gutentags: In: /home/dawn/MyGit/apue_learn gutentags: gutentags: [job output]: 'Locking tags file...' gutentags: [job output]: 'Removing references to: /home/dawn/MyGit/apue_learn/chapter_1/Figure1.5_input_output/read_and_write.cpp' gutentags: [job output]: 'grep --text -Ev ''^[^^I]+^I/home/dawn/MyGit/apue_learn/chapter_1/Figure1.5_input_output/read_and_write.cpp^I'' ''/ho me/dawn/.cache/tags/home-dawn-MyGit-apue_learn-.tags'' > ''/home/dawn/.cache/tags/home-dawn-MyGit-apue_learn-.tags.temp''' gutentags: [job output]: 'gtags: nextkey not found in GPATH.' gutentags: Finished gtags_cscope job. gutentags: gtags-cscope job failed, returned: 1 gutentags: [job output]: 'Running ctags on "/home/dawn/MyGit/apue_learn/chapter_1/Figure1.5_input_output/read_and_write.cpp"' gutentags: [job output]: 'ctags -f "/home/dawn/.cache/tags/home-dawn-MyGit-apue_learn-.tags.temp" --options=/home/dawn/.vim/bundles/vim-guten tags/res/ctags_recursive.options --fields=+niazS --extra=+q --c++-kinds=+px --c-kinds=+px --exclude=@/home/dawn/.cache/tags/_wildignore.option s --append "/home/dawn/MyGit/apue_learn/chapter_1/Figure1.5_input_output/read_and_write.cpp"' gutentags: [job output]: 'Replacing tags file' gutentags: [job output]: 'mv -f "/home/dawn/.cache/tags/home-dawn-MyGit-apue_learn-.tags.temp" "/home/dawn/.cache/tags/home-dawn-MyGit-apue_le arn-.tags"' gutentags: [job output]: 'Unlocking tags file...' gutentags: [job output]: 'Done.' gutentags: Finished ctags job.
@CodingdAwn me too. The log ending with "gutentags: [job output]: 'gtags: nextkey not found in GPATH.'", exactly the same with you. my gtags version is 6.6.3, osx 10.14.4
Me too. 3 files generated with file size 0 in Vim, while manualy run gtag with same instruction showed in "messages" in terminal can generate proper files. (need to delete these 3 empty files first)
Do you all have both ctags
and gtags_cscope
enabled as Gutentags modules? I'm wondering if the 2 jobs could be messing with each other... can someone try to only enable gtags_cscope
?
Do you all have both
ctags
andgtags_cscope
enabled as Gutentags modules? I'm wondering if the 2 jobs could be messing with each other... can someone try to only enablegtags_cscope
?
I disable generate ctags, open new c++ file, it's not work. and then, I remove all files in .cache/tags/ and open a new or old c++ file, it works. and i enable ctags, it perfect too. so i think it's no matter with whether ctags is generate. just cache files maybe mess. forgive my bad english and thank for response
On Ubuntu 20.04 daily build, I got the same error with 3 empty GTAGS
files.
Finally I found the culprit:
ctags
and gtags_cscope
python
executable in $PATH
, which is why gtags_cscope
failsI manually added a /usr/local/bin/python
symbolic link to /usr/bin/python3
, gtags_cscope
works
So if you are experiencing the same issue, you might want to check your python
installation as well
Gentoo, /usr/bin/python
and /usr/bin/python3
exist, still got 3 empty files.
On Ubuntu 20.04 daily build, I got the same error with 3 empty
GTAGS
files. Finally I found the culprit:
- @ludovicchabant is right, I don't need to enable both
ctags
andgtags_cscope
- Ubuntu 20.04 doesn't have
python
executable in$PATH
, which is whygtags_cscope
failsI manually added a
/usr/local/bin/python
symbolic link to/usr/bin/python3
,gtags_cscope
worksSo if you are experiencing the same issue, you might want to check your
python
installation as well
Ok , i have try switch to Python3 ,gtags worked !! Thank U.
The reason is that your system python is python 2, but the /usr/local/share/gtags/script/pygments_parser.py
is a python 3 file.
if you have python 3 installed in your system already(for example, /usr/bin/python3), you can simply change the parser of pygments_parser.py
to python 3.
@winkee01 , it is a totally flaky solution to modify gtags's read-only script.
This script works for both python 2 and 3.
Why not just install pygments module in your python2 ??
I'm not familiar with gtags but maybe some files had encoding it doesn't handle, or maybe permissions it couldn't access? Either way we should add a
gutentags_gtags_extra_args
so people can add custom extra arguments.Look for
:help gutentags_exclude_filetypes
. This is for Vim file types, though, so probably not what you want. All it does is check the&filetype
of the currently opened Vim buffer and uses that to decide if it shoud do anything at all.
Has there been any progress on implementing 'g:gutentags_gtags_extra_args' or any other way of setting default options? For example I prefer to have '--accept-dotfiles --compact' on every run.
Do you all have both
ctags
andgtags_cscope
enabled as Gutentags modules? I'm wondering if the 2 jobs could be messing with each other... can someone try to only enablegtags_cscope
?I disable generate ctags, open new c++ file, it's not work. and then, I remove all files in .cache/tags/ and open a new or old c++ file, it works. and i enable ctags, it perfect too. so i think it's no matter with whether ctags is generate. just cache files maybe mess. forgive my bad english and thank for response
Just delete ~/.cache/tags/* . It works for me -:)
gutentags: gtags-cscope job failed, returned: 1
when first open a new file, it auto-generate some tags, this process is successful, and no error messages are popped out, but when executing:w again, the error message will show.
usually, when the tracing message does not identify where the errors come from, it's probably because the tags file are messed up, so in this case, we can try simply delete all cached tags file in ~/.cache/tags/*
to fix it.
I think gutentags needs more precise error reporting (job failed, returned 1 is no better than nothing), or even better, check the environment during installation
try simple project first
I've submitted a PR(https://github.com/ludovicchabant/vim-gutentags/pull/359), maybe it helps you @wangawen .
Describe the bug I got error message like tittle. And I put "let g:gutentags_trace = 1" in .vimrc then I saw a message: gutentags: Running: ['gtags', '--incremental', '/home/hellokitty/.cache/.tags/project-hellokitty-proj1-'] gutentags: In: project/hellokitty/proj1 ... 'gtags: /home/hellokitty/.cache/.tags/project-hellokitty-proj1-/GTAGS seems corrupted.' gutentags: gutentags: gtags-cscope job failed, returned: 1
I manually run gtags in the root project folder and it works.
And in cache : -rw------- 1 hellokitty rnd 0 Dec 20 22:35 GPATH -rw------- 1 hellokitty rnd 0 Dec 20 22:35 GRTAG -rw------- 1 hellokitty rnd 0 Dec 20 22:35 GTAGS
Steps to reproduce
Share your setup
g:gutentags_cache_dir
? YesHers's my confiuration in .vimrc let g:gutentags_modules = ['ctags', 'gtags_cscope'] let g:gutentags_project_root = ['.git'] let g:gutentags_ctags_tagfile = '.tags' let s:vim_tags = expand('~/.cache/.tags') let g:gutentags_cache_dir = s:vim_tags let g:gutentags_file_list_command = 'find . -type f -name .c -o -type f -name .h' if !isdirectory(s:vim_tags) silent! call mkdir(s:vim_tags, 'p') endif let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extras=+q'] let g:gutentags_ctags_extra_args += ['--c++-kinds=+px'] let g:gutentags_ctags_extra_args += ['--c-kinds=+px'] let g:gutentags_ctags_extra_args += ['--output-format=e-ctags'] let g:gutentags_trace = 1
Best Regards!!!!!!