[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] fix build with new versions of glibc

From: Joe Orton <jorton_at_redhat.com>
Date: 2007-09-13 11:04:05 CEST

Recent releases of glibc define "open" in unistd.h as a macro, to allow
the detection at compile time of open() invocations which have undefined
behaviour (omitting the mode parameter when required, notably). This is
explicitly permitted by the POSIX specification for all function call
interfaces it defines.

The SVN build breaks with these new glibc releases - in places where
"foo->open(" is used, the "open(" part gets macro-expanded to
something... undesirable. The patch below prevents that macro expansion
and fixes the build.

(please CC me on responses, I am not subscribed to the list)

* build/generator/swig/header_wrappers.py: Wrap generated callback
function name invocation with parentheses to prevent macro expansion
with new versions of glibc.

* subversion/libsvn_fs/fs-loader.c,
subversion/libsvn_fs_base/bdb/changes-table.c,
subversion/libsvn_fs_base/bdb/copies-table.c,
subversion/libsvn_fs_base/bdb/env.c,
subversion/libsvn_fs_base/bdb/lock-tokens-table.c,
subversion/libsvn_fs_base/bdb/locks-table.c,
subversion/libsvn_fs_base/bdb/nodes-table.c,
subversion/libsvn_fs_base/bdb/reps-table.c,
subversion/libsvn_fs_base/bdb/rev-table.c,
subversion/libsvn_fs_base/bdb/strings-table.c,
subversion/libsvn_fs_base/bdb/txn-table.c,
subversion/libsvn_fs_base/bdb/uuids-table.c,
subversion/libsvn_ra/ra_loader.c,
subversion/libsvn_ra/wrapper_template.h: Wrap use of "open"
throughout, to prevent expansion as a macro with new versions of
glibc.

Index: build/generator/swig/header_wrappers.py
===================================================================
--- build/generator/swig/header_wrappers.py (revision 26575)
+++ build/generator/swig/header_wrappers.py (working copy)
@@ -153,7 +153,7 @@
         type = "%s *" % struct
 
         self._write_callback(type, return_type, struct[:-2], name, params,
- "_obj->%s" % name)
+ "(_obj->%s)" % name)
 
       elif match[0] and match[1]:
         # Callbacks declared as a typedef
Index: subversion/libsvn_fs_base/bdb/txn-table.c
===================================================================
--- subversion/libsvn_fs_base/bdb/txn-table.c (revision 26575)
+++ subversion/libsvn_fs_base/bdb/txn-table.c (working copy)
@@ -51,9 +51,9 @@
 
   BDB_ERR(svn_fs_bdb__check_version());
   BDB_ERR(db_create(&txns, env, 0));
- BDB_ERR(txns->open(SVN_BDB_OPEN_PARAMS(txns, NULL),
- "transactions", 0, DB_BTREE,
- open_flags, 0666));
+ BDB_ERR((txns->open)(SVN_BDB_OPEN_PARAMS(txns, NULL),
+ "transactions", 0, DB_BTREE,
+ open_flags, 0666));
 
   /* Create the `next-key' table entry. */
   if (create)
Index: subversion/libsvn_fs_base/bdb/reps-table.c
===================================================================
--- subversion/libsvn_fs_base/bdb/reps-table.c (revision 26575)
+++ subversion/libsvn_fs_base/bdb/reps-table.c (working copy)
@@ -44,9 +44,9 @@
 
   BDB_ERR(svn_fs_bdb__check_version());
   BDB_ERR(db_create(&reps, env, 0));
- BDB_ERR(reps->open(SVN_BDB_OPEN_PARAMS(reps, NULL),
- "representations", 0, DB_BTREE,
- open_flags, 0666));
+ BDB_ERR((reps->open)(SVN_BDB_OPEN_PARAMS(reps, NULL),
+ "representations", 0, DB_BTREE,
+ open_flags, 0666));
 
   /* Create the `next-key' table entry. */
   if (create)
Index: subversion/libsvn_fs_base/bdb/locks-table.c
===================================================================
--- subversion/libsvn_fs_base/bdb/locks-table.c (revision 26575)
+++ subversion/libsvn_fs_base/bdb/locks-table.c (working copy)
@@ -45,9 +45,9 @@
 
   BDB_ERR(svn_fs_bdb__check_version());
   BDB_ERR(db_create(&locks, env, 0));
- error = locks->open(SVN_BDB_OPEN_PARAMS(locks, NULL),
- "locks", 0, DB_BTREE,
- open_flags, 0666);
+ error = (locks->open)(SVN_BDB_OPEN_PARAMS(locks, NULL),
+ "locks", 0, DB_BTREE,
+ open_flags, 0666);
 
   /* Create the table if it doesn't yet exist. This is a form of
      automagical repository upgrading. */
