Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <3F269DE6.F6E94A57@acm.org> Date: Tue, 29 Jul 2003 09:16:38 -0700 From: David Rothenberger Reply-To: cygwin AT cygwin DOT com X-Accept-Language: en MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: 1.5.1: lseek64 woes (was Re: 1.5.1: unzip problems with binary files in archive) References: <16165 DOT 33853 DOT 968862 DOT 592625 AT phish DOT entomo DOT com> <20030729011247 DOT GB3099 AT redhat DOT com> <3F25CACF DOT 945DCBED AT acm DOT org> <20030729011846 DOT GC3099 AT redhat DOT com> <3F25F644 DOT 2090202 AT cwilson DOT fastmail DOT fm> <16166 DOT 5927 DOT 665592 DOT 841970 AT gargle DOT gargle DOT HOWL> <20030729154925 DOT GA16588 AT redhat DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Christopher Faylor wrote: > > On Mon, Jul 28, 2003 at 11:41:43PM -0700, David Rothenberger wrote: > Content-Description: message body text > >Charles Wilson writes: > > > Christopher Faylor wrote: > > > > > > >>>>I'm getting a strange error from unzip when trying to extract an > > > >>>>archive that contains binary files. Everything works fine if the > > > >>>>archive contains just text files. > > > >>> > > > >>>Can't duplicate it. Sorry. > > > >> > > > I --can-- duplicate it. But I don't know why it happens; I'll have to > > > debug it...but not until after I update to 1.5.1. FWIW, zip does use > > > fdopen(). > > > >I've done some debugging and I have a STC. I have no idea why it > >fails, and why Chris doesn't see it, but here's the info. > > > >The STC is composed of the two attached files: works.c and fails.c. > >Both files essentially do > > > > int fd = open("works.c", 0); > > lseek(fd, 1, 0); > > > >but works.c does this directly in main(), while fails.c does this in > >unzip() called from main(). As you can guess, lseek() returns -1 in > >fails.c and 1 in works.c. > > And here's why "fails.c" fails: > > --- lseek-fails.c~ 2003-07-29 11:43:29.428769079 -0400 > +++ lseek-fails.c 2003-07-29 11:46:01.911652780 -0400 > @@ -1,4 +1,5 @@ > #include > +#include > > void unzip() > { > > You need to include the prototype for lseek. > > cgf This is also why unzip fails. --- unzip-5.50/unzpriv.h 2003-07-29 09:10:41.325502400 -0700 +++ unzip-5.50-fixed/unzpriv.h 2003-07-29 09:08:48.783675200 -0700 @@ -200,6 +200,10 @@ typedef unsigned int extent; #endif /* ?MODERN */ +#ifdef __CYGWIN__ +# include +#endif + #ifndef MINIX /* Minix needs it after all the other includes (?) */ # include I spent WAY too much time on this for such a simple problem. Darn! Next time I'll know to look for prototypes if the strace output is strange. Dave -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/