Skip to content

halcompile: reject declarations that export the same HAL name (2.9 backport) - #4299

Open
tzuohann wants to merge 1 commit into
LinuxCNC:2.9from
tzuohann:halcompile-halname-2.9
Open

halcompile: reject declarations that export the same HAL name (2.9 backport)#4299
tzuohann wants to merge 1 commit into
LinuxCNC:2.9from
tzuohann:halcompile-halname-2.9

Conversation

@tzuohann

@tzuohann tzuohann commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

2.9 backport of #4298.

pin in float my_input is exported as component.N.my-input — underscores become dashes (comp.adoc, HALNAME).

A component that declares both x_y and x_y_ exports both as x-y. halcompile accepts it; the module then fails at loadrt:

HAL: ERROR: duplicate variable 'collide.0.x-y'
collide: rtapi_app_main: Invalid argument (-22)

check_name_ok() only compares declared names. check_hal_name() rejects the collision at the offending line and points at the HALNAME documentation. Functions are tracked separately from pins and params, which share one namespace in hal_lib.c.

Docs: NAMES section in the halcompile man page, note under the HALNAME table in comp.adoc. Tests: tests/halcompile/halname. All 119 in-tree .comp files preprocess with no new output.

Man page there is the tracked troff docs/man/man1/halcompile.1, not the adoc.

🤖 Generated with Claude Code

@tzuohann tzuohann changed the title halcompile: warn about, and reject colliding, mangled HAL names halcompile: warn about, and reject colliding, mangled HAL names (2.9 backport) Jul 31, 2026
@tzuohann
tzuohann force-pushed the halcompile-halname-2.9 branch from 4b25bc7 to f3f45d9 Compare July 31, 2026 01:12
@grandixximo

Copy link
Copy Markdown
Contributor

Had a weird CI failure, re-running, @BsAtHome shmem issue in 2.9?

@BsAtHome

Copy link
Copy Markdown
Contributor

Had a weird CI failure, re-running, @BsAtHome shmem issue in 2.9?

No idea...

However, I do not think this should be backported. At least we should have an agreement how this must be done before we can think about backporting.

A name declared in a .comp file is a C identifier, but it is exported
under a mangled HAL identifier: underscores become dashes and a trailing
dash or period is removed (comp.adoc, HALNAME). check_name_ok() compares
only declared names, so a component declaring both x_y and x_y_ exported
both as x-y. halcompile accepted it and the module failed at loadrt:

    HAL: ERROR: duplicate variable 'collide.0.x-y'
    collide: rtapi_app_main: Invalid argument (-22)

check_hal_name() rejects that at the offending line and points at the
HALNAME documentation. Functions are tracked separately from pins and
params, which share one namespace in hal_lib.c.

All 119 in-tree .comp files preprocess with no new error and no new
output. tests/halcompile/halname covers the rejection.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tzuohann
tzuohann force-pushed the halcompile-halname-2.9 branch from f3f45d9 to 1e5b086 Compare July 31, 2026 17:13
@tzuohann tzuohann changed the title halcompile: warn about, and reject colliding, mangled HAL names (2.9 backport) halcompile: reject declarations that export the same HAL name (2.9 backport) Jul 31, 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.

3 participants