Skip to content

Commit 360429e

Browse files
committed
Fix pg_bsd_indent bug where newlines were not being trimmed from typedef
lines. Update pg_bsd_indent required version to 1.1 (and update ftp site). Problem reported by Magnus.
1 parent d9bae53 commit 360429e

File tree

3 files changed

+29
-30
lines changed

3 files changed

+29
-30
lines changed

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -379,21 +379,20 @@ progress_report(int tablespacenum, const char *filename)
379379
char totalsize_str[32];
380380

381381
/*
382-
* Avoid overflowing past 100% or the full size. This may make the
383-
* total size number change as we approach the end of the backup
384-
* (the estimate will always be wrong if WAL is included), but
385-
* that's better than having the done column be bigger than the
386-
* total.
382+
* Avoid overflowing past 100% or the full size. This may make the total
383+
* size number change as we approach the end of the backup (the estimate
384+
* will always be wrong if WAL is included), but that's better than having
385+
* the done column be bigger than the total.
387386
*/
388387
if (percent > 100)
389388
percent = 100;
390389
if (totaldone / 1024 > totalsize)
391390
totalsize = totaldone / 1024;
392391

393392
/*
394-
* Separate step to keep platform-dependent format code out of translatable
395-
* strings. And we only test for INT64_FORMAT availability in snprintf,
396-
* not fprintf.
393+
* Separate step to keep platform-dependent format code out of
394+
* translatable strings. And we only test for INT64_FORMAT availability
395+
* in snprintf, not fprintf.
397396
*/
398397
snprintf(totaldone_str, sizeof(totaldone_str), INT64_FORMAT, totaldone / 1024);
399398
snprintf(totalsize_str, sizeof(totalsize_str), INT64_FORMAT, totalsize);
@@ -410,7 +409,7 @@ progress_report(int tablespacenum, const char *filename)
410409
ngettext("%s/%s kB (100%%), %d/%d tablespace %35s",
411410
"%s/%s kB (100%%), %d/%d tablespaces %35s",
412411
tablespacecount),
413-
totaldone_str, totalsize_str, tablespacenum, tablespacecount, "");
412+
totaldone_str, totalsize_str, tablespacenum, tablespacecount, "");
414413
else
415414
fprintf(stderr,
416415
ngettext("%s/%s kB (%d%%), %d/%d tablespace (%-30.30s)",

src/tools/pgindent/indent.bsd.patch

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff -c -r bsd_indent/Makefile pg_bsd_indent/Makefile
2-
*** bsd_indent/Makefile Mon Nov 14 19:30:11 2005
2+
*** bsd_indent/Makefile Wed Oct 26 17:13:34 2011
33
--- pg_bsd_indent/Makefile Wed Oct 12 12:17:12 2011
44
***************
55
*** 2,10 ****
@@ -38,7 +38,7 @@ diff -c -r bsd_indent/Makefile pg_bsd_indent/Makefile
3838
! install: $(TARGET)
3939
install -s -o bin -g bin $(TARGET) /usr/local/bin
4040
diff -c -r bsd_indent/README pg_bsd_indent/README
41-
*** bsd_indent/README Wed Oct 12 11:51:58 2011
41+
*** bsd_indent/README Wed Oct 26 17:13:34 2011
4242
--- pg_bsd_indent/README Mon Nov 14 19:30:24 2005
4343
***************
4444
*** 1,3 ****
@@ -57,15 +57,15 @@ diff -c -r bsd_indent/README pg_bsd_indent/README
5757
via some distribution tape for PDP-11 Unix. It has subsequently been
5858
hacked upon by James Gosling @ CMU. It isn't very pretty, and really needs
5959
diff -c -r bsd_indent/args.c pg_bsd_indent/args.c
60-
*** bsd_indent/args.c Mon Nov 14 19:30:00 2005
61-
--- pg_bsd_indent/args.c Wed Oct 12 12:30:06 2011
60+
*** bsd_indent/args.c Wed Oct 26 17:13:34 2011
61+
--- pg_bsd_indent/args.c Wed Oct 26 17:16:56 2011
6262
***************
6363
*** 83,88 ****
6464
--- 83,90 ----
6565
#include <string.h>
6666
#include "indent_globs.h"
6767

68-
+ #define INDENT_PG_VERSION "1.0"
68+
+ #define INDENT_PG_VERSION "1.1"
6969
+
7070
/* profile types */
7171
#define PRO_SPECIAL 1 /* special case */
@@ -125,7 +125,7 @@ diff -c -r bsd_indent/args.c pg_bsd_indent/args.c
125125
indent: set_option: internal error: p_special %d\n", p->p_special);
126126
***************
127127
*** 459,461 ****
128-
--- 485,509 ----
128+
--- 485,508 ----
129129
exit(1);
130130
}
131131
}
@@ -145,17 +145,16 @@ diff -c -r bsd_indent/args.c pg_bsd_indent/args.c
145145
+ while ((fgets(line, BUFSIZ, file)) != NULL)
146146
+ {
147147
+ /* Remove trailing whitespace */
148-
+ if (strstr(line, " \t\n\r") != NULL)
149-
+ *strstr(line, " \t\n\r") = '\0';
148+
+ *(line + strcspn(line, " \t\n\r")) = '\0';
150149
+ addkey(strdup(line), 4);
151150
+ }
152151
+ fclose(file);
153152
+ }
154-
Only in pg_bsd_indent/: args.o
155-
Only in bsd_indent/: indent.bsd.patch
156-
Only in pg_bsd_indent/: indent.o
153+
Only in pg_bsd_indent: args.o
154+
Only in pg_bsd_indent: indent.bsd.patch
155+
Only in pg_bsd_indent: indent.o
157156
diff -c -r bsd_indent/indent_globs.h pg_bsd_indent/indent_globs.h
158-
*** bsd_indent/indent_globs.h Wed Oct 12 11:51:58 2011
157+
*** bsd_indent/indent_globs.h Wed Oct 26 17:13:34 2011
159158
--- pg_bsd_indent/indent_globs.h Mon Nov 14 19:30:24 2005
160159
***************
161160
*** 239,245 ****
@@ -178,9 +177,9 @@ diff -c -r bsd_indent/indent_globs.h pg_bsd_indent/indent_globs.h
178177

179178
EXTERN struct parser_state {
180179
int last_token;
181-
Only in pg_bsd_indent/: io.o
180+
Only in pg_bsd_indent: io.o
182181
diff -c -r bsd_indent/lexi.c pg_bsd_indent/lexi.c
183-
*** bsd_indent/lexi.c Wed Oct 12 11:51:58 2011
182+
*** bsd_indent/lexi.c Wed Oct 26 17:13:34 2011
184183
--- pg_bsd_indent/lexi.c Mon Nov 14 19:30:24 2005
185184
***************
186185
*** 93,99 ****
@@ -221,9 +220,9 @@ diff -c -r bsd_indent/lexi.c pg_bsd_indent/lexi.c
221220
p->rwd = key;
222221
p->rwcode = val;
223222
p[1].rwd = 0;
224-
Only in pg_bsd_indent/: lexi.o
223+
Only in pg_bsd_indent: lexi.o
225224
diff -c -r bsd_indent/parse.c pg_bsd_indent/parse.c
226-
*** bsd_indent/parse.c Wed Oct 12 11:51:58 2011
225+
*** bsd_indent/parse.c Wed Oct 26 17:13:34 2011
227226
--- pg_bsd_indent/parse.c Mon Nov 14 19:30:24 2005
228227
***************
229228
*** 231,236 ****
@@ -239,9 +238,9 @@ diff -c -r bsd_indent/parse.c pg_bsd_indent/parse.c
239238
reduce(); /* see if any reduction can be done */
240239

241240
#ifdef debug
242-
Only in pg_bsd_indent/: parse.o
241+
Only in pg_bsd_indent: parse.o
243242
diff -c -r bsd_indent/pr_comment.c pg_bsd_indent/pr_comment.c
244-
*** bsd_indent/pr_comment.c Wed Oct 12 11:51:58 2011
243+
*** bsd_indent/pr_comment.c Wed Oct 26 17:13:34 2011
245244
--- pg_bsd_indent/pr_comment.c Mon Nov 14 19:30:24 2005
246245
***************
247246
*** 148,154 ****
@@ -286,4 +285,4 @@ diff -c -r bsd_indent/pr_comment.c pg_bsd_indent/pr_comment.c
286285
} else
287286
if (++buf_ptr >= buf_end)
288287
fill_buffer();
289-
Only in pg_bsd_indent/: pr_comment.o
288+
Only in pg_bsd_indent: pr_comment.o

src/tools/pgindent/pgindent

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ TYPEDEFS="$1"
2222
shift
2323

2424
[ -z "$INDENT" ] && INDENT=pg_bsd_indent
25+
INDENT_VERSION="1.1"
2526

2627
trap "rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15
2728

@@ -39,8 +40,8 @@ if [ "$?" -ne 1 ]
3940
then echo "You do not appear to have '$INDENT' installed on your system." >&2
4041
exit 1
4142
fi
42-
if [ "`$INDENT -V`" != "$INDENT 1.0" ]
43-
then echo "You do not appear to have $INDENT version 1.0 installed on your system." >&2
43+
if [ "`$INDENT -V`" != "$INDENT $INDENT_VERSION" ]
44+
then echo "You do not appear to have $INDENT version $INDENT_VERSION installed on your system." >&2
4445
exit 1
4546
fi
4647
$INDENT -gnu </dev/null >/dev/null 2>&1

0 commit comments

Comments
 (0)