[comp.sources.bugs] zoo timezone bug fix

dhesi@bsu-cs.UUCP (Rahul Dhesi) (02/22/89)

I was sent the following bug fix for the zoo timezone bug.  It changes
the timezone field to a signed quantity.  I have not tested it.  It
looks like it should work.  It does not introduce any incompatibility.

This fix should be needed only if you are t hours east of GMT, such
that 0 < t < 12, and if GETTZ is defined at compilation time.  Thanks
to Thomas P.S. Olesen <mcvax!dkuug!dde!tpo> for this.

---------------------cut------------------------------------------
*** portable.c.ori
--- portable.c
**************
*** 20,25
  For machine-dependent declarations see files "machine.h" and "options.h". 
  
  For machine-dependent functions see file "machine.c"
  */
  
  #include "zooio.h"
--- 20,27 -----
  For machine-dependent declarations see files "machine.h" and "options.h". 
  
  For machine-dependent functions see file "machine.c"
+ CHANGES:
+    changed tz in direntry to signed char      (Thomas  P. Olesen   tpo@dde.dk)
  */
  
  #include "zooio.h"
**************
*** 496,502
     if (direntry->type == 2) { /* handle stuff relevant to type 2 */
        cursize = SIZ_DIRL;
        fixsize = SIZ_DIRL;
!       bytes[TZ_I] = direntry->tz;
        assert(direntry->namlen < 256 && direntry->namlen >= 0);
  		cursize += 2;        /* space for namlen and dirlen */
        if (direntry->namlen != 0) {
--- 498,504 -----
     if (direntry->type == 2) { /* handle stuff relevant to type 2 */
        cursize = SIZ_DIRL;
        fixsize = SIZ_DIRL;
!       bytes[TZ_I] = (uchar)direntry->tz;
        assert(direntry->namlen < 256 && direntry->namlen >= 0);
  		cursize += 2;        /* space for namlen and dirlen */
        if (direntry->namlen != 0) {
**************
*** 594,600
        assert(direntry->var_dir_len <= MAXDIRSIZE);
        if (direntry->var_dir_len > MAXDIRSIZE)
           direntry->var_dir_len = MAXDIRSIZE;
!       direntry->tz = bytes[TZ_I];   
        if (direntry->var_dir_len > 0)
           direntry->namlen = bytes[NAMLEN_I];
        if (direntry->var_dir_len > 1)
--- 596,602 -----
        assert(direntry->var_dir_len <= MAXDIRSIZE);
        if (direntry->var_dir_len > MAXDIRSIZE)
           direntry->var_dir_len = MAXDIRSIZE;
!       direntry->tz = (char)bytes[TZ_I];   
        if (direntry->var_dir_len > 0)
           direntry->namlen = bytes[NAMLEN_I];
        if (direntry->var_dir_len > 1)
*** zoo.h.orig
--- zoo.h
**************
*** 49,54
  The directory entry of each file will contain the minimum version number of
  Zoo needed to extract that file.  As far as possible, version 1.00 of Zoo
  will be able to extract files from future version archives.
  */
  
  #define H_TYPE	1				/* archive header type */
--- 49,57 -----
  The directory entry of each file will contain the minimum version number of
  Zoo needed to extract that file.  As far as possible, version 1.00 of Zoo
  will be able to extract files from future version archives.
+ -------------------------------------------------------------------------
+ CHANGES:
+    changed tz in direntry to signed char      (Thomas  P. Olesen   tpo@dde.dk)
  */
  
  #define H_TYPE	1				/* archive header type */
**************
*** 122,128
     char fname[FNAMESIZE]; 		/* filename */
  
     int var_dir_len;           /* length of variable part of dir entry */
!    uchar tz;                   /* timezone where file was archived */
     unsigned int dir_crc;      /* CRC of directory entry */
  
     /* fields for variable part of directory entry follow */
--- 125,131 -----
     char fname[FNAMESIZE]; 		/* filename */
  
     int var_dir_len;           /* length of variable part of dir entry */
!    char tz;                   /* timezone where file was archived */
     unsigned int dir_crc;      /* CRC of directory entry */
  
     /* fields for variable part of directory entry follow */
-- end of patch --
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi
                    ARPA:  bsu-cs!dhesi@iuvax.cs.indiana.edu

gordon@sneaky.TANDY.COM (Gordon Burditt) (02/23/89)

>I was sent the following bug fix for the zoo timezone bug.  It changes
>the timezone field to a signed quantity.  I have not tested it. 
...
>This fix should be needed only if you are t hours east of GMT, such
>that 0 < t < 12, and if GETTZ is defined at compilation time.  Thanks
      ^^^^^^^^^^
>to Thomas P.S. Olesen <mcvax!dkuug!dde!tpo> for this.

A minor nit here:  the valid range of timezone offsets east of GMT is
minus twelve hours to plus thirteen hours, inclusive.  In UNIX and ZOO
terms, that's minus thirteen to plus twelve hours WEST of GMT.  
The timezone offsets minus twelve and plus twelve are not the same,
and neither are the minus thirteen and plus eleven timezones.

Why is there a minus thirteen zone?  There are quite a few politically-inspired
deviations in the International Date Line, especially around Siberia and
Pacific islands south of it.  Some countries didn't like the idea of having 
such a large time jump between parts of the same country.  I forget
exactly where, but there really is land in the minus thirteen zone.

The minus twelve and plus twelve zones would exist even if the International
Date Line were a straight line.  They ARE different.

				Gordon L. Burditt
				...!texbell!sneaky!gordon