Re: EVOLUTION SLOW START , a workaround

2008-03-16 Thread User Lenzi


> I'm trying to use your patch but it fails to apply patch.
> It results in:
> 
> ecerejo# patch -uspl  File to patch: patch-gmodule::gmodule-dl.c
> 4 out of 4 hunks failed--saving rejects to patch-gmodule::gmodule-dl.c.rej
> 
> 

OK, probably, it is because you did not put the module (the patch in the
correct place)

the patch I publish on the email is to replace the glib patch that is
located in:
/usr/ports/devel/glib20/files/patch-gmodule::gmodule-dl.c

the idea is:
you copy the code from the email, and replace the file in the 
/usr/ports/devel/glib20/files/patch-gmodule::gmodule-dl.c

and then just build glib20 again. either by the comand
(cd /usr/ports/devel/glib20;make clean deinstall install)  or
portupgrade -fp devel/glib20

should work

There is no need to rebuild evolution.

the patch works with glib versions 2 
tested on glib2.12 till 2.16 (the last one).

cut===
--- gmodule/gmodule-dl.c.orig 2008-02-07 03:24:53.0 -0200
+++ gmodule/gmodule-dl.c 2008-03-11 18:53:44.0 -0300
@@ -73,6 +73,14 @@
#endif /* RTLD_GLOBAL */


