Mail Archives: cygwin/2009/01/08/10:31:37
On Dec 30 14:06, Christopher Faylor wrote:
> On Tue, Dec 30, 2008 at 12:52:46PM -0500, Christopher Faylor wrote:
> >Hmm. After removing the /dev/fd directory that I had created years
> >ago, find now just SEGVs. And, it seems to be dying in find itself
> >if the stack dump is any indication.
> >
> >Eric, is there any way that you could confirm or deny this? I would
> >rather not build a debugging version of find if I don't have to.
>
> It was stupid of me to assume that this was just a generic find problem.
> If I'd actually checked the error log I would have seen this:
>
> assertion "state.type != 0" failed: file "/usr/src/findutils-4.5.3-1/src/findutils-4.5.3/find/ftsfind.c", line 475, function: consider_visiting
>
> This is apparently caused by a symlink that looks like this:
>
> lrwxrwxrwx 1 cgf None 6 Jul 9 2005 n -> //none
>
> I don't remember creating that symlink. Apparently I was checking on
> creating symlinks to nonexistent domains back in 2005.
>
> I don't know if this is a find bug or a cygwin bug. I could see it
> being either or both.
It looks like a find bug to me.
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.
Additionally, consider that the BSD variant of fts_read as used by Cygwin
memset's fts_statp to 0 in the FTS_NS case. Consequentially:
state.have_type = !!ent->fts_statp->st_mode
==> state.have_type = 0
==> state.type = 0
==> assert (state.type != 0) FAILs
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/
- Raw text -