Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Bugs with Ant and symbolic links

I'm running 10.5.2. I've had a couple issues with how ant deals with symbolic links. I'm using the Ant that came with the developer tools.

$ ant -version
]Apache Ant version 1.7.0 compiled on September 23 2007

1) I had the following in my build.xml:

<mkdir dir="${dist}/temp"/>
<symlink action="single" link="${dist}/temp/Applications" resource="/Applications" />
...
<delete dir="${dist}/temp" />

In other words, I created a temporary directory, stuck in a symbolic link to /Applications, did some stuff, and deleted the temporary directory.

Ant proceeded to delete 7,800 some files out of /Applications. Fortunately, I run Time Machine and was able to recover completely within 20 minutes or so. But, it was pretty unnerving.

It's also clearly a bug. If you recursively delete a directory from the shell, it does NOT follow symbolic links. It simply deletes the link.

2) So, obviously I need to work around this by deleting the symbolic link before deleting the directory containing it.

<symlink action="single" link="${dist}/temp/Applications" resource="/Applications" />
...
<symlink action="delete" link="${dist}/temp/Applications" />

Nope. That generates:

BUILD FAILED
.../build.xml:241: java.io.IOException: Couldn't return resource /symlink78325137.tmp to its original name: /Applications
THE RESOURCE'S NAME ON DISK HAS BEEN CHANGED BY THIS ERROR!

and leaves the symbolic link intact.

That's obviously another bug.

Presumably, both of these are bugs in ant, but I'm bringing them up here because they may or may not affect other platforms, but they certainly do affect OS X.

I'm open to suggestions on how to workaround the problems. Thanks.

Powerbook G4, Mac OS X (10.5.2)

Posted on Mar 22, 2008 9:43 AM

Reply

There are no replies.

Bugs with Ant and symbolic links

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.