Bug 51216 - chmod task when build is run using sudo hangs.
Summary: chmod task when build is run using sudo hangs.
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.6.2
Hardware: Other AIX
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-18 09:32 UTC by Silvano Lutri
Modified: 2012-01-24 12:23 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Silvano Lutri 2011-05-18 09:32:44 UTC
I run a .sh script using sudo that invokes Ant. It copies file and run chmod on them.
When it arrives to the chmod task it hangs.

Here a subset of my Ant script:
-----------------------------------------------------------------------------
<project name="CustomizeSQLScripts" default="everything" basedir=".">
	<description>
		This build file is used to customize the sql scripts used to create the database
	</description>

    <property name="src" location="."/>

    <target name="createDBtools_DB2" description="The target to create in the temp dir the structure of the DB tools when using DB2">
        <mkdir dir="${TWSTEMPDIR}/scripts"/>
        <copy file="${DBSETUPSCRIPT}" todir="${TWSTEMPDIR}/scripts" overwrite="true"/>
        <mkdir dir="${TWSTEMPDIR}/sql"/>
        <chmod dir="${TWSTEMPDIR}/scripts" perm="755" includes="**/*"/>
        <chmod dir="${TWSTEMPDIR}/sql" perm="755" includes="**/*"/>
    </target>

    <target name="customize_migratedb_root_sh" description="The target to customize the launching script used to migrate the database on Unix">
        <filter token="DB2LOCALADMINUSER" value="${DB2LOCALADMINUSER}"/>
        <filter token="TWSTEMPDIR" value="${TWSTEMPDIR}"/>
        <copy tofile="${TWSTEMPDIR}/scripts/migratedb_root.sh" filtering="true" overwrite="true">
            <fileset dir="${src}">
                <filename name="_migratedb_root.sh"/>
            </fileset>
        </copy>
        <copy file="dbupgrade.sh" todir="${TWSTEMPDIR}/scripts" overwrite="true"/>
        <copy file="dbmigrate.sh" todir="${TWSTEMPDIR}/scripts" overwrite="true"/>
        <chmod file="${TWSTEMPDIR}/scripts/migratedb_root.sh" perm="755"/>
        <chmod file="${TWSTEMPDIR}/scripts/dbupgrade.sh" perm="755"/>
        <chmod file="${TWSTEMPDIR}/scripts/dbmigrate.sh" perm="755"/>
    </target>


    <target name="everything"
		depends="createDBtools_DB2,
                 customize_migratedb_root_sh"
		description="The default target">
    </target>

</project>


And here the output of Ant executed in debug mode:
----------------------------------------------------------------------------
 > sudo ./commandToRun.sh                                  

                                                                         

               Apache Ant version 1.6.2 compiled on July 16 2004         

                                                                         

               Buildfile:                                                

               /software/TWS/8.5.1/TWS/AIX/./../AIX/tws_tools/customizeS 

               QLScripts4upgrade84.xml                                   

                                                                         

               Detected Java version: 1.4 in:                            

               /tmp/istemp3538996112160829/_bundledJRE_                  

                                                                         

               Detected OS: AIX                                          

                                                                         

               parsing buildfile                                         

               /software/TWS/8.5.1/TWS/AIX/tws_tools/customizeSQLScripts 

               4upgrade84.xml with URI =                                 

               file:///software/TWS/8.5.1/TWS/AIX/tws_tools/customizeSQL 

               Scripts4upgrade84.xml                                     

                                                                         

               Project base dir set to:                                  

               /software/TWS/8.5.1/TWS/AIX/tws_tools                     

                                                                         

               Build sequence for target `everything' is                 

               [detectCurrentOSFamily, defineOSSpecificPlatformFlag,     

               define_db_use, define_db2Win, define_db2Unix,             

               define_oracleWin, define_oracleUnix, createDBtools_DB2,   

               createDBtools_Oracle, customize_migratedb_root_bat,       

               customize_migratedb_root_oracle_bat,                      

               customize_migratedb_root_sh,                              

               customize_migratedb_root_oracle_sh, customizeSQL,         

               customizeOracleSQL, chmodSqlDir, chmodSqlStdedDir,        

               everything]                                               

                                                                         

               Complete build sequence is [detectCurrentOSFamily,        

               defineOSSpecificPlatformFlag, define_db_use,              

               define_db2Win, define_db2Unix, define_oracleWin,          

               define_oracleUnix, createDBtools_DB2,                     

               createDBtools_Oracle, customize_migratedb_root_bat,       

               customize_migratedb_root_oracle_bat,                      

               customize_migratedb_root_sh,                              

               customize_migratedb_root_oracle_sh, customizeSQL,         

               customizeOracleSQL, chmodSqlDir, chmodSqlStdedDir,        

               everything, ]                                             

                                                                         

                                                                         

                                                                         

               detectCurrentOSFamily:                                    

                                                                         

                                                                         

                                                                         

               defineOSSpecificPlatformFlag:                             

                                                                         

                                                                         

                                                                         

               define_db_use:                                            

                                                                         

                                                                         

                                                                         

               define_db2Win:                                            

                                                                         

               Property ${isWindows} has not been set                    

                                                                         

                                                                         

                                                                         

               define_db2Unix:                                           

                                                                         

                                                                         

                                                                         

               define_oracleWin:                                         

                                                                         

               Property ${isWindows} has not been set                    

                                                                         

               Property ${DB_ORACLE} has not been set                    

                                                                         

                                                                         

                                                                         

               define_oracleUnix:                                        

                                                                         

               Property ${DB_ORACLE} has not been set                    

                                                                         

                                                                         

                                                                         

               createDBtools_DB2:                                        

                                                                         

                    [copy] Copying 1 file to /tmp/TWA/tws851/scripts     

                                                                         

                    [copy] Copying                                       

               /software/TWS/8.5.1/TWS/AIX/tws_tools/dbmigrate.sh to     

               /tmp/TWA/tws851/scripts/dbmigrate.sh                      

                                                                         

                   [chmod] Current OS is AIX                             

                                                                         

                   [chmod] Executing 'chmod' with arguments:             

                                                                         

                   [chmod] '755'                                         

                                                                         

                   [chmod] '/tmp/TWA/tws851/scripts/dbmigrate.sh'        

                                                                         

                   [chmod] '/tmp/TWA/tws851/scripts/dbupgrade.sh'        

                                                                         

                   [chmod] '/tmp/TWA/tws851/scripts/migratedb_root.sh'   

                                                                         

                   [chmod]                                               

                                                                         

                   [chmod] The ' characters around the executable and    

               arguments are                                             

                                                                         

                   [chmod] not part of the command.                      
--------------------------------------------------------------------------
After this the script hangs.
Comment 1 Silvano Lutri 2011-10-19 11:33:10 UTC
Anyone took a look to this?
Comment 2 Jesse Glick 2012-01-19 14:34:19 UTC
Do you have a minimal test case? Thread dump?
Comment 3 Silvano Lutri 2012-01-24 09:46:42 UTC
Hello and thanks for the update.
I would like to underline that the problem is reproduced only on one specific machine, and that I solved it changing the task from <chmod> to the native
<exec executable="chmod">.
On that machine also a small build.xml file that includes only one
target with only one copy file and the chmod of the same file is hanging
(at the chmod). The Ant task is executed via sudo.

I don't have a thread dump of the problem.
Could the problem be related to some specific configuration of the AIX machine?

Silvano
Comment 4 Jesse Glick 2012-01-24 12:23:10 UTC
Sounds likely to be OS-specific.