-
Notifications
You must be signed in to change notification settings - Fork 910
-
Notifications
You must be signed in to change notification settings - Fork 910
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
home directory lookup can fail #395
Comments
+1 |
Note also that we've experienced some unreliability with this cgo call. (This is not OOM, it appears to be some other failure.)
It would be wonderful to avoid this crash in the future. :) Another way we might dramatically reduce the incidence of this failure would be to store the results of setupSSLClientCertificates in memory, so lib/pq only does the work once, when the first connection is opened. I'm also happy to send a patch for that in addition to (or instead of) the env var suggestion above. |
For now, we are working around this with |
That looks like something that ought to be fixed elsewhere.
That sounds superficially reasonable.
I think at least on POSIX we only need to look at $HOME. On Windows, though, I'm not so sure; does HOMEPATH work the same way as user.Current().HomeDir? |
Cool, two patches coming up!
Yes. As mentioned above, on unix we should use
|
Just opened #396. Env var patch still coming up. |
@kr you can use |
FYI, |
…and it uses |
Method setupSSLClientCertificates uses uses getpwuid_r (via user.Current) to find the user's home directory.
It would be better to use the environment variable
HOME
(or, on windows, a combination ofHOMEDRIVE
andHOMEPATH
). That way the user can control where it looks.Avoiding os/user would also prevent having to call into cgo, which would make cross compiling a bit easier and behave more consistently. For example, the comment above about how the lookup "might fail" would no longer be necessary.
If this sounds ok, I'll send a patch.
The text was updated successfully, but these errors were encountered: