Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f7bd0a3

Browse filesBrowse files
committed
Prevent CRLF conversion of inputs in json_parser test module
Do this by opening the file in PG_BINARY_R mode. This prevents us from getting wrong byte count from stat(). Per complaint from Andres Freund Discussion: https://postgr.es/m/20240707052030.r77hbdkid3mwksop@awork3.anarazel.de Backpatch to rlease 17 where this code was introduced
1 parent 896cd26 commit f7bd0a3
Copy full SHA for f7bd0a3

File tree

Expand file treeCollapse file tree

2 files changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-2
lines changed

‎src/test/modules/test_json_parser/test_json_parser_incremental.c

Copy file name to clipboardExpand all lines: src/test/modules/test_json_parser/test_json_parser_incremental.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ main(int argc, char **argv)
124124
makeJsonLexContextIncremental(&lex, PG_UTF8, need_strings);
125125
initStringInfo(&json);
126126

127-
if ((json_file = fopen(testfile, "r")) == NULL)
127+
if ((json_file = fopen(testfile, PG_BINARY_R)) == NULL)
128128
pg_fatal("error opening input: %m");
129129

130130
if (fstat(fileno(json_file), &statbuf) != 0)

‎src/test/modules/test_json_parser/test_json_parser_perf.c

Copy file name to clipboardExpand all lines: src/test/modules/test_json_parser/test_json_parser_perf.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ main(int argc, char **argv)
5555

5656
sscanf(argv[1], "%d", &iter);
5757

58-
if ((json_file = fopen(argv[2], "r")) == NULL)
58+
if ((json_file = fopen(argv[2], PG_BINARY_R)) == NULL)
5959
pg_fatal("Could not open input file '%s': %m", argv[2]);
6060

6161
while ((n_read = fread(buff, 1, 6000, json_file)) > 0)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.