home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!julienas!chorus!octave.chorus.fr!jloup
- From: jloup@chorus.fr (Jean-loup Gailly)
- Newsgroups: comp.compression
- Subject: Re: Another Info-ZIP problem
- Message-ID: <1870@chorus.chorus.fr>
- Date: 25 Jan 93 17:18:36 GMT
- References: <1993Jan21.224456.11475@lugb.latrobe.edu.au>
- Sender: jloup@chorus.chorus.fr
- Reply-To: jloup@chorus.fr (Jean-loup Gailly)
- Lines: 83
-
- Graeme Cross <chegc@lure.latrobe.edu.au> writes:
-
- > If you say: ZIP -m9 TEST e:*.* you will find that ZIP moves the original
- > TEST.ZIP into the new TEST.ZIP file, resulting in an empty directory!
-
- The fix for this problem is given below.
-
- > Note also that the current release of PKZIP does not manifest this problem.
-
- Not this one, but a close friend:
-
- C:\TMP>mkdir d
- C:\TMP>echo hi > d\hi
- C:\TMP>pkzip -P d\ghost d\hi
- PKZIP (R) FAST! Create/Update Utility Version 2.04c 12-28-92
- [...]
- Creating ZIP: D/GHOST.ZIP
- Adding: D/HI Storing ( 0%), done.
-
- C:\TMP>pkzip -mP d\ghost d\ghost.zip
- [...]
- Updating ZIP: D/GHOST.ZIP
- Adding: D/GHOST.ZIP Deflating (44%), done.
- Moving files, done.
-
- C:\TMP>dir d
- [...]
- . <REP> 01-23-93 12:07p
- .. <REP> 01-23-93 12:07p
- HI 5 01-23-93 12:07p
- 3 fichier(s) 5 octets
-
-
- My patch was made in a few minutes, but I could not work on zip
- until yesterday, sorry. Now wait for the same fix from PKWARE.
-
- Please send bug reports on zip and unzip to zip-bugs@wkuvx1.bitnet.
-
- Jean-loup Gailly
- info-zip
-
- *** zip19p1/fileio.c Wed Aug 26 18:53:38 1992
- --- new/fileio.c Mon Jan 25 18:05:32 1993
- ***************
- *** 305,310 ****
- --- 305,313 ----
-
- /* Local globals (kinda like "military intelligence" or "broadcast quality") */
- local int exflag = 0; /* Exclude flag */
- + local struct stat zipstatb;
- + local int zipstate = -1;
- + /* -1 unknown, 0 old zip file exists, 1 new zip file */
-
- #ifdef VMS
- typedef int statime;
- ***************
- *** 1155,1160 ****
- --- 1158,1182 ----
- }
- else
- {
- + /* Check that we are not adding the zip file to itself. This
- + * catches cases like "zip -m foo ../dir/foo.zip".
- + */
- + struct stat statb;
- + if (zipstate == -1)
- + zipstate = strcmp(zipfile, "-") != 0 &&
- + stat(zipfile, &zipstatb) == 0;
- + if (zipstate == 1 && (statb = zipstatb, stat(n, &statb) == 0
- + && zipstatb.st_mode == statb.st_mode
- + && zipstatb.st_ino == statb.st_ino
- + && zipstatb.st_dev == statb.st_dev
- + && zipstatb.st_uid == statb.st_uid
- + && zipstatb.st_gid == statb.st_gid
- + && zipstatb.st_size == statb.st_size
- + && zipstatb.st_mtime == statb.st_mtime
- + && zipstatb.st_ctime == statb.st_ctime))
- + /* Don't compare a_time since we are reading the file */
- + return ZE_OK;
- +
- /* allocate space and add to list */
- if ((f = (struct flist far *)farmalloc(sizeof(struct flist))) == NULL ||
- (f->name = malloc(strlen(n) + 1 + PAD)) == NULL)
-