severity 484879 normal
tags 484879 +pending
thanks
On Sat, Jun 07, 2008 at 09:10:07AM +0200, Mike Hommey wrote:
> Package: e2fslibs-dev
> Version: 1.40.8-2
> Severity: important
>
> If a program using ext2fs public headers want to use some functions or
> features that are #ifdef'ed within conditionals that are defined at
> e2fsprogs build time, they just can't. Similarly, it would need to
> include sys/types.h itself to circumvent the lack of HAVE_SYS_TYPES_H.
>
> It's particularly a problem for WORDS_BIGENDIAN, because byte swapping
> macros won't do the right thing on big endians without defining
> WORDS_BIGENDIAN.
>
> There should be a config.h file, included in the headers, that set all
> these variables that are defined at build time but are required by
> headers.
The general design rule is that we try to avoid using any
autoconf-defined macros in the public header files. Some have slipped
in; the HAVE_SYS_TYPES_H was just to calm down some gcc -Wall
messages, for example. The use of WORDS_BIGENDIAN has been there much
longer, but in general hasn't been a problem because there really
isn't a good reason for external ext2 programs to use the ext2fs_*
byte swapping macros. So in practice this hasn't caused any problems
at all.
Still, it should be fixed, and the following diff will be checked into
e2fsprogs's tree.
- Ted
diff --git a/configure.in b/configure.in
index d4d6925..9a43f99 100644
--- a/configure.in
+++ b/configure.in
@@ -680,6 +680,25 @@ BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh
$ac_aux_dir/parse-types.sh
ASM_TYPES_HEADER=./asm_types.h
AC_SUBST_FILE(ASM_TYPES_HEADER)
dnl
+dnl Save the configuration #defines needed for the public ext2fs.h
+dnl header file
+dnl
+echo "/* These defines are needed for the public ext2fs.h header file */" \
+ > public_config.h
+if grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
+ uniq tmp_config.$$ >> public_config.h
+else
+ echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
+fi
+if grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
+ uniq tmp_config.$$ >> public_config.h
+else
+ echo "#undef WORDS_BIGENDIAN" >> public_config.h
+fi
+rm -f tmp_config.$$
+PUBLIC_CONFIG_HEADER=./public_config.h
+AC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
+dnl
dnl See if we have inttypes.h and if intptr_t is defined
dnl
AC_CHECK_HEADERS([inttypes.h])
diff --git a/lib/ext2fs/ext2_types.h.in b/lib/ext2fs/ext2_types.h.in
index 899476b..aa7ca3a 100644
--- a/lib/ext2fs/ext2_types.h.in
+++ b/lib/ext2fs/ext2_types.h.in
@@ -132,3 +132,5 @@ typedef signed long long __s64;
#undef __U64_TYPEDEF
#endif /* _*_TYPES_H */
+
[EMAIL PROTECTED]@
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]