You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by jtnews <jt...@bellatlantic.net> on 2000/10/03 23:59:20 UTC

how do you get ant's tar task to preserve execute permissions?

how do you get ant's tar task to preserve execute permissions?

Whenever I tar a directory with a .sh script that has the execute
bit set,  a tar tzvf stuff.tar.gz reveals that the .sh file
doesn't have the execute bit set and, unsurprisingly,
when I unpack the tar file the .sh file doesn't have the execute 
bit set either.

Re: how do you get ant's tar task to preserve execute permissions?

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "j" == jtnews  <jt...@bellatlantic.net> writes:

 j> how do you get ant's tar task to preserve execute permissions?

Basically you can't. Java doesn't have the slightest idea of file
permissions (well, apart from isReadable and such) so there is no API
to get or set them.

If you really wanted Ant to do this, <tar> would need to exec a stat
and parse its result for every file - and untar would need to exec a
chmod for each file.

In this particular situation I'd take one of the following two
options:

(1) use <exec> to invoke the OS's tar utility.

(2) use <chmod> after <untar> - only possible if the number of files
whose permissions need to be adjusted is fixed and known.

Stefan