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

ping: bad timing interval: 0.5 #273

Closed
JiaoXianjun opened this issue Jun 10, 2020 · 8 comments
Closed

ping: bad timing interval: 0.5 #273

JiaoXianjun opened this issue Jun 10, 2020 · 8 comments

Comments

@JiaoXianjun
Copy link

ping 192.168.13.1 -i 0.5

version:
ping -V
ping from iputils s20190709

@kerolasa
Copy link
Collaborator

Lets see.

$ ping 192.168.13.1  -c 3
PING 192.168.13.1 (192.168.13.1) 56(84) bytes of data.

--- 192.168.13.1 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2036ms

Ok, all lost. How about pinging something that does answer.

$ ping 127.0.0.1 -i 0.5 -c 3
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.035 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.061 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.047 ms

--- 127.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1034ms
rtt min/avg/max/mdev = 0.035/0.047/0.061/0.010 ms

I do not think there is anything wrong with ping.

@JiaoXianjun
Copy link
Author

can you:

ping 192.168.13.1 -i 0.5 -c 3

@JiaoXianjun
Copy link
Author

Strange, on my computer, ping 127.0.0.1 -i 0.5 -c 3
Give me:
bad timing interval

Maybe Lubuntu issue.

@JiaoXianjun
Copy link
Author

real crazy! I don't know what happened to my system....

Screenshot from 2020-06-10 21-33-54

@JiaoXianjun
Copy link
Author

After I change "Region & Language" --> "Fromats" from Belgien to United States. The issue disappear.
Every time install a new Ubuntu I have to change this to avoid some strange issue. For this fresh Ubuntu20 installation, I forgot!
Crazy.
We can close this.

@pevik
Copy link
Contributor

pevik commented Jun 10, 2020

First, for checking these language / locale / i18n problems please use localhost address, which is always available: 127.0.0.1 (IPv4) or ::1 (IPv6).
For locale problems you can also test like english locale (whatever you have in the system, it should work even with Belgien:
LC_ALL=C 127.0.0.1 -i 0.3

-i uses decimal point according to locales, which is for English .:

$ LC_ALL=C ping ::1 -i 0.5 -c 1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.083 ms

--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.083/0.083/0.083/0.000 ms
$ LC_ALL=C ping ::1 -i 0,5 -c 1
ping: bad timing interval: 0,5

But for Czech it's ,:

$ LC_ALL=cs_CZ.UTF-8 ping ::1 -i 0.5 -c 1
ping: bad timing interval: 0.5

$ LC_ALL=cs_CZ.UTF-8 ping ::1 -i 0,5 -c 1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.064 ms

--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.064/0.064/0.064/0.000 ms

I consider having -i localized as really bad feature, ping is low level tool. This mean that locales should be set to C in each script to be portable :(. See also #271.

@pevik
Copy link
Contributor

pevik commented Jun 10, 2020

BTW which version do you use? This has been fixed to always use . as decimal point in recent versions by df41e25 (released in s20160308; there are other later related commits: 918e824 918e824 562e0d5 d865d4c).

@JiaoXianjun
Copy link
Author

It is the default ping from ubuntu20 LTS:

ping from iputils s20190709

pevik added a commit to pevik/iputils that referenced this issue Aug 10, 2020
Handling -i and -W parameter changed over the time, recently introducing
several *incompatible* changes:

* -i interval option
Until s20121114 ping used '.' (dot) as a decimal separator.

Then in 04d3f79 ("ping,ping6: Do not assume radix point is denoted by
'.' (-i option).") released in s20121121 decided to use decimal point
from locales (depended on $LC_NUMERIC). But even then it depend on
USE_IDN=yes which does not make much sense.

Recently d865d4c ("ping: Use C locale for parsing -i/-W without IDN")
addressed that and called setlocale() unconditionally. Maybe condition
based on ENABLE_NLS definition should have been discussed, but that
would probably lead just to LC_ALL=C setup in the scripts. People also
get confused by old behavior when decimal separator depends on locale
as some distros e.g. compile without IDN but other don't (see issue iputils#273)
But that introduced *incompatible* behavior for next release, thus
documenting it in this commit.

562e0d5 fixed problems for -W, but also introduced yet another
*incompatible* behavior as invalid number is no longer fatal error (see
below).

d196177 ("ping: Add missing preprocesses checks around setlocale()
calls") unintentionally restored the old behavior, which was fixed by
7a90bd5 ("ping: Fix handling decimal separator for -i/-W opt").

* -W timeout option
Until s20180629 there was undocumented behavior:

1) timeout silently rounded down to the next lower integral number
2) -W N for N < 1 was rounded to 0 => infinite timeout (obviously a bug)
3) -W Ns worked as expected (sleep for N sec, as 's' was dropped,
this could be considered as a feature)
4) -W Nm -W Nh also slept for N sec instead of N min or hour (obviously
a bug)

918e824 ("ping: add support for sub-second timeouts") released in
s20190324 fixed 1) and 2) by allowing real number with locale based
decimal separator when USE_IDN=yes configured. But that introduced
*incompatible* behavior as broke 3 and 4). As it was not documented in
release notes, people complained (issue iputils#236).

562e0d5 ("ping: allow -i and -W option arguments contain garbage input")
restored 3) and 4) support (everything including and after first
non-numeric character is dropped, warning printed).

Fixes: iputils#290

Signed-off-by: Petr Vorel <pvorel@suse.cz>
pevik added a commit to pevik/iputils that referenced this issue Aug 10, 2020
Handling -i and -W parameter changed over the time, recently introducing
several *incompatible* changes:

* -i interval option
Until s20121114 ping used '.' (dot) as a decimal separator.

Then in 04d3f79 ("ping,ping6: Do not assume radix point is denoted by
'.' (-i option).") released in s20121121 decided to use decimal point
from locales (depended on $LC_NUMERIC). But even then it depend on
USE_IDN=yes which does not make much sense.

Recently d865d4c ("ping: Use C locale for parsing -i/-W without IDN")
addressed that and called setlocale() unconditionally. Maybe condition
based on ENABLE_NLS definition should have been discussed, but that
would probably lead just to LC_ALL=C setup in the scripts. People also
get confused by old behavior when decimal separator depends on locale
as some distros e.g. compile without IDN but other don't (see issue iputils#273)
But that introduced *incompatible* behavior for next release, thus
documenting it in this commit.

562e0d5 fixed problems for -W, but also introduced yet another
*incompatible* behavior as invalid number is no longer fatal error (see
below).

d196177 ("ping: Add missing preprocesses checks around setlocale()
calls") unintentionally restored the old behavior, which was fixed by
previous commit 7a90bd5 ("ping: Fix handling decimal separator for -i/-W opt").

* -W timeout option
Until s20180629 there was undocumented behavior:

1) timeout silently rounded down to the next lower integral number
2) -W N for N < 1 was rounded to 0 => infinite timeout (obviously a bug)
3) -W Ns worked as expected (sleep for N sec, as 's' was dropped,
this could be considered as a feature)
4) -W Nm -W Nh also slept for N sec instead of N min or hour (obviously
a bug)

918e824 ("ping: add support for sub-second timeouts") released in
s20190324 fixed 1) and 2) by allowing real number with locale based
decimal separator when USE_IDN=yes configured. But that introduced
*incompatible* behavior as broke 3 and 4). As it was not documented in
release notes, people complained (issue iputils#236).

562e0d5 ("ping: allow -i and -W option arguments contain garbage input")
restored 3) and 4) support (everything including and after first
non-numeric character is dropped, warning printed).

Fixes: iputils#290

Signed-off-by: Petr Vorel <pvorel@suse.cz>
pevik added a commit to pevik/iputils that referenced this issue Aug 18, 2020
Handling -i and -W parameter changed over the time, recently introducing
several *incompatible* changes:

* -i interval option
Until s20121114 ping used '.' (dot) as a decimal separator.

