git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: William Giokas <1007380@gmail.com>, git@vger.kernel.org
Subject: Re: [bug report] git-am applying maildir patches in reverse
Date: Fri, 1 Mar 2013 18:05:08 -0500	[thread overview]
Message-ID: <20130301230508.GC862@sigill.intra.peff.net> (raw)
In-Reply-To: <20130301225231.GB862@sigill.intra.peff.net>

On Fri, Mar 01, 2013 at 05:52:31PM -0500, Jeff King wrote:

> > Note to bystanders.  This is coming from populate_maildir_list() in
> > builtin/mailsplit.c; the function claims to know what "maildir"
> > should look like, so it should be enforcing the ordering as
> > necessary by sorting the list, _if_ the implicit ordering given by
> > string_list_insert() is insufficient.
> [...]
> 
> I think it is a property of the maildir format that it does not
> technically define the message order. The order of items you get from
> readdir is filesystem specific and not necessarily defined (and that is
> what we use now). On my ext4 system, I do not even get them in backwards
> order; it is jumbled.

Hmph, sorry, I mistook string_list_insert for string_list_append. So we
do actually sort them by filename, not just random readdir order. But
due to this:

> The maildir spec explicitly says that readers should not make
> assumptions about the content of the filenames. Mutt happens to write
> them as:
> 
>   ${epoch_seconds}.${pid}_${seq}.${host}
> 
> so in practice, sorting them kind of works. Except that a series written
> out at once will all have the same timestamp and pid, and because ${seq}
> is not zero-padded, you have to actually parse up to there and do a
> numeric instead of byte-wise comparison.  So we can add a mutt-specific
> hack, but that's the best we can do. Other maildir writers (including
> future versions of mutt) will not necessarily do the same thing.

That ordering is not necessarily useful.

So one strategy could be to try harder to sort numeric elements
numerically. That is, to treat:

  1234.5678_90.foo

as the list

  {1234, '.', 5678, '_', 90, "foo"}

for the purposes of sorting (even though we do not necessarily know what
each piece means). That works for mutt and similar schemes (dovecot, for
example, does something like "M${seq}P${pid}"), but some systems may put
random bytes in the middle (the point of it is to create a unique name).

So it is somewhat against the maildir spec, but I think in practice it
would help.

-Peff

  reply	other threads:[~2013-03-01 23:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01 22:20 [bug report] git-am applying maildir patches in reverse William Giokas
2013-03-01 22:27 ` Junio C Hamano
2013-03-01 22:52   ` Jeff King
2013-03-01 23:05     ` Jeff King [this message]
2013-03-01 23:24       ` Junio C Hamano
2013-03-01 23:35         ` Jeff King
2013-03-01 23:57           ` Junio C Hamano
2013-03-02  0:38             ` Jeff King
2013-03-02  0:08           ` Junio C Hamano
2013-03-02  0:41             ` Jeff King
2013-03-02  8:44               ` Andreas Schwab
2013-03-03  6:22                 ` Junio C Hamano
2013-03-03  6:32                   ` Jeff King
2013-03-03  6:26                 ` Jeff King

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: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20130301230508.GC862@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=1007380@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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://80x24.org/mirrors/git.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).