RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1105125 - Locale dependent float delay in top and watch utilities
Summary: Locale dependent float delay in top and watch utilities
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: procps
Version: 6.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jaromír Cápík
QA Contact: Martin Frodl
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-05 12:52 UTC by Pavel Roschin
Modified: 2016-02-01 02:00 UTC (History)
3 users (show)

Fixed In Version: procps-3.2.8-28.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1182248 (view as bug list)
Environment:
Last Closed: 2014-10-14 08:22:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1595 0 normal SHIPPED_LIVE procps bug fix and enhancement update 2014-10-14 01:39:48 UTC

Description Pavel Roschin 2014-06-05 12:52:28 UTC
Description of problem:

Different behavior in watch and top utilities while decimal point delimiter != ".". Depending on package (procps, procps-np) those utilities implement locale settings in different way.

Version-Release number of selected component (if applicable):
All RHEL from 6.0 to 6.5, possibly earlier versions, also Fedora and RHEL implementations of top utility look different while LANG=ru_RU.UTF-8.

How reproducible:

Depends on current/environment locale.

Steps to Reproduce:

Just try those under different locales. Other utilities that accept float arguments are possibly affected.

1. LANG=C top -d0.5 - OK
2. LANG=C watch -n0.5 date - OK
3. LANG=ru_RU.UTF-8 top -d0.5 - OK
4. LANG=ru_RU.UTF-8 top -d0,5 - FAILED (dealy is set to 0, no error reported)
5. LANG=ru_RU.UTF-8 watch -n0.5 date - FAILED (shows usage)
6. LANG=ru_RU.UTF-8 watch -n0,5 date - OK

Actual results:

There is no locale conventions in software from one package. In Fedora (tested 20) top follows locale but it not only accepts locale-dependent delay but also shows locale-dependent floating-point numbers that differs from RHEL.

Expected results:

Possible expected results.
1. All software should work with locale as expected in the same way (in C locale "0.5" values are OK, in ru_RU locale "0,5" values are OK). From this point of view top and watch utilities in Fedora work correctly. Report about incorrect values.
2. Accept both variants for compatibility reasons. I didn't see that manuals for top or watch pointed about locale dependent arguments, but maybe there is some agreement.

Comment 3 Jaromír Cápík 2014-06-18 17:57:07 UTC
Hello Pavel.

The Fedora component uses locale honoring functions. The idea of fallback to the second variant sounds good in general, I'm just unsure whether this is what everyone wants. Some custom scripts could use this flaw (for example using ',' as separators). But, even changing the 'top' behaviour from accepting '.' to ',' could be unwanted and cause regressions. So, it's difficult for me to decide.

Regards,
Jaromir.

Comment 4 Pavel Roschin 2014-06-19 12:43:01 UTC
The main idea is to make Fedora/RHEL compatible while accepting _arguments_. In Russian locale float numbers like "0,1" are correct but as user I always enter "0.1" while passing command line arguments - many software accept only that form of floating numbers.

Example (ru_RU locale):
 $ echo "2+2.2" | bc -l
 4.2
 $ echo "2+2,2" | bc -l
 (standard_in) 1: syntax error

But bc at least report about error while top doesn't and 'top -d0,5' works like 'top -d0'.

This is very common mistake especially in configuration files (config written with en_US locale cannot be accepted in ru_RU locale because fscanf/atod expects for commas). I hate this libc "handy" feature.

Output is much harder. Sure some scrips may parse e.g. 'top -b -n1' output and printing commas instead dots will cause unexpected bugs depending on user's locale settings. Actually Fedora already had broken compatibility with RHEL by printing commas instead dots (RHEL doesn't do that).

It would be nice to accept both (comma and dot) in command line arguments and keep output "as is".

Comment 5 Jaromír Cápík 2014-06-24 15:27:03 UTC
Ok ... I did the proposed change even when not accepted by the rest of the procps-ng upstream members yet. Hopefully I'll be able to convince the guys this is what we want upstream. And breaking custom scripts misusing the flaw is acceptable risk in this case.

Comment 8 Martin Frodl 2014-07-08 09:00:14 UTC
One more thing I would like to ask. On RHEL 7, decimal point in ru_RU.utf8 locale is treated the same way decimal commas are treated in e.g. en_US.utf8 locale. That is, 

$ LANG=ru_RU.utf8 watch -n0.5 date
watch: failed to parse argument: '0.5'
$ LANG=ru_RU.utf8 top -d 0.5
[top executes with refresh interval apparently set to 0]

This is definitely a correct solution, but alas, incompatible with the RHEL 6 approach (accept decimal points AND commas). So, would it be reasonable to report this incompatibility as a new bug, or is this going to become a feature from now on?

Comment 9 errata-xmlrpc 2014-10-14 08:22:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1595.html


Note You need to log in before you can comment on or make changes to this bug.