-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NVS Partition Generator Utility lost ability to parse multiline string values in v4.3 (IDFGH-5434) #7175
Comments
@DaStoned Thank you. We are looking into adding the fix. |
As far as I can tell it's also not possible to have commas within escaped strings. I think the problem is in the following line:
This simply splits the line at the commas. The problem mentioned in this issue is also related to that code since the file is read line by line and thus the newlines within escaped strings are lost. |
Hi @DaStoned For IDF >=v4.3, recommend to use the
And then you can have the string in the pubKey.txt as follows -
|
Hi @dbahrdt |
Hi, thank you for the reply. That is a viable workaround, though not nearly as convenient as the earlier behaviour I'm sorry to say. |
@shivani-tipnis - I see you've marked this issue as Done. Unfortunately I cannot accept this resolution. The proposed workaround is not viable for the problem that @dbahrdt reported, for strings containing commas. I will be generating per-device strings during the manufacturing process and will not know in advance which characters they contain. A CSV file must support a string field with commas (and all other regular, printable characters) if enclosed within quotes, or it's not usable for string data. E.g. this worked fine in v4.2 (NVS stored value "Hello,World") and stopped working in v4.3 (stored value "Hello"):
When looking at the history of nvs_partition_gen.py I see that you've replaced the Python Gentlemen. This script is proposed by Espressif as the tool for preparing device images in manufacturing, and you've effectively made it useless for that purpose in v4.3. Please show your commercial users some respect and fix this. |
Hi @DaStoned |
Thank you! |
…ts in the CSV file Closes #7175
I've also just been affected by this. I think it's a good idea to force people to use the |
I agree that the silent failure is the worst problem. But as a side note - the Python CSV module (which was used in previous versions of this same script) is perfectly capable of handling "complicated" strings. Replacing this with a naive split string on commas is the source of the current problem. Please revert back to the Python CSV module (which did its job admirably) or use another, more deterministic text format (JSON, YAML,...) |
Hi all. We are sorry it took us so long but this has now been addressed in the master branch (v5.0). The fix will be backported to previous releases shortly. |
Wonderful news. I'll be happy to verify once it reaches a 4.x release. |
This fixes the issue where multiline strings and strings with delimiters inside the nvs input csv file were incorrectly parsed, and adds back the ability to add comment lines anywhere in the CSV file. The issue stems from the move away from the python built in csv module to manual parsing, which was made after moving away from using the csv module to parse mfg data. This reverts back to using the csv module for parsing and writing csv data in both mfg_gen and nvs_partition_gen, fixes the original issue in mfg_gen and improves code quality which makes the code more readable and maintainable. Closes #7175
This fixes the issue where multiline strings and strings with delimiters inside the nvs input csv file were incorrectly parsed, and adds back the ability to add comment lines anywhere in the CSV file. The issue stems from the move away from the python built in csv module to manual parsing, which was made after moving away from using the csv module to parse mfg data. This reverts back to using the csv module for parsing and writing csv data in both mfg_gen and nvs_partition_gen, fixes the original issue in mfg_gen and improves code quality which makes the code more readable and maintainable. Closes #7175
…ts in the CSV file Closes espressif/esp-idf#7175
This fixes the issue where multiline strings and strings with delimiters inside the nvs input csv file were incorrectly parsed, and adds back the ability to add comment lines anywhere in the CSV file. The issue stems from the move away from the python built in csv module to manual parsing, which was made after moving away from using the csv module to parse mfg data. This reverts back to using the csv module for parsing and writing csv data in both mfg_gen and nvs_partition_gen, fixes the original issue in mfg_gen and improves code quality which makes the code more readable and maintainable. Closes espressif/esp-idf#7175
Environment
Problem Description
Given NVS partition data described in CSV file below,
nvs_partition_gen.py
fails to parse the multiline string value (a PEM format ECC key which contains newlines). This works in ESP IDF v4.2.2 and started to fail with v4.3.As a result I can no longer provision my devices with their keys and certificates.
Expected Behavior
In ESP IDF 4.2.2 this generates a valid NVS partition binary with the multi-line PEM key as a string:
Actual Behavior
In ESP IDF 4.3 this started to fail:
Steps to reproduce
Side note: in addition to this issue, comments in the file (lines starting with
#
) are no longer supported, which is slightly annoying but not critical.Other
My python version is 3.9.1 (note this didn't change when I upgraded ESP IDF) and below is output from
pip freeze
(which was upgraded quite a bit with the upgrade) if relevant:The text was updated successfully, but these errors were encountered: