[sane-devel] signal handling by libsane and backends

Ryan Reading ryanr23 at gmail.com
Fri Sep 15 14:12:27 UTC 2006


On 9/15/06, Gerhard Jaeger <gerhard at gjaeger.de> wrote:
> On Thursday 14 September 2006 13:30, Wittawat Yamwong wrote:
> > Hi,
> >
> > On Thursday 14 September 2006 09:09, Gerhard Jaeger wrote:
> > > On Tuesday 12 September 2006 04:02, Ryan Reading wrote:
> > > > The sane library and/or its backends don't seem to "clean up" after
> > > > themselves by restoring signal handlers and/or signal masks.
> > > > [...]
> > >
> > > And yes, I think you are right. Grep for sigaction or signal function calls
> > > within the backend directory and you'll see, that no backend saves the
> > > old sigmasks or handlers for restoring.
> >
> > I think, it is OK if the backend modifies sigmasks and/or installs signal
> > handlers in the _child_ process but doesn't restore them. On the other hand,
> > as Ryan mentioned, it will probably cause problems if you do it in the parent
> > process and do not take special care of old sigmasks and signal handlers.
> >
> > > Even sanei_thread does not restore the tweaked masks/handlers.
> > > Workaround could be to get the settings before calling any sane function
> > > and to do the restore stuff on your own.
> >
> > This should be documented somewhere, maybe in PROBLEMS?
>
> Nope, I think it should be fixed...
> I digged a little deeper to sanei_thread and the only points, where
> we fiddle with signals is
> SIGPIPE and
> SIGUSR2 (only for __APPLE__ && __MACH__)
>
> SIGPIPE will be restored
> SIGUSR2 not, which is IMHO not critical
>
> So the point to fix are inside the backends. If someone could
> provide a testcase, this could be easily fixed.
>
> Gerhard
>
>
>
> --
> sane-devel mailing list: sane-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/sane-devel
> Unsubscribe: Send mail with subject "unsubscribe your_password"
>              to sane-devel-request at lists.alioth.debian.org
>

Thanks for the quick replies.  (My bad on the HTML... I have no idea
why I was even using hotmail).

I agree that the handlers in the child process are not a big deal.
The particular backend that I was using was "plustek".  It
specifically sets a SIGCHLD handler.  I think SIGALRM is affected in
other backends.  Anyway, I could put together a test case that
exhibits the problem if needed.  In what form should a test case be in
to most useful?  Where could I look for an example?  I didn't see any
code in the "testsuite" dir in the source tree.

Anyway, I'm happy to do whatever needs to be done if someone can give
me a nudge in the right direction.  Thanks again.

-- Ryan



More information about the sane-devel mailing list