Skip to content
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

tests/gnrc_udp: Replace atoi() by strtol() [backport 2019.04] #11357

Merged
merged 2 commits into from
Apr 15, 2019

Conversation

jcarrano
Copy link
Contributor

@jcarrano jcarrano commented Apr 8, 2019

Contribution description

Partial backport of #11356 (only the bare minimum required to get the tests going.)

Issues/PRs references

See #11356 .

@jcarrano jcarrano added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: release backport Integration Process: The PR is a release backport of a change previously provided to master labels Apr 8, 2019
@miri64
Copy link
Member

miri64 commented Apr 8, 2019

Let's discuss the fix first before backporting it ;-). Otherwise, you just have more work, when you have to backport your fixups ;)

@miri64
Copy link
Member

miri64 commented Apr 8, 2019

(also when you backport after merge you can use the convenient backporting script)

@jcarrano
Copy link
Contributor Author

jcarrano commented Apr 9, 2019

@miri64 I removed all of the changes that were unrelated to the Zero-length bug.

(also when you backport after merge you can use the convenient backporting script)

Actually, I forward-ported. I first made the change in the release branch and afterwards cherry-picked to master.

@jcarrano jcarrano changed the title tests/gnrc_udp: Replace atoi() by strtol(). tests/gnrc_udp: Replace atoi() by strtol() [backport 2019.04] Apr 9, 2019
@miri64
Copy link
Member

miri64 commented Apr 9, 2019

Actually, I forward-ported. I first made the change in the release branch and afterwards cherry-picked to master.

Can you apply the changes here to master then, please, so we can merge there first?

@miri64
Copy link
Member

miri64 commented Apr 15, 2019

@jcarrano ping: Please adapt your backport. Also needs rebase.

miri64
miri64 previously approved these changes Apr 15, 2019
Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. Identical to #11356 and still working. Still needs rebase though.

Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-ACK

This patch is a reduced version of an earlier one, with the bare minimum
required to be able to run the test and get the release going.

Original description:

atoi() cannot detect errors. Many implementation return zero on error
and that is what was being checked here, making the "udp send" command
unable to parse integer values of zero. On top of this, the behavior on
errors does not seem to be specified in the standard (so it is not even
correct to check for zero even when zero is not an accepted value, like
for a port number).

The result of all this is that sending UDP packets of zero length (as
required by the Release Specs) was not possible.

This patch replaces atoi by strlen, which allows for robust error detection.
Sending zero length packets is possible.
This was causing the CI build to fail in the static-check stage
(cppcheck).
@miri64 miri64 merged commit b0dccc4 into RIOT-OS:2019.04-branch Apr 15, 2019
@danpetry danpetry added this to the Release 2019.04 milestone Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: release backport Integration Process: The PR is a release backport of a change previously provided to master Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants