forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcb65b45
committed
Fix failures to ignore \r when reading Windows-style newlines.
libpq failed to ignore Windows-style newlines in connection service files.This normally wasn't a problem on Windows itself, because fgets() wouldconvert \r\n to just \n. But if libpq were running inside a program thatchanges the default fopen mode to binary, it would see the \r's and thinkthey were data. In any case, it's project policy to ignore \r in textfiles unconditionally, because people sometimes try to use files withDOS-style newlines on Unix machines, where the C library won't hide thatfrom us.Hence, adjust parseServiceFile() to ignore \r as well as \n at the end ofthe line. In HEAD, go a little further and make it ignore all trailingwhitespace, to match what it's always done with leading whitespace.In HEAD, also run around and fix up everyplace where we havenewline-chomping code to make all those places look consistent anduniformly drop \r. It is not clear whether any of those changes arefixing live bugs. Most of the non-cosmetic changes are in places thatare reading popen output, and the jury is still out as to whether popenon Windows can return \r\n. (The Windows-specific code in pipe_read_lineseems to think so, but our lack of support for this elsewhere suggestsmaybe it's not a problem in practice.) Hence, I desisted from applyingthose changes to back branches, except in run_ssl_passphrase_command()which is new enough and little-tested enough that we'd probably not haveheard about any problems there.Tom Lane and Michael Paquier, per bug #15827 from Jorge Gustavo Rocha.Back-patch the parseServiceFile() change to all supported branches,and the run_ssl_passphrase_command() change to v11 where that was added.Discussion:https://postgr.es/m/15827-e6ba53a3a7ed543c@postgresql.org1 parent165f4ee commitcb65b45
1 file changed
+8
-4
lines changedLines changed: 8 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4660 | 4660 |
| |
4661 | 4661 |
| |
4662 | 4662 |
| |
| 4663 | + | |
| 4664 | + | |
4663 | 4665 |
| |
4664 | 4666 |
| |
4665 | 4667 |
| |
| |||
4672 | 4674 |
| |
4673 | 4675 |
| |
4674 | 4676 |
| |
4675 |
| - | |
4676 |
| - | |
4677 |
| - | |
| 4677 | + | |
| 4678 | + | |
| 4679 | + | |
| 4680 | + | |
| 4681 | + | |
4678 | 4682 |
| |
4679 | 4683 |
| |
4680 | 4684 |
| |
4681 | 4685 |
| |
4682 | 4686 |
| |
4683 | 4687 |
| |
4684 |
| - | |
| 4688 | + | |
4685 | 4689 |
| |
4686 | 4690 |
| |
4687 | 4691 |
| |
|
0 commit comments
Comments
(0)