Haven't reviewed the code here but if it's not there already I would suggest having some sort of abstraction layer for this function instead of tying Ant directly to this jna-posix library. Last time I checked Java 7 is *supposed* to provide access to "bulk file attributes" (such as permissions) under JSR 203; there may be other libraries that can implement these functions too.

(http://openjdk.java.net/projects/nio/)
____________________________________________________________________________________________
Jeffrey E. (Jeff) Care
carej@us.ibm.com
IBM WebSphere Application Server
WAS Release Engineering

WebSphere Mosiac
WebSphere Brandmark



Robin Fernandes <rewbs.soal@gmail.com> wrote on 01/23/2011 08:02:23 AM:

> [image removed]

>
> Preserving file permissions in copy and zip tasks [patch]

>
> Robin Fernandes

>
> to:

>
> dev

>
> 01/23/2011 08:11 AM

>
> Please respond to "Ant Developers List"

>
> Hi all,
>
> A fairly common (and documented) gripe with filesystem tasks is that
> they tend to ignore or lose Unix file permissions. I've had a look at
> workarounds for this, and have found that the jna-posix library
> (originally developed for JRuby) provides useful APIs for interacting
> with file permissions as best as possible from current levels of Java.
> The library attempts to invoke standard native functions over JNA if
> possible, and falls back Java APIs (which can only approximate
> permissions) if no suitable linkage is available.
>
> Here's a patch which modifies the Copy and Zip tasks to preserve
> permissions, using jna-posix :
https://gist.github.com/792062.
> Is this approach worth considering to make Ant's core tasks play
> better with file permissions?
>
> Cheers,
> Robin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>