Skip to content

bug: Homebrew v5.3.1 install crashes on startup — num_ib_patches_max missing from Fortran constants fallback #1420

@sbryngelson

Description

@sbryngelson

Summary

Every MFC v5.3.1 Homebrew install crashes immediately on startup with:

RuntimeError: Fortran constant 'num_ib_patches_max' not found in m_constants.fpp.
Toolchain is out of sync with Fortran source.

This breaks mfc case.py for all users who installed via brew install mflowcode/mfc/mfc.

Root cause

Homebrew does not install src/ (only toolchain/, bin/, and examples/), so get_fortran_constants() in namelist_parser.py cannot find src/common/m_constants.fpp and falls back to _FALLBACK_CONSTANTS.

PR #1348 (Ib collisions, @danieljvickers) correctly split patch_ib onto its own Fortran bound by adding:

# toolchain/mfc/params/definitions.py
NIB = _fc("num_ib_patches_max")  # patch_ib (Fortran array bound)

But _FALLBACK_CONSTANTS in namelist_parser.py — the dict used when src/ is absent — was never updated to include "num_ib_patches_max". As a result, _fc() raised on every Homebrew startup.

The structural problem: _fc(name) and _FALLBACK_CONSTANTS were two separate places that had to stay in sync, with no enforcement.

Affected versions

  • v5.3.1 (introduced by Ib collisions #1348, shipped in this release)
  • v5.3.0 and earlier: not affected (NIB did not yet exist)

Fix

PR #1419 removes _FALLBACK_CONSTANTS entirely and changes _fc to require an inline default:

NIB = _fc("num_ib_patches_max", 50000)  # can't forget — default is right here

Going forward, any developer adding a new _fc() call must supply the fallback value at the call site. It is a required argument.

cc @danieljvickers

Metadata

Metadata

Assignees

Labels

bugSomething isn't working or doesn't seem right

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions