Bug 7462 - Non-standard SA_RESETHAND is used in ...lib/tevent/tevent_signal.c
Summary: Non-standard SA_RESETHAND is used in ...lib/tevent/tevent_signal.c
Alias: None
Product: Samba 3.5
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.5.7
Hardware: Other Other
: P3 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Reported: 2010-05-27 10:14 UTC by Joachim Schmitz (mail address dead)
Modified: 2011-08-02 18:51 UTC (History)
3 users (show)

See Also:

Patch (771 bytes, patch)
2010-06-01 04:11 UTC, Joachim Schmitz (mail address dead)
no flags Details
patch (1.00 KB, text/plain)
2010-09-27 06:34 UTC, Joachim Schmitz (mail address dead)
no flags Details
Patch for 3.5.x. (1.54 KB, patch)
2011-08-01 18:35 UTC, Jeremy Allison
metze: review+
git-am fix for 3.6.0. (2.18 KB, patch)
2011-08-02 17:08 UTC, Jeremy Allison
metze: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Schmitz (mail address dead) 2010-05-27 10:14:15 UTC
...lib/tevent/tevent_signal.c used SA_RESETHAND  twice. This is none-standard and not available universaly.
Don't have a good idea how fix this, other than just disabling that part?

diff -u ./lib/tevent/tevent_signal.c.orig ./lib/tevent/tevent_signal.c
--- ./lib/tevent/tevent_signal.c.orig   2010-05-17 06:51:23.000000000 -0500
+++ ./lib/tevent/tevent_signal.c        2010-05-26 08:21:33.000000000 -0500
@@ -352,16 +355,20 @@
                                if (se->sa_flags & SA_RESETHAND) {
                        se->handler(ev, se, i, count, NULL, se->private_data);
                        if (se->sa_flags & SA_RESETHAND) {

 #ifdef SA_SIGINFO

Bye, Jojo
Comment 1 Joachim Schmitz (mail address dead) 2010-05-30 13:24:08 UTC
The actual problem seems to be in .../lib/replace/system/wait.h, which #define's SA_RESETHANT to SA_ONESHOT it not #define'd before, without checking wheter SA_ONESHOT exists.

So my patch should actually check for SA_ONESHOT rather than SA_RESETHAND.

Bye, Jojo
Comment 2 Joachim Schmitz (mail address dead) 2010-06-01 04:11:12 UTC
Created attachment 5753 [details]
Comment 3 Björn Jacke 2010-09-21 17:23:30 UTC
Metze, can you have a look how this could be solved?
Comment 4 Joachim Schmitz (mail address dead) 2010-09-27 06:34:36 UTC
Created attachment 5986 [details]

I believe this patch is cleaner. It still doesn't solve the case when neither SA_RESETHAND not SA_ONESHOT is available (other than to make tervent_signal.c compile), but this may not be fixable at all?
Comment 5 Joachim Schmitz (mail address dead) 2011-03-01 06:23:37 UTC
still an issue in 3.5.7
Comment 6 Stefan Metzmacher 2011-07-30 08:46:59 UTC
Jeremy, Tridge you are the signal experts, any ideas on this?
Comment 7 Joachim Schmitz (mail address dead) 2011-07-30 12:34:50 UTC
Hi there

I'm currently out of office and will be back on Monday, the 15th of August 2011. I may occasionally have access to email during my absence, but don't hold your breath on it, I'll surely deal with them after my return.
For urgent business matters please contact either my manager Thomas Petrausch (mailto:thomas.petrausch@hp.com) or call HP's Global NonStop Solution Center (for the numbers check http://h20195.www2.hp.com/V2/GetPDF.aspx/c02083951.pdf) and ask for the Duty Manager. On existing cases you may also send an email to GNSC (mailto:gcsc@hp.com) and mention the case number.
For urgent private matters call me on my mobile phone, if you don't have the number, well, then it's probably not much of a private matter ;-).
Note: this message will be send to you only once during my absence!

Bye, Joachim 'Jojo' Schmitz
NonStop and Neoview Support Expert
Global NonStop Solution Centre (GNSC)
Europe, Middle East, Africa
Hewlett-Packard GmbH
Comment 8 Jeremy Allison 2011-08-01 18:31:32 UTC
SA_ONESHOT is a linux-only thing isn't it ? The safest thing is just to conditionally guard all uses of SA_RESETHAND and not define it in lib/replace if it doesn't exist on the system. It isn't used in any Samba code except for tevent testing code.

Modified patch to follow.

Comment 9 Jeremy Allison 2011-08-01 18:32:16 UTC
FYI. SA_RESETHAND is part of the Posix standard.
Comment 10 Jeremy Allison 2011-08-01 18:35:04 UTC
Created attachment 6744 [details]
Patch for 3.5.x.
Comment 11 Stefan Metzmacher 2011-08-02 01:51:00 UTC
Comment on attachment 6744 [details]
Patch for 3.5.x.

Looks ok
Comment 12 Stefan Metzmacher 2011-08-02 01:51:59 UTC
Karolin, please pick for the next 3.5 release

Jeremy, can you upload a patch for 3.6.x?
Comment 13 Jeremy Allison 2011-08-02 17:08:19 UTC
Created attachment 6747 [details]
git-am fix for 3.6.0.
Comment 14 Stefan Metzmacher 2011-08-02 18:40:56 UTC
Comment on attachment 6747 [details]
git-am fix for 3.6.0.

Looks good
Comment 15 Stefan Metzmacher 2011-08-02 18:41:33 UTC
Karolin, please pick for the release
Comment 16 Karolin Seeger 2011-08-02 18:51:28 UTC
Pushed to v3-6-test and v3-5-test.
Closing out bug report.