[Pkg-electronics-devel] RFS: NEW: geda-gaf 1.6.0-1

Peter Clifton pcjc2 at cam.ac.uk
Fri Dec 4 18:04:45 UTC 2009


On Fri, 2009-12-04 at 19:07 +0200, أحمد المحمودي wrote:
> On Fri, Dec 04, 2009 at 09:17:53AM +0200, أحمد المحمودي wrote:
> >  As required, I tested the package against unstable's version of lintian and it
> >  has the following issues:
> ---end quoted text---
> 
> There is also this experimental tag:
> 
> X: libgeda38: shlib-calls-exit usr/lib/libgeda.so.38.0.0
> N: 
> N:    The listed shared library calls the C library exit() or _exit()
> N:    functions.
> N:    
> N:    In the case of an error, the library should instead return an
> N:    appropriate error code to the calling program which can then determine
> N:    how to handle the error, including performing any required clean-up.
> N:    
> N:    In most cases, removing the call should be discussed with upstream,
> N:    particularly as it may produce an ABI change.
> N:    
> N:    Severity: wishlist, Certainty: possible
> N:    
> N:    This tag is marked experimental, which means that the code that
> N:    generates it is not as well-tested as the rest of Lintian and might
> N:    still give surprising results. Feel free to ignore experimental tags
> N:    that do not seem to make sense, though of course bug reports are always
> N:    welcomed.
> 
> Peter, can you comment on this ?

There are 5 cases in libgeda which call exit(-1);

These fall into various categories...

1. Ugly code style, which should be improved..

2. Utility functions which are actually known to exit the program after
performing some task. exit() is part of their purpose!

Since libgeda is not a typical shared library, these uses aren't as bad
as, say.. a library which calls exit() when memory allocation fails
internally, for example.

NB: glib memory allocation failures abort the program if you don't use
the _try_ variant.

libgeda is used by a known suite of applications, and I think we can
define the behaviours of certain shared routines, to include calling
exit(). I admit that it isn't very nice though.


Perhaps you could file an upstream bug to remind us to look at it. Some
cases could simply be turned into g_assert_not_reached(), for example.
Some routines could be changed to return a failure result, rather than
exit(), deferring the exit (and/or error message) to the calling
program. One case may have to remain.. or at least, is defined to exit:

void exit_if_null(void *ptr) 
{
  if (ptr == NULL) {
    fprintf(stderr, "gEDA: Got NULL ptr!, please e-mail maintainer\n");
    g_assert(0);
    exit(-1);
  }	
}

There is probably an equivalent g_assert we could use instead, given it
would almost certainly be fine to change the error message we print.

We could also just cheat.. and move the function to gschem, since
nothing outside of gschem calls it!





More information about the Pkg-electronics-devel mailing list