Automatic backtrace [Was: Re: NetAPP/Samba 3.0/plugs]

Scott Gifford sgifford at
Wed Mar 13 02:39:02 GMT 2002

Andrew Bartlett <abartlet at> writes:

> Scott Gifford wrote:
> > 
> > Andrew Bartlett <abartlet at> writes:
> > 
> > > Scott Gifford wrote:


> > > > Perhaps I'm missing something obvious, but why not just let Samba dump
> > > > core?...It's straightforward to provide a backtrace from a core file.
> > >
> > > Where?  Under what uid?  Following what symlinks?
> > 
> > All of this is handled by the OS, and core is dumped in the current
> > working directory.  I don't know how Samba decides what directories to
> > chdir() into, but if it wanders around a bit, something like
> > chdir("/some/known/directory"); abort(); in a signal handler will make
> > sure that the corefile ends up in a sane place.
> But as what user?  And it must work perfectly across 30 different
> operating systems.  A sig11 that has us compleatly hosed must not be
> able to affect where/how we dump core. 

A setuid() could select which user, and:


is pretty standard stuff, and pretty likely (even if not guaranteed)
to work in a signal handler.  But at any rate...

> In any case, the user who understands what a 'core' does is not the
> target audience.  The target audience is the user who gets a Panic and
> doesn't know much more than how to send us a logfile.  
> If we can somehow safely redirect a backtrace into the standard samba
> logfile then that would be great!

That's true; Mozilla does this with its talkback interface, and both
KDE and GNOME include components that help with this when applications
crash, so those might be good sources of ideas and code.

What I've never liked about these instead of a corefile is that the
corefile lets you inspect the variables, both global and in the
various stack frames, when the program crashed.  Plain old stack
traces are useful, but not nearly as useful as seeing exactly what all
of your variables were set to right before the crash.

Still, maybe it's better to have pretty good bug reports from lots and
lots of people than to have really good bug reports from a few...


More information about the samba-technical mailing list