Nothing wrong with the patch per se but there's more
than testing for sys/endian.h that needs to be done.

There's breakage in colliding WORDS_BIGENDIAN et al, beecrypt
has internal m4 tests that set WORDS_BIGENDIAN, and there are platforms
that are missing endian.h entirely but need WORDS_BIGENDIAN defined
correctly.

It more a tedious issue than anything else. The proper fix (imho)
is to arrange for a run-time, not a compiled in AutoFu check, test for 
endianness.

The run-time test has been implemented 5 or 6 places in RPM code, and
isn't very hard to do (but does involve a union).

So the better fix is not to include endian.h anywhere.

73 de Jeff

On Jun 28, 2011, at 8:26 AM, Pinto Elia wrote:

>  RPM Package Manager, CVS Repository
>  http://rpm5.org/cvs/
>  ____________________________________________________________________________
> 
>  Server: rpm5.org                         Name:   Pinto Elia
>  Root:   /v/rpm/cvs                       Email:  devzero2...@rpm5.org
>  Module: rpm                              Date:   28-Jun-2011 14:26:11
>  Branch: rpm-5_4                          Handle: 2011062812261001
> 
>  Modified files:           (Branch: rpm-5_4)
>    rpm                     CHANGES configure.ac
>    rpm/tools               dbconvert.c
> 
>  Log:
>    merge from HEAD afb patch portability of endian
> 
>  Summary:
>    Revision    Changes     Path
>    1.3501.2.144+1  -0      rpm/CHANGES
>    2.472.2.25  +2  -2      rpm/configure.ac
>    2.1.2.6     +10 -1      rpm/tools/dbconvert.c
>  ____________________________________________________________________________
> 
>  patch -p0 <<'@@ .'
>  Index: rpm/CHANGES
>  ============================================================================
>  $ cvs diff -u -r1.3501.2.143 -r1.3501.2.144 CHANGES
>  --- rpm/CHANGES      28 Jun 2011 12:01:47 -0000      1.3501.2.143
>  +++ rpm/CHANGES      28 Jun 2011 12:26:10 -0000      1.3501.2.144
>  @@ -1,4 +1,5 @@
>   5.4.1 -> 5.4.2
>  +    - devzero2000: merge afb patch portability of endian
>       - proyvind: check-multiarch-files: remove unnecessary import of 
> MDK::Common,
>       causing undesired dependency from perl dependency generator.
>       - devzero2000: add a simple usage command to devtool
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/configure.ac
>  ============================================================================
>  $ cvs diff -u -r2.472.2.24 -r2.472.2.25 configure.ac
>  --- rpm/configure.ac 20 Jun 2011 12:33:27 -0000      2.472.2.24
>  +++ rpm/configure.ac 28 Jun 2011 12:26:10 -0000      2.472.2.25
>  @@ -672,8 +672,8 @@
>   dnl # standard headers (generic)
>   AC_CHECK_HEADERS([dnl
>       fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h dnl
>  -    signal.h sys/ipc.h sys/socket.h sys/select.h sys/time.h dnl
>  -    sys/types.h sys/stdtypes.h sys/mman.h sys/resource.h dnl
>  +    signal.h sys/endian.h sys/ipc.h sys/socket.h sys/select.h dnl
>  +    sys/time.h sys/types.h sys/stdtypes.h sys/mman.h sys/resource.h dnl
>       sys/utsname.h sys/prctl.h sys/wait.h netinet/in_systm.h dnl
>       machine/types.h mntent.h sys/mnttab.h sys/systemcfg.h dnl
>       sys/param.h sys/mount.h sys/mntctl.h sys/vmount.h dnl
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/tools/dbconvert.c
>  ============================================================================
>  $ cvs diff -u -r2.1.2.5 -r2.1.2.6 dbconvert.c
>  --- rpm/tools/dbconvert.c    2 Jun 2011 17:39:41 -0000       2.1.2.5
>  +++ rpm/tools/dbconvert.c    28 Jun 2011 12:26:11 -0000      2.1.2.6
>  @@ -18,9 +18,18 @@
>   #include <rpmts.h>
>   #include <rpmlog.h>
> 
>  +#ifdef HAVE_SYS_ENDIAN_H
>  +#include <sys/endian.h>
>  +#endif
>  +#ifdef __APPLE__
>  +#include <libkern/OSByteOrder.h>
>  +
>  +#define htobe32(x) OSSwapHostToBigInt32(x)
>  +#define htole32(x) OSSwapHostToLittleInt32(x)
>  +#endif /* __APPLE__ */
>   #if BYTE_ORDER == LITTLE_ENDIAN
>   #define bswap32(x) htobe32(x)
>  -#elif __BYTE_ORDER == BIG_ENDIAN
>  +#elif BYTE_ORDER == BIG_ENDIAN
>   #define bswap32(x) htole32(x)
>   #endif
> 
>  @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-...@rpm5.org

______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        rpm-devel@rpm5.org

Reply via email to