[PATCH] notmuch-mutt: replace gnu sed and xargs with perl

Tomi Ollila tomi.ollila at iki.fi
Thu Apr 12 11:49:35 PDT 2012


On Thu, Apr 12 2012, Taylor Carpenter <taylor at codecafe.com> wrote:

> On Thu, Apr 12, 2012 at 02:07, Tomi Ollila <tomi.ollila at iki.fi> wrote:
>
>> Btw: what if there are same filenames in different directories that
>> match. With basename there will be collision.
>
> FYI, the current xargs version does not handle collisions either.

True -- so that is not strictly a requirement ;)

>> Alternatives:
>>
>> * instead of basename convert '/':s to '_':s
>> * take md5 or sha1 sum of the filename
>> * take md5 or sha1 sum of dirname of the filename and concatenate...
>
> How about pre-pending some unique text to the colliding file?

Anything goes -- the target filename could also be generated ...
like this:

    my $counter = 0;
    foreach(...) {
        chomp;
        my $target = sprintf("$maildir/cur/%08d", $counter++);
        symlink($_, $target);
    }    

i.e. target filename is just counter value.

> Regards,
>
> Taylor

Tomi


More information about the notmuch mailing list