View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0003995||OpenFOAM||Bug||public||2023-07-11 20:17||2023-07-12 10:31|
|Fixed in Version||11|
|Summary||0003995: wmkdep calculates replacement position wrong|
|Description||This bug appeared the first time in a Ubuntu docker container where the Ubuntu/debian package openfoam11 was installed. (It does not happen with the openfoam-dev installation package openfoam-dev (20230707).|
If in the file "Make/file" of the user library/solver a source file of the installation is used, wmkdep crashes with the following error:
Making dependency list for source file setDeltaT.C
free(): invalid next size (fast)
This is the Make/file:
EXE = $(FOAM_USER_APPBIN)/foamRunCoupled
Then running wmake in the corresponding directory produces the above mention error.
|Additional Information||Debugging wmkdep show the reason for the error:|
At some point, the path to the dependency file Make/linux64GccDPInt32Opt//opt/openfoam11/src/../applications/solvers/foamRun/setDeltaT.C.dep should be replaced first by $(OBJECTS_DIR)//opt/openfoam11/src/../applications/solvers/foamRun/setDeltaT.C.dep and in a second step by $(OBJECTS_DIR)/$(WM_PROJECT_DIR)/src/../applications/solvers/foamRun/setDeltaT.C.dep.
But in the second replacement, the string /opt/openfoam11 (len=15) is shorter than $(WM_PROJECT_DIR) (len=17). (If using the openfoam-dev version, the strings have actually the same length, and the error does not appear).
Now in https://github.com/OpenFOAM/OpenFOAM-11/blob/cfbe06828419fdb6440f74bea6a190bc0abd7624/wmake/src/wmkdep.l#L433 the offset for the search string should be calculated. In this case it should be a positive positive number (not 0 as in probably all the other cases). But as searchStart points somewhere behind str, the returned value here is negative. Then the newly assigned searchStart pointer in https://github.com/OpenFOAM/OpenFOAM-11/blob/cfbe06828419fdb6440f74bea6a190bc0abd7624/wmake/src/wmkdep.l#L439 points before the actual string.
So to fix this bug, the calculation in line 433 needs to be reversed:
const size_t start = searchStart - str;
|Tags||No tags attached.|
Thanks for the bug-report and proposed fix, this is a "corner" case we have never come across before, nor has anyone else I guess.
Resolved in OpenFOAM-11 by commit 528c1e71cc9af83a4d91d25d7ede64e74649ca2e
Resolved in OpenFOAM-dev by commit 70290b3e2db9041df3f6e23f4506534ddf24081e