Branch: Tag:

2004-03-22

2004-03-22 17:41:00 by Martin Stjernholm <mast@lysator.liu.se>

Improved error reporting from load_module and convert dlopen errors to
warnings. This to treat dynamic modules in the dist as nonexisting if they
fail to load due to nonexisting libs on the running system.

Rev: lib/master.pike.in:1.255
Rev: src/dynamic_load.c:1.72
Rev: src/errors.h:1.24

6:   // Pike is distributed under GPL, LGPL and MPL. See the file COPYING   // for more information.   // - // $Id: master.pike.in,v 1.254 2004/03/16 14:14:49 grubba Exp $ + // $Id: master.pike.in,v 1.255 2004/03/22 17:41:00 mast Exp $      #pike __REAL_VERSION__   
731:    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: compilation ok\n", fname);    break; +    #if constant(load_module)    case ".so":    if (fname == "") {
738:    "%s\n", pname, ext, describe_backtrace(backtrace()) );    }    -  ret=load_module(fakeroot(fname)); +  if (array|object err = catch (ret=load_module(fakeroot(fname)))) { +  if (objectp (err) && err->is_dlopen_error) { +  // Do not treat errors from dlopen(3) as exceptions since in +  // a dist we can have .so files that are dynamically linked +  // against libraries that don't exist on the system, and in +  // that case we should just treat the module as nonexisting. +  // +  // What we really want is to do this only for errors that +  // are due to nonexisting files, but the error reporting +  // from dlerror(3) doesn't allow us to tell those from other +  // errors. +  (handler && handler->compile_warning || compile_warning) +  (fname, 0, "Failed to load library: " + err->__dlerror); +  ret = 0; +  } +  else +  throw (err); +  } +     resolv_debug ("low_findprog %s: loaded binary\n", fname);   #endif /* load_module */    }