Normally patches like this would go to htdig3-dev only, but this
seems of sufficient interest for most users about to upgrade or
that have already crashed, on sun-solaris-sparc or like platforms.

I've committed the following patch to the main CVS trunk
(Geoff, I'm not sure how you want check-ins done on the
htdig-3-1-x branch, so I refrained from messing with it).

It lets htdig finish successfully on the sun-sparc-solaris-2.5
machine I debugged on with the testcases I got (although I
stopped Frank's testcase after some 2100 pages), and to my
knowledge it was the only sparc-related bug that is in the way
for a successful upgrade from 3.1.0b4 to 3.1.0.

The bug was that I missed that some machines do not allow an
unaligned access for "unsigned short".  (Temporary insanity; I'm
not [normally] clueless about that issue...  Egg in my face.)

 Thanks to Antti and Frank for providing testcases.

There was also a bug in that a signed types were used for
temporary values when "expanding" a serialized value.
 May have caused the "BAD TAG IN SERIALIZED DATA" outputs (seen
on alphas), but only maybe.  If someone is experiencing that
problem, and has a setup (configuration file, etc) I can work on
using a guest account with a working gdb & gcc, I'd be happy to
track it down.  But please apply the attached patch (against
3.1.0) and rerun the digging before any such adventures:

Thu Feb 11 00:29:42 1999  Hans-Peter Nilsson  <[EMAIL PROTECTED]>

        * htcommon/DocumentRef.cc (NUM_ASSIGN): Expand from unsigned types.
        (getnum): Use temporary for "unsigned short", and memcpy data into
        it instead of assignment.

*** DocumentRef.cc.orig Wed Feb 10 01:26:07 1999
--- DocumentRef.cc      Wed Feb 10 23:44:13 1999
*************** void DocumentRef::Deserialize(String &st
*** 388,401 ****
  
  #define NUM_ASSIGN(to, from) \
   do {                                                                 \
!    if (sizeof(to) == sizeof(long int))                                \
!      MEMCPY_ASSIGN(to, from, long int);                               \
!    else if (sizeof(to) == sizeof(int))                                \
!      MEMCPY_ASSIGN(to, from, int);                                    \
!    else if (sizeof(to) == sizeof(short int))                          \
!      MEMCPY_ASSIGN(to, from, short int);                              \
!    else if (sizeof(to) == sizeof(char))                               \
!      MEMCPY_ASSIGN(to, from, char);                                   \
     /* else fatal error here? */                                       \
   } while (0)
  
--- 388,401 ----
  
  #define NUM_ASSIGN(to, from) \
   do {                                                                 \
!    if (sizeof(to) == sizeof(unsigned long int))                       \
!      MEMCPY_ASSIGN(to, from, unsigned long int);                      \
!    else if (sizeof(to) == sizeof(unsigned int))                       \
!      MEMCPY_ASSIGN(to, from, unsigned int);                           \
!    else if (sizeof(to) == sizeof(unsigned short int))                 \
!      MEMCPY_ASSIGN(to, from, unsigned short int);                     \
!    else if (sizeof(to) == sizeof(unsigned char))                      \
!      MEMCPY_ASSIGN(to, from, unsigned char);                          \
     /* else fatal error here? */                                       \
   } while (0)
  
*************** void DocumentRef::Deserialize(String &st
*** 407,413 ****
   }                                                                    \
   else if (type & SHORTSIZE_MARKER_BIT)                                \
   {                                                                    \
!    NUM_ASSIGN(var, *(unsigned short int *) in);                       \
     in += sizeof(unsigned short int);                                  \
   }                                                                    \
   else                                                                 \
--- 407,415 ----
   }                                                                    \
   else if (type & SHORTSIZE_MARKER_BIT)                                \
   {                                                                    \
!    unsigned short int _tmp0;                                          \
!    memcpy((char *) &_tmp0, (char *) (in), sizeof(unsigned short));    \
!    NUM_ASSIGN(var, _tmp0);                                            \
     in += sizeof(unsigned short int);                                  \
   }                                                                    \
   else                                                                 \

brgds, H-P
-- 
Hans-Peter Nilsson, Axis Communications AB, S - 223 70 LUND, SWEDEN
[EMAIL PROTECTED] | Tel +46 462701867,2701800
Fax +46 46136130 | RFC 1855 compliance implemented; report loss of brain.
------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.

Reply via email to