Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 50FAA431FBC for ; Thu, 14 Jan 2010 23:30:30 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.035 X-Spam-Level: X-Spam-Status: No, score=-2.035 tagged_above=-999 required=5 tests=[AWL=0.564, BAYES_00=-2.599] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cjvKTo2fkDwx for ; Thu, 14 Jan 2010 23:30:28 -0800 (PST) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by olra.theworths.org (Postfix) with ESMTP id 75A89431FAE for ; Thu, 14 Jan 2010 23:30:28 -0800 (PST) Received: from list by lo.gmane.org with local (Exim 4.50) id 1NVgdW-0005Xk-5m for notmuch@notmuchmail.org; Fri, 15 Jan 2010 08:30:26 +0100 Received: from ip-118-90-138-203.xdsl.xnet.co.nz ([118.90.138.203]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 15 Jan 2010 08:30:26 +0100 Received: from olly by ip-118-90-138-203.xdsl.xnet.co.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 15 Jan 2010 08:30:26 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: notmuch@notmuchmail.org From: Olly Betts Date: Fri, 15 Jan 2010 07:30:04 +0000 (UTC) Lines: 37 Message-ID: References: <4B4ED7E8.20501@exys.org> <878wc0623y.fsf@exys.org> <20100114183854.1d04f111@hikari> <87fx68e2am.fsf@yoom.home.cworth.org> <878wbzx3td.wl%djcb@djcbsoftware.nl> X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ip-118-90-138-203.xdsl.xnet.co.nz User-Agent: slrn/pre1.0.0-11 (Linux) Sender: news Subject: Re: [notmuch] indexing mail? X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2010 07:30:30 -0000 On 2010-01-15, Dirk-Jan C Binnema wrote: >>>>>> "Olly" == Olly Betts writes: > Olly> Not a full patch, but I already posted what this code should look like > Olly> to handle both systems without d_type, and those which return DT_UNKNOWN: > > Olly> http://article.gmane.org/gmane.mail.notmuch.general/1044 > static gboolean > _set_dtype (const char* path, struct dirent *entry) Underscore prefixed identifiers are reserved by ISO C at file-scope; using them yourself is undefined behaviour... > /* we only care about dirs, regular files and links */ > if (S_ISREG (statbuf.st_mode)) > entry->d_type = DT_REG; > else if (S_ISDIR (statbuf.st_mode)) > entry->d_type = DT_DIR; > else if (S_ISLNK (statbuf.st_mode)) > entry->d_type = DT_LNK; This addresses the case where the FS returns DT_UNKNOWN for d_type, but doesn't deal with the case of platforms where struct dirent has no d_type member - from the Linux readdir man page: The only fields in the dirent structure that are mandated by POSIX.1 are: d_name[], of unspecified size, with at most NAME_MAX characters preceding the terminating null byte; and (as an XSI extension) d_ino. The other fields are unstandardized, and not present on all systems; see NOTES below for some further details. And in NOTES: Other than Linux, the d_type field is available mainly only on BSD systems. Cheers, Olly