nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] sortm's Default of all is Brain-Damaged.


From: Ralph Corderoy
Subject: Re: [Nmh-workers] sortm's Default of all is Brain-Damaged.
Date: Thu, 11 Oct 2012 20:44:27 +0100

Hi Paul,

> kevin wrote:
>  > I have two use cases for sortm
>  > 
>  >  1.  sortm +folder
>  >  2.  sortm -textfield subject -limit 0 +folder
> 
> does that actually work for you?

I think so.  Initial conditions:

    $ type sortm
    sortm is hashed (/usr/bin/mh/sortm)
    $ g -w sortm ~/.mh_profile
    $
    $ s() { scan -forma '%(msg)  %{date}  %{subject}'; }
    $ s
    1  Thu, 03 Oct 2012 12:00:00 +0000  A
    2  Thu, 02 Oct 2012 12:00:00 +0000  A
    3  Thu, 02 Oct 2012 12:00:00 +0000  C
    4  Thu, 01 Oct 2012 12:00:00 +0000  B
    5  Thu, 01 Oct 2012 12:00:00 +0000  A
    $

I restore the folder to the above state before each sortm below.

    $ sortm
    $ s
    1  Thu, 01 Oct 2012 12:00:00 +0000  B
    2  Thu, 01 Oct 2012 12:00:00 +0000  A
    3  Thu, 02 Oct 2012 12:00:00 +0000  A
    4  Thu, 02 Oct 2012 12:00:00 +0000  C
    5  Thu, 03 Oct 2012 12:00:00 +0000  A
    $

This has sorted by date order, identical dates appear to have preserved
the original relative order of subject, e.g. 4->1, 5->2.  Is sortm
defined as a stable sort all other things being equal, or does that
defer to something like the platform's qsort(3)?

    $ sortm -textf subject
    $ s
    1  Thu, 01 Oct 2012 12:00:00 +0000  B
    2  Thu, 01 Oct 2012 12:00:00 +0000  A
    3  Thu, 02 Oct 2012 12:00:00 +0000  A
    4  Thu, 03 Oct 2012 12:00:00 +0000  A
    5  Thu, 02 Oct 2012 12:00:00 +0000  C
    $

Date then subject, with all `A's coming together as -nolimit is the
default, as sortm(1) says.

    $ sortm -textf subject -limit 0
    $ s
    1  Thu, 01 Oct 2012 12:00:00 +0000  A
    2  Thu, 02 Oct 2012 12:00:00 +0000  A
    3  Thu, 03 Oct 2012 12:00:00 +0000  A
    4  Thu, 01 Oct 2012 12:00:00 +0000  B
    5  Thu, 02 Oct 2012 12:00:00 +0000  C
    $

Subject then date, the one in question.  Looks good to me.  Ubuntu nmh
1.3-1.

Cheers, Ralph.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]