Project

General

Profile

Actions

Bug #3834

closed

crushtool really really hates \r

Added by Dan Mick over 11 years ago. Updated almost 7 years ago.

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

0%

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

Description

Spent a long time trying to figure out why a crush map wouldn't compile; finally got it to no differences at all, even whitespace, according to every tool I used.

That's because the only remaining difference was EOL: \r\n vs. \n. ARGH.

It turns out a small change makes crushtool insensitive to such things:

--- a/src/crush/CrushCompiler.cc
+++ b/src/crush/CrushCompiler.cc
@@ -686,7 +686,7 @@ string CrushCompiler::consolidate_whitespace(string in)

   bool white = false;
   for (unsigned p=0; p<in.length(); p++) {
-    if (in[p] == ' ' || in[p] == '\t') {
+    if (in[p] == ' ' || in[p] == '\t' || in[p] == '\r') {
       if (white)
        continue;
       white = true;
Actions

Also available in: Atom PDF