Index: subversion/libsvn_fs_base/bdb/copies-table.c
===================================================================
--- subversion/libsvn_fs_base/bdb/copies-table.c (revision 26575)
+++ subversion/libsvn_fs_base/bdb/copies-table.c (working copy)
@@ -43,9 +43,9 @@
 
   BDB_ERR(svn_fs_bdb__check_version());
   BDB_ERR(db_create(&copies, env, 0));
- BDB_ERR(copies->open(SVN_BDB_OPEN_PARAMS(copies, NULL),
- "copies", 0, DB_BTREE,
- open_flags, 0666));
+ BDB_ERR((copies->open)(SVN_BDB_OPEN_PARAMS(copies, NULL),
+ "copies", 0, DB_BTREE,
+ open_flags, 0666));
 
   /* Create the initial `next-key' table entry. */
   if (create)
Index: subversion/libsvn_fs_base/bdb/lock-tokens-table.c
===================================================================
--- subversion/libsvn_fs_base/bdb/lock-tokens-table.c (revision 26575)
+++ subversion/libsvn_fs_base/bdb/lock-tokens-table.c (working copy)
@@ -45,9 +45,9 @@
 
   BDB_ERR(svn_fs_bdb__check_version());
   BDB_ERR(db_create(&lock_tokens, env, 0));
- error = lock_tokens->open(SVN_BDB_OPEN_PARAMS(lock_tokens, NULL),
- "lock-tokens", 0, DB_BTREE,
- open_flags, 0666);
+ error = (lock_tokens->open)(SVN_BDB_OPEN_PARAMS(lock_tokens, NULL),
+ "lock-tokens", 0, DB_BTREE,
+ open_flags, 0666);
 
   /* Create the table if it doesn't yet exist. This is a form of
      automagical repository upgrading. */
Index: subversion/libsvn_fs_base/bdb/strings-table.c
===================================================================
--- subversion/libsvn_fs_base/bdb/strings-table.c (revision 26575)
+++ subversion/libsvn_fs_base/bdb/strings-table.c (working copy)
@@ -47,9 +47,9 @@
      multiple records. Note: this must occur before ->open(). */
   BDB_ERR(strings->set_flags(strings, DB_DUP));
 
- BDB_ERR(strings->open(SVN_BDB_OPEN_PARAMS(strings, NULL),
- "strings", 0, DB_BTREE,
- open_flags, 0666));
+ BDB_ERR((strings->open)(SVN_BDB_OPEN_PARAMS(strings, NULL),
+ "strings", 0, DB_BTREE,
+ open_flags, 0666));
 
   if (create)
     {
Index: subversion/libsvn_fs_base/bdb/uuids-table.c
===================================================================
--- subversion/libsvn_fs_base/bdb/uuids-table.c (revision 26575)
+++ subversion/libsvn_fs_base/bdb/uuids-table.c (working copy)
@@ -47,9 +47,9 @@
   BDB_ERR(db_create(&uuids, env, 0));
   BDB_ERR(uuids->set_re_len(uuids, APR_UUID_FORMATTED_LENGTH));
 
- error = uuids->open(SVN_BDB_OPEN_PARAMS(uuids, NULL),
- "uuids", 0, DB_RECNO,
- open_flags, 0666);
+ error = (uuids->open)(SVN_BDB_OPEN_PARAMS(uuids, NULL),
+ "uuids", 0, DB_RECNO,
+ open_flags, 0666);
 
   /* This is a temporary compatibility check; it creates the
      UUIDs table if one does not already exist. */
Index: subversion/libsvn_fs_base/bdb/rev-table.c
===================================================================
--- subversion/libsvn_fs_base/bdb/rev-table.c (revision 26575)
+++ subversion/libsvn_fs_base/bdb/rev-table.c (working copy)
@@ -41,9 +41,9 @@
 
   BDB_ERR(svn_fs_bdb__check_version());
   BDB_ERR(db_create(&revisions, env, 0));
- BDB_ERR(revisions->open(SVN_BDB_OPEN_PARAMS(revisions, NULL),
- "revisions", 0, DB_RECNO,
- open_flags, 0666));
+ BDB_ERR((revisions->open)(SVN_BDB_OPEN_PARAMS(revisions, NULL),
+ "revisions", 0, DB_RECNO,
+ open_flags, 0666));
 
   *revisions_p = revisions;
   return 0;
Index: subversion/libsvn_fs_base/bdb/env.c
===================================================================
--- subversion/libsvn_fs_base/bdb/env.c (revision 26575)
+++ subversion/libsvn_fs_base/bdb/env.c (working copy)
@@ -563,7 +563,7 @@
   flags |= DB_THREAD;
 #endif
   SVN_ERR(convert_bdb_error
- (bdb, bdb->env->open(bdb->env, bdb->path_bdb, flags, mode)));
+ (bdb, (bdb->env->open)(bdb->env, bdb->path_bdb, flags, mode)));
 
 #if SVN_BDB_AUTO_COMMIT
   /* Assert the BDB_AUTO_COMMIT flag on the opened environment. This
Index: subversion/libsvn_fs_base/bdb/changes-table.c
===================================================================
--- subversion/libsvn_fs_base/bdb/changes-table.c (revision 26575)
+++ subversion/libsvn_fs_base/bdb/changes-table.c (working copy)
@@ -54,9 +54,9 @@
      one-per-row. Note: this must occur before ->open(). */
   BDB_ERR(changes->set_flags(changes, DB_DUP));
 
