Patchwork [wwwdocs] Harden bin/preprocess a bit

login
register
mail settings
Submitter Gerald Pfeifer
Date Sept. 12, 2010, 3:07 a.m.
Message ID <alpine.LNX.2.00.1009120459040.17560@acrux.dbai.tuwien.ac.at>
Download mbox | patch
Permalink /patch/64534/
State New
Headers show

Comments

Gerald Pfeifer - Sept. 12, 2010, 3:07 a.m.
I ran into this while testing something locally, and while this is 
not a current issue on gcc.gnu.org, adding a check like this seems
like a generally good idea.

Installed, and updated the copy on gcc.gnu.org, too.

Gerald


Sanity check the mhc tool upon startup.

Patch

Index: preprocess
===================================================================
RCS file: /cvs/gcc/wwwdocs/bin/preprocess,v
retrieving revision 1.46
retrieving revision 1.48
diff -u -3 -p -r1.46 -r1.48
--- preprocess	30 Mar 2008 19:31:39 -0000	1.46
+++ preprocess	12 Sep 2010 03:05:44 -0000	1.48
@@ -193,7 +193,7 @@  process_file()
 ########
 # Main: This is where executions starts.
 
-## First of all,  process command-line options. As a special case for
+## First of all, process command-line options. As a special case for
 #  compatibility with existing installations, if there is no command-line
 #  parameter at all, we assume -r.
 
@@ -212,6 +212,11 @@  shift `expr ${OPTIND} - 1`
 
 ## Various safety checks.
 
+if ! ${MHC} --version >/dev/null; then
+    echo "Something does not look right with \"${MHC}\"; aborting."
+    exit 1
+fi
+
 if [ ! -d $SOURCETREE ]; then
     echo "Source tree \"$SOURCETREE\" does not exist."
     exit 1