From: Taylor Carpenter Date: Thu, 12 Apr 2012 18:29:59 +0000 (+1900) Subject: Re: [PATCH] notmuch-mutt: replace gnu sed and xargs with perl X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=08fa18c8df20f9802692c7212adb76000a0fc328;p=notmuch-archives.git Re: [PATCH] notmuch-mutt: replace gnu sed and xargs with perl --- diff --git a/26/6ea40ba2cffc26bf009cd303e5609dabac3886 b/26/6ea40ba2cffc26bf009cd303e5609dabac3886 new file mode 100644 index 000000000..e60b4a09d --- /dev/null +++ b/26/6ea40ba2cffc26bf009cd303e5609dabac3886 @@ -0,0 +1,100 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 4C77D431FAF + for ; Thu, 12 Apr 2012 11:30:44 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id Ngynz5+ONt9Q for ; + Thu, 12 Apr 2012 11:30:42 -0700 (PDT) +Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com + [74.125.82.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 13230431FAE for ; Thu, 12 Apr 2012 11:30:41 -0700 + (PDT) +Received: by wgbds1 with SMTP id ds1so5396037wgb.2 + for ; Thu, 12 Apr 2012 11:30:39 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=mime-version:in-reply-to:references:from:date:message-id:subject:to + :cc:content-type:content-transfer-encoding:x-gm-message-state; + bh=WJEeH6tpJrhy9ZxXwlPV4GqZkQ9/rWkxesWyE2j4z4g=; + b=RCmUW7v3jSL/OY52x/qEUGG8O0IJdClmGpRSpuodInUz/mhAsP7x72+glTIVZ899gd + 9rL7E0wzvGBpdyWB328MrO+ecQmnFdNjdrFL1tgXlbtkeoOPlLr2Mh2t93bW7Oy3yA1y + nUJvJJp4JG3OMCkhsFwfVFucB/Y6Hf50UaZm1c30U1GKtMOdaqgjmjuycHq23pvsPigm + vwXETmvhZWvd8VVAJv4qziHVrPR68bYrvvH0hf5aaqDb11CMwp8zI36027p0ICu0MxMT + t7kWIsRgiGTX0RyqkdMAVEP3bkMjPG1SVbReRl6cUR2/+KKadzb2csW23vj+CS+WjNiV + Pq1A== +Received: by 10.180.98.8 with SMTP id ee8mr8297279wib.14.1334255439485; Thu, + 12 Apr 2012 11:30:39 -0700 (PDT) +MIME-Version: 1.0 +Received: by 10.216.85.144 with HTTP; Thu, 12 Apr 2012 11:29:59 -0700 (PDT) +In-Reply-To: +References: <20120412002953.GA27056@codecafe.com> + +From: Taylor Carpenter +Date: Thu, 12 Apr 2012 13:29:59 -0500 +Message-ID: + +Subject: Re: [PATCH] notmuch-mutt: replace gnu sed and xargs with perl +To: Tomi Ollila +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +X-Gm-Message-State: + ALoCoQkkjiG9WLCMhpLl/hhwU6ZaIR3OYTrmDVaSKiEitcghJIRhFO+y0SyRA1tjkT+vfWY6ohh8 +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Thu, 12 Apr 2012 18:30:44 -0000 + +On Thu, Apr 12, 2012 at 02:07, Tomi Ollila wrote: +> On Thu, Apr 12 2012, Taylor Carpenter wrote: +> +>> External software dependencies removed: sed and xargs. +>> +>> Sed shell escaping is handled automatically with perl symlink function. +>> +>> The xargs usage is specific to gnu xargs (fails on bsd xargs, etc). +>> +>> NOTE: The current query pulls the list of files into an array all at +>> once. =A0The larger the list the more memory used. +>> --- +> It is not too hard to read the filelist from pipe; Check the example +> I sent in id:"m2hawr4klm.fsf@guru.guru-group.fi" + +Understood. + + +> 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. + +> 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? + +Regards, + +Taylor