Commit 0b707d6
committed
Be more careful about newline-chomping in pgbench.
process_backslash_command would drop the last character of the input
command on the assumption that it was a newline. Given a non newline
terminated input file, this could result in dropping the last character
of the command. Fix that by doing an actual test that we're removing
a newline.
While at it, allow for Windows newlines (\r\n), and suppress multiple
newlines if any. I do not think either of those cases really occur,
since (a) we read script files in text mode and (b) the lexer stops
when it hits a newline. But it's cheap enough and it provides a
stronger guarantee about what the result string looks like.
This is just cosmetic, I think, since the possibly-overly-chomped
line was only used for display not for further processing. So
it doesn't seem necessary to back-patch.
Fabien Coelho, reviewed by Nikolay Shaplov, whacked around a bit by me
Discussion: https://postgr.es/m/alpine.DEB.2.20.1704171422500.4025@lancre1 parent c23bb6b commit 0b707d6
3 files changed
+26
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
201 | 200 | | |
202 | 201 | | |
203 | 202 | | |
| |||
210 | 209 | | |
211 | 210 | | |
212 | 211 | | |
| 212 | + | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 215 | + | |
| 216 | + | |
220 | 217 | | |
221 | 218 | | |
222 | 219 | | |
| |||
341 | 338 | | |
342 | 339 | | |
343 | 340 | | |
344 | | - | |
| 341 | + | |
| 342 | + | |
345 | 343 | | |
346 | 344 | | |
347 | 345 | | |
348 | | - | |
| 346 | + | |
| 347 | + | |
349 | 348 | | |
350 | 349 | | |
| 350 | + | |
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
355 | 363 | | |
356 | | - | |
| 364 | + | |
357 | 365 | | |
358 | 366 | | |
359 | 367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3065 | 3065 | | |
3066 | 3066 | | |
3067 | 3067 | | |
3068 | | - | |
3069 | | - | |
| 3068 | + | |
3070 | 3069 | | |
3071 | 3070 | | |
3072 | 3071 | | |
| |||
3120 | 3119 | | |
3121 | 3120 | | |
3122 | 3121 | | |
3123 | | - | |
3124 | | - | |
3125 | | - | |
3126 | | - | |
| 3122 | + | |
3127 | 3123 | | |
3128 | 3124 | | |
3129 | | - | |
| 3125 | + | |
| 3126 | + | |
3130 | 3127 | | |
3131 | 3128 | | |
3132 | 3129 | | |
| |||
3147 | 3144 | | |
3148 | 3145 | | |
3149 | 3146 | | |
3150 | | - | |
3151 | | - | |
3152 | | - | |
3153 | | - | |
| 3147 | + | |
3154 | 3148 | | |
3155 | 3149 | | |
3156 | | - | |
| 3150 | + | |
| 3151 | + | |
3157 | 3152 | | |
3158 | 3153 | | |
3159 | 3154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
0 commit comments