Hi All,
As pointed out here https://sourceforge.net/tracker/?func=detail&aid=3440227&group_id=15... the current signal handling in Geany is broken.
Matthew tried my suggestion of g_unix_signal() but as Colomban noted on IRC its a fairly new function (glib 2.30). There was no resolution of this after their tl;dr discussion on IRC.
I suggest that:
1. The current signal handling be removed, it is broken and potentially extremely dangerous. Simply letting the application exit is safer.
2. g_signal_unix() be used when available, but the runtime glib_check_version() must be used instead of the compile time GLIB_CHECK_VERSION() since it is the target glib that matters, not the build system one. This of course requires lazy dynamic linking so that it won't get a missing symbol error if g_signal_unix is not available, but luckily its the default on most Linuxii.
3. Matthew has suggested adding SIGINT to the handling. That raises the question of why is this handling here anyway?
SIGTERM is used by window managers to signal imminent logout/shutdown. So there is no time for GUI checks to happen, and refusing to shutdown is going to be ignored anyway. For example, on my system if Geany is running on shutdown, a warning from the WM flashes past and goes away as the process is SIGKILLed for not dying quickly enough.
So can anyone describe a useful use-case for catching SIGTERM and potentially refusing to exit? And also for SIGINT.
Cheers Lex
On 12-09-09 05:23 PM, Lex Trotman wrote:
[...] So can anyone describe a useful use-case for catching SIGTERM and potentially refusing to exit? And also for SIGINT.
For SIGINT, if it's handled, it'll ask if you want to save unsaved documents before closing when Ctrl+C is used from the terminal. Not saying whether we should handle it or not, just that it's why my tests included it.
Cheers, Matthew Brush
On Sun, 09 Sep 2012 19:41:19 -0700 Matthew Brush mbrush@codebrainz.ca wrote:
On 12-09-09 05:23 PM, Lex Trotman wrote:
[...] So can anyone describe a useful use-case for catching SIGTERM and potentially refusing to exit? And also for SIGINT.
From what I see, signal_cb (used currently for SIGTERM only) looks like
a naive attempt to replace the session management. That will never work, of course - either the WM will send a SIGKILL quickly (in 1-2 seconds), or the entire X will terminate, killing Geany.
BTW, I'm happy to inform all Xfce users here that it's session management was fixed and pushed to git, so we may expect it with the next xfce-session versions. Using the "Action Buttons" plugin with Shutdown or Restart will still not work, but that's a different bug. Or maybe a feature, because the session settings specifically include the text "... on logout".
For SIGINT, if it's handled, it'll ask if you want to save unsaved documents before closing when Ctrl+C is used from the terminal. Not saying whether we should handle it or not, just that it's why my tests included it.
My whole X terminates if I run it from a virtual console and press Ctrl+C, so why should Geany handle the signal? Is this a normal practice for the GUI programs under X than I'm not aware of?
And of course, the portability of signal(2) is so bad that only SIG_DFL and SIG_IGN can be trusted.
On 12-09-10 10:15 AM, Dimitar Zhekov wrote:
On Sun, 09 Sep 2012 19:41:19 -0700 Matthew Brush mbrush@codebrainz.ca wrote:
On 12-09-09 05:23 PM, Lex Trotman wrote:
[...]
just that it's why my *tests* included it.
Emphasis added
Cheers, Matthew Brush
On 11 September 2012 03:15, Dimitar Zhekov dimitar.zhekov@gmail.com wrote:
On Sun, 09 Sep 2012 19:41:19 -0700 Matthew Brush mbrush@codebrainz.ca wrote:
On 12-09-09 05:23 PM, Lex Trotman wrote:
[...] So can anyone describe a useful use-case for catching SIGTERM and potentially refusing to exit? And also for SIGINT.
From what I see, signal_cb (used currently for SIGTERM only) looks like a naive attempt to replace the session management. That will never work, of course - either the WM will send a SIGKILL quickly (in 1-2 seconds), or the entire X will terminate, killing Geany.
Thats my thoughts too, just wanting to see if anyone has any further info on it.
BTW, I'm happy to inform all Xfce users here that it's session management was fixed and pushed to git, so we may expect it with the next xfce-session versions. Using the "Action Buttons" plugin with Shutdown or Restart will still not work, but that's a different bug. Or maybe a feature, because the session settings specifically include the text "... on logout".
Sorry I've changed DEs again :)
For SIGINT, if it's handled, it'll ask if you want to save unsaved documents before closing when Ctrl+C is used from the terminal. Not saying whether we should handle it or not, just that it's why my tests included it.
My whole X terminates if I run it from a virtual console and press Ctrl+C, so why should Geany handle the signal? Is this a normal practice for the GUI programs under X than I'm not aware of?
And of course, the portability of signal(2) is so bad that only SIG_DFL and SIG_IGN can be trusted.
Which is why it should only be "handled" via the mainloop, but as you say its very questionable if we want to do any handling of either of these signals anyway.
Lets see if a reason emerges.
Cheers Lex
-- E-gards: Jimmy _______________________________________________ Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
On 11 September 2012 11:47, Lex Trotman elextr@gmail.com wrote:
On 11 September 2012 03:15, Dimitar Zhekov dimitar.zhekov@gmail.com wrote:
On Sun, 09 Sep 2012 19:41:19 -0700 Matthew Brush mbrush@codebrainz.ca wrote:
On 12-09-09 05:23 PM, Lex Trotman wrote:
[...] So can anyone describe a useful use-case for catching SIGTERM and potentially refusing to exit? And also for SIGINT.
From what I see, signal_cb (used currently for SIGTERM only) looks like a naive attempt to replace the session management. That will never work, of course - either the WM will send a SIGKILL quickly (in 1-2 seconds), or the entire X will terminate, killing Geany.
Thats my thoughts too, just wanting to see if anyone has any further info on it.
BTW, I'm happy to inform all Xfce users here that it's session management was fixed and pushed to git, so we may expect it with the next xfce-session versions. Using the "Action Buttons" plugin with Shutdown or Restart will still not work, but that's a different bug. Or maybe a feature, because the session settings specifically include the text "... on logout".
Sorry I've changed DEs again :)
For SIGINT, if it's handled, it'll ask if you want to save unsaved documents before closing when Ctrl+C is used from the terminal. Not saying whether we should handle it or not, just that it's why my tests included it.
My whole X terminates if I run it from a virtual console and press Ctrl+C, so why should Geany handle the signal? Is this a normal practice for the GUI programs under X than I'm not aware of?
And of course, the portability of signal(2) is so bad that only SIG_DFL and SIG_IGN can be trusted.
Which is why it should only be "handled" via the mainloop, but as you say its very questionable if we want to do any handling of either of these signals anyway.
Lets see if a reason emerges.
Cheers Lex
Since Dimitar and I are in agreement that the current code is *WRONG* and dangerous I will commit an initial patch to comment out the sigterm handling soon.
I see no reason to have this at all, but a corrected version of the commented out code may be added later if needed.
Cheers Lex
-- E-gards: Jimmy _______________________________________________ Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel