I ran into a problem with xargs and I found this code in updatefiles: echo_n "Checking if xargs accepts -r... " if [ ! -z "`find . -name __random_file__`" ] ; then error "found a file named __random_file__" exit 1 else find . -name __random_file__ | xargs rm -rf > /dev/null 2>&1 if [ $? = 0 ] ; then echo "accepted" else echo "not accepted (error)" exit 1 fi fi This test is not doing what it says - there is a -r option for xargs, but this doesn't test for it (it tests whether rm -rf works from xargs if there is no input). Further, a test may be needed, because some versions of xargs fail if there are no commands to run and others (OSX, for one) are quite happy in that case. What is this test supposed to check? Was it intended to check whether xargs accepts - r? Whether you can use xargs this way with rm? Something else? Bill William Gropp Deputy Director for Research Institute for Advanced Computing Applications and Technologies Paul and Cynthia Saylor Professor of Computer Science University of Illinois Urbana-Champaign
On 03/01/2011 06:08 PM, William Gropp wrote:
This test is not doing what it says - there is a -r option for xargs, but this doesn't test for it (it tests whether rm -rf works from xargs if there is no input). Further, a test may be needed, because some versions of xargs fail if there are no commands to run and others (OSX, for one) are quite happy in that case. What is this test supposed to check? Was it intended to check whether xargs accepts - r? Whether you can use xargs this way with rm? Something else?
I've corrected this in r8107. The check should be for "xargs rm -rf". -- Pavan -- Pavan Balaji http://www.mcs.anl.gov/~balaji
participants (2)
-
Pavan Balaji -
William Gropp