Using Geanyctags 1.38 on Ubuntu 20.04.
On first use the 'Project > Generate tags' menu command completes correctly and generates a new .tags file for the project. After that, trying to re-generate the tags (repeat 'Generate tags') fails with the following error in the Messages pane:
``` find -L . -not -path '*/.*' | ctags --totals --fields=fKsSt --extra=-fq --c-kinds=+p --sort=foldcase --excmd=number -L - -f '/home/user/work/test-project.tags' ctags: "/home/developer/work/geany-plugins-develop.tags" doesn't look like a tag file; I refuse to overwrite it. ``` Looking inside the .tags file, reveals that the first line of it is blank. Removing the blank line allows the regeneration as expected.
Geany info: ``` geany -V geany 1.36 (git >= 825acb21) (built on 2020-04-28 with GTK 3.22.30, GLib 2.56.4) ```
That looks like a problem with ctags, not Geany. Geany-ctags is just running ctags. Whats your version of ctags?
Digging more into this... Obviously, this appears to be a known issue in [geanyctags.c](../blob/bc4dc07e4deb694b647977791a23af6776db4644/geanyctags/src/geanyctags.c#L234-L250) (albeit conditionally handled for Windows only).
Looks like the issue is tied to the output from the `find` command that feeds the file list for the `ctags` to index.
When the file list begins with `./` (the relative current directory) -- the base-name is empty. Thus the `ctags` apparently coughs out a blank line.
One way to avoid producing the `./` is to set a File filter for the project files (Project > Properties) to explicitly match named files. However this seems more like a workaround.
Alternatively, the `find` command in Geanyctags should be explicitly set to list **only files** `find -type f``. Not sure if this would affect the intended logic of Geanyctags in any adverse way.
-------- ``` ctags --version Exuberant Ctags 5.9~svn20110310, Copyright (C) 1996-2009 Darren Hiebert Addresses: dhiebert@users.sourceforge.net, http://ctags.sourceforge.net Optional compiled features: +wildcards, +regex ```
Exuberant ctags is very old and unmaintained, maybe try [Universal ctags](https://github.com/universal-ctags/ctags) which is maintained and is the source of most of Geany's real time parsers. It should be in Ubuntu's repository.
Thanks for suggesting the alternative.
Perhaps, we should consider fixing Geanyctags to work with "vanilla" `ctags`, as this one is likely more commonly installed by default.
I don't mind submitting the patch to restrict the `find` to `-type f`. This should not cause any issues, so far as I could see from the code; after all `ctags` pulls the tags from the actual files listed (`-L`), and `find` will list just the files in such case.
There is no "vanilla" ctags, the Ubuntu packages are called `exuberant-ctags` and `universal-ctags` and both install the `ctags` program, but exuberant ctags is actually a debian package, whereas the universal ctags package is maintained by the Ubuntu developers.
As I said Exuberant ctags is unmaintained, the last commit to its SVN appears to have been in 2014, so basically its not what you should be using. So I would strongly recommend you switch.
That doesn't mean the problem will go away of course, but you should try it first.
Without getting into semantics of "vanilla", exuberant-ctags is listed as a dependency for [geany-plugin-ctags package](https://packages.ubuntu.com/focal/geany-plugin-ctags) on Ubuntu.
So it will be fetched automatically for anyone getting Geanyctags plugin . This is how exuberant-ctags found its way onto my box, that is specifically for geany-plugin-ctags. As long as these two are listed together, we need to make sure they can work properly together too.
Thanks @nomadbyte for reporting and the analysis of the problem. I added the `-type f` as you suggested in #1098.
Closed #1042 via #1098.
github-comments@lists.geany.org