Skip to content

halui: fix inverted HOME_SEQUENCE polarity for halui.home-all pin creation (regression from 2f57090adb)#3939

Closed
is-primary-dev wants to merge 1 commit intoLinuxCNC:masterfrom
is-primary-dev:fix-halui-home-all-polarity
Closed

halui: fix inverted HOME_SEQUENCE polarity for halui.home-all pin creation (regression from 2f57090adb)#3939
is-primary-dev wants to merge 1 commit intoLinuxCNC:masterfrom
is-primary-dev:fix-halui-home-all-polarity

Conversation

@is-primary-dev
Copy link
Copy Markdown

Summary

Upstream commit 2f57090 ("ini: Implement a new ini-file parser and adapt the code to use it") ported halui.cc's HOME_SEQUENCE check from the old inifile.Find() API to the new inifile.isSet() API and accidentally flipped the polarity of the condition that gates halui.home-all pin creation.

Originally from commit 38d35cd ("Add pin home-all to halui pin is created only if HOME_SEQUENCE is properly defined in inifile"):

if (inifile.Find("HOME_SEQUENCE", "JOINT_0")) {
    have_home_all = 1;
}

Find() returned truthy when the key was defined, so the pin was created when HOME_SEQUENCE was properly set — matching the commit message's stated intent.

After 2f57090:

if (!inifile.isSet("HOME_SEQUENCE", "JOINT_0")) {
    have_home_all = 1;
}

isSet() returns true when the key is set, so with the added ! the condition fires only when HOME_SEQUENCE is NOT set — the opposite of the original semantics.

Observable symptom

Properly-configured machines (which define HOME_SEQUENCE in [JOINT_0]) no longer get the halui.home-all convenience pin:

$ halcmd setp halui.home-all 1
<commandline>:0: parameter or pin 'halui.home-all' not found

This affects any GUI, HAL script, or test harness that triggers home-all via this pin.

Fix

Remove the !. Added a comment documenting the regression and the original semantics from 38d35cd.

Testing

Built against upstream master and verified on a simulation configuration with [JOINT_0] HOME_SEQUENCE = 0. Before the fix: halcmd show pin halui.home-all returns nothing. After the fix: the pin exists, and pulsing it correctly triggers home-all.

Upstream commit 2f57090 ("ini: Implement a new ini-file parser and
adapt the code to use it") ported halui.cc's HOME_SEQUENCE check from
the old inifile API to the new one and accidentally flipped the
polarity of the condition that gates halui.home-all pin creation.

Before 2f57090 (inherited from commit 38d35cd "Add pin home-all
to halui pin is created only if HOME_SEQUENCE is properly defined in
inifile"):

    if (inifile.Find("HOME_SEQUENCE", "JOINT_0")) {
        have_home_all = 1;
    }

Find() returned truthy when the key IS defined, so the pin was
created when HOME_SEQUENCE was properly set — matching the commit
message's stated intent.

After 2f57090:

    if (!inifile.isSet("HOME_SEQUENCE", "JOINT_0")) {
        have_home_all = 1;
    }

The "!" was added by mistake — isSet() returns true when the key IS
set, so the new condition fires only when HOME_SEQUENCE is NOT set,
which is the OPPOSITE of the original behavior and the opposite of
what 38d35cd's commit message documents.

The practical effect: properly-configured machines (which set
HOME_SEQUENCE in [JOINT_0]) no longer get the halui.home-all
convenience pin after 2f57090. halcmd lookups fail with
"parameter or pin 'halui.home-all' not found", and any tooling or
GUI that pulses halui.home-all to trigger home-all cannot trigger
homing at all.

Restore the original semantics by removing the "!":

    if (inifile.isSet("HOME_SEQUENCE", "JOINT_0")) {
        have_home_all = 1;
    }

Also add a source comment documenting the regression and the
original semantics so the next person who looks at this code sees
the history without having to dig the git log.
Comment thread src/emc/usr_intf/halui.cc
Comment on lines +1475 to +1482
// Create halui.home-all pin only if [JOINT_0]HOME_SEQUENCE is properly
// defined (original semantics from commit 38d35cdf8e). Commit 2f57090adb
// ("ini: Implement a new ini-file parser...") ported the old
// `inifile.Find("HOME_SEQUENCE", "JOINT_0")` check to the new API as
// `!inifile.isSet("HOME_SEQUENCE", "JOINT_0")`, inadvertently flipping
// the polarity — the "!" should not be there. With the polarity
// inverted, properly-configured machines (which set HOME_SEQUENCE in
// [JOINT_0]) lose the halui.home-all convenience pin.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is superfluous.

@BsAtHome
Copy link
Copy Markdown
Contributor

Superseded by #3940

@BsAtHome BsAtHome closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants