configs: remove duplicate INI keys (first occurrence wins)#4092
Open
PeterStolz wants to merge 3 commits into
Open
configs: remove duplicate INI keys (first occurrence wins)#4092PeterStolz wants to merge 3 commits into
PeterStolz wants to merge 3 commits into
Conversation
LinuxCNC's INI reader returns the first occurrence of a key within a section (IniFile::findTag with num=1), so a second line with the same key in the same section is silently ignored. Several shipped sim/demo configs contain such duplicates where the later value is dead -- in a couple of cases masking the author's evident intent. The first-wins behaviour was confirmed on 2.10 with `inivar` and the linuxcnc.ini Python reader. - sim/axis/gladevcp/probe.ini: [RS274NGC] SUBROUTINE_PATH was set twice, so the second value (../../nc_files/gladevcp_lib -- the gladevcp demo's O-word subs) was ignored and those subs were unreachable. Merge both into one colon-separated SUBROUTINE_PATH. - sim/woodpecker/woodpecker_xyzab.ini: [DISPLAY] GEOMETRY = xyzab (added for this 5-axis variant) was overridden by a leftover XYZABCUVW; make xyzab effective. Also drop a duplicate [RS274NGC] PARAMETER_FILE. - sim/woodpecker/woodpecker_xyza.ini: drop a pasted-twice spindle-override block ([DISPLAY] MIN/MAX_SPINDLE_0_OVERRIDE). - sim/axis/histogram_demo.ini, ini_hal_demo.ini: drop a stray second [TRAJ] MAX_LINEAR_VELOCITY (1.2345) after 1.2. - sim/axis/vismach/5axis/bridgemill/5axis.ini: drop a redundant [TRAJ] MAX_ANGULAR_VELOCITY (360, identical to 360.0).
Follow-up to the previous commit. These configs repeat a key within one section with the *same* value. LinuxCNC uses the first occurrence, so the repeats are pure redundancy with no behaviour change -- removing them just de-clutters the configs. - [TRAJ] MAX_LINEAR_VELOCITY = 58 duplicated in: sim/axis/gantry/gantry.ini, sim/axis/gantry/gantry_jjog.ini, sim/qtaxis/gantry/qt_gantry.ini, sim/qtvcp_screens/qt_gantry.ini, sim/qtvcp_screens/qtdefault_gantry.ini - [RS274NGC] HAL_PIN_VARS = 1 duplicated in: sim/axis/vismach/scara/scara.ini, sim/qtaxis/non-trivial/scara/scara.ini, sim/qtvcp_screens/non-trivial/scara/scara.ini - [DISPLAY] GEOMETRY = XYZCBW duplicated in: sim/axis/vismach/5axis/bridgemill/5axis.ini The Sherline4Axis configs also have same-value duplicates, but they sit in a "# for gui only" block next to a conflicting MAX_LINEAR_VELOCITY that needs a separate decision, so they are left for a follow-up.
grandixximo
reviewed
Jun 1, 2026
GEOMETRY is uppercased at parse time (axis.py, gremlin), so this is a cosmetic change to match the uppercase convention used across the INI files and this config's own COORDINATES = XYZAB. Addresses review feedback on PR LinuxCNC#4092.
grandixximo
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Several shipped
sim/demo configs define the same INI key more than once within one section. LinuxCNC only reads the first occurrence, so the later lines are silently ignored — in two cases hiding the author's intent. Split into two commits:How I found it
I'm building a LinuxCNC VS Code extension (HAL/INI/G-code language support) — https://marketplace.visualstudio.com/items?itemName=PeterStolz.linuxcnc-lsp — and its INI linter flagged duplicate keys across a number of in-tree configs, so I went through each to confirm they're real.
Why the second value is ignored
IniFile::findTag(tag, section, num)defaults tonum=1and returns the first match in file order (src/emc/ini/inifile.cc); there is no concatenation for scalar keys. The same is true of theinivarCLI used byscripts/linuxcncand oflinuxcnc.ini(...).find()used by the GUIs. Confirmed on a 2.10 run-in-place build:Commit 1 — conflicting duplicates
Behaviour-changing (restore intent):
sim/axis/gladevcp/probe.ini—[RS274NGC] SUBROUTINE_PATHwas set twice, so the second value (../../nc_files/gladevcp_lib, the gladevcp demo's O-word subs, per its own comment) was never on the path. Merged into one colon-separatedSUBROUTINE_PATH.sim/woodpecker/woodpecker_xyzab.ini—[DISPLAY] GEOMETRY = xyzab(added for this XYZAB variant) was overridden by a leftoverXYZABCUVW; madexyzabeffective.No-op (the removed value was already the ignored one):
woodpecker_xyzab.ini— duplicate[RS274NGC] PARAMETER_FILE(metric_parameters.txtdead; keepswoodpecker.var).woodpecker_xyza.ini— a pasted-twice[DISPLAY]spindle-override block.histogram_demo.ini,ini_hal_demo.ini— stray second[TRAJ] MAX_LINEAR_VELOCITY = 1.2345.sim/axis/vismach/5axis/bridgemill/5axis.ini— redundant[TRAJ] MAX_ANGULAR_VELOCITY = 360(identical to360.0).Commit 2 — redundant (same-value) duplicates
Pure de-clutter, no behaviour change:
[TRAJ] MAX_LINEAR_VELOCITY = 58insim/axis/gantry/gantry.ini,gantry_jjog.ini,sim/qtaxis/gantry/qt_gantry.ini,sim/qtvcp_screens/qt_gantry.ini,qtdefault_gantry.ini.[RS274NGC] HAL_PIN_VARS = 1insim/axis/vismach/scara/scara.ini,sim/qtaxis/non-trivial/scara/scara.ini,sim/qtvcp_screens/non-trivial/scara/scara.ini.[DISPLAY] GEOMETRY = XYZCBWinsim/axis/vismach/5axis/bridgemill/5axis.ini.Not included
The Sherline
Sherline4Axis_{inch,mm}.iniconfigs have a# for gui onlyblock where the first[TRAJ] MAX_LINEAR_VELOCITY(25) wins over a more realistic second value (.36in/s ·8mm/s). Fixing that changes the effective max velocity — a judgement call — so it's left for separate discussion.