delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/10/14/15:31:03

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=RjDHhLF06hDbyA/qS++bPYFZAfg+oB0YabJD/J1q+sXR9Ad6dcHOo
iUbpy4rl4+jQzkrbZHc5L02AZXaoStuV/3H/0qky1u21znri1o+R/FHj1FtfAm/U
rwzmAXDuXq3k+P7G+Ui+EZIXggSQH5wG/MDAAN+mAlprYNhACKdDDM=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=Y2XDsmrCDwkux4mzhyeRqc3g2aA=; b=x/KIFAvieEHbPDTRD8NT3kltFC3m
pIzVGHsdG3HH0in9/EagOysceEr5OZLrGTG7J8PEZVAUd1LA6kkisUenvMhtGXUM
9PkVcQa1JHo8aSaobUNebtwAs45OsJrgys2P8tqqwIYhB94dyLO/+VetWb3hQI9W
/U+94NGpiw1ckBA=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Tue, 14 Oct 2014 21:30:45 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Cannot exec() program outside of /bin if PATH is unset
Message-ID: <20141014193045.GF2681@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20141009100317 DOT GI29235 AT calimero DOT vinschen DOT de> <54369ADE DOT 7060201 AT redhat DOT com> <20141009162906 DOT GA25389 AT calimero DOT vinschen DOT de> <571726 DOT 85545 DOT bm AT smtp112 DOT sbc DOT mail DOT ne1 DOT yahoo DOT com> <20141010103446 DOT GJ2681 AT calimero DOT vinschen DOT de> <CAO1jNwt5UyB9CDKJdotXUND--mg1sY-5Fu+-ZHf2atM5_=HArA AT mail DOT gmail DOT com> <CAMCbSMrar1Zu4p6gN=gc8-XqE-8RUTmP3er0ujeN--CHKzCNAQ AT mail DOT gmail DOT com> <816144 DOT 8551 DOT bm AT smtp119 DOT sbc DOT mail DOT ne1 DOT yahoo DOT com> <CAMCbSMpWKbSVhVu85_02fN3sgWXiFBkUzjOOAJ6+Jxot8X6E=Q AT mail DOT gmail DOT com> <20141010153925 DOT GL2681 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20141010153925.GL2681@calimero.vinschen.de>
User-Agent: Mutt/1.5.23 (2014-03-12)

--q56cwELb5ReCVVQh
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Oct 10 17:39, Corinna Vinschen wrote:
> On Oct 10 14:13, Arjen Markus wrote:
> > 2014-10-10 13:22 GMT+02:00  <tednolan>:
> > >>2014-10-10 13:24 GMT+02:00 Jan Nijtmans <...>:
> > >>> 2014-10-10 12:34 GMT+02:00 Corinna Vinschen <...>:
> > >>>> On Oct  9 11:46, tednolan.net wrote:
> > >>>>> I'm pretty sure I've got some programs loading Tcl extensions that
> > >>>>> cd into the directory with the extension dlls, load the extension=
 and then
> > >>>>> change back to where ever they were.
> > >>>>
> > >>>> Hmm.  If so, it's quite a weird way to handle this, rather than
> > >>>> loading the modules with full path.
> > >>>>
> > >>>> Is that a Tcl "feature", or is it how certain Tcl apps are impleme=
nted?
> > >>>> I can't really believe the former...
> > >>>
> > >>> This is certainly not a Tcl "feature"!  The standard Tcl extension
> > >>> mechanism always uses the full path simply because Tcl
> > >>> cannot depend on platform-specific ways to search for
> > >>> such libraries elsewhere.
> > >>>
> > >>> I'm willing to test this;I don't believe such a change
> > >>> will break anything in my Tcl environment.
> > >>>
> > >>> Regards,
> > >>>        Jan Nijtmans
> > >
> > > Hmm,
> > >
> > > It's been a while, but I think it is something like the extension is
> > > a DLL, but it depends on another DLL.  Consider for instance, mysqltc=
l.
> > > If you want to deploy that, you need the mysqltcl.dll and the mysql d=
ll,
> > > so you either have to be in the same dir when you load the extension,
> > > or put that dir in PATH.
> > >
> > > Unfortunately, I can't run a test release on my work machine, or take
> > > my work progs home.
> >=20
> > Right, that makes sense. There is indeed no way for the package
> > manager to handle that scenario without external help, such as a PATH
> > variable that includes the various directories these extra DLLs reside
> > in.
>=20
> There might be a potential workaround.  Given that Cygwin Tcl calls
> dlopen to load DLLs, we have this somewhat under control.
>=20
> The default DLL search algorithm searches the application dir for
> dependent DLLs.  But there's a LoadLibraryEx flag called
> LOAD_WITH_ALTERED_SEARCH_PATH.  When using this flag, and the DLL is
> given with full path, the application dir in the DLL search path is
> replaced by the directory of the DLL.  Thus, dependent DLLs will be
> searched in the same dir the original DLL has been loaded from.
>=20
> This could be utilized in dlopen.  If the DLL is given with no path, and
> if LoadLibrary failes, create the full path to the DLL and call
> LoadLibraryEx (full_path, LOAD_WITH_ALTERED_SEARCH_PATH).  DLLs in /bin
> are taken care of by the SetDllDirectory call we're talking about here.

I implemented this in the latest snapshot.  It calls SetDllDirectory
on Cygwin's /bin, and dlopen addiotnally tries to load the DLL with
LoadLibraryEx(LOAD_WITH_ALTERED_SEARCH_PATH) if all else failed.

Please give the latest snapshot from https://cygwin.com/snapshots/
a try.


Thanks,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--q56cwELb5ReCVVQh
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUPXnkAAoJEPU2Bp2uRE+gl/AP/j+P63MJrS9P/39Yi9sLVfIL
ZdS1dooZhW4yXI4YUXWg3oy2rFXeOPw58QKVYg/DEIz1NY7lI8ObcGk3ea1PdNAW
CtDCCkP4nlCRPdgrVSqMN4ggxGnMIuCOCb+C1AU+8MPrVMWfSqnLFnXG2R5CXpg1
0NR8dkJaIMjiQ+URI8AhGuWVzACa2sZpOe/2nh9Aw+RqdUNTUCSFqd857eTqw9d+
jdfpR2cFDx339XLBMJDdBYiYhF+Y01aTXmkiumZ+Sr7HXKDuovBl9QWMSAQqwGCb
hR2zm//GwKmMEJmiCQEg1Zrut7jqVW/eWQDmBXdm5k1hkQnS+o/1suPaexmgbVC/
w5tw6jg2mamdmuBJ5DEy5zfbdjmcjCeydV17F3yJAPFxMmNpDxtoAlBUQk7VGlkJ
3cURFXSIhxAJJEPhSHqXlxvxM/kQyAHKYA1Ga2DJNS030WNd/R6P638Mg2u9tWvb
T3v1EO1fDa+gsaDuxjklmQL0q2HECZumBGRjw31fTEYHeKSlKi25CCLO3eESJuDk
A3ohnXFdq0yHjzG1bt2p5owYgFffK0M84+F+U/qpQfPkx+aFuEvMyOsfsedi7nNP
TCIwNLVdPjHxvfR54CqOiq5Cy1rHZ3xF2WzlHqCR30ZqeVWtfKTx5otNDawFwKlb
44MSKzWHxxbTs4e9smh0
=6orh
-----END PGP SIGNATURE-----

--q56cwELb5ReCVVQh--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019