Bug 229453 - ps (process status) charset problem
Summary: ps (process status) charset problem
Status: Closed DUPLICATE of bug 241491
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2018-07-01 15:34 UTC by Vladimir
Modified: 2020-06-07 08:01 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir 2018-07-01 15:34:20 UTC
If current LOCALE not UTF-8, national encoding in "ps" output broken.

For example, mplayer with cyrillic args (filename in KOI8-R) not present in "COMMAND" column.

Bug in bin/ps/ps.c:

# diff -u bin/ps/ps.c.orig bin/ps/ps.c 
--- bin/ps/ps.c.orig    2017-07-21 06:43:20.000000000 +0700
+++ bin/ps/ps.c 2018-07-01 22:05:52.817718000 +0700
@@ -668,7 +668,7 @@
                        fwidthmin = (xo_get_style(NULL) != XO_STYLE_TEXT ||
                            (STAILQ_NEXT(vent, next_ve) == NULL &&
                            (vent->var->flag & LJUST))) ? 0 : vent->var->width;
-                       snprintf(fmtbuf, sizeof(fmtbuf), "{:%s/%%%s%d..%ds}",
+                       snprintf(fmtbuf, sizeof(fmtbuf), "{:%s/%%%s%d..%dhs}",
                            vent->var->field ?: vent->var->name,
                            (vent->var->flag & LJUST) ? "-" : "",
                            fwidthmin, fwidthmax);


Function xo_emit requires an argument %s in UTF-8 only encoding. But acceptably
replace %s with %hs, in which case pass argument in $LANG encoding.
Comment 1 Yuri Pankov freebsd_committer freebsd_triage 2020-06-07 08:01:04 UTC
Will be fixed in bug 241491 (as it was the first I noticed and opened review for). Thank you for the report!

*** This bug has been marked as a duplicate of bug 241491 ***