forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2131c04
committed
Avoid calling gettext() in signal handlers.
It seems highly unlikely that gettext() can be relied on to beasync-signal-safe. psql used to understand that, but someone gotit wrong long ago in the src/bin/scripts/ version of handle_sigint,and then the bad idea was perpetuated when those two versions wereunified into src/fe_utils/cancel.c.I'm unsure why there have not been field complaints about this... maybe gettext() is signal-safe once it's translated at leastone message? But we have no business assuming any such thing.In cancel.c (v13 and up), I preserved our ability to localize"Cancel request sent" messages by invoking gettext() beforethe signal handler is set up. In earlier branches I just madesrc/bin/scripts/ not localize those messages, as psql did then.(Just for extra unsafety, the src/bin/scripts/ version wasinvoking fprintf() from a signal handler. Sigh.)Noted while fixing signal-safety issues in PQcancel() itself.Back-patch to all supported branches.Discussion:https://postgr.es/m/2937814.1641960929@sss.pgh.pa.us1 parentf3f467b commit2131c04
1 file changed
+16
-4
lines changedLines changed: 16 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
45 | 52 |
| |
46 | 53 |
| |
47 | 54 |
| |
| |||
158 | 165 |
| |
159 | 166 |
| |
160 | 167 |
| |
161 |
| - | |
| 168 | + | |
162 | 169 |
| |
163 | 170 |
| |
164 | 171 |
| |
165 |
| - | |
| 172 | + | |
166 | 173 |
| |
167 | 174 |
| |
168 | 175 |
| |
| |||
179 | 186 |
| |
180 | 187 |
| |
181 | 188 |
| |
| 189 | + | |
| 190 | + | |
| 191 | + | |
182 | 192 |
| |
183 | 193 |
| |
184 | 194 |
| |
| |||
203 | 213 |
| |
204 | 214 |
| |
205 | 215 |
| |
206 |
| - | |
| 216 | + | |
207 | 217 |
| |
208 | 218 |
| |
209 | 219 |
| |
210 |
| - | |
| 220 | + | |
211 | 221 |
| |
212 | 222 |
| |
213 | 223 |
| |
| |||
225 | 235 |
| |
226 | 236 |
| |
227 | 237 |
| |
| 238 | + | |
| 239 | + | |
228 | 240 |
| |
229 | 241 |
| |
230 | 242 |
| |
|
0 commit comments
Comments
(0)