You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New ini-file parser breaks hm2_eth config on master #3946
It took me some time and bisecting to figure out the reason. With added some debug printf's:
Before: rtapi_app load hm2_eth board_ip=192.168.1.121 config="num_encoders=0 num_pwmgens=1 num_stepgens=4"
After: rtapi_app load hm2_eth board_ip=192.168.1.121 config=num_encoders=0 num_pwmgens=1 num_stepgens=4
Note the missing "
The error message is quite usless:
hm2: loading Mesa HostMot2 driver version 0.15
./hm2-stepper-eth.hal:38: waitpid failed /home/hannes/linuxcnc-src/bin/rtapi_app hm2_eth
./hm2-stepper-eth.hal:38: /home/hannes/linuxcnc-src/bin/rtapi_app exited without becoming ready
./hm2-stepper-eth.hal:38: insmod for hm2_eth failed, returned -1
The "breaks..." is more like "I probably intentionally broke..." ;-)
The problem is that double quotes no longer are a literal part of a value but are now interpreted. This is, of course, unfortunate for existing configs. But is does add consistency for the future.
The simple fix is enclose the double quoted string in single quotes in the INI-file entry to:
Thanks for the info. So more like a breaking change needing users to update their config together with hm2_eth not generating useful error messages.
There are a lot of examples and might be also doc that need updating in this case. Just one example that is broken now: configs/by_interface/mesa/hm2-stepper/4i68.ini
It would make sense to add some checks and give a proper error in hm2_eth, it took me some time to resolve it and others will have the same issue for sure.
This parameter parsing also happens in uspace_rtapi_app.cc. It looks like the warning about unknown parameters is broken on master. On 2.9, I have a warning when I add a parameter that is not used.
I can look into that but only after #3919 got merged.
You seem to have taken the position that the existing configs are wrong. I don't think that is necessarily reasonable.
I would guess that the majority of configs use a Mesa card, and you have broken all of them.
(This problem won't be limited to hm2_eth, all the Mesa cards take configuration strings.)
The quotes are needed so that the handlers get a list of config parameters without them being broken up by the Linux parameter parser.
Considering our user base, I don't like expecting them all to start using nested or escaped quotes, the parser should pass-through quoted string including quotes.
You cannot both pass quotes in values and interpret content. Neither can you do string collection if you do not interpret quotes.
And, yes, the idea that bare quotes in values are allowed is wrong IMO. The compromise is that strings with quotes, when not the first character, are left as is. But you cannot detect the difference between a quoted string and a literal string in quotes.
There may be an alternative in the mesa config string in that the target expansion in the HAL file can be quoted. That may very well be the better solution than quoting the quotes.
But is you want to interpret values in ini-files as bare text, then you also have to re-instate comment characters as a part of the value (and cannot have a comment on a value line).
One thing to consider: CONFIG='"num_encoders=0 num_pwmgens=1 num_stepgens=4"'
doesn't work in 2.9. So you need different ini files for 2.9 and master from now on.
On one side, this is what master is for, break things to make the whole system better. On the other side, breaking changes are often hard on the users, even if properly documented.
The INI file documentation specifically permits quoted strings.
I feel that any updated INI file parser should work at least as well as the old parser.
Activity
BsAtHome commentedon Apr 18, 2026
The "breaks..." is more like "I probably intentionally broke..." ;-)
The problem is that double quotes no longer are a literal part of a value but are now interpreted. This is, of course, unfortunate for existing configs. But is does add consistency for the future.
The simple fix is enclose the double quoted string in single quotes in the INI-file entry to:
Alternative is to escape the double quotes in a double quoted string:
However, I'd prefer using a single quoted string with embedded double quotes.
hdiethelm commentedon Apr 18, 2026
Thanks for the info. So more like a breaking change needing users to update their config together with hm2_eth not generating useful error messages.
There are a lot of examples and might be also doc that need updating in this case. Just one example that is broken now: configs/by_interface/mesa/hm2-stepper/4i68.ini
It would make sense to add some checks and give a proper error in hm2_eth, it took me some time to resolve it and others will have the same issue for sure.
BsAtHome commentedon Apr 18, 2026
Already going through all configs' ini-files.
It was unknown to be breaking this particular use... However, there was anticipated some fallout.
hdiethelm commentedon Apr 18, 2026
Ok, all fine.
This parameter parsing also happens in uspace_rtapi_app.cc. It looks like the warning about unknown parameters is broken on master. On 2.9, I have a warning when I add a parameter that is not used.
I can look into that but only after #3919 got merged.
BsAtHome commentedon Apr 18, 2026
Fix in #3947 for in-tree configs.
hdiethelm commentedon Apr 18, 2026
That was fast! Meanwhile, I traced the missing error message. There is one, it is just not shown in master: #3948
andypugh commentedon Apr 19, 2026
You seem to have taken the position that the existing configs are wrong. I don't think that is necessarily reasonable.
I would guess that the majority of configs use a Mesa card, and you have broken all of them.
(This problem won't be limited to hm2_eth, all the Mesa cards take configuration strings.)
The quotes are needed so that the handlers get a list of config parameters without them being broken up by the Linux parameter parser.
Considering our user base, I don't like expecting them all to start using nested or escaped quotes, the parser should pass-through quoted string including quotes.
BsAtHome commentedon Apr 19, 2026
You cannot both pass quotes in values and interpret content. Neither can you do string collection if you do not interpret quotes.
And, yes, the idea that bare quotes in values are allowed is wrong IMO. The compromise is that strings with quotes, when not the first character, are left as is. But you cannot detect the difference between a quoted string and a literal string in quotes.
There may be an alternative in the mesa config string in that the target expansion in the HAL file can be quoted. That may very well be the better solution than quoting the quotes.
But is you want to interpret values in ini-files as bare text, then you also have to re-instate comment characters as a part of the value (and cannot have a comment on a value line).
hdiethelm commentedon Apr 19, 2026
One thing to consider:
CONFIG='"num_encoders=0 num_pwmgens=1 num_stepgens=4"'doesn't work in 2.9. So you need different ini files for 2.9 and master from now on.
On one side, this is what master is for, break things to make the whole system better. On the other side, breaking changes are often hard on the users, even if properly documented.
andypugh commentedon Apr 19, 2026
The INI file documentation specifically permits quoted strings.
I feel that any updated INI file parser should work at least as well as the old parser.
https://linuxcnc.org/docs/master/html/config/ini-config.html#sub:ini:variables
BsAtHome commentedon Apr 19, 2026
Don't worry, #3947 has been changed so that quotes are no longer treated as special but just part of the string.