Repository navigation
common: ocispec: return integrity error on file read - #326
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
MykolaSuperman
left a comment
There was a problem hiding this comment.
Reviewed-by: Mykola Solianko <mykola_solianko@epam.com>
mlohvynenko
left a comment
There was a problem hiding this comment.
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Integrity recovery is triggered by eIntegrity, but the OCI spec loaders read files with std::ifstream, which doesn't report read errors: a failed read ends up as a JSON parse error. Add utils::ReadJsonFromFile, which reads the file with fs::ReadFile and parses its content, and use it in all the loaders. EIO and EBADMSG are returned as eIntegrity, ENOENT as eNotFound, any other errno as is. Malformed JSON that is read successfully is still returned as eInvalidArgument. This change requires fs::ReadFile of aos_core_lib_cpp that returns eIntegrity and eNotFound. Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com> Reviewed-by: Mykola Solianko <mykola_solianko@epam.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|




Integrity recovery is triggered by eIntegrity, but the OCI spec loaders read files with std::ifstream, which doesn't report read errors: a failed read ends up as a JSON parse error.
Add utils::ReadJsonFromFile, which reads the file with fs::ReadFile and parses its content, and use it in all the loaders. EIO and EBADMSG are returned as eIntegrity, ENOENT as eNotFound, any other errno as is. Malformed JSON that is read successfully is still returned as eInvalidArgument.
This change requires fs::ReadFile of aos_core_lib_cpp that returns eIntegrity and eNotFound.