View Issue Details

IDProjectCategoryView StatusLast Update
0002726OpenFOAMBugpublic2017-10-20 11:35
Reportertniemi Assigned Tohenry  
PrioritylowSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Versiondev 
Fixed in Versiondev 
Summary0002726: foamDictionary: problem with #include-statement in a subdict with disableFunctionEntries
DescriptionI was trying to use foamDictionary inside a loop to modify values in a dictionary which also had #include-statement inside a subdict. I didn't want to expand that include, so I used disableFunctionEntries flag. However, this seemed to corrupt the dictionary file after two rounds of modifications.

I have attached a minimal test-dictionary. Running the following command two or more times shows the issues:
foamDictionary -entry a -set val -disableFunctionEntries testDict

foamDictionary seems to delete newlines when writing the #include line first time. This is not problematic by itself, but if there is a "}"-symbol at the end of the line, additional closing brackets will get injected and the structure of the dict gets corrupted.
TagsNo tags attached.

Activities

tniemi

2017-10-17 13:20

reporter  

testDict (858 bytes)   
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  dev                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version         2;
    format          ascii;
    class           dictionary;
    location        "constant";
    object          testDict;
}

subDict
{
#include "someFile"    
}

a               val;


// ************************************************************************* //
testDict (858 bytes)   

henry

2017-10-20 11:35

manager   ~0008900

Resolved by commit aaa8405bd1d006a9b35877fb232a6eebf5b01db5

Issue History

Date Modified Username Field Change
2017-10-17 13:20 tniemi New Issue
2017-10-17 13:20 tniemi File Added: testDict
2017-10-20 11:35 henry Assigned To => henry
2017-10-20 11:35 henry Status new => resolved
2017-10-20 11:35 henry Resolution open => fixed
2017-10-20 11:35 henry Fixed in Version => dev
2017-10-20 11:35 henry Note Added: 0008900