This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: find assert (was Re: [1.7] System reboot (udfs.sys),...)


On Jan  8 16:36, Eric Blake wrote:
> Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
> > The assertion is basically
> > 
> >   if (ent->fts_info == FTS_NSOK || ent->fts_info == FTS_NS)
> >     assert (state.type != 0);
> > 
> > state.type is set in the calling function find() like this:
> > 
> >   while ( (ent=fts_read(p)) != NULL )
> >     {
> >       state.have_type = !!ent->fts_statp->st_mode;
> >       state.type = state.have_type ? ent->fts_statp->st_mode : 0;
> >     }
> > 
> > which is a bug, AFAICS.  The reason is that per the fts_read man page
> > the value of ent->fts_statp is undefined if ent->fts_info is FTS_NSOK
> > or FTS_NS.  So the values of state.have_type and consequentially
> > state.type are undefined as well and the above assertion makes no sense.
> 
> find uses gnulib's implementation of fts, not cygwin's.
> [...]
> I also know about a recent upstream patch that fixed the use of an 
> uninitialized variable related to st_mode, that was not part of findutils 
> 4.5.3.  I'm not sure if it is related to this particular issue, but it is a 
> possibility.

That's what happens in gnulib's fts in case of returning FTS_NS:

  memset(sbp, 0, sizeof(struct stat));
  return (FTS_NS);

So st_mode is 0 here, too and the same problem occurs.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]