Bug 155974 - mc uses strange 'Other 8 bit' in the charset conversion
mc uses strange 'Other 8 bit' in the charset conversion
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: mc (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jindrich Novy
:
Depends On: 154516
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-26 08:26 EDT by Andy Shevchenko
Modified: 2013-07-02 19:07 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-05-18 06:39:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch for using current charmap instead of 'Other 8 bit' (4.21 KB, patch)
2005-04-26 08:26 EDT, Andy Shevchenko
no flags Details | Diff
New version of patch (4.37 KB, patch)
2005-04-27 05:59 EDT, Andy Shevchenko
no flags Details | Diff

  None (edit)
Description Andy Shevchenko 2005-04-26 08:26:57 EDT
Description of problem:
mc uses strange item 'Other 8 bit' in charset chooser. I resolved the problem by 
changing that item to native current charmap (got by nl_langinfo(CODESET)).
In addition we do not need to choose charmap after first start of mc.

This bug is correlated with Andrew's patch from bug #154516.

Version-Release number of selected component (if applicable):
Last official FC3 update (and may be current)
Comment 1 Andy Shevchenko 2005-04-26 08:26:57 EDT
Created attachment 113664 [details]
Patch for using current charmap instead of 'Other 8 bit'
Comment 2 Jindrich Novy 2005-04-27 01:05:03 EDT
Hello Andy,

+static const char *
+get_current_charmap (void)
+{
+    int init = -1;
+    static char *charmap = NULL;
+
+    if (init == -1) {
+       char *lc_ctype = setlocale (LC_CTYPE, "");
+       charmap = nl_langinfo (CODESET);
+       setlocale (LC_CTYPE, lc_ctype);
+       init = 0;
+    }
+    return charmap;
+}

Doesn't the init variable miss the static storage class? The condition will be
executed every time when get_current_charmap() is called what is likely not
intended. Also #include <langinfo.h> seems to be missing.
Comment 3 Andy Shevchenko 2005-04-27 05:44:58 EDT
Hi, Jindrich.

1. Yes, I missed
2. Also, yes.

Thanks for reviewing code.
Comment 4 Andy Shevchenko 2005-04-27 05:46:19 EDT
2. Sorry, I am wrong. The langinfo.h already added.
Comment 5 Andy Shevchenko 2005-04-27 05:59:48 EDT
Created attachment 113710 [details]
New version of patch

Fix non-static class of init variable.
Also fix potential segfault in the strcasecmp().
Comment 6 Jindrich Novy 2005-04-28 04:02:20 EDT
Andy, the patch looks much better now but the only thing I'm afraid of is broken
translations of the "Current charmap" instead of "Other 8 bit". Maybe it's a
good thing if you send this patch to upstream so that people will take care
about translating the message when the patch is commmitted there.

Also it's not very usual that you put credits directly to the source code. If
you don't have any objections I credit authors of the patches in the spec file
instead of the source directly as I did in Andrew's case for instance.
Comment 7 Andy Shevchenko 2005-05-04 04:13:14 EDT
Ok, I try to some change patch (instead of -> with) and send to upstream it.
Yes, I agree with you. This patch injects minor function and no needs credit.
Comment 8 Jindrich Novy 2005-05-04 06:38:11 EDT
Andy, thanks for the patch anyway.

I'll close this bug UPSTREAM whenever I see mail from you on mc-devel.
Comment 9 Andy Shevchenko 2005-05-18 04:44:08 EDT
Hi, Jindrich!

I've put message to mc-devel@ list today.
You can close bug.

P.S> However, I should like to make this patch more convenient.
Comment 10 Jindrich Novy 2005-05-18 06:39:46 EDT
Hello Andy!

Thanks! I'll try to discuss it on upstream list when needed and keep track of it.

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