libtool-patches
[Top][All Lists]
Advanced

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

Re: libltdl and dlopen global/local


From: Ralf Wildenhues
Subject: Re: libltdl and dlopen global/local
Date: Mon, 23 Jul 2007 19:58:08 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Hello,

* Brian Barrett wrote on Fri, May 11, 2007 at 07:11:33PM CEST:
>
> It looks like the problem with lt_dlopenext() -- we always call it with an 
> absolute path to a dso, minus the extension.  Before the patches from Gary, 
> this worked.  Now lt_dlopenext() always returns an error in that case, and 
> the error returned from libtool is "file not found".  I unfortunately don't 
> have time in the next week to investigate further.  System details:

This patch updates the old testsuite (HEAD and branch-1-5) to expose the
failure (which is present on HEAD only).  OK to apply (and put Brian in
THANKS)?

Note the gist of the failure is not the absolute path (although it's
good to try that as well, so I'm putting it in mdemo-exec.test), but
the fact that our testsuite did not try lt_dlopenext at all before.

Sorry for not putting it in the new suite, that would have been more
work.  But nothing happening on this front is worse than this, IMVHO.

Cheers,
Ralf

HEAD:
2007-07-22  Ralf Wildenhues  <address@hidden>

        * tests/mdemo-exec.test: Also try absolute library names.
        * tests/mdemo/main.c (test_dl, main): Try lt_dlopenext as well.
        * THANKS: Update.
        Report by Brian Barrett.

Index: tests/mdemo-exec.test
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/mdemo-exec.test,v
retrieving revision 1.22
diff -u -r1.22 mdemo-exec.test
--- tests/mdemo-exec.test       16 Jul 2007 22:53:06 -0000      1.22
+++ tests/mdemo-exec.test       23 Jul 2007 17:52:34 -0000
@@ -1,7 +1,7 @@
 #! /bin/sh
 # mdemo-exec.test - check that programs in the mdemo subdirectory are viable
 #
-#   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+#   Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
 #   Written by Gary V. Vaughan, 2003
 #
 #   This file is part of GNU Libtool.
@@ -33,5 +33,7 @@
          "try_iterate: .*libfoo2"
 func_exec "tests/mdemo/mdemo$EXEEXT tests/mdemo/foo1.la 
tests/mdemo/libfoo2.la" \
          "try_iterate: .*libfoo2"
+func_exec "tests/mdemo/mdemo_static$EXEEXT `pwd`/tests/mdemo/foo1.la 
`pwd`/tests/mdemo/libfoo2.la"
+func_exec "tests/mdemo/mdemo$EXEEXT `pwd`/tests/mdemo/foo1.la 
`pwd`/tests/mdemo/libfoo2.la"
 
 exit $exec_status
Index: tests/mdemo/main.c
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/mdemo/main.c,v
retrieving revision 1.6
diff -u -r1.6 main.c
--- tests/mdemo/main.c  25 Mar 2007 12:12:44 -0000      1.6
+++ tests/mdemo/main.c  23 Jul 2007 17:52:34 -0000
@@ -1,6 +1,6 @@
 /* main.c -- mdemo test program
 
-   Copyright (C) 1998-2000, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1998-2000, 2006, 2007 Free Software Foundation, Inc.
    Written by Thomas Tanner, 1998
 
    This file is part of GNU Libtool.
@@ -32,7 +32,7 @@
 LT_END_C_DECLS
 
 int
-test_dl (char *filename)
+test_dl (char *filename, int test_ext)
 {
   lt_dlhandle handle;  
   const lt_dlinfo *info;
@@ -42,7 +42,11 @@
   int *pnothing = 0;
   int ret = 0;
 
-  handle = lt_dlopen(filename);
+  if (test_ext)
+    handle = lt_dlopenext (filename);
+  else
+    handle = lt_dlopen (filename);
+
   if (!handle) {
     fprintf (stderr, "can't open the module %s!\n", filename);
     fprintf (stderr, "error was: %s\n", lt_dlerror());
@@ -206,6 +210,7 @@
 {
   int i;
   int ret = 0;
+  char *p;
 
   printf ("Welcome to GNU libtool mdemo!\n");
 
@@ -220,8 +225,18 @@
   }
 
   for (i = 1; i < argc; i++)
-    if (test_dl(argv[i]))
+  {
+    if (test_dl(argv[i], 0))
        ret = 1;
+    p = strrchr(argv[i], '.');
+    if (p)
+      {
+       *p = '\0';
+       if (test_dl(argv[i], 1))
+         ret = 1;
+       *p = '.';
+      }
+  }
 
   if (test_dlself())
     ret = 1;



branch-1-5:
2007-07-22  Ralf Wildenhues  <address@hidden>

        * mdemo/main.c (test_dl, main): Try lt_dlopenext as well.
        * tests/mdemo-exec.test: Also try absolute library names.
        * THANKS: Update.
        Report by Brian Barrett.

Index: mdemo/main.c
===================================================================
RCS file: /cvsroot/libtool/libtool/mdemo/Attic/main.c,v
retrieving revision 1.19.4.1
diff -u -r1.19.4.1 main.c
--- mdemo/main.c        22 Apr 2005 09:05:43 -0000      1.19.4.1
+++ mdemo/main.c        23 Jul 2007 17:53:04 -0000
@@ -1,5 +1,5 @@
 /* main.c -- mdemo test program
-   Copyright (C) 1998-2000 Free Software Foundation, Inc.
+   Copyright (C) 1998-2000, 2007 Free Software Foundation, Inc.
    Originally by Thomas Tanner <address@hidden>
    This file is part of GNU Libtool.
 
@@ -23,7 +23,7 @@
 #include <stdio.h>
 
 int
-test_dl (filename)
+test_dl (filename, test_ext)
   char *filename;
 {
   lt_dlhandle handle;  
@@ -34,7 +34,11 @@
   int *pnothing = 0;
   int ret = 0;
 
-  handle = lt_dlopen(filename);
+  if (test_ext)
+    handle = lt_dlopenext (filename);
+  else
+    handle = lt_dlopen (filename);
+
   if (!handle) {
     fprintf (stderr, "can't open the module %s!\n", filename);
     fprintf (stderr, "error was: %s\n", lt_dlerror());
@@ -170,6 +174,7 @@
 {
   int i;
   int ret = 0;
+  char *p;
 
   printf ("Welcome to GNU libtool mdemo!\n");
 
@@ -184,8 +189,18 @@
   }
 
   for (i = 1; i < argc; i++)
-    if (test_dl(argv[i]))
+  {
+    if (test_dl(argv[i], 0))
        ret = 1;
+    p = strrchr(argv[i], '.');
+    if (p)
+      {
+       *p = '\0';
+       if (test_dl(argv[i], 1))
+         ret = 1;
+       *p = '.';
+      }
+  }
 
   if (test_dlself())
     ret = 1;
Index: tests/mdemo-exec.test
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/mdemo-exec.test,v
retrieving revision 1.12
diff -u -r1.12 mdemo-exec.test
--- tests/mdemo-exec.test       29 Mar 2003 05:06:46 -0000      1.12
+++ tests/mdemo-exec.test       23 Jul 2007 17:53:04 -0000
@@ -20,16 +20,15 @@
 echo "Executing uninstalled programs in ../mdemo"
 
 status=0
-if ../mdemo/mdemo_static ../mdemo/foo1.la ../mdemo/libfoo2.la; then :
-else
-  echo "$0: execution of ../mdemo/mdemo_static failed" 1>&2
-  status=1
-fi
-
-if ../mdemo/mdemo ../mdemo/foo1.la ../mdemo/libfoo2.la; then :
-else
-  echo "$0: execution of ../mdemo/mdemo failed" 1>&2
-  status=1
-fi
+for binary in ../mdemo/mdemo_static ../mdemo/mdemo; do
+  for args in "../mdemo/foo1.la ../mdemo/libfoo2.la" \
+              "\"`pwd`/../mdemo/foo1.la\" \"`pwd`/../mdemo/libfoo2.la\""; do
+    if eval "$binary $args"; then :
+    else
+      echo "$0: execution of $binary $args failed" 1>&2
+      status=1
+    fi
+  done
+done
 
 exit $status




reply via email to

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