From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2DCC9431FAF for ; Thu, 12 Apr 2012 11:49:40 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 At4nvCnNKnt0 for ; Thu, 12 Apr 2012 11:49:39 -0700 (PDT) Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66]) by olra.theworths.org (Postfix) with ESMTP id 37C82431FAE for ; Thu, 12 Apr 2012 11:49:39 -0700 (PDT) Received: by guru.guru-group.fi (Postfix, from userid 501) id 53C3268055; Thu, 12 Apr 2012 21:49:35 +0300 (EEST) From: Tomi Ollila To: Taylor Carpenter Subject: Re: [PATCH] notmuch-mutt: replace gnu sed and xargs with perl In-Reply-To: References: <20120412002953.GA27056@codecafe.com> User-Agent: Notmuch/0.12+104~gf9ad237 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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:49:40 -0000 On Thu, Apr 12 2012, Taylor Carpenter wrote: > On Thu, Apr 12, 2012 at 02:07, Tomi Ollila 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