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 77669431FBC for ; Thu, 14 Jan 2010 22:47:18 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 1.595 X-Spam-Level: * X-Spam-Status: No, score=1.595 tagged_above=-999 required=5 tests=[AWL=1.594, BAYES_50=0.001] 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 czkBgf612ibv for ; Thu, 14 Jan 2010 22:47:15 -0800 (PST) Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115]) by olra.theworths.org (Postfix) with ESMTP id 7CEFF431FAE for ; Thu, 14 Jan 2010 22:47:15 -0800 (PST) Received: from djcbsoftware.nl (a88-114-93-212.elisa-laajakaista.fi [88.114.93.212]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by gw01.mail.saunalahti.fi (Postfix) with ESMTP id 30069151707; Fri, 15 Jan 2010 08:47:11 +0200 (EET) Received: from cthulhu.mindcrime.djcbsoftware.nl (localhost [127.0.0.1]) by djcbsoftware.nl (Postfix) with ESMTP id 81841456098; Fri, 15 Jan 2010 08:47:10 +0200 (EET) Date: Fri, 15 Jan 2010 08:47:10 +0200 Message-ID: <878wbzx3td.wl%djcb@djcbsoftware.nl> From: Dirk-Jan C. Binnema To: Olly Betts In-Reply-To: References: <4B4ED7E8.20501@exys.org> <878wc0623y.fsf@exys.org> <20100114183854.1d04f111@hikari> <87fx68e2am.fsf@yoom.home.cworth.org> Mail-Reply-To: djcb@djcbsoftware.nl User-Agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/23.1 Mule/6.0 (HANACHIRUSATO) Organization: DJCBSoftware MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: notmuch@notmuchmail.org Subject: Re: [notmuch] indexing mail? X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: djcb@djcbsoftware.nl 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 06:47:18 -0000 >>>>> "Olly" == Olly Betts writes: Olly> On 2010-01-14, Carl Worth wrote: >> On Thu, 14 Jan 2010 18:38:54 +0100, Adrian Perez de Castro wrote: >>> I am using XFS, which always returns DT_UNKNOWN. Taking into account that >>> there is a good deal of people using filesystems other than the ones you >>> mention, and that other non-linux filesystems may also return DT_UNKNOWN, >>> in my opinion there should be a fall-back. I will try to post a patch >>> Anytime Soon=E2=84=A2. >> >> We definitely want the fallback. I can attempt to code it, but I don't >> have ready access to an afflicted filesystem, so I'd need help testing >> anyway. >> >> I'd love to see a patch for this bug soon. Be sure to CC me when the >> patch is sent and that will help me commit it sooner. 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 I take a slighly different approach in mu: /* if the file system does not support entry->d_type, we add it ourselves * this is slower (extra stat) but at least it works */ static gboolean _set_dtype (const char* path, struct dirent *entry) { struct stat statbuf; char fullpath[4096]; snprintf (fullpath, sizeof(fullpath), "%s%c%s", path, G_DIR_SEPARATOR, entry->d_name); if (stat (fullpath, &statbuf) != 0) { g_warning ("stat failed on %s: %s", fullpath, strerror(errno)); return FALSE; } /* 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; return TRUE; } and then in some other places: /* handle FSs that don't support entry->d_type */ if (entry->d_type == DT_UNKNOWN) _set_dtype (dirname, entry); Note, that is untested as of yet. Best wishes, Dirk. -- Dirk-Jan C. Binnema Helsinki, Finland e:djcb@djcbsoftware.nl w:www.djcbsoftware.nl pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C