ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: FileUtils.normalize/isLeadingPath have bitten me
Date Thu, 28 Jun 2018 15:52:06 GMT
On 2018-06-28, Jaikiran Pai wrote:

> On 28/06/18 8:37 PM, Stefan Bodewig wrote:

>> /dir
>>    /dir2
>>    /dir3
>>       link -> /dir/dir2

>> isLeadingPath("/dir/dir3", "/dir/dir3/link") returns true which it would
>> not do if links have been resolved.

> That's a good example and yes it would return false if we would change
> it to use canonical paths.

> Which then makes me wonder - in the context of this specific
> untar/expand/unzip issue, should we probably be using a different
> custom very specific logic (which relies on canonical files and
> getParent()) instead of a call to isLeadingPath()?

Probably. I used isLeadingPath because it has been already there - and )
simply didn't realize it wouldn't do what I expected it to.

https://github.com/apache/commons-compress/blob/a080293da69f3fe3d11d5214432e1469ee195870/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java#L245
is how I implemented it in Commons Compress' example code.

> I don't have an answer though and I will have to sleep over this a bit
> to see if it has other implications and if it does indeed solve the
> issue at hand.

I appreciate this a lot, many thanks.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message