Ant task hangs due to suspected permissions issue

877 Views Asked by At

I have a STAF job which kicks off an Ant script, all run under a functional ID. The ant script does basic 'init' tasks which work fine, and then hangs on one of the following tasks: delete, mkdir, or junit, depending on how much muddling I do in the file system.

<target name="run.nightly.tests" depends="init">
    <delete dir="/path/results/latestDate" />
    <mkdir dir="/path/results/latestDate"  />
    <chmod perm="777" dir="/path/results/latestDate" />
    <junit printsummary="on" fork="no">
                <!-- typical classpath/tests setup snipped -->
    </junit>
</target>

I am able to sudo to this functional ID and run the corresponding commands from a shell just fine (ex: rm -rf /path/results/latestDate). Clearly something is different about running in the Ant environment, under the functional id. (In fact, I can run the script just fine with my own id)

/path/results has 777 permissions before my script runs, and when /path/results/latestDate exists it is owned by the same functional id w/ 777 permissions.

STAF launches this script:

export ANT_HOME=/opt/apache-ant-1.8.2
#This entire directory tree and jar files are world r+x
LIB_DIR=/home/afreed/automation/dependencies/mail
ant -debug -verbose -buildfile nightlyTest.xml -lib ${LIB_DIR}/mail.jar:${LIB_DIR}/activation.jar

I would understand if Ant would fail on any of these tasks with a permissions error but I cannot understand why it would hang.

I would like help either a) determining why there is a hang or b) how to convert the hang to a hard failure

1

There are 1 best solutions below

0
On

Solved, the Ant script was hanging on an exec command that was waiting for input from STDIN. (Execution had continued past that point because it was launched with 'spawn' attribute.) When I removed this 'exec' task from my 'init' target, the Ant script ran as expected.

<!-- hanging task in init-->
<exec executable="blah.sh" spawn="true">