Woohoo! I nailed it.... (Was: Another showstopper in 2.2.5)

Fredrik Ohrn ohrn at chl.chalmers.se
Thu Aug 22 08:38:00 GMT 2002


On Wed, 21 Aug 2002 jra at dp.samba.org wrote:

> On Thu, Aug 22, 2002 at 09:04:39AM +0200, Fredrik Ohrn wrote:
> 
> > OK, I put this at the top of the while loop in smbd_process:
> > 
> > sigset_t dummy_mask, blocked_mask;
> > 
> > sigemptyset (&dummy_mask);
> > sigemptyset (&blocked_mask);
> > sigprocmask (SIG_BLOCK, &dummy_mask, &blocked_mask);
> > DEBUG (0, ("SIGPIPE is %s\n", sigismember (&blocked_mask, SIGPIPE) ? "blocked" : "nonblocked" ));
> > 
> > 
> > The signal gets unblocked right after I connect to the share.
> > 
> > Below is the log (at level 4), it got a bit large so I added some ** marks 
> > at the SIGPIPE is blocked/nonblocked messages.
> > 
> > I'll go through the code tonight and add more debug messages to try to 
> > pinpoint the exact place the signal is unmasked.
> 
> Great - thanks. Maybe a debug level 10 may help pinpoint this ?
> 

Oh no, anoter 10 million lines of log entries won't help... :)


> I'm not seeing this on my system, neither is tridge or others
> here at the CIFS conference.
> 


Exactly! And I've just realised whats so different here: We've just moved 
from NIS to nss_ldap.


A quick patch to sys_getpwnam:

struct passwd *sys_getpwnam(const char *name)
{
        struct passwd *tmp;
        sigset_t dummy_mask, blocked_mask;

        if (!name || !name[0])
                return NULL;

        /* check for a cache hit first */
        if (num_lookups && pw_cache.pass.pw_name && !strcmp(name, pw_cache.pass.pw_name)) {
                return setup_pwret(&pw_cache.pass);
        }

        sigemptyset (&dummy_mask);
        sigemptyset (&blocked_mask);
        sigprocmask (SIG_BLOCK, &dummy_mask, &blocked_mask);
        DEBUG (0, ("before getpwnam: SIGPIPE is %s\n", sigismember (&blocked_mask, SIGPIPE) ? "blocked" : "nonblocked" ));

        tmp = getpwnam(name);

        sigemptyset (&dummy_mask);
        sigemptyset (&blocked_mask);
        sigprocmask (SIG_BLOCK, &dummy_mask, &blocked_mask);
        DEBUG (0, ("after getpwnam: SIGPIPE is %s\n", sigismember (&blocked_mask, SIGPIPE) ? "blocked" : "nonblocked" ));

        return setup_pwret(tmp);
}


And what do we get in the log?

[2002/08/22 19:20:35, 0, pid=10579] lib/system.c:sys_getpwnam(865)
  before getpwnam: SIGPIPE is blocked
[2002/08/22 19:20:35, 0, pid=10579] lib/system.c:sys_getpwnam(872)
  after getpwnam: SIGPIPE is nonblocked


Now I'm off to padl.com with a big club. Thou shalt not touch signals that 
doesn't belong to you!


/Fredrik

-- 
   "It is easy to be blinded to the essential uselessness of computers by
   the sense of accomplishment you get from getting them to work at all."
                                                   - Douglas Adams

Fredrik Öhrn                               Chalmers University of Technology
ohrn at chl.chalmers.se                                                  Sweden





More information about the samba-technical mailing list