- Notifications
You must be signed in to change notification settings - Fork28
Commit7dc66a2
committed
Fix libpq to not require user's home directory to exist.
Some people like to run libpq-using applications in environments wherethere's no home directory. We've broken that scenario before (cf commits5b40677 andbd58d9d), and commitba005f1 broke it again, by makingit a hard error if we fail to get the home directory name while lookingfor ~/.pgpass. The previous precedent is that if we can't get the homedirectory name, we should just silently act as though the file we hopedto find there doesn't exist. Rearrange the new code to honor that.Looking around, the service-file code added by commit41a4e45 had thesame disease. Apparently, that escaped notice because it only runs whena service name has been specified, which I guess the people who use thisscenario don't do. Nonetheless, it's wrong too, so fix that case as well.Add a comment about this policy to pqGetHomeDirectory, in the probablyvain hope of forestalling the same error in future. And upgrade therather miserable commenting in parseServiceInfo, too.In passing, also back off parseServiceInfo's assumption that only ENOENTis an ignorable error from stat() when checking a service file. We wouldneed to ignore at least ENOTDIR as well (cf5b40677), and seeing thatthe far-better-tested code for ~/.pgpass treats all stat() failures alike,I think this code ought to as well.Per bug #14872 from Dan Watson. Back-patch the .pgpass change to v10whereba005f1 came in. The service-file bugs are far older, soback-patch the other changes to all supported branches.Discussion:https://postgr.es/m/20171025200457.1471.34504@wrigleys.postgresql.org1 parent98efa5e commit7dc66a2
1 file changed
+27
-9
lines changedLines changed: 27 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3906 | 3906 |
| |
3907 | 3907 |
| |
3908 | 3908 |
| |
| 3909 | + | |
| 3910 | + | |
| 3911 | + | |
| 3912 | + | |
| 3913 | + | |
| 3914 | + | |
| 3915 | + | |
| 3916 | + | |
| 3917 | + | |
| 3918 | + | |
3909 | 3919 |
| |
3910 | 3920 |
| |
3911 | 3921 |
| |
| |||
3924 | 3934 |
| |
3925 | 3935 |
| |
3926 | 3936 |
| |
| 3937 | + | |
3927 | 3938 |
| |
3928 | 3939 |
| |
3929 | 3940 |
| |
| 3941 | + | |
| 3942 | + | |
| 3943 | + | |
| 3944 | + | |
3930 | 3945 |
| |
3931 | 3946 |
| |
3932 | 3947 |
| |
3933 | 3948 |
| |
3934 | 3949 |
| |
3935 | 3950 |
| |
3936 | 3951 |
| |
3937 |
| - | |
3938 |
| - | |
3939 |
| - | |
3940 |
| - | |
| 3952 | + | |
3941 | 3953 |
| |
3942 |
| - | |
3943 |
| - | |
| 3954 | + | |
3944 | 3955 |
| |
3945 | 3956 |
| |
3946 | 3957 |
| |
| |||
3956 | 3967 |
| |
3957 | 3968 |
| |
3958 | 3969 |
| |
3959 |
| - | |
3960 |
| - | |
| 3970 | + | |
3961 | 3971 |
| |
3962 | 3972 |
| |
3963 | 3973 |
| |
| |||
5922 | 5932 |
| |
5923 | 5933 |
| |
5924 | 5934 |
| |
5925 |
| - | |
| 5935 | + | |
| 5936 | + | |
| 5937 | + | |
| 5938 | + | |
| 5939 | + | |
| 5940 | + | |
| 5941 | + | |
| 5942 | + | |
| 5943 | + | |
5926 | 5944 |
| |
5927 | 5945 |
| |
5928 | 5946 |
| |
|
0 commit comments
Comments
(0)