1 #!/bin/bash -u 2 # 3 # This is one of the scripts that is passed to binary_search_state.py to do 4 # the bisection. This one takes a list of object files (either a real list or 5 # a file containing the list) and copies the files from the bad objects 6 # directory to the working directory. 7 # 8 9 source full_bisect_test/common.sh 10 11 pushd ${BISECT_WORK_BUILD} 12 chmod 644 * 13 14 OBJ_LIST_FILES=$1 15 FILE_ARGS=0 16 17 if [[ -f ${OBJ_LIST_FILES} ]] ; then 18 file ${OBJ_LIST_FILES} &> ${BISECT_WORK_BUILD}/file_type.tmp 19 grep "ASCII text" ${BISECT_WORK_BUILD}/file_type.tmp 20 result=$? 21 if [[ ${result} -eq 0 ]] ; then 22 FILE_ARGS=1 23 fi 24 rm ${BISECT_WORK_BUILD}/file_type.tmp 25 fi 26 27 overall_status=0 28 29 if [[ ${FILE_ARGS} -eq 1 ]] ; then 30 while read obj || [[ -n "${obj}" ]]; 31 do 32 cp ${BISECT_BAD_BUILD}/${obj} ${BISECT_WORK_BUILD} 33 status=$? 34 if [[ ${status} -ne 0 ]] ; then 35 echo "Failed to copy ${obj} to work build tree." 36 overall_status=2 37 fi 38 done < ${OBJ_LIST_FILES} 39 else 40 41 for o in "$@" 42 do 43 cp ${BISECT_BAD_BUILD}/${o} ${BISECT_WORK_BUILD} 44 status=$? 45 if [[ ${status} -ne 0 ]] ; then 46 echo "Failed to copy ${o} to work build tree." 47 overall_status=2 48 fi 49 done 50 fi 51 52 popd 53 54 exit ${overall_status} 55