Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call SetDllDirectory("") after sqlite3 init on cygwin #1417

Merged
merged 1 commit into from Jun 30, 2017

Conversation

corngood
Copy link
Contributor

Cygwin sqlite3 is patched to call SetDllDirectory("/usr/bin") on init, which
affects the current process and is inherited by child processes. It causes
DLLs to be loaded from /usr/bin/ before $PATH, which breaks all sorts of
things. A typical failures would be header/lib version mismatches (e.g.
openssl when running checkPhase on openssh). We'll just set it back to the
default value.

Note that this is a problem with the cygwin version of sqlite3 (currently
3.18.0). nixpkgs doesn't have the problematic patch.

This is obviously a hack, and I will look into addressing it in the cygwin package.

if (kernel32)
{
BOOL WINAPI (*setDllDirectory)(LPCWSTR) =
(BOOL WINAPI (*)(LPCWSTR))GetProcAddress(kernel32, "SetDllDirectoryW");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does setDllDirectory need to be looked up dynamically? Isn't it declared in windows.h?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I borrowed that from cygwin. I presume it's for ancient versions of windows. The API was added in XP/2003, so it was extreme overkill. I've switched it over.

This will change build behaviour. Is there some sort of global key I should increment to force rebuilds on cygwin?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of global key?

Cygwin sqlite3 is patched to call SetDllDirectory("/usr/bin") on init, which
affects the current process and is inherited by child processes.  It causes
DLLs to be loaded from /usr/bin/ before $PATH, which breaks all sorts of
things.  A typical failures would be header/lib version mismatches (e.g.
openssl when running checkPhase on openssh).  We'll just set it back to the
default value.

Note that this is a problem with the cygwin version of sqlite3 (currently
3.18.0).  nixpkgs doesn't have the problematic patch.
@corngood
Copy link
Contributor Author

@edolstra I was thinking of some sort of seed or version value that would be included in every derivation hash. I had a quick look and didn't see anything obvious. It's not a big deal because in my experience so far this has caused the affected packages to fail on build.

@edolstra edolstra merged commit 63d6e0a into NixOS:master Jun 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants