From 33b607dab162e86e783e88e06c642a22cafa3f48 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 2 Jan 2012 07:33:08 +0000 Subject: [PATCH] - upgrade script: - prompt user for DB user/passwd if DB updates needed - error out immediately if any DB update fails Fixes #1169, #1170 - create_work: check for duplicate s in input template NOTE: the input template syntax is pretty clunky svn path=/trunk/boinc/; revision=24969 --- checkin_notes | 16 ++++++++++++++++ html/inc/util_ops.inc | 9 ++++----- html/ops/upgrade_db.php | 2 ++ tools/process_input_template.cpp | 13 +++++++++++++ 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/checkin_notes b/checkin_notes index 21d889c9ce..748414b1cb 100644 --- a/checkin_notes +++ b/checkin_notes @@ -68,3 +68,19 @@ David 2 Jan 2012 cs_prefs.cpp cs_scheduler.cpp cpu_sched.cpp + +David 2 Jan 2012 + - upgrade script: + - prompt user for DB user/passwd if DB updates needed + - error out immediately if any DB update fails + Fixes #1169, #1170 + - create_work: check for duplicate s in input template + NOTE: the input template syntax is pretty clunky + + tools/ + process_input_template.cpp + html/ + ops/ + upgrade_db.php + inc/ + util_ops.inc diff --git a/html/inc/util_ops.inc b/html/inc/util_ops.inc index 6a2ac65062..17bbaf56bc 100644 --- a/html/inc/util_ops.inc +++ b/html/inc/util_ops.inc @@ -104,19 +104,18 @@ function db_init_cli() { $host = "localhost"; } $in = fopen("php://stdin","r"); - print "Database username for $db_name@$host: "; + print "Database username (if not current user): "; $user = rtrim(fgets($in, 80)); - print "Database password for $db_name@host: "; + print "Database password (if any): "; $pass = rtrim(fgets($in, 80)); $retval = mysql_pconnect($host, $user, $pass); if (!$retval) { - return 1; + die("Can't connect to DB\n"); } if (!mysql_select_db($db_name)) { - return 2; + die("Can't select DB\n"); } - return 0; } function print_login_form_ops($next_url='') { diff --git a/html/ops/upgrade_db.php b/html/ops/upgrade_db.php index 6341a87919..329c79acea 100755 --- a/html/ops/upgrade_db.php +++ b/html/ops/upgrade_db.php @@ -58,6 +58,8 @@ if ($argc > 1) { echo "\nWarning: you are upgrading only web or server code,\nbut these updates may affect the other code as well.\nWe recommend that you run 'upgrade' again to upgrade both parts of the code.\n\n"; } +db_init_cli(); + foreach($updates as $update) { list($rev, $func) = $update; echo "performing update $func\n"; diff --git a/tools/process_input_template.cpp b/tools/process_input_template.cpp index c88541ced8..360a36d87f 100644 --- a/tools/process_input_template.cpp +++ b/tools/process_input_template.cpp @@ -132,6 +132,8 @@ static void write_md5_info( return; } +static bool input_file_found[1024]; + static int process_file_info( XML_PARSER& xp, string& out, int ninfiles, const char** infiles, SCHED_CONFIG& config_loc @@ -176,6 +178,13 @@ static int process_file_info( ); return ERR_XML_PARSE; } + if (input_file_found[file_number]) { + fprintf(stderr, + "Input file %d listed twice\n", file_number + ); + return ERR_XML_PARSE; + } + input_file_found[file_number] = true; if (generated_locally) { sprintf(buf, " %s\n" @@ -382,6 +391,10 @@ int process_input_template( bool found_workunit=false; int nfiles_parsed = 0; + for (int i=0; i<1024; i++) { + input_file_found[i] = false; + } + out = ""; MIOFILE mf; XML_PARSER xp(&mf);