SEEK_DATA should fail at EOF (was: coreutils-9.6-1 (TEST): cp: infinite SEEK_SET/DATA/HOLE loop if file is compressed)

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Feb 17 10:00:48 GMT 2025


On Feb 15 12:18, Christian Franke via Cygwin wrote:
> Corinna Vinschen via Cygwin wrote:
> > On Feb 14 14:14, Corinna Vinschen via Cygwin wrote:
> > > On Feb 14 13:49, Corinna Vinschen via Cygwin wrote:
> > > > On Feb 14 12:24, Christian Franke via Cygwin wrote:
> > > > > Hmm... does "beyond" mean '>=' or '>' ?
> > > > ...do you think this fixes it?
> > > > 
> > > > diff --git a/winsup/cygwin/fhandler/base.cc b/winsup/cygwin/fhandler/base.cc
> > > > index 8f3dbd4ed51a..79dfaaa5987a 100644
> > > > --- a/winsup/cygwin/fhandler/base.cc
> > > > +++ b/winsup/cygwin/fhandler/base.cc
> > > > @@ -1144,7 +1144,7 @@ fhandler_base::lseek (off_t offset, int whence)
> > > >   	    return -1;
> > > >   	  }
> > > >   	/* Per Linux man page, ENXIO if offset is beyond EOF */
> > > > -	if (offset > fsi.EndOfFile.QuadPart)
> > > > +	if (offset >= fsi.EndOfFile.QuadPart)
> > > >   	  {
> > > >   	    set_errno (ENXIO);
> > > >   	    return -1;
> > > Yeah, it does.  I'll push the patch.
> > Patch is in the latest cygwin-3.6.0-0.373.gfac7441835b0
> > test release.
> > 
> > We're probably releasing 3.6 in the next few weeks.
> > 
> 
> Problem does not longer occur with 3.6.0-0.374.g4dd859d01c22.x86_64 and cp
> from coreutils-9.6-1.

Great, thanks for checking!


Corinna


More information about the Cygwin mailing list