Then in 04d3f79 ("ping,ping6: Do not assume radix point is denoted by
'.' (-i option).") released in s20121121 decided to use decimal point
from locales (depended on $LC_NUMERIC). But even then it depend on
USE_IDN=yes which does not make much sense.

Recently d865d4c ("ping: Use C locale for parsing -i/-W without IDN")
addressed that and called setlocale() unconditionally. Maybe condition
based on ENABLE_NLS definition should have been discussed, but that
would probably lead just to LC_ALL=C setup in the scripts. People also
get confused by old behavior when decimal separator depends on locale
as some distros e.g. compile without IDN but other don't (see issue iputils#273)
But that introduced *incompatible* behavior for next release, thus
documenting it in this commit.

562e0d5 fixed problems for -W, but also introduced yet another
*incompatible* behavior as invalid number is no longer fatal error (see
below).

d196177 ("ping: Add missing preprocesses checks around setlocale()
calls") unintentionally restored the old behavior, which was fixed by
previous commit 7a90bd5 ("ping: Fix handling decimal separator for -i/-W opt").

* -W timeout option
Until s20180629 there was undocumented behavior:

1) timeout silently rounded down to the next lower integral number
2) -W N for N < 1 was rounded to 0 => infinite timeout (obviously a bug)
3) -W Ns worked as expected (sleep for N sec, as 's' was dropped,
this could be considered as a feature)
4) -W Nm -W Nh also slept for N sec instead of N min or hour (obviously
a bug)

918e824 ("ping: add support for sub-second timeouts") released in
s20190324 fixed 1) and 2) by allowing real number with locale based
decimal separator when USE_IDN=yes configured. But that introduced
*incompatible* behavior as broke 3 and 4). As it was not documented in
release notes, people complained (issue iputils#236).

562e0d5 ("ping: allow -i and -W option arguments contain garbage input")
restored 3) and 4) support (everything including and after first
non-numeric character is dropped, warning printed).

Fixes: iputils#290

Signed-off-by: Petr Vorel <pvorel@suse.cz>
pevik added a commit that referenced this issue Aug 18, 2020
Handling -i and -W parameter changed over the time, recently introducing
several *incompatible* changes:

* -i interval option
Until s20121114 ping used '.' (dot) as a decimal separator.

Then in 04d3f79 ("ping,ping6: Do not assume radix point is denoted by
'.' (-i option).") released in s20121121 decided to use decimal point
from locales (depended on $LC_NUMERIC). But even then it depend on
USE_IDN=yes which does not make much sense.

Recently d865d4c ("ping: Use C locale for parsing -i/-W without IDN")
addressed that and called setlocale() unconditionally. Maybe condition
based on ENABLE_NLS definition should have been discussed, but that
would probably lead just to LC_ALL=C setup in the scripts. People also
get confused by old behavior when decimal separator depends on locale
as some distros e.g. compile without IDN but other don't (see issue #273)
But that introduced *incompatible* behavior for next release, thus
documenting it in this commit.

562e0d5 fixed problems for -W, but also introduced yet another
*incompatible* behavior as invalid number is no longer fatal error (see
below).

d196177 ("ping: Add missing preprocesses checks around setlocale()
calls") unintentionally restored the old behavior, which was fixed by
previous commit 7a90bd5 ("ping: Fix handling decimal separator for -i/-W opt").

* -W timeout option
Until s20180629 there was undocumented behavior:

1) timeout silently rounded down to the next lower integral number
2) -W N for N < 1 was rounded to 0 => infinite timeout (obviously a bug)
3) -W Ns worked as expected (sleep for N sec, as 's' was dropped,
this could be considered as a feature)
4) -W Nm -W Nh also slept for N sec instead of N min or hour (obviously
a bug)

918e824 ("ping: add support for sub-second timeouts") released in
s20190324 fixed 1) and 2) by allowing real number with locale based
decimal separator when USE_IDN=yes configured. But that introduced
*incompatible* behavior as broke 3 and 4). As it was not documented in
release notes, people complained (issue #236).

562e0d5 ("ping: allow -i and -W option arguments contain garbage input")
restored 3) and 4) support (everything including and after first
non-numeric character is dropped, warning printed).

See also: #290

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants