libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ltdl sillyness


From: Peter O'Gorman
Subject: Re: ltdl sillyness
Date: Thu, 13 Oct 2005 13:52:00 +0900
User-agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317)

Ralf Wildenhues wrote:
Hi Peter,

Does a simple test expose this on Tru64?  Try something like adding a
call to mdemo-exec that tries
  ( cd mdemo && ./mdemo foo1.la libfoo2.la )
(i.e., without path) and if this exposes it, please commit along with
it.  (It doesn't expose it on GNU/Linux.)

No, if the dlopen() call fails on a file thta exists, it drops through to here. I'll come up with something to test it at the weekend.

Gaah!  This bug has been in ltdl ever since 2001-02-22, since the MT API
was introduced.  Good catch!

Can we have a cheap test for this as well?  I'd be fine with putting the
corresponding tests in CVS HEAD only for now, and if you have time
constraints, I can try to write them later.

The test here is probably only going to work on systems that need ltdl's help to load deplibs. But yes, I'll look at the weekend here too.


Okay to apply to branch-1-5 and forward port?


Yes.  The `dir' test is certainly ok, the other part looks as if it
does not cause regressions (and passes on GNU/Linux), but the semantics
of freeing the non-local object rather than the local one truly suck.

Watch out, the load_deplibs part in HEAD is changed.


Thanks. I just applied these.

Peter
Index: ChangeLog
2005-10-13  Peter O'Gorman  <address@hidden>

        * libltdl/ltdl.c (find_module): Check that dir is set.
        (load_deplibs): Don't free the user search paths too early.

from  Ralf Wildenhues  <address@hidden>
Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.234
diff -u -3 -p -u -r1.234 ltdl.c
--- libltdl/ltdl.c 27 Sep 2005 10:41:07 -0000 1.234
+++ libltdl/ltdl.c 13 Oct 2005 04:33:16 -0000
@@ -473,8 +473,8 @@ find_module (lt_dlhandle *handle, const 
 
       /* maybe it was moved to another directory */
       {
-         if (tryall_dlopen_module (handle,
-                                   (const char *) 0, dir, dlname) == 0)
+         if (dir && (tryall_dlopen_module (handle,
+                                   (const char *) 0, dir, dlname) == 0))
            return 0;
       }
     }
@@ -774,8 +774,6 @@ load_deplibs (lt_dlhandle handle, char *
        }
     }
 
-  /* restore the old search path */
-  MEMREASSIGN (user_search_path, save_search_path);
 
   if (!depcount)
     {
@@ -864,6 +862,10 @@ load_deplibs (lt_dlhandle handle, char *
 
  cleanup:
   FREE (names);
+  /* restore the old search path */
+  if (save_search_path) {
+    MEMREASSIGN (user_search_path, save_search_path);
+  }
 #endif
 
   return errors;
Index: ChangeLog
2005-10-12  Peter O'Gorman  <address@hidden>

        * libltdl/ltdl.c (find_module): Check that dir is set.
        (load_deplibs): Don't free the user search paths too early.

from  Gary V. Vaughan  <address@hidden>
Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.174.2.19
diff -u -3 -p -u -r1.174.2.19 ltdl.c
--- libltdl/ltdl.c 14 Sep 2005 16:08:13 -0000 1.174.2.19
+++ libltdl/ltdl.c 12 Oct 2005 13:53:21 -0000
@@ -2553,8 +2553,8 @@ find_module (handle, dir, libdir, dlname
 
       /* maybe it was moved to another directory */
       {
-         if (tryall_dlopen_module (handle,
-                                   (const char *) 0, dir, dlname) == 0)
+         if (dir && (tryall_dlopen_module (handle,
+                                   (const char *) 0, dir, dlname) == 0))
            return 0;
       }
     }
@@ -2881,12 +2881,6 @@ load_deplibs (handle, deplibs)
        }
     }
 
-  /* restore the old search path */
-  LT_DLFREE (user_search_path);
-  user_search_path = save_search_path;
-
-  LT_DLMUTEX_UNLOCK ();
-
   if (!depcount)
     {
       errors = 0;
@@ -2973,6 +2967,13 @@ load_deplibs (handle, deplibs)
 
  cleanup:
   LT_DLFREE (names);
+  /* restore the old search path */
+  if (user_search_path) {
+    LT_DLFREE (user_search_path);
+    user_search_path = save_search_path;
+  }
+  LT_DLMUTEX_UNLOCK ();
+
 #endif
 
   return errors;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]