Project

General

Profile

Actions

Bug #4229

closed

conf parsing gives very confusing message if no '=' present on setting line

Added by Dan Mick about 11 years ago. Updated about 11 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
% Done:

0%

Source:
Development
Tags:
Backport:
Regression:
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

A doc bug caused a user to attempt to include settings of the form

public network <addr>

i.e. missing the equals sign. The config parsing ended up saying

"unexpected character while parsing putative key value, at char N line M", where N was "one past EOL".
The problematic code calls #, ;, and '\0' all "illegal characters in key names", which they are,
but, '\0' should probably be handled differently, issuing something like "no value found on line M; missing =?"

Actions #1

Updated by Dan Mick about 11 years ago

Something like this:

--- a/src/common/ConfUtils.cc
+++ b/src/common/ConfUtils.cc
@@ -471,8 +471,13 @@ process_line(int line_no, const char *line, std::deque<std::string> *errors)
       case ACCEPT_KEY:
        if ((((c == '#') || (c == ';')) && (!escaping)) || (c == '\0')) {
          ostringstream oss;
-         oss << "unexpected character while parsing putative key value, " 
-             << "at char " << (l - line) << ", line " << line_no;
+         if (c == '\0') {
+           oss << "end of key=val line " << line_no
+               << "reached, no \"=val\" found...missing =?";
+         } else {
+           oss << "unexpected character while parsing putative key value, " 
+               << "at char " << (l - line) << ", line " << line_no;
+         }
          errors->push_back(oss.str());
          return NULL;
        }

Actions #2

Updated by Sage Weil about 11 years ago

  • Assignee set to Dan Mick

looks good to me!

Actions #3

Updated by Dan Mick about 11 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF