Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wangawen opened this issue Dec 21, 2018 · 18 comments
Open

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

wangawen opened this issue Dec 21, 2018 · 18 comments

Comments

@wangawen
Copy link

wangawen commented Dec 21, 2018

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
Copy link
Author

wangawen commented Dec 21, 2018

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.

@ludovicchabant
Copy link
Owner

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.

@CodingdAwn
Copy link

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.

@xianyinxin
Copy link

@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

@grant7788
Copy link

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)

@ludovicchabant
Copy link
Owner

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?

@CodingdAwn
Copy link

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

@jm33-m0
Copy link

jm33-m0 commented Feb 2, 2020

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

@PetrusZ
Copy link

PetrusZ commented Feb 6, 2020

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

@razor7788
Copy link

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.

@winkee01
Copy link

winkee01 commented Mar 16, 2020

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

@skywind3000
Copy link

skywind3000 commented Mar 16, 2020

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

@Corey-Keller
Copy link

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.

@moon548834
Copy link

moon548834 commented May 4, 2020

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

@winkee01
Copy link

winkee01 commented Sep 17, 2020

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.

@jm33-m0
Copy link

jm33-m0 commented Sep 18, 2020

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

@joecgs
Copy link

joecgs commented Oct 31, 2020

try simple project first

@iLeeWell
Copy link

iLeeWell commented Mar 25, 2024

I've submitted a PR(#359), maybe it helps you @wangawen .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests