forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9a45a89
committed
Avoid symbol collisions between pqsignal.c and legacy-pqsignal.c.
In the name of ABI stability (that is, to avoid a library majorversion bump for libpq), libpq still exports a version of pqsignal()that we no longer want to use ourselves. However, since that hasthe same link name as the function exported by src/port/pqsignal.c,there is a link ordering dependency determining which version willactually get used by code that uses libpq as well as libpgport.a.It now emerges that the wrong version has been used by pgbench andpsql since commit06843df rearranged their link commands. Thiscan result in odd failures in pgbench with the -T switch, since itsSIGALRM handler will now not be marked SA_RESTART. psql may havesome edge-case problems in \watch, too.Since we don't want to depend on link ordering effects anymore,let's fix this in the same spirit asb6c7cfa: use macros to changethe actual link names of the competing functions. We cannot changelegacy-pqsignal.c's exported name of course, so the victim has to besrc/port/pqsignal.c.In master, rename its exported name to be pqsignal_fe in frontend orpqsignal_be in backend. (We could perhaps have gotten away with usingthe same symbol in both cases, but since the FE and BE versions nowwork a little differently, it seems advisable to use different names.)In back branches, rename to pqsignal_fe in frontend but keep it aspqsignal in backend. The frontend change could affect third-partycode that is calling pqsignal from libpgport.a or libpgport_shlib.a,but only if the code is compiled against port.h from a different minorrelease than libpgport. Since we don't support using libpgport as ashared library, it seems unlikely that there will be such a problem.I left the backend symbol unchanged to avoid an ABI break forextensions. This means that the link ordering hazard still existsfor any extension that links against libpq. However, none of our ownextensions use both pqsignal() and libpq, and we're not making thingsany worse for third-party extensions that do.Report from Andy Fan, diagnosis by Fujii Masao, patch by me.Back-patch to all supported branches, as06843df was.Discussion:https://postgr.es/m/87msfz5qv2.fsf@163.com1 parent2ae98ea commit9a45a89
File tree
3 files changed
+19
-2
lines changed- src
- include
- interfaces/libpq
- port
3 files changed
+19
-2
lines changedLines changed: 6 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
513 | 513 |
| |
514 | 514 |
| |
515 | 515 |
| |
516 |
| - | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
517 | 522 |
| |
518 | 523 |
| |
519 | 524 |
| |
|
Lines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
31 |
| - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 |
| |
| 38 | + | |
| 39 | + | |
| 40 | + | |
33 | 41 |
| |
34 | 42 |
| |
35 | 43 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
123 | 123 |
| |
124 | 124 |
| |
125 | 125 |
| |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
126 | 130 |
| |
127 | 131 |
| |
128 | 132 |
| |
|
0 commit comments
Comments
(0)