+static char *special_names[]={
+ "g_module_check_init",
+ "g_module_unload",
+ "e_plugin_lib_enable",
+ NULL
+};
+ 
+
/* --- functions --- */
static gchar*
fetch_dlerror (gboolean replace_null)
@@ -106,6 +114,7 @@
static gpointer
_g_module_self (void)
{
+#ifndef __FreeBSD__
   gpointer handle;
   
   /* to query symbols from the program itself, special link options
@@ -117,6 +126,9 @@
 g_module_set_error (fetch_dlerror (TRUE));
   
   return handle;
+#else
+  return RTLD_DEFAULT;
+#endif
}

static void
@@ -141,9 +153,19 @@
{
   gpointer p;
   gchar *msg;
+  char **pn;

   fetch_dlerror (FALSE);
-  p = dlsym (handle, symbol_name);
+
+  for (pn=special_names;*pn;pn++) {
+ if (!strcmp(*pn,symbol_name)) {
+ p=dlsym(RTLD_NEXT,symbol_name);
+ break;
+ }
+  }
+
+  if (! *pn)
+  p = dlsym (handle, symbol_name);
   msg = fetch_dlerror (FALSE);
   if (msg)
 g_module_set_error (msg);
===cut==
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: EVOLUTION SLOW START , a workaround

2008-03-11 Thread E. J. Cerejo
On Tue, 11 Mar 2008 17:45:05 -0300
sergio lenzi <[EMAIL PROTECTED]> wrote:

> Hello all
> 
> This week I have time to trace the problem with evolution that
> lasts too much time to start.
> 
> The problem is that glib on function g_module_load, searchs for a symbol
> g_module_check_init, g_module_unload... by default.
> 
> It occurs that the evolution code, that will be loaded, does not have
> those functions available... so th glib (and dlsym) tries to find the
> symbol in every load module in memory... and doing so consumes all cpu
> for several seconds, for each load module
> 
> ! coded a solution for gmodule that tests for those special symbos, and
> if found, uses dlsymb(RTLD_NEXT,) instead of dlsym(handler) 
> so it will search a much less modules, and evolution will start in 3
> seconds... (20 times less...)
> 
> Of course the correct strategy is to correct code evolution module
> (libevolution-mail.so). will do next time
> 
> modified file: /usr/ports/devel/glib20/files/patch-gmodule::gmodule-dl.c
> 
> please note this is only a temporary fix... the correct solution is to
> fix the 
> evolution module
> 
> =
> --- gmodule/gmodule-dl.c.orig 2008-02-07 03:24:53.0 -0200
> +++ gmodule/gmodule-dl.c  2008-03-11 18:53:44.0 -0300
> @@ -73,6 +73,14 @@
>  #endif   /* RTLD_GLOBAL */
>  
>  
> +static char *special_names[]={
> + "g_module_check_init",
> + "g_module_unload",
> + "e_plugin_lib_enable",
> + NULL
> +};
> + 
> +
>  /* --- functions --- */
>  static gchar*
>  fetch_dlerror (gboolean replace_null)
> @@ -106,6 +114,7 @@
>  static gpointer
>  _g_module_self (void)
>  {
> +#ifndef __FreeBSD__
>gpointer handle;
>
>/* to query symbols from the program itself, special link options
> @@ -117,6 +126,9 @@
>  g_module_set_error (fetch_dlerror (TRUE));
>
>return handle;
> +#else
> +  return RTLD_DEFAULT;
> +#endif
>  }
>  
>  static void
> @@ -141,9 +153,19 @@
>  {
>gpointer p;
>gchar *msg;
> +  char   **pn;
>  
>fetch_dlerror (FALSE);
> -  p = dlsym (handle, symbol_name);
> +
> +  for (pn=special_names;*pn;pn++) {
> + if (!strcmp(*pn,symbol_name)) {
> + p=dlsym(RTLD_NEXT,symbol_name);
> + break;
> + }
> +  }
> +
> +  if (! *pn)
> + p = dlsym (handle, symbol_name);
>msg = fetch_dlerror (FALSE);
>if (msg)
>  g_module_set_error (msg);
> 
> 
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"

I stopped using gnome because of evolution and few other admin apps that don't 
work, it took about 80 seconds to open evolution so I got fed up with it and 
changed to xfce4, personally I think there's quite a few things broken with 
gnome, specially the admin part of it which is not a problem with KDE.  Posted 
the problem a few times and all I've got was the freebsd loader spent quit a 
bit of time looking for every evolution plugin so I disabled them and it still 
took about 50 seconds to open which was unacceptable to me.  Ubuntu on a slower 
machine only takes about 3 seconds with every plugin enabled so it was obvious 
to me that there was a bug somewhere.  I hope they apply your fix to the gnome 
port.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


EVOLUTION SLOW START , a workaround

2008-03-11 Thread sergio lenzi
Hello all

This week I have time to trace the problem with evolution that
lasts too much time to start.

The problem is that glib on function g_module_load, searchs for a symbol
g_module_check_init, g_module_unload... by default.

It occurs that the evolution code, that will be loaded, does not have
those functions available... so th glib (and dlsym) tries to find the
symbol in every load module in memory... and doing so consumes all cpu
for several seconds, for each load module

! coded a solution for gmodule that tests for those special symbos, and
if found, uses dlsymb(RTLD_NEXT,) instead of dlsym(handler) 
so it will search a much less modules, and evolution will start in 3
seconds... (20 times less...)

Of course the correct strategy is to correct code evolution module
(libevolution-mail.so). will do next time

modified file: /usr/ports/devel/glib20/files/patch-gmodule::gmodule-dl.c

please note this is only a temporary fix... the correct solution is to
fix the 
evolution module

=
--- gmodule/gmodule-dl.c.orig   2008-02-07 03:24:53.0 -0200
+++ gmodule/gmodule-dl.c2008-03-11 18:53:44.0 -0300
@@ -73,6 +73,14 @@
 #endif /* RTLD_GLOBAL */
 
 
+static char *special_names[]={
+   "g_module_check_init",
+   "g_module_unload",
+   "e_plugin_lib_enable",
+   NULL
+};
+   
+
 /* --- functions --- */
 static gchar*
 fetch_dlerror (gboolean replace_null)
@@ -106,6 +114,7 @@
 static gpointer
 _g_module_self (void)
 {
+#ifndef __FreeBSD__
   gpointer handle;
   
   /* to query symbols from the program itself, special link options
@@ -117,6 +126,9 @@
 g_module_set_error (fetch_dlerror (TRUE));
   
   return handle;
+#else
+  return RTLD_DEFAULT;
+#endif
 }
 
 static void
@@ -141,9 +153,19 @@
 {
   gpointer p;
   gchar *msg;
+  char **pn;
 
   fetch_dlerror (FALSE);
-  p = dlsym (handle, symbol_name);
+
+  for (pn=special_names;*pn;pn++) {
+   if (!strcmp(*pn,symbol_name)) {
+   p=dlsym(RTLD_NEXT,symbol_name);
+   break;
+   }
+  }
+
+  if (! *pn)
+   p = dlsym (handle, symbol_name);
   msg = fetch_dlerror (FALSE);
   if (msg)
 g_module_set_error (msg);


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"