Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 67134 invoked from network); 8 Sep 2008 10:32:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Sep 2008 10:32:13 -0000 Received: (qmail 29013 invoked by uid 500); 8 Sep 2008 10:32:10 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 28697 invoked by uid 500); 8 Sep 2008 10:32:08 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 28686 invoked by uid 99); 8 Sep 2008 10:32:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Sep 2008 03:32:08 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gscokart@gmail.com designates 209.85.200.169 as permitted sender) Received: from [209.85.200.169] (HELO wf-out-1314.google.com) (209.85.200.169) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Sep 2008 10:31:10 +0000 Received: by wf-out-1314.google.com with SMTP id 29so1621534wff.10 for ; Mon, 08 Sep 2008 03:31:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=aDq4pOofzruuxbkujwuMYT54PcBal+yJwBXj0d8eIgw=; b=QUTnqVeDzCADxkWgzBuPFFd9/mfF4h9J6Cs/Dh8CTop5nT2P8HoGLXVwRECqnyCP52 DGDJH40lyADaVWfc4HuUeROCxsW/EDCK1dgnLN8YJSN41d0sjoPozkFNjLHlVGQAivS/ xWTUNQ3WsukCkfJedoZ+xXzY7OKKPDFJjB6Cg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=V3abMmupFiISG7ygsktb7C9fAHEPBaCnA1in8JmEwSxwuf4rVJNfQpdJ9IFK52wOby pxU+4gSekwICF7mnHjsYUTa6v/NXRoYZXoXouF/kiV4YFWEux4VvLT75DSOfvwF66ZMN 7jyRTBQuRke1PzCZIBbT8dkNZNhrmDlJWCkgg= Received: by 10.142.139.14 with SMTP id m14mr5162308wfd.291.1220869901733; Mon, 08 Sep 2008 03:31:41 -0700 (PDT) Received: by 10.142.11.3 with HTTP; Mon, 8 Sep 2008 03:31:41 -0700 (PDT) Message-ID: Date: Mon, 8 Sep 2008 12:31:41 +0200 From: "Gilles Scokart" To: "Ant Developers List" Subject: Re: DirectoryScanner and Symlinks In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <255d8d690809040838h63d26ab3y6b262f13a0dd6115@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org I fear that with this aproach, you may have to "rollback" some of the files already scanned because you will detect a loop after you have already looped one or more time (including multiple time the same files). This "rollback" will be required if you want to provide a "clean" fileset when the patterns (and file system) would give infinite loop. The other aproach might be to fail the build if an infinite loop is detected. What is wrong with the failing aproach? It is simpler to implement, will be faster to execute, don't requires an additional parameter and is I think easier to understand for the user (he don't need to understand what files are included if its pattern contains a loop). 2008/9/8 Stefan Bodewig : > OK, combining suggestions by Gilles and Dominique here is what we > could do: > > * add a new sttribute for maxSymlinkRecursionDepth (better name > appreciated) and make it default to 5 (up for discussion as well). > This limits how many times the same symlink can be followed. > > * Keep a stack of simple directory names (only the file name portion, > no leading directory and certainly not the canonical path) that > holds the names of all directories traversed so far while doing the > traversal. > > * If the same simple name appears for the MAXth time, check whether > that directory is a symlink. If it is, check its canonical name and > the canonical names of all other occurances of directories with the > same name. If they all point to the same location, ignore the > directory. If they point to different locations recurse but revisit > things if the same name is encountered for the (MAX + 1)th time and > so on. > > This should address infinite loops and it should avoid > getCanonicalPath as much as possible. > > I first thought it would be enough to check whether the link pointed > to a parent directory but it is possible to create inifinte loops with > two "cooperating" symlinks where neither link would point to a parent > of its own. > > Does that sound OK? > > Stefan > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org > For additional commands, e-mail: dev-help@ant.apache.org > > -- Gilles Scokart --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org