Bug 965867

Summary: watch does not support UTF-8 (at least not out of the box)
Product: [Fedora] Fedora Reporter: Jan Pokorný [poki] <jpokorny>
Component: procps-ngAssignee: Jaromír Cápík <jcapik>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: jcapik, ovasik
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: procps-ng-3.3.7-6.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 977957 (view as bug list) Environment:
Last Closed: 2013-05-30 17:16:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 977957    
Attachments:
Description Flags
Extending configure with --enable-watch8bit none

Description Jan Pokorný [poki] 2013-05-21 21:18:24 UTC
$ echo 'Příliš žluťoučký kůň úpěl ďábelské ódy' > /tmp/utf8-test
$ watch -tn5 "cat /tmp/utf8-test"
Pli luouk k pl belsk dy

It's sad to see another thing (beside [bug 801626]) with the same command
that simply works in Debian but fails in Fedora.

Admittedly, there is some relevant code (proc/escape.c), just one or more
preconditions may not be met using the distro default locale (and more or
less also the environment) as indicated by following external tests:

$ { cat <<EOF
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
    printf("MB_CUR_MAX: %d\n", MB_CUR_MAX);
}
EOF
} | gcc -xc - -o test
$ ./test
> MB_CUR_MAX: 1

(would need to be 2+?)

$ python -c 'import locale; print locale.nl_langinfo(locale.CODESET)'
> ANSI_X3.4-1968

(would need to be 'UTF-8'?)


Locale diagnostics (NB: I tried "localectl set-keymap UTF-8" prior to
                    the above test but to no effect)

$ locale
> LANG=en_US.UTF-8
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=

$ localectl
>   System Locale: LANG=en_US.UTF-8
>       VC Keymap: UTF-8
>      X11 Layout: n/a

$ rpm -qf $(which watch) $(which localectl)
> procps-ng-3.3.3-4.20120807git.fc18.x86_64
> systemd-201-2.fc18.6.x86_64


Please, make UTF-8 work out-of-the-box.

Comment 1 Jan Pokorný [poki] 2013-05-22 10:23:14 UTC
Created attachment 751650 [details]
Extending configure with --enable-watch8bit

Sorry for bit of noise, I am unfamiliar with procps-ng code and did some
blind grepping.

Solution is much simpler.

Would appreciate more proactive approach regarding UTF-8 support (I am
likely barking up the wrong tree, I know).

Comment 2 Jaromír Cápík 2013-05-30 17:16:51 UTC
Successfully built and tested ... closing.

Comment 3 Fedora Update System 2013-06-26 16:54:37 UTC
procps-ng-3.3.7-6.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/procps-ng-3.3.7-6.fc19

Comment 4 Fedora Update System 2013-07-04 00:58:14 UTC
procps-ng-3.3.7-6.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.