Bug #26833 Compile error with embedded lib: check_table_access: org_tables undeclared
Submitted: 4 Mar 2007 20:37 Modified: 17 Mar 2007 20:16
Reporter: Christian Hammers (Silver Quality Contributor) (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1.16 OS:Linux (Debian GNU/Linux sid)
Assigned to: Alexey Botchkov CPU Architecture:Any
Tags: qc

[4 Mar 2007 20:37] Christian Hammers
Description:
I get the following compile error when using --with-embedded-server:

if g++ -DEMBEDDED_LIBRARY -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/usr\"" -DDATADIR="\"/var/lib/mysql\"" -DSHAREDIR="\"/usr/share/mysql\"" -DLIBDIR="\"/usr/li
b\"" -I. -I. -I.. -I../include -I../include -I../sql -I../sql -I../sql/examples -I../regex  -I../storage/federated/ -I../storage/heap/ -I../storage/innobase/
handler/ -I../storage/myisam/ -I../storage/myisammrg/    -DBIG_JOINS=1 -felide-constructors -fno-rtti -O2   -fno-implicit-templates -fno-exceptions -fno-rtti
  -MT sql_parse.o -MD -MP -MF ".deps/sql_parse.Tpo" -c -o sql_parse.o sql_parse.cc; \
        then mv -f ".deps/sql_parse.Tpo" ".deps/sql_parse.Po"; else rm -f ".deps/sql_parse.Tpo"; exit 1; fi
sql_parse.cc: In function 'bool check_table_access(THD*, ulong, TABLE_LIST*, bool)':
sql_parse.cc:5707: error: 'org_tables' was not declared in this scope
make[4]: *** [sql_parse.o] Fehler 1
make[4]: Leaving directory `/home/ch/debian/mysql/exp-5.1/mysql-dfsg-5.1-5.1.16beta/libmysqld'

The reason is that in sql_parse.cc the variable org_tables is only defined when
embedded-server is not used:

bool
check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
                   bool no_errors)
{
  uint found=0;
  ulong found_access=0;
#ifndef EMBEDDED_LIBRARY
  TABLE_LIST *org_tables= tables;
#endif

and later the unconditional use of this symbol:

  if (grant_option)
    return check_grant(thd,want_access & ~EXTRA_ACL,org_tables,
                       test(want_access & EXTRA_ACL), UINT_MAX, no_errors);

How to repeat:
compile (on amd64 but most probably architecture independend) with:

 $ ./configure --build=x86_64-linux-gnu --host=x86_64-linux-gnu --prefix=/usr --exec-prefix=/usr --libexecdir=/usr/sbin --datadir=/usr/share --localstatedir
=/var/lib/mysql --includedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --with-server-suffix=-Debian_1 --with-comment=Debian etch distrib
ution --enable-shared --enable-static --enable-thread-safe-client --enable-local-infile --with-big-tables --with-raid --with-unix-socket-path=/var/run/mysqld
/mysqld.sock --with-mysqld-user=mysql --with-libwrap --with-vio --with-ssl --without-docs --with-bench --with-libedit --with-extra-charsets=all --with-innodb
 --with-isam --with-archive-storage-engine --with-csv-storage-engine --with-federated-storage-engine --without-embedded-server --with-ndbcluster --with-ndb-s
hm --without-ndb-sci --without-ndb-test --with-embedded-server --with-embedded-privilege-control --with-ndb-docs

Suggested fix:
Probably make the symbol unconditionally available?
[5 Mar 2007 13:09] Sveta Smirnova
Thankk you for the report.

Verified as described.
[10 Mar 2007 13:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/21676

ChangeSet@1.2470, 2007-03-10 17:44:25+04:00, holyfoot@mysql.com +1 -0
  bug #26833 (Compile error with embedded lib)
  org_tables declaration was mistakenly #ifdef-ed with the EMBEDDED_LIBRARY
  instead of ACCESS_CHECKS
[17 Mar 2007 18:04] Alexey Botchkov
Pushed in 5.0.40, 5.1.17
[17 Mar 2007 20:16] Paul DuBois
No changelog entry needed.