git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Fernando J. Pereda" <ferdy@gentoo.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Teach mailsplit about Maildir's
Date: Fri, 27 Apr 2007 10:59:51 +0200	[thread overview]
Message-ID: <20070427085951.GC4690@ferdyx.org> (raw)
In-Reply-To: <7vd51qp57k.fsf@assigned-by-dhcp.cox.net>

[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]

On Fri, Apr 27, 2007 at 01:54:55AM -0700, Junio C Hamano wrote:
> "Fernando J. Pereda" <ferdy@gentoo.org> writes:
> 
> > +int split_maildir(const char *maildir, const char *dir, int nr_prec, int skip)
> >  {
> > ...
> > +	while ((maildent = readdir(mddir)) != NULL) {
> > +		FILE *f;
> > +
> > +		snprintf(file, sizeof(file), "%s/%s",
> > +				curdir, maildent->d_name);
> > +
> > +		if (maildent->d_name[0] == '.')
> > +			continue;
> >  ...
> > +		sprintf(name, "%s/%0*d", dir, nr_prec, ++skip);
> > +		split_one(f, name, 1);
> > +
> > +		fclose(f);
> > +	}
> > +
> > +	closedir(mddir);
> > +
> > +	ret = skip;
> > +out:
> > +	return ret;
> > +}
> 
> I do not personally deal with maildir so I do not know for sure,
> but this feels very wrong.
> 
> What order are you emitting the output?
> 
> split_mbox() is designed to number the messages the same order
> as they are found in the mailbox, but the above loop relies on
> readdir() to give them in a reasonable order to you, which does
> not seem a right assumption to me (otherwise "/bin/ls" and
> friends would not sort what they read from the filesystem would
> they?).

It is indeed very wrong. You can't sort them without opening and parsing
the headers. Please drop this patch.

Sorry for the noise.

- ferdy

-- 
Fernando J. Pereda Garcimartín
20BB BDC3 761A 4781 E6ED  ED0B 0A48 5B0C 60BD 28D4

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2007-04-27  9:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-26 19:24 [PATCH] Teach mailsplit about Maildir's Fernando J. Pereda
2007-04-27  8:30 ` Fernando J. Pereda
2007-04-27  8:54 ` Junio C Hamano
2007-04-27  8:59   ` Fernando J. Pereda [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-05-20 18:14 Fernando J. Pereda
2007-05-20 18:36 ` Junio C Hamano
2007-05-20 18:49   ` Alex Riesen
2007-05-20 19:00     ` Fernando J. Pereda
2007-05-20 20:35       ` Alex Riesen
2007-05-20 20:44         ` Fernando J. Pereda
2007-05-20 18:53   ` Johan Herland
2007-05-20 19:18     ` Fernando J. Pereda
2007-05-20 19:27       ` Johan Herland
2007-05-21 12:55       ` Johannes Schindelin
2007-05-21  3:15 ` Junio C Hamano
2007-05-21 12:56   ` Johannes Schindelin
2007-05-21 18:17     ` Fernando J. Pereda
2007-05-21 18:20   ` Fernando J. Pereda
2007-05-24 19:47     ` Junio C Hamano
2007-05-24 19:56       ` Fernando J. Pereda
2007-05-24 20:12         ` Junio C Hamano
2007-05-24 22:15           ` Fernando J. Pereda

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070427085951.GC4690@ferdyx.org \
    --to=ferdy@gentoo.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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.
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 NNTP newsgroup(s).