vim-gutentags icon indicating copy to clipboard operation
vim-gutentags copied to clipboard

gutentags: gutentags: gtags-cscope job failed, returned: 1

Open wangawen opened this issue 6 years ago • 18 comments

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

  1. let g:gutentags_trace = 1 in ~/.vimrc
  2. open any project file.

Share your setup

  • CentOS / Vim 8.2.0
  • Universal Ctags/gtags (GNU GLOBAL) 6.6.3
  • Are you using g:gutentags_cache_dir? Yes

Hers'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!!!!!!

wangawen avatar Dec 21 '18 03:12 wangawen

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.

wangawen avatar Dec 21 '18 13:12 wangawen

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.

ludovicchabant avatar Mar 11 '19 07:03 ludovicchabant

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 avatar Apr 12 '19 15:04 CodingdAwn

@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

xianyinxin avatar Apr 15 '19 15:04 xianyinxin

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)

grant7788 avatar Apr 21 '19 09:04 grant7788

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?

ludovicchabant avatar May 06 '19 05:05 ludovicchabant

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?

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

CodingdAwn avatar May 11 '19 10:05 CodingdAwn

On Ubuntu 20.04 daily build, I got the same error with 3 empty GTAGS files. Finally I found the culprit:

  1. @ludovicchabant is right, I don't need to enable both ctags and gtags_cscope
  2. Ubuntu 20.04 doesn't have python executable in $PATH, which is why gtags_cscope fails

I 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

jm33-m0 avatar Feb 02 '20 06:02 jm33-m0

Gentoo, /usr/bin/python and /usr/bin/python3 exist, still got 3 empty files.

PetrusZ avatar Feb 06 '20 07:02 PetrusZ

On Ubuntu 20.04 daily build, I got the same error with 3 empty GTAGS files. Finally I found the culprit:

  1. @ludovicchabant is right, I don't need to enable both ctags and gtags_cscope
  2. Ubuntu 20.04 doesn't have python executable in $PATH, which is why gtags_cscope fails

I 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

Ok , i have try switch to Python3 ,gtags worked !! Thank U.

razor7788 avatar Mar 06 '20 11:03 razor7788

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.

joberrs image

winkee01 avatar Mar 16 '20 04:03 winkee01

@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 ??

skywind3000 avatar Mar 16 '20 06:03 skywind3000

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.

Corey-Keller avatar Apr 23 '20 19:04 Corey-Keller

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?

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 -:)

moon548834 avatar May 04 '20 13:05 moon548834

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.

winkee01 avatar Sep 17 '20 03:09 winkee01

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

jm33-m0 avatar Sep 18 '20 05:09 jm33-m0

try simple project first

joecgs avatar Oct 31 '20 03:10 joecgs

I've submitted a PR(https://github.com/ludovicchabant/vim-gutentags/pull/359), maybe it helps you @wangawen .

iLeeWell avatar Mar 25 '24 15:03 iLeeWell