From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 19 15:25:47 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 668CB106566C for ; Mon, 19 Mar 2012 15:25:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3A57B8FC17 for ; Mon, 19 Mar 2012 15:25:47 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id DE1DD46B2D; Mon, 19 Mar 2012 11:25:46 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6AD95B924; Mon, 19 Mar 2012 11:25:46 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Mon, 19 Mar 2012 09:30:09 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201203190930.09782.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 19 Mar 2012 11:25:46 -0400 (EDT) Cc: Matthew Story Subject: Re: FTSENT: name and path on `/' versus name and path on `*/' X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 15:25:47 -0000 On Thursday, March 15, 2012 4:46:03 pm Matthew Story wrote: > Found a curious incongruent behavior in fts(3), wondering if there is some > reason for this, or if it's just a bug. If you include the path > > `/' > > the FTSENT at depth 0 that is returned for the path has both fts_path = "/" > and fts_name = "/", compared to other entries, like /var which has fts_path > = "/" and fts_path = "/" and fts_name = "var", or /var/, which has fts_path > = "/var/" and fts_name = "". > > Given the behavior of other paths used in fts(3), my expectation here is > that FTSENT for path "/" on depth 0 would have fts_path = "/" and fts_name > = "". Haven't delved down into the code enough to figure out where this is > happening, but from a cursory read through libc/gen/fts.c there doesn't > seem to be any explicit special casing of the path "/". > > Can anyone shed light on why this behavior is desirable, or if it's just a > bug I'm happy to file a PR and delve further into fts.c ... My guess is that it is a bug. / is a bit special as it serves two purposes (i.e., both the idea of "/var" and "/var/" map to "/" for the root). -- John Baldwin