From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bruce Korb Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] do not augment environment Date: Fri, 21 Sep 2012 16:36:28 -0700 Message-ID: <505CF9FC.9060007@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040402070906030107070701" X-Trace: ger.gmane.org 1348270597 2154 80.91.229.3 (21 Sep 2012 23:36:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Sep 2012 23:36:37 +0000 (UTC) To: Guile Development Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Sep 22 01:36:42 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TFCm0-00045v-KC for guile-devel@m.gmane.org; Sat, 22 Sep 2012 01:36:40 +0200 Original-Received: from localhost ([::1]:51324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFClv-0002fJ-S2 for guile-devel@m.gmane.org; Fri, 21 Sep 2012 19:36:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFClt-0002fD-8E for guile-devel@gnu.org; Fri, 21 Sep 2012 19:36:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TFClr-0004XV-Of for guile-devel@gnu.org; Fri, 21 Sep 2012 19:36:33 -0400 Original-Received: from mail-pb0-f41.google.com ([209.85.160.41]:33423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFClr-0004XO-IG for guile-devel@gnu.org; Fri, 21 Sep 2012 19:36:31 -0400 Original-Received: by pbbro12 with SMTP id ro12so9526466pbb.0 for ; Fri, 21 Sep 2012 16:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=R4XtZ4/tD27KQqGiW7hfmv1APQoj9dHlkAoah6Ltjkk=; b=qOUmX9j3KHd9zvyOUkjF2e3o5eDtW1bmFjHaHkQ6M6l7ESFdtVax0Z9Dys+/DLr9fL QaEs7Nte3zZa7ePhy2V26X/VJ5JGDHxOHMHJCij752PvOaRNo2Y6LG93NdcYekkKnfcQ eiEsySAAEajJkM4tHfJrRQ1Btxx0iBxM4O1c8Rx5sMcNt9b9+FVovTBTw3tcpYU+yRm1 m6NO+o3ySSLkaPPEiQ3D0Ew+9AKWYtcsmpyyrHKrnSy3k00CnlJH+VE0YhUIbRXkEpPR 8EialQ7bl98JtN6FURorMBbHL74NklXZHhqKKByN4qUGbDw01NUXVYF+oh9dGc1r332a VhHg== Original-Received: by 10.68.221.168 with SMTP id qf8mr19218008pbc.37.1348270590294; Fri, 21 Sep 2012 16:36:30 -0700 (PDT) Original-Received: from [192.168.10.2] (adsl-99-37-225-29.dsl.pltn13.sbcglobal.net. [99.37.225.29]) by mx.google.com with ESMTPS id pw9sm5778384pbb.42.2012.09.21.16.36.29 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Sep 2012 16:36:29 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.41 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:14908 Archived-At: This is a multi-part message in MIME format. --------------040402070906030107070701 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit --------------040402070906030107070701 Content-Type: text/x-patch; name="0001-do-not-augment-environment.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-do-not-augment-environment.patch" >From b7a04164b9de62fe1e80f061f926c9255c84e710 Mon Sep 17 00:00:00 2001 From: Bruce Korb Date: Fri, 21 Sep 2012 16:33:44 -0700 Subject: [PATCH] do not augment environment * libguile/dynl.c (augment_env): no longer used. Removed. (sysdep_dynl_init): remove code that fiddled LD_LIBRARY_PATH -- aka SHARED_LIBRARY_PATH_VARIABLE (augment_env): removed. Not used any more. --- libguile/dynl.c | 67 +++++++++++++++++++++---------------------------------- 1 file changed, 25 insertions(+), 42 deletions(-) diff --git a/libguile/dynl.c b/libguile/dynl.c index 72305a4..999627a 100644 --- a/libguile/dynl.c +++ b/libguile/dynl.c @@ -81,7 +81,25 @@ sysdep_dynl_link (const char *fname, const char *subr) lt_dlhandle handle; if (fname != NULL) - handle = lt_dlopenext (fname); + { + char * buf; + + handle = lt_dlopenext (fname); + if (handle == NULL) + do + { + static char const ext_dir[] = SCM_EXTENSIONS_DIR; + static char const lib_dir[] = SCM_LIB_DIR; + buf = alloca (max(sizeof (ext_dir), sizeof (lib_dir)) + + strlen (fname) + 1); // fault on failure + sprintf (buf, "%s/%s", lib_dir, fname); + handle = lt_dlopenext (buf); + if (handle != NULL) + break; + sprintf (buf, "%s/%s", ext_dir, fname); + handle = lt_dlopenext (buf); + } while (0); + } else /* Return a handle for the program as a whole. */ handle = lt_dlopen (NULL); @@ -120,30 +138,6 @@ sysdep_dynl_value (const char *symb, void *handle, const char *subr) return fptr; } -/* Augment environment variable VARIABLE with VALUE, assuming VARIABLE - is a path kind of variable. */ -static void -augment_env (const char *variable, const char *value) -{ - const char *env; - - env = getenv (variable); - if (env != NULL) - { - char *new_value; - static const char path_sep[] = { LT_PATHSEP_CHAR, 0 }; - - new_value = alloca (strlen (env) + strlen (value) + 2); - strcpy (new_value, env); - strcat (new_value, path_sep); - strcat (new_value, value); - - setenv (variable, new_value, 1); - } - else - setenv (variable, value, 1); -} - static void sysdep_dynl_init () { @@ -152,26 +146,15 @@ sysdep_dynl_init () lt_dlinit (); env = getenv ("GUILE_SYSTEM_EXTENSIONS_PATH"); - if (env && strcmp (env, "") == 0) - /* special-case interpret system-ltdl-path=="" as meaning no system path, - which is the case during the build */ - ; - else if (env) + if (env == NULL) + return; + + /* special-case interpret system-ltdl-path=="" as meaning no system path, + which is the case during the build */ + if (*env != '\0') /* FIXME: should this be a colon-separated path? Or is the only point to allow the build system to turn off the installed extensions path? */ lt_dladdsearchdir (env); - else - { - /* Add SCM_LIB_DIR and SCM_EXTENSIONS_DIR to the loader's search - path. `lt_dladdsearchdir' and $LTDL_LIBRARY_PATH can't be used - for that because they are searched before the system-dependent - search path, which is the one `libtool --mode=execute -dlopen' - fiddles with (info "(libtool) Libltdl Interface"). See - - for details. */ - augment_env (SHARED_LIBRARY_PATH_VARIABLE, SCM_LIB_DIR); - augment_env (SHARED_LIBRARY_PATH_VARIABLE, SCM_EXTENSIONS_DIR); - } } scm_t_bits scm_tc16_dynamic_obj; -- 1.7.10.4 --------------040402070906030107070701--