socsvn commit: r240581 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport

tzabal at FreeBSD.org tzabal at FreeBSD.org
Mon Aug 20 15:20:04 UTC 2012


Author: tzabal
Date: Mon Aug 20 15:20:01 2012
New Revision: 240581
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240581

Log:
  Update for crashreport in client-side. Informing the user that is running and fix issue related with the DDB capture buffer.

Modified:
  soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh

Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh
==============================================================================
--- soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh	Mon Aug 20 14:54:30 2012	(r240580)
+++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh	Mon Aug 20 15:20:01 2012	(r240581)
@@ -80,6 +80,10 @@
 done
 
 
+## Inform  the user that the program has started
+echo "crashreport is running..."
+
+
 ## Find the dump directory
 if [ -z "${_dumpdir}" ]; then
 	# dumpdir of /etc/rc.conf
@@ -243,7 +247,7 @@
 	sed '/^ *$/d' > "${tmp_file}"
 	numline=''
 	while read line; do
-		echo "${line}" | egrep '^#[0-9] ' > /dev/null
+		echo "${line}" | egrep '^#[0-9]{1,2} ' > /dev/null
 		if [ $? -eq 0 ]; then
 			if [ -z "${numline}" ]; then
 				numline="${line}"
@@ -263,7 +267,9 @@
 	for cmd in $commands2; do
 		echo "<command>" >> ${data}
 		echo "<name>" >> ${data}
-		echo "${cmd}" >> ${data}
+		name=`echo "${cmd}" | sed 's/ -/_/'`
+		name=`echo "${name}" | sed -E 's/([a-z]) ([a-z])/\1\2/g'`
+		echo "${name}" >> ${data}
 		echo "</name>" >> ${data}
 		echo "<result>" >> ${data}
 		cat "${_dumpdir}/${_file}" | \
@@ -285,33 +291,54 @@
 	# A valid textdump can contain up to 5 files with the following names:
 	# ddb.txt, config.txt, msgbuf.txt, panic.txt and version.txt
 
+# 	if [ -f "${tmp_dir}/ddb.txt" ]; then
+# 		flag='false'
+# 		while read line; do
+# 			echo "${line}" | egrep '^.+> [a-z ]+$' > /dev/null
+# 			if [ $? -eq 0 ]; then
+# 				if [ "${flag}" == false ]; then
+# 					flag='true'
+# 					echo "<command>" >> ${data}
+# 					echo "<name>" >> ${data}
+# 					echo "${line}" | \
+# 					 sed -E 's/^.+> ([a-z ]+)$/\1/' >> ${data}
+# 					echo "</name>" >> ${data}
+# 					echo "<result>" >> ${data}
+# 				else
+# 					echo "</result>" >> ${data}
+# 					echo "</command>" >> ${data}
+# 					echo "<command>" >> ${data}
+# 					echo "<name>" >> ${data}
+# 					echo "${line}" | \
+# 					 sed -E 's/^.+> ([a-z ]+)$/\1/' >> ${data}
+# 					echo "</name>" >> ${data}
+# 					echo "<result>" >> ${data}
+# 				fi
+# 			else
+# 				echo "${line}" >> ${data}
+# 			fi
+# 		done < "${tmp_dir}/ddb.txt"
+# 		echo "</result>" >> ${data}
+# 		echo "</command>" >> ${data}
+# 	fi
+
+	# The above code reads the ddb.txt file and for every DDB command it
+	# creates an equivalent XML command tag. Although this is useful, it is
+	# not feasible to be used from the server side system because the
+	# number of commands and which commands are arbitrary. For example, a
+	# user could have a captured ddb output with only 2 commands. Another
+	# user could have a captured ddb output that includes all the commands
+	# that DDB offers. We decided to create one column in the database with
+	# the name ddbcapturebuffer instead of creating a large number of
+	# extra columns only for the output of DDB.
+	
 	if [ -f "${tmp_dir}/ddb.txt" ]; then
-		flag='false'
-		while read line; do
-			echo "${line}" | egrep '^.+> [a-z ]+$' > /dev/null
-			if [ $? -eq 0 ]; then
-				if [ "${flag}" == false ]; then
-					flag='true'
-					echo "<command>" >> ${data}
-					echo "<name>" >> ${data}
-					echo "${line}" | \
-					 sed -E 's/^.+> ([a-z ]+)$/\1/' >> ${data}
-					echo "</name>" >> ${data}
-					echo "<result>" >> ${data}
-				else
-					echo "</result>" >> ${data}
-					echo "</command>" >> ${data}
-					echo "<command>" >> ${data}
-					echo "<name>" >> ${data}
-					echo "${line}" | \
-					 sed -E 's/^.+> ([a-z ]+)$/\1/' >> ${data}
-					echo "</name>" >> ${data}
-					echo "<result>" >> ${data}
-				fi
-			else
-				echo "${line}" >> ${data}
-			fi
-		done < "${tmp_dir}/ddb.txt"
+		echo "<command>" >> ${data}
+		echo "<name>" >> ${data}
+		echo "ddb capture buffer" >> ${data}
+		echo "</name>" >> ${data}
+		echo "<result>" >> ${data}
+		cat "${tmp_dir}/ddb.txt" >> ${data}
 		echo "</result>" >> ${data}
 		echo "</command>" >> ${data}
 	fi


More information about the svn-soc-all mailing list