delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/09/06:46:03

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 9 Jan 2009 12:45:35 +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: <20090109114535.GG19133@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> <20090108153111 DOT GA18089 AT calimero DOT vinschen DOT de> <loom DOT 20090108T162816-939 AT post DOT gmane DOT org>
MIME-Version: 1.0
In-Reply-To: <loom.20090108T162816-939@post.gmane.org>
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 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/

- Raw text -


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