Cannot exec() program outside of /bin if PATH is unset
Corinna Vinschen
corinna-cygwin@cygwin.com
Fri Oct 17 18:20:00 GMT 2014
On Oct 17 19:56, Christian Franke wrote:
> Corinna Vinschen wrote:
> >On Oct 17 11:10, Corinna Vinschen wrote:
> >>On Oct 16 23:51, Christian Franke wrote:
> >>>Corinna Vinschen wrote:
> >>>>...
> >>>>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.
> >>>For some reason, the SetDllDirectory() call has no effect for exec():
> >>>
> >>>Testcase:
> >>>
> >>>$ unset PATH
> >>>
> >>>$ uname -srvm
> >>>-bash: uname: No such file or directory
> >>>
> >>>$ /bin/uname -srvm
> >>>CYGWIN_NT-6.1-WOW64 1.7.33s(0.277/5/3) 20141014 19:44:03 i686
> >>>
> >>>$ /usr/sbin/alternatives
> >>>/usr/sbin/alternatives: error while loading shared libraries: ?: cannot open
> >>>shared object file: No such file or directory
> >>Weird. The same sequence of commands works fine for me on W8,
> >>W8.1 and W10 64 bit, under i686 as well as x86_64 Cygwin.
> >>
> >>[...]
> >>
> >>but it doesn't on Vista and W7, wow.
> >>
> >>The question now is, is it because the path given to SetDllDirectory
> >>is not propagated to child processes on older systems, or is it
> >>because the directory is only used in calls to LoadLibrary{Ex} on
> >>older systems.
> >>
> >>Stay tuned, I have to investigate this.
> >Ok, so prior to W8, the SetDllDirectory path is not propagated to child
> >processes :-|
> >
> >I created a patch and a new snapshot on https://cygwin.com/snapshots/
> >which calls SetDllDirectory during initialization of every process.
> >Please give it a try.
>
> Now works.
>
> cygwin_patches_for_postfix_count++; postfix_patches_for_cygwin_count--; :-)
You seem to like the idea... ;)
Thanks for testing,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20141017/9932b9fe/attachment.sig>
More information about the Cygwin
mailing list