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

GeanyGenDoc crash #1362

Closed
caclark opened this issue Jun 29, 2024 · 12 comments · Fixed by #1365
Closed

GeanyGenDoc crash #1362

caclark opened this issue Jun 29, 2024 · 12 comments · Fixed by #1365

Comments

@caclark
Copy link

caclark commented Jun 29, 2024

Running the latest geany from Ubuntu 2404:
geany 2.0-1build2
geany-common 2.0-1build2
geany-plugins 2.0-4ubuntu5

Selecting a C file function name and then Tools/Documentation Generator/Document Current Symbol

results in a crash.

Running from gdb gives:

Starting program: /usr/bin/geany
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff2c006c0 (LWP 242811)]
[New Thread 0x7ffff22006c0 (LWP 242812)]
[New Thread 0x7ffff18006c0 (LWP 242813)]
[New Thread 0x7ffff0e006c0 (LWP 242814)]
[New Thread 0x7fffeb8006c0 (LWP 242815)]
[New Thread 0x7fffeae006c0 (LWP 242816)]
[New Thread 0x7fffea4006c0 (LWP 242817)]
[Thread 0x7fffeae006c0 (LWP 242816) exited]
[Thread 0x7fffeb8006c0 (LWP 242815) exited]
[Detaching after fork from child process 242819]
[New Thread 0x7fffeb8006c0 (LWP 242826)]

Thread 1 "geany" received signal SIGSEGV, Segmentation fault.
Downloading source file /usr/src/glib2.0-2.80.0-6ubuntu3.1/debian/build/deb/../../../glib/ghash.c
g_str_hash (v=0x0) at ../../../glib/ghash.c:2463
warning: 2463 ../../../glib/ghash.c: No such file or directory

Does anyone have a suggestion how to narrow this down?

@elextr
Copy link
Member

elextr commented Jun 29, 2024

Try running Geany under gdb and get a backtrace.

@b4n
Copy link
Member

b4n commented Jun 29, 2024

Maybe it is #1294?

@caclark
Copy link
Author

caclark commented Jun 29, 2024

Thanks for the quick responses, but I think it is a system configuration problem.
I cloned geany and the geany-plugins, and executed the usual sudo make install.
Geanygendoc was not included because the version of ctpl in Ubuntu 24.04 was not new enough.
I cloned and installed the latest ctpl.
The crash still occurs.

However if I run ./src/geany from the cloned geany directory geanygendoc works correctly.

I am not sure how to resolve this (although I have found a roundabout way of getting it to run).

Maybe this issue should be closed, as it is probably not a geany problem.

@b4n
Copy link
Member

b4n commented Jun 29, 2024

If you install Geany from source, we recommend you uninstall the distribution packages because it's a little too easy to run the wrong binary, or worse, have one version load bits from the other. In theory it should work, but we've seen both users getting slightly confused, and distros making things hard on us (I didn't say Ubuntu, did I? 😁). Alternatively, make sure you're running the Geany version you expect (e.g. check the version numbers), just in case.

Geanygendoc was not included because the version of ctpl in Ubuntu 24.04 was not new enough.

Looking at packages.ubuntu.com it's definitely new enough, are you sure you had the libctpl-dev package installed?

@caclark
Copy link
Author

caclark commented Jun 30, 2024

Thanks for the advice.

I have cleaned the unneeded files, installed libctpl-dev, re-cloned and recompiled.
If I select Tools/Documentation Generator/Document All Symbols, there is still a crash.

However if I select a single function there is no crash, but whether or not text is generated depends on the function parameters.

I now see that the problem occurs only if I select a function with an anonymous parameter e.g.
void collect_manager_notify_cb(FileData *fd, NotifyType type, gpointer)

The Status pane of Geany shows something similar to No setting applies to symbol "anon_parameter_5" of type "local" at line 1094.

I could not find anything in the Geany documentation regarding anonymous or unnamed parameters.
Have I missed something?

@b4n
Copy link
Member

b4n commented Jun 30, 2024

The type being "local" really suggests if you have a crash it ought to be the issue from the mentioned PR… I'll try and reproduce later tonight though.

@b4n
Copy link
Member

b4n commented Jul 1, 2024

I can't seem to reproduce, but:

  • if the signature you report is a prototype, OK, I see the issue. It sounds like a bug in the C parser (why generate a local tag for a prototype??), but there is probably also an issue in the plugin as the rule local.policy = FORWARD should make it ignore it… at any rate, by default there's no generation for prototypes.
  • could you try and give a backtrace, to share the exact setup that causes the crash? (e.g. the source code + plugin config)

@caclark
Copy link
Author

caclark commented Jul 3, 2024

I created a file - /tmp/test-geany/test.c which contains the single line #include "test-include.h"

The executable is generated from the clones of geany and geany-plugins.
geany -V gives geany 2.1 (git >= 9bf5769f5) (built on 2024-07-02 with GTK 3.24.41, GLib 2.80.0)

GeanyGenDoc is the only plugin enabled.

Opening the test file in Geany and selecting either Document Current Symbol or Document All Symbols results in a crash.

The backtrace is attached.

If you do not see the same result, I will create a more realistic setup.

[Changing the line to be #xxxinclude "test-include.h -> no crash, but with the Status message No valid tag at line 0.]

test-geany-backtrace-1.txt

@elextr
Copy link
Member

elextr commented Jul 3, 2024

Can someone who can reproduce please run Geany under gdb and get a backtrace.

@b4n
Copy link
Member

b4n commented Jul 6, 2024

@caclark OK I can reproduce with the file containing only a single include, I'll look into it.

b4n added a commit to b4n/geany-plugins that referenced this issue Jul 6, 2024
Fix crash if the tag to generate documentation for is of an unknown
type.  Also consolidate some code around this to validate parameters
just to be more defensive in case it sill actually happens.

Fixes geany#1362.
@b4n
Copy link
Member

b4n commented Jul 6, 2024

@caclark you can give #1365 a try, it should fix it properly.

@caclark
Copy link
Author

caclark commented Jul 6, 2024

Thanks.

That solves the problems.

@caclark caclark closed this as completed Jul 6, 2024
b4n added a commit to b4n/geany-plugins that referenced this issue Jul 6, 2024
Fix crash if the tag to generate documentation for is of an unknown
type.  Also consolidate some code around this to validate parameters
just to be more defensive in case it sill actually happens.

Fixes geany#1362.
@b4n b4n added this to the 2.1.0 milestone Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants