You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Matthew Wyatt <ma...@gmail.com> on 2009/07/21 02:14:27 UTC

Problems using tarfileset to set a directory's mode

Hi all,
   I'm trying to set a particular directory to mode 777 using tarfileset,
and it's not working. The task looks like:

    <tar destfile="my-tar-file.tar.gz" compression="gzip">
      <tarfileset dir="${tgt.TARGET_DIR}" uid="999" gid="99">
        <exclude name="**/Verify"/> <!-- probably redundant with the
following exclude: -->
        <exclude name="**/Verify/*"/>
      </tarfileset>
      <tarfileset dir="${tgt.TARGET_DIR}" uid="999" gid="99" mode="777">
        <include name="Verify"/>
        <include name="**/Verify/*"/>
      </tarfileset>
    </tar>

I'd like the Verify/ *directory* in the tar file to be set to 777, but it's
always 755.  All the files in the Verify/ directory are set to 777, but not
the directory itself.  I've tried a few different permutations on the
<include>s, but none have worked.  I've tried this on a SunOS box, with Ant
1.7.0, and Windows XP with Ant 1.7.1.
   Either I'm setting the path improperly (entirely possible), or tarfileset
can't set the mode of a directory.  I've looked on the wiki and I've googled
for ideas, to no avail.  Any help is appreciated.
-Matt

Re: Problems using tarfileset to set a directory's mode

Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-07-21, Matthew Wyatt <ma...@gmail.com> wrote:

>     <tar destfile="my-tar-file.tar.gz" compression="gzip">
>       <tarfileset dir="${tgt.TARGET_DIR}" uid="999" gid="99">
>         <exclude name="**/Verify"/> <!-- probably redundant with the
> following exclude: -->
>         <exclude name="**/Verify/*"/>
>       </tarfileset>
>       <tarfileset dir="${tgt.TARGET_DIR}" uid="999" gid="99" mode="777">
>         <include name="Verify"/>
>         <include name="**/Verify/*"/>
>       </tarfileset>
>     </tar>

> I'd like the Verify/ *directory* in the tar file to be set to 777, but it's
> always 755.

The mode attribute of tar's nested tarfileset element corresponds to
the more general tarfileset's filemode attribute, this means you are
explicitly setting the mode for plain files only.  To specify the mode
for directories you must use the dirmode attribute.

Just saw the examples in tar's manual page are still using mode
instead of filemode and will fix it in svn.

Stefan

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