- BDB_ERR(changes->open(SVN_BDB_OPEN_PARAMS(changes, NULL),
- "changes", 0, DB_BTREE,
- open_flags, 0666));
+ BDB_ERR((changes->open)(SVN_BDB_OPEN_PARAMS(changes, NULL),
+ "changes", 0, DB_BTREE,
+ open_flags, 0666));
 
   *changes_p = changes;
   return 0;
Index: subversion/libsvn_fs_base/bdb/nodes-table.c
===================================================================
--- subversion/libsvn_fs_base/bdb/nodes-table.c (revision 26575)
+++ subversion/libsvn_fs_base/bdb/nodes-table.c (working copy)
@@ -50,9 +50,9 @@
 
   BDB_ERR(svn_fs_bdb__check_version());
   BDB_ERR(db_create(&nodes, env, 0));
- BDB_ERR(nodes->open(SVN_BDB_OPEN_PARAMS(nodes, NULL),
- "nodes", 0, DB_BTREE,
- open_flags, 0666));
+ BDB_ERR((nodes->open)(SVN_BDB_OPEN_PARAMS(nodes, NULL),
+ "nodes", 0, DB_BTREE,
+ open_flags, 0666));
 
   /* Create the `next-key' table entry (use '1' because '0' is
      reserved for the root directory to use). */
Index: subversion/libsvn_ra/wrapper_template.h
===================================================================
--- subversion/libsvn_ra/wrapper_template.h (revision 26575)
+++ subversion/libsvn_ra/wrapper_template.h (working copy)
@@ -73,8 +73,8 @@
   callbacks2->progress_func = NULL;
   callbacks2->progress_baton = NULL;
 
- SVN_ERR(VTBL.open(sess, repos_URL, callbacks2, callback_baton,
- config, pool));
+ SVN_ERR((VTBL.open)(sess, repos_URL, callbacks2, callback_baton,
+ config, pool));
   *session_baton = sess;
   return SVN_NO_ERROR;
 }
Index: subversion/libsvn_ra/ra_loader.c
===================================================================
--- subversion/libsvn_ra/ra_loader.c (revision 26575)
+++ subversion/libsvn_ra/ra_loader.c (working copy)
@@ -459,8 +459,8 @@
   session->pool = pool;
 
   /* Ask the library to open the session. */
- SVN_ERR(vtable->open(session, repos_URL, callbacks, callback_baton,
- config, pool));
+ SVN_ERR((vtable->open)(session, repos_URL, callbacks, callback_baton,
+ config, pool));
 
   *session_p = session;
   return SVN_NO_ERROR;
Index: subversion/libsvn_fs/fs-loader.c
===================================================================
--- subversion/libsvn_fs/fs-loader.c (revision 26575)
+++ subversion/libsvn_fs/fs-loader.c (working copy)
@@ -392,7 +392,7 @@
   SVN_ERR(fs_library_vtable(&vtable, path, pool));
   *fs_p = svn_fs_new(fs_config, pool);
   SVN_ERR(acquire_fs_mutex());
- err = vtable->open(*fs_p, path, pool, common_pool);
+ err = (vtable->open)(*fs_p, path, pool, common_pool);
   err2 = release_fs_mutex();
   if (err)
     {
@@ -494,7 +494,7 @@
 
   SVN_ERR(fs_library_vtable(&vtable, path, fs->pool));
   SVN_ERR(acquire_fs_mutex());
- err = vtable->open(fs, path, fs->pool, common_pool);
+ err = (vtable->open)(fs, path, fs->pool, common_pool);
   err2 = release_fs_mutex();
   if (err)
     {

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Sep 13 11:00:48 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.