On Oct 25 19:29, Denis Excoffier wrote: > On 2014-10-25 16:49, Corinna Vinschen wrote: > > Apart from SetDllDirectory and AddDllDirectory, what about this very > > simple solution in Cygwin: > > > > - Don't call SetDllDirectory at all, thus "." is kept in the search > > path. > > > > - In execve, when creating the Windows environment for the child process, > > check if $PATH is empty. If so, set $PATH to /bin for the child. > > Or, check if /bin is in $PATH, if not, add it. > > Then you may add it at the beginning. People that would want it at the > end (or elsewhere) can insert it explicitly.
Appending it to PATH doesn't change the search order, prepending does. Also, appending is the faster technique, especially in this context in the code. > Also make sure to consider /usr/bin and /bin as being equivalent here. This functionality would test the Windows path, not the POSIX path. > However, modifying PATH behind the scenes may be considered as an > unexpected intrusion by the user (PATH is for user consumption isn't > it?). Aren't there any legitimate scenarios where the user would omit > /usr/bin from the PATH? No, not really. > Is it possible to SetDllDirectory("/usr/bin") only if /usr/bin is > _not_ in PATH? This would be less intrusive. This would potentially break your scenario again. The /bin dir would be search before your PATH settings again. Yes, you always have /bin in PATH, but I'm thinking of the general case. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
pgp4hFTRiohw9.pgp
Description: PGP signature