Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

warn if ROS_IP contains whitespace#1379

Merged
dirk-thomas merged 1 commit intoros:melodic-develfrom
v4hn:pr-melodic-warn-about-whitespace-ip
May 1, 2018
Merged

warn if ROS_IP contains whitespace#1379
dirk-thomas merged 1 commit intoros:melodic-develfrom
v4hn:pr-melodic-warn-about-whitespace-ip

Conversation

@v4hn
Copy link
Copy Markdown
Contributor

@v4hn v4hn commented Apr 29, 2018

This breaks ROS connections and it does not show with echo $ROS_IP.

Also "local IP address" often refers to 192.168. et al,
so I resolved this ambiguity too.

This breaks ROS connections and it does not show with `echo $ROS_IP`.

Also "local IP address" often refers to 192.168. et al,
so I resolved this ambiguity too.
@mikepurvis
Copy link
Copy Markdown
Member

mikepurvis commented Apr 30, 2018

Is this added check catching a case not already caught by the in addrs check which immediately follows?

@v4hn
Copy link
Copy Markdown
Contributor Author

v4hn commented Apr 30, 2018 via email

@dirk-thomas
Copy link
Copy Markdown
Member

Can you please give an example of a value which you ran into? Are we talking about leading / trailing spaces or spaces in the middle of the IP address?

@mikepurvis
Copy link
Copy Markdown
Member

LGTM then.

@v4hn
Copy link
Copy Markdown
Contributor Author

v4hn commented May 1, 2018

Can you please give an example of a value which you ran into?

This was my problem this time:

> export ROS_IP=$(ip address show eth0 | sed -n 's:inet \([^ /]*\).*:\1:; T; p')
> echo $ROS_IP
1.2.3.4
> roswtf
...
WARNING ROS_IP may be incorrect: ROS_IP [    1.2.3.4] does not appear to be a local IP address [u'127.0.0.1', ...]

There is probably a better way to extract the intended IP address, but a bug in the sed script accidentally added 4 spaces before the IP. In theory this is shown in the warning, but in practice it could also be random padding in the output.

Now this will say

WARNING ROS_IP may be incorrect: ROS_IP [    1.2.3.4] contains whitespace. This is not a valid IP.

Additionally I disambiguate the previous warning when the IP does not match a local adapter.
It will now print the more comprehensive warning:

WARNING ROS_IP may be incorrect: ROS_IP [1.2.3.4] does not appear to be an IP address of a local network interface (one of [u'127.0.0.1', ...]).

@dirk-thomas
Copy link
Copy Markdown
Member

Thank you for the patch and the explanation.

@dirk-thomas dirk-thomas merged commit fcf37d2 into ros:melodic-devel May 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants