aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2015-05-27 19:14:39 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2015-05-27 19:14:55 -0400
commit269cb4fbcad116d3ec497326f166b6690a6ffbd5 (patch)
tree74c3e52a990408d68b18aa410c49dc9c5cefd140 /src
parentc8c6a693ecb69d9f5f83da14e2501bc49f49612b (diff)
downloadpostgresql-269cb4fbcad116d3ec497326f166b6690a6ffbd5.tar.gz
postgresql-269cb4fbcad116d3ec497326f166b6690a6ffbd5.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/test/isolation/specparse.y16
-rw-r--r--src/test/isolation/specscanner.l2
2 files changed, 9 insertions, 9 deletions
diff --git a/src/test/isolation/specparse.y b/src/test/isolation/specparse.y
index 5243f192831..f1520423320 100644
--- a/src/test/isolation/specparse.y
+++ b/src/test/isolation/specparse.y
@@ -39,12 +39,12 @@ TestSpec parseresult; /* result of parsing is left here */
%type <str> opt_setup opt_teardown
%type <str> setup
%type <ptr_list> step_list session_list permutation_list opt_permutation_list
-%type <ptr_list> string_list
+%type <ptr_list> string_literal_list
%type <session> session
%type <step> step
%type <permutation> permutation
-%token <str> sqlblock string
+%token <str> sqlblock string_literal
%token PERMUTATION SESSION SETUP STEP TEARDOWN TEST
%%
@@ -111,7 +111,7 @@ session_list:
;
session:
- SESSION string opt_setup step_list opt_teardown
+ SESSION string_literal opt_setup step_list opt_teardown
{
$$ = malloc(sizeof(Session));
$$->name = $2;
@@ -140,7 +140,7 @@ step_list:
step:
- STEP string sqlblock
+ STEP string_literal sqlblock
{
$$ = malloc(sizeof(Step));
$$->name = $2;
@@ -179,7 +179,7 @@ permutation_list:
permutation:
- PERMUTATION string_list
+ PERMUTATION string_literal_list
{
$$ = malloc(sizeof(Permutation));
$$->stepnames = (char **) $2.elements;
@@ -187,15 +187,15 @@ permutation:
}
;
-string_list:
- string_list string
+string_literal_list:
+ string_literal_list string_literal
{
$$.elements = realloc($1.elements,
($1.nelements + 1) * sizeof(void *));
$$.elements[$1.nelements] = $2;
$$.nelements = $1.nelements + 1;
}
- | string
+ | string_literal
{
$$.nelements = 1;
$$.elements = malloc(sizeof(void *));
diff --git a/src/test/isolation/specscanner.l b/src/test/isolation/specscanner.l
index e1cac60d7af..9a32018de13 100644
--- a/src/test/isolation/specscanner.l
+++ b/src/test/isolation/specscanner.l
@@ -58,7 +58,7 @@ teardown { return(TEARDOWN); }
litbuf[litbufpos] = '\0';
yylval.str = strdup(litbuf);
BEGIN(INITIAL);
- return(string);
+ return(string_literal);
}
<qstr>. { addlitchar(yytext[0]); }
<qstr>\n { yyerror("unexpected newline in quoted string"); }