Re: Data::UUID problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Grau wrote:
On Fri, Sep 02, 2005 at 12:24:05PM -0500, Steven Pritchard wrote:

I'm trying to build a package for Data::UUID.  Something, possibly the
from_string() function, apparently isn't 64-bit clean.  ("make test"
fails on x86_64 but works fine on i386.)  Unfortunately, I can't see
an obvious problem.  Well, I can't figure out what's going on in the
code really either...  :-)

Anyway, if there's anyone on this list that might be able to help me
figure this out, I'd really appreciate it.  The author doesn't seem to
be terribly responsive.


Not very responsive at all.  This same bug looks to have been reported
at rt.cpan.org on Jan 4, 2005 without response.

I took a quick look at the code.  These lines in UUID.h appear to be the
problem:

  typedef unsigned long      unsigned32;
  typedef unsigned short     unsigned16;
  typedef unsigned char      unsigned8;
  typedef unsigned char      byte;
  typedef unsigned long long unsigned64_t;
  typedef unsigned64_t       uuid_time_t;

I can't readily verify this right now, since I don't have access to an
x86_64 box, but I suspect that sizeof(long) is 4 on x86 and 8 on x86_64.
This would change the size of uuid_t and throw off the pointer
arithmetic done in from_string().

The program could probably be patched fairly easily with some #ifdefs to
handle the different architectures, but that's a pretty fundamental
change to be making in a distribution patch.

Attached patch appears to be in the spirit of what the author intended, and results in working "make test" on FC4 (i386) and RHEL3 (x86_64). RHEL3 is the only platform I have access to an x86_64 box with.

Paul.
--- Data-UUID-0.11/UUID.h	2005-09-08 10:22:53.000000000 +0100
+++ Data-UUID-0.11/UUID.h	2005-09-08 10:27:54.000000000 +0100
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <time.h>
+#include <sys/types.h>
 #include "md5.h"
 
 #if !defined INT2PTR
@@ -59,11 +60,11 @@
 
 #define CHECK(f1, f2) if (f1 != f2) RETVAL = f1 < f2 ? -1 : 1;
 
-typedef unsigned long      unsigned32;
-typedef unsigned short     unsigned16;
-typedef unsigned char      unsigned8;
-typedef unsigned char      byte;
-typedef unsigned long long unsigned64_t;
+typedef u_int32_t          unsigned32;
+typedef u_int16_t          unsigned16;
+typedef u_int8_t           unsigned8;
+typedef u_int8_t           byte;
+typedef u_int64_t          unsigned64_t;
 typedef unsigned64_t       uuid_time_t;
 
 #if   defined __solaris__ || defined __linux__

[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Legacy Announce]     [Fedora PHP Devel]     [Kernel Devel]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite Information]
  Powered by Linux