delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/08/10:31:37

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 8 Jan 2009 16:31:11 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: find assert (was Re: [1.7] System reboot (udfs.sys),...)
Message-ID: <20090108153111.GA18089@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <495A4B87 DOT 3080009 AT partners DOT org> <20081230170638 DOT GB5230 AT ednor DOT casa DOT cgf DOT cx> <20081230174104 DOT GD5230 AT ednor DOT casa DOT cgf DOT cx> <20081230175246 DOT GE5230 AT ednor DOT casa DOT cgf DOT cx> <20081230190603 DOT GA13443 AT ednor DOT casa DOT cgf DOT cx>
MIME-Version: 1.0
In-Reply-To: <20081230190603.GA13443@ednor.casa.cgf.cx>
User-Agent: Mutt/1.5.17 (2007-11-01)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019