Skip to content

Conversation

macvenez
Copy link
Contributor

@macvenez macvenez commented Oct 9, 2025

The behaviour before this commit was causing an error when using a string starting with character '0' in userPrefs.jsonc as node long or short name.

This was because all strings not quoted starting with 0 are interpreted as octal values so we couldn't use any number above 7 and also no alphabetic characters at all

<command-line>: error: invalid digit "8" in octal constant
src/mesh/NodeDB.cpp:1054:70: note: in expansion of macro 'USERPREFS_CONFIG_OWNER_LONG_NAME'
     snprintf(owner.long_name, sizeof(owner.long_name), (const char *)USERPREFS_CONFIG_OWNER_LONG_NAME);
                                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<command-line>: error: invalid digit "8" in octal constant
src/mesh/NodeDB.cpp:1059:72: note: in expansion of macro 'USERPREFS_CONFIG_OWNER_SHORT_NAME'
     snprintf(owner.short_name, sizeof(owner.short_name), (const char *)USERPREFS_CONFIG_OWNER_SHORT_NAME);

when using for example:

   "USERPREFS_CONFIG_OWNER_LONG_NAME": "08715",
   "USERPREFS_CONFIG_OWNER_SHORT_NAME": "0871",

in userprefs.jsonc file.

This should fix it, probably it would be nice to check if similar problems are caused by similar declarations in userPrefs.jsonc file

@vidplace7
Copy link
Member

@macvenez
This should work as is by wrapping in 'single quotes'.

   "USERPREFS_CONFIG_OWNER_LONG_NAME": "'08715'",
   "USERPREFS_CONFIG_OWNER_SHORT_NAME": "'0871'",

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