From: Dirk-Jan C. Binnema <djcb.bulk@gmail.com>
To: Olly Betts <olly@survex.com>
Cc: notmuch@notmuchmail.org
Subject: Re: indexing mail?
Date: Fri, 15 Jan 2010 21:57:32 +0200 [thread overview]
Message-ID: <87pr5bw383.wl%djcb@djcbsoftware.nl> (raw)
In-Reply-To: <slrnhl06bt.2rf.olly@msgid.survex.com>
Hi Olly,
>>>>> "Olly" == Olly Betts <olly@survex.com> writes:
Olly> On 2010-01-15, Dirk-Jan C Binnema wrote:
>>>>>>> "Olly" == Olly Betts <olly@survex.com> 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)
Olly> Underscore prefixed identifiers are reserved by ISO C at file-scope;
Olly> using them yourself is undefined behaviour...
Ah, thanks for reminding, I thought it was __ and _C (capital), but you are
right:
,---- (7.1.3 Reserved identifiers)
| All identifiers that begin with an underscore and either an uppercase letter
| or another underscore are always reserved for any use.
|
| — All identifiers that begin with an underscore are always reserved for use as
| identifiers with file scope in both the ordinary and tag name spaces.
`----
>> /* 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;
Olly> This addresses the case where the FS returns DT_UNKNOWN for d_type,
Olly> but doesn't deal with the case of platforms where struct dirent has
Olly> no d_type member - from the Linux readdir man page:
Olly> The only fields in the dirent structure that are mandated by
Olly> POSIX.1 are: d_name[], of unspecified size, with at most NAME_MAX
Olly> characters preceding the terminating null byte; and (as an XSI
Olly> extension) d_ino. The other fields are unstandardized, and not
Olly> present on all systems; see NOTES below for some further details.
Olly> And in NOTES:
Olly> Other than Linux, the d_type field is available mainly only on BSD
Olly> systems.
Yes, my patch could me generalized a bit more, just like your patch could not
hardcode the '/'-separator :)
In practice though, what Unices in use today do not support d_type?
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
next prev parent reply other threads:[~2010-01-15 19:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-14 8:38 indexing mail? Arvid Picciani
2010-01-14 17:13 ` Arvid Picciani
2010-01-14 17:38 ` Adrian Perez de Castro
2010-01-14 22:42 ` Carl Worth
2010-01-15 3:28 ` Olly Betts
2010-01-15 6:47 ` Dirk-Jan C. Binnema
2010-01-15 7:27 ` Arvid Picciani
2010-01-23 6:09 ` Carl Worth
2010-01-23 6:28 ` Jesse Rosenthal
2010-01-23 9:47 ` Carl Worth
2010-01-23 14:29 ` Arvid Picciani
2010-01-23 14:34 ` Arvid Picciani
2010-01-15 7:30 ` Olly Betts
2010-01-15 19:57 ` Dirk-Jan C. Binnema [this message]
2010-01-15 20:15 ` Carl Worth
2010-01-15 21:41 ` Olly Betts
2010-01-16 15:20 ` Dirk-Jan C. Binnema
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pr5bw383.wl%djcb@djcbsoftware.nl \
--to=djcb.bulk@gmail.com \
--cc=djcb@djcbsoftware.nl \
--cc=notmuch@notmuchmail.org \
--cc=olly@survex.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).