-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sys/ubjson: Do not invert bool when writing it #11702
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MrKevinWeiss
added
Area: sys
Area: System
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
Impact: minor
The PR is small in size and might only require a quick look of a knowledgeable reviewer
Type: bug
The issue reports a bug / The PR fixes a bug (including spelling errors)
labels
Jun 17, 2019
leandrolanzieri
added
Reviewed: 1-fundamentals
The fundamentals of the PR were reviewed according to the maintainer guidelines
Reviewed: 2-code-design
The code design of the PR was reviewed according to the maintainer guidelines
Reviewed: 4-code-style
The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines
labels
Jun 17, 2019
leandrolanzieri
approved these changes
Jun 17, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks for fixing this. The change makes sense. ACK!
leandrolanzieri
added
the
Reviewed: 3-testing
The PR was tested according to the maintainer guidelines
label
Jun 17, 2019
jcarrano
added a commit
to jcarrano/RIOT
that referenced
this pull request
Jun 19, 2019
The ubjson module has a number of quality defects and is unsafe. Considering CBOR is popular, standarized and supported in RIOT and that the ubjson implementation is a home-grown one whose API will likely be unfamiliar to new users, I propose to delete it. This removal, of course, dows not have to be NOW. We can deprecate it for one or two releases before. What's wrong with this module? - Unsafe: the parsing is done recursively. This is embedded in the API, so it is not possible to fix it without changing the API. A document with too much nesting can cause a stack overflow. - Does not validate writing: it is possible to produce invalid output. From the docs: > The library won't complain if you write multiple values that are not > inside an array or object. The result will just not be properly serialized. - Poorly tested. As shown by RIOT-OS#11702, RIOT-OS#11703 the tests were not even detecting that a False was stored as True. - In line with the previous remark, see https://github.com/RIOT-OS/RIOT/blob/68dc5b0d6e0422df9c3653c2cb8021fc35974aae/tests/unittests/tests-ubjson/tests-ubjson.c#L66-L77 Why is the following code in the unit tests?? ```c irq_disable(); sched_set_status(data->main_thread, STATUS_PENDING); ``` - RIOT-OS#2175 is still unfixed after 3.5 years. - Code quality. The code has multiline macros that assign variables and return. See https://github.com/RIOT-OS/RIOT/blob/c3325148755c64a56b256253151a485498bcbc9b/sys/ubjson/ubjson-write.c#L34-L41 Can we mark it as deprecated this release and sweep it in the following one?
jcarrano
added a commit
to jcarrano/RIOT
that referenced
this pull request
Aug 15, 2019
The ubjson module has a number of quality defects and is unsafe. Considering CBOR is popular, standarized and supported in RIOT and that the ubjson implementation is a home-grown one whose API will likely be unfamiliar to new users, I propose to delete it. This removal, of course, dows not have to be NOW. We can deprecate it for one or two releases before. What's wrong with this module? - Unsafe: the parsing is done recursively. This is embedded in the API, so it is not possible to fix it without changing the API. A document with too much nesting can cause a stack overflow. - Does not validate writing: it is possible to produce invalid output. From the docs: > The library won't complain if you write multiple values that are not > inside an array or object. The result will just not be properly serialized. - Poorly tested. As shown by RIOT-OS#11702, RIOT-OS#11703 the tests were not even detecting that a False was stored as True. - In line with the previous remark, see https://github.com/RIOT-OS/RIOT/blob/68dc5b0d6e0422df9c3653c2cb8021fc35974aae/tests/unittests/tests-ubjson/tests-ubjson.c#L66-L77 Why is the following code in the unit tests?? ```c irq_disable(); sched_set_status(data->main_thread, STATUS_PENDING); ``` - RIOT-OS#2175 is still unfixed after 3.5 years. - Code quality. The code has multiline macros that assign variables and return. See https://github.com/RIOT-OS/RIOT/blob/c3325148755c64a56b256253151a485498bcbc9b/sys/ubjson/ubjson-write.c#L34-L41 Can we mark it as deprecated this release and sweep it in the following one?
leandrolanzieri
pushed a commit
to leandrolanzieri/RIOT
that referenced
this pull request
Dec 1, 2019
The ubjson module has a number of quality defects and is unsafe. Considering CBOR is popular, standarized and supported in RIOT and that the ubjson implementation is a home-grown one whose API will likely be unfamiliar to new users, I propose to delete it. This removal, of course, dows not have to be NOW. We can deprecate it for one or two releases before. What's wrong with this module? - Unsafe: the parsing is done recursively. This is embedded in the API, so it is not possible to fix it without changing the API. A document with too much nesting can cause a stack overflow. - Does not validate writing: it is possible to produce invalid output. From the docs: > The library won't complain if you write multiple values that are not > inside an array or object. The result will just not be properly serialized. - Poorly tested. As shown by RIOT-OS#11702, RIOT-OS#11703 the tests were not even detecting that a False was stored as True. - In line with the previous remark, see https://github.com/RIOT-OS/RIOT/blob/68dc5b0d6e0422df9c3653c2cb8021fc35974aae/tests/unittests/tests-ubjson/tests-ubjson.c#L66-L77 Why is the following code in the unit tests?? ```c irq_disable(); sched_set_status(data->main_thread, STATUS_PENDING); ``` - RIOT-OS#2175 is still unfixed after 3.5 years. - Code quality. The code has multiline macros that assign variables and return. See https://github.com/RIOT-OS/RIOT/blob/c3325148755c64a56b256253151a485498bcbc9b/sys/ubjson/ubjson-write.c#L34-L41 Can we mark it as deprecated this release and sweep it in the following one?
fjmolinas
pushed a commit
to fjmolinas/RIOT
that referenced
this pull request
Dec 15, 2019
The ubjson module has a number of quality defects and is unsafe. Considering CBOR is popular, standarized and supported in RIOT and that the ubjson implementation is a home-grown one whose API will likely be unfamiliar to new users, I propose to delete it. This removal, of course, dows not have to be NOW. We can deprecate it for one or two releases before. What's wrong with this module? - Unsafe: the parsing is done recursively. This is embedded in the API, so it is not possible to fix it without changing the API. A document with too much nesting can cause a stack overflow. - Does not validate writing: it is possible to produce invalid output. From the docs: > The library won't complain if you write multiple values that are not > inside an array or object. The result will just not be properly serialized. - Poorly tested. As shown by RIOT-OS#11702, RIOT-OS#11703 the tests were not even detecting that a False was stored as True. - In line with the previous remark, see https://github.com/RIOT-OS/RIOT/blob/68dc5b0d6e0422df9c3653c2cb8021fc35974aae/tests/unittests/tests-ubjson/tests-ubjson.c#L66-L77 Why is the following code in the unit tests?? ```c irq_disable(); sched_set_status(data->main_thread, STATUS_PENDING); ``` - RIOT-OS#2175 is still unfixed after 3.5 years. - Code quality. The code has multiline macros that assign variables and return. See https://github.com/RIOT-OS/RIOT/blob/c3325148755c64a56b256253151a485498bcbc9b/sys/ubjson/ubjson-write.c#L34-L41 Can we mark it as deprecated this release and sweep it in the following one?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: sys
Area: System
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
Impact: minor
The PR is small in size and might only require a quick look of a knowledgeable reviewer
Reviewed: 1-fundamentals
The fundamentals of the PR were reviewed according to the maintainer guidelines
Reviewed: 2-code-design
The code design of the PR was reviewed according to the maintainer guidelines
Reviewed: 3-testing
The PR was tested according to the maintainer guidelines
Reviewed: 4-code-style
The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines
Type: bug
The issue reports a bug / The PR fixes a bug (including spelling errors)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
The UBJSON writer inverts boolean values when writing the output. This does not seem to be the intended behavior. This PR reverts the inversion.
UBJSON in general uses a
<type-marker>[value]
syntax, and for boolean values, there are two dedicated markers for true (T
) and false (F
). Those are interchanged when writing.Testing procedure
The following demo application can be run on
native
to examine the issue in isolation:main.c
Makefile
Before applying the fix, it will output:
With the fix, the values will be correct (note the different markers after
bool_true
andbool_false
):Issues/PRs references
None.