[Pkg-ace-devel] Bug#420216: libace-dev bug regarding _REENTRANT macro

Scott D. Fleming sdf at cse.msu.edu
Fri Apr 20 19:33:19 UTC 2007


Package: libace-dev
Version: 5.4.7-12

I believe the libace-dev package maintainer responded to debian bug
report #380739 (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=380739)
incorrectly, and introduced a portability bug into the ACE sources.

Bug report #380739 describes a compatibility problem between ACE and
Boost (libace-dev and libboost-dev). I believe the correct response to
that bug report would have been to say, "compatibility between these
libraries is not a feature supported by either library; therefore, I'm
sorry, but I cannot help you. To resolve your problem, you will need
send the library developers a request for the addition of that
feature." Instead, the package maintainer attempted to solve the
compatibility problem by modifying the ACE sources. Specifically, the
maintainer changed the following stanza in ace/config-lite.h:

# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
#   define ACE_MT(X) X
#   if !defined (_REENTRANT)
#     define _REENTRANT
#   endif /* _REENTRANT */
# else
...

To this:

# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
#   define ACE_MT(X) X
#   if !defined (_REENTRANT)
#     error _REENTRANT has to be defined!
#   endif /* _REENTRANT */
# else
...

Note that instead of having the header define the _REENTRANT macro, it
now reports an error. Unfortunately, this change introduces a
portability bug into ACE. The problem arises because _REENTRANT is a
platform-specific macro. By removing the macro definition from the ace
header, the package maintainer forces users of ACE to define it
explicity (either in their code or via a compiler flag). However, this
undermines one of the primary benefits of ACE -- portability (see
http://www.cs.wustl.edu/~schmidt/ACE-overview.html); ACE is supposed
to shield it users from such platform-dependent concerns.

To put it another way, I expect to be able to write the following
simple ACE-based C++ program (ace-bug.cc):

  #include <iostream>
  #include <ace/OS_main.h>

  int ACE_MAIN(int argc, char* argv[])
  {
    std::cout << "Hello, world" << std::endl;
    return 0;
  }

And I should be able to compile it with this command (on any platform
that ACE supports):

  g++ `pkg-config --cflags ACE` ace-bug.cc `pkg-config --libs ACE`

But, with the current implementation of the package, I get the error:

  In file included from /usr/include/ace/ACE_export.h:11,
                   from /usr/include/ace/OS_main.h:17,
                   from ace-bug.cc:3:
  /usr/include/ace/config-lite.h:71:7: error: #error _REENTRANT has to
be defined!

I think the best solution to this bug is to revert the config-lite.h
stanza shown above to its original form.

An alternate solution would be to modify the /usr/lib/pkgconfig/ACE.pc
so that it includes "-D_REENTRANT" in its Cflags section. However, I
consider this to be a weaker solution.

Thanks for your time,
Scott Fleming




More information about the Pkg-ace-devel mailing list