Content-Length: 372765 | pFad | http://github.com/postgrespro/postgres/commit/ee8b93c83d791ef60ba789174d4c7e6b7d5f901a

59 Fix portability issue in isolationtester grammar. · postgrespro/postgres@ee8b93c · GitHub
Skip to content

Commit ee8b93c

Browse files
committed
Fix portability issue in isolationtester grammar.
specparse.y and specscanner.l used "string" as a token name. Now, bison likes to define each token name as a macro for the token code it assigns, which means those names are basically off-limits for any other use within the grammar file or included headers. So names as generic as "string" are dangerous. This is what was causing the recent failures on protosciurus: some versions of Solaris' sys/kstat.h use "string" as a field name. With late-model bison we don't see this problem because the token macros aren't defined till later (that is why castoroides didn't show the problem even though it's on the same machine). But protosciurus uses bison 1.875 which defines the token macros up front. This land mine has been there from day one; we'd have found it sooner except that protosciurus wasn't trying to run the isolation tests till recently. To fix, rename the token to "string_literal" which is hopefully less likely to collide with names used by system headers. Back-patch to all branches containing the isolation tests.
1 parent 5585cc7 commit ee8b93c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/test/isolation/specparse.y

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ TestSpec parseresult; /* result of parsing is left here */
3737

3838
%type <str> opt_setup opt_teardown
3939
%type <ptr_list> step_list session_list permutation_list opt_permutation_list
40-
%type <ptr_list> string_list
40+
%type <ptr_list> string_literal_list
4141
%type <session> session
4242
%type <step> step
4343
%type <permutation> permutation
4444

45-
%token <str> sqlblock string
45+
%token <str> sqlblock string_literal
4646
%token PERMUTATION SESSION SETUP STEP TEARDOWN TEST
4747

4848
%%
@@ -89,7 +89,7 @@ session_list:
8989
;
9090

9191
session:
92-
SESSION string opt_setup step_list opt_teardown
92+
SESSION string_literal opt_setup step_list opt_teardown
9393
{
9494
$$ = malloc(sizeof(Session));
9595
$$->name = $2;
@@ -118,7 +118,7 @@ step_list:
118118

119119

120120
step:
121-
STEP string sqlblock
121+
STEP string_literal sqlblock
122122
{
123123
$$ = malloc(sizeof(Step));
124124
$$->name = $2;
@@ -156,23 +156,23 @@ permutation_list:
156156

157157

158158
permutation:
159-
PERMUTATION string_list
159+
PERMUTATION string_literal_list
160160
{
161161
$$ = malloc(sizeof(Permutation));
162162
$$->stepnames = (char **) $2.elements;
163163
$$->nsteps = $2.nelements;
164164
}
165165
;
166166

167-
string_list:
168-
string_list string
167+
string_literal_list:
168+
string_literal_list string_literal
169169
{
170170
$$.elements = realloc($1.elements,
171171
($1.nelements + 1) * sizeof(void *));
172172
$$.elements[$1.nelements] = $2;
173173
$$.nelements = $1.nelements + 1;
174174
}
175-
| string
175+
| string_literal
176176
{
177177
$$.nelements = 1;
178178
$$.elements = malloc(sizeof(void *));

src/test/isolation/specscanner.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ teardown { return(TEARDOWN); }
5757
litbuf[litbufpos] = '\0';
5858
yylval.str = strdup(litbuf);
5959
BEGIN(INITIAL);
60-
return(string);
60+
return(string_literal);
6161
}
6262
<qstr>. { addlitchar(yytext[0]); }
6363
<qstr>\n { yyerror("unexpected newline in quoted string"); }

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/ee8b93c83d791ef60ba789174d4c7e6b7d5f901a

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy