public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: find assert (was Re: [1.7] System reboot (udfs.sys),...)
Date: Thu, 08 Jan 2009 16:07:00 -0000	[thread overview]
Message-ID: <20090108153111.GA18089@calimero.vinschen.de> (raw)
In-Reply-To: <20081230190603.GA13443@ednor.casa.cgf.cx>

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/

  reply	other threads:[~2009-01-08 15:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30 16:27 System reboot (udfs.sys), cygwin 1.7 Gregory C. Sharp
2008-12-30 16:51 ` Larry Hall (Cygwin)
2008-12-30 17:07 ` [1.7] " Christopher Faylor
2008-12-30 17:42   ` Christopher Faylor
2008-12-30 17:53     ` [1.7] System reboot (udfs.sys), cygwin 1.7 (question for Eric Blake) Christopher Faylor
2008-12-30 19:06       ` find assert (was Re: [1.7] System reboot (udfs.sys),...) Christopher Faylor
2009-01-08 16:07         ` Corinna Vinschen [this message]
2009-01-08 16:46           ` Eric Blake
2009-01-09 12:29             ` Corinna Vinschen
2009-01-11  1:49               ` Eric Blake
2009-01-11  2:33               ` Eric Blake
2009-01-11  3:01         ` find assert Eric Blake
2009-01-11 13:34           ` Corinna Vinschen
2009-01-11 16:14             ` Eric Blake
2009-01-11 16:31               ` Corinna Vinschen
2008-12-31 21:26 find assert (was Re: [1.7] System reboot (udfs.sys),...) Gregory Sharp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090108153111.GA18089@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).