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

Indexing updated source truncates tag file #81

Closed
gezpage opened this issue Apr 12, 2016 · 6 comments
Closed

Indexing updated source truncates tag file #81

gezpage opened this issue Apr 12, 2016 · 6 comments

Comments

@gezpage
Copy link

gezpage commented Apr 12, 2016

I have been attempting to get gutentags to work on a PHP codebase, but have problems.

Entering a project correctly generates a ~50MB tags file, jumping through functions and autocompleting using the tags works great. But when I call :GutentagsUpdate or save a file, the tags file becomes much smaller (around ~6Mb) and Vim complains with E431: Format error in tags file when I attempt to jump to a function definition again.

After attempting to debug the problem it appears that when plat/unix/update_tags.sh is called, it attempts to generate a temp tags file, but the $UPDATED_SOURCE value becomes .../vim-gutentags/plat/unix/update_tags.sh in the grep command (see https://github.com/ludovicchabant/vim-gutentags/blob/master/plat/unix/update_tags.sh#L77).

This means the temp file is blank and the ctags --append only populates it with the new content before replacing the old tags file.

Hope this makes sense. Any pointers on how to debug this further? Happy to help out.

Cheers.

gezpage added a commit to gezpage/vim-gutentags that referenced this issue Apr 12, 2016
@gezpage
Copy link
Author

gezpage commented Apr 12, 2016

Found that grep was failing as it detected the tags file as binary. I still don't know why this is happening but adding the -a switch forces grep to treat the file as text, which resolves the issue.

@ludovicchabant
Copy link
Owner

Ah interesting. My guess is that maybe ctags is somehow indexing binary files, or source files with "unusual" character sets, so the tags file ends up with some symbols that contain characters that it interprets as binary? However, I'm worried that using the -a switch messes up Unicode symbols... it's pretty unusual (most programming languages are ASCII only) but it can happen.

@ludovicchabant
Copy link
Owner

Ok I just merged a PR which adds the --text flag, which is the same a -a. Thanks!

@yevhen-m
Copy link

yevhen-m commented Aug 9, 2016

Updating tag file still truncates it for my even with grep --text command. What can be the issue?

@ludovicchabant
Copy link
Owner

No idea off the top of my head... :(

If you enable tracing (:call gutentags#toggletrace()) you will get a log file next to your tags file which shows what happened. This way you can run every step by hand in the command line and see at what point the tags file got truncated...

@yevhen-m
Copy link

Sorry, there was a problem with my ctags. Your plugin works smooth.

On Aug 10, 2016 6:54 AM, "Ludovic Chabant" notifications@github.com wrote:

No idea off the top of my head... :(

If you enable tracing (:call gutentags#toggletrace()) you will get a log
file next to your tags file which shows what happened. This way you can run
every step by hand in the command line and see at what point the tags file
got truncated...


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#81 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJtpYm7FE-SYx5EQEsTMrgYLzj-PIj4Bks5qeUt6gaJpZM4IFsKW
.

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

3 participants