home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / compress / 4800 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  2.9 KB

  1. Path: sparky!uunet!mcsun!julienas!chorus!octave.chorus.fr!jloup
  2. From: jloup@chorus.fr (Jean-loup Gailly)
  3. Newsgroups: comp.compression
  4. Subject: Re: Another Info-ZIP problem
  5. Message-ID: <1870@chorus.chorus.fr>
  6. Date: 25 Jan 93 17:18:36 GMT
  7. References: <1993Jan21.224456.11475@lugb.latrobe.edu.au>
  8. Sender: jloup@chorus.chorus.fr
  9. Reply-To: jloup@chorus.fr (Jean-loup Gailly)
  10. Lines: 83
  11.  
  12. Graeme Cross <chegc@lure.latrobe.edu.au> writes:
  13.  
  14. > If you say: ZIP -m9 TEST e:*.*  you will find that ZIP moves the original 
  15. > TEST.ZIP into the new TEST.ZIP file, resulting in an empty directory!
  16.  
  17. The fix for this problem is given below.
  18.  
  19. > Note also that the current release of PKZIP does not manifest this problem.
  20.  
  21. Not this one, but a close friend:
  22.  
  23. C:\TMP>mkdir d
  24. C:\TMP>echo hi > d\hi
  25. C:\TMP>pkzip -P d\ghost d\hi
  26. PKZIP (R)   FAST!   Create/Update Utility   Version 2.04c   12-28-92
  27. [...]
  28. Creating ZIP: D/GHOST.ZIP
  29.   Adding: D/HI  Storing   ( 0%), done.
  30.  
  31. C:\TMP>pkzip -mP d\ghost d\ghost.zip
  32. [...]
  33. Updating ZIP: D/GHOST.ZIP
  34.   Adding: D/GHOST.ZIP  Deflating  (44%), done.
  35. Moving files, done.
  36.  
  37. C:\TMP>dir d
  38. [...]
  39. .            <REP>     01-23-93  12:07p
  40. ..           <REP>     01-23-93  12:07p
  41. HI                   5 01-23-93  12:07p
  42.         3 fichier(s)          5 octets
  43.  
  44.  
  45. My patch was made in a few minutes, but I could not work on zip
  46. until yesterday, sorry. Now wait for the same fix from PKWARE.
  47.  
  48. Please send bug reports on zip and unzip to zip-bugs@wkuvx1.bitnet.
  49.  
  50. Jean-loup Gailly
  51. info-zip
  52.  
  53. *** zip19p1/fileio.c    Wed Aug 26 18:53:38 1992
  54. --- new/fileio.c    Mon Jan 25 18:05:32 1993
  55. ***************
  56. *** 305,310 ****
  57. --- 305,313 ----
  58.   
  59.   /* Local globals (kinda like "military intelligence" or "broadcast quality") */
  60.   local int exflag = 0;           /* Exclude flag */
  61. + local struct stat zipstatb;
  62. + local int zipstate = -1;
  63. + /* -1 unknown, 0 old zip file exists, 1 new zip file */
  64.   
  65.   #ifdef VMS
  66.     typedef int statime;
  67. ***************
  68. *** 1155,1160 ****
  69. --- 1158,1182 ----
  70.       }
  71.       else
  72.       {
  73. +       /* Check that we are not adding the zip file to itself. This
  74. +        * catches cases like "zip -m foo ../dir/foo.zip".
  75. +        */
  76. +       struct stat statb;
  77. +       if (zipstate == -1)
  78. +          zipstate = strcmp(zipfile, "-") != 0 &&
  79. +                      stat(zipfile, &zipstatb) == 0;
  80. +       if (zipstate == 1 && (statb = zipstatb, stat(n, &statb) == 0
  81. +         && zipstatb.st_mode  == statb.st_mode
  82. +     && zipstatb.st_ino   == statb.st_ino
  83. +     && zipstatb.st_dev   == statb.st_dev
  84. +     && zipstatb.st_uid   == statb.st_uid
  85. +     && zipstatb.st_gid   == statb.st_gid
  86. +     && zipstatb.st_size  == statb.st_size
  87. +     && zipstatb.st_mtime == statb.st_mtime
  88. +     && zipstatb.st_ctime == statb.st_ctime))
  89. +         /* Don't compare a_time since we are reading the file */
  90. +            return ZE_OK;
  91.         /* allocate space and add to list */
  92.         if ((f = (struct flist far *)farmalloc(sizeof(struct flist))) == NULL ||
  93.             (f->name = malloc(strlen(n) + 1 + PAD)) == NULL)
  94.