Bug 169531

Summary: Some patches need to be corrected
Product: [Fedora] Fedora Reporter: Victor Abramoff <abramoff>
Component: mcAssignee: Jindrich Novy <jnovy>
Status: CLOSED RAWHIDE QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 4CC: leonard-rh-bugzilla, pknirsch
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-29 17:55:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Victor Abramoff 2005-09-29 13:14:50 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; ru-RU; rv:1.7.10) Gecko/20050717 Firefox/1.0.6

Description of problem:
Patches strangeness: mc-utf8.patch change from 'strlen' to 'mbstrlen', then mc-find.patch do the contrary.

Hunk from mc-utf8.patch:

@@ -223,8 +223,8 @@ find_parameters (char **start_dir, char
        ilen = FIND_X - 7 - maxlen;     /* for the case of very long buttons :)
*/
        istart = FIND_X - 3 - ilen;

-       b1 = b0 + strlen (buts[0]) + 7;
-       b2 = FIND_X - (strlen (buts[2]) + 6);
+       b1 = b0 + mbstrlen (buts[0]) + 7;
+       b2 = FIND_X - (mbstrlen (buts[2]) + 6);

        i18n_flag = 1;
        case_label = _(case_label);


Hunk from mc-find.patch:

@@ -223,11 +235,12 @@
        ilen = FIND_X - 7 - maxlen;     /* for the case of very long buttons :)
*/
        istart = FIND_X - 3 - ilen;

-       b1 = b0 + mbstrlen (buts[0]) + 7;
-       b2 = FIND_X - (mbstrlen (buts[2]) + 6);
+       b1 = b0 + strlen (buts[0]) + 7;
+       b2 = FIND_X - (strlen (buts[2]) + 6);

        i18n_flag = 1;
        case_label = _(case_label);
+       recurs_label = _(recurs_label);
     }
 #endif                         /* ENABLE_NLS */

Also, I offer addition to gcc4 patch:

diff -uNr mc-4.6.1.gcc4/src/widget.c mc-4.6.1/src/widget.c
--- mc-4.6.1.gcc4/src/widget.c  Fri May 27 18:19:19 2005
+++ mc-4.6.1/src/widget.c       Thu Sep 29 15:59:58 2005
@@ -1165,7 +1165,7 @@
 static void
 forward_word (WInput *in)
 {
-    unsigned char *p = in->buffer+in->point;
+    char *p = in->buffer+in->point;

     while (*p && (isspace (*p) || ispunct (*p)))
        p++;
@@ -1177,7 +1177,7 @@
 static void
 backward_word (WInput *in)
 {
-    unsigned char *p = in->buffer+in->point;
+    char *p = in->buffer+in->point;

     while (p-1 > in->buffer-1 && (isspace (*(p-1)) || ispunct (*(p-1))))
        p--;


Version-Release number of selected component (if applicable):
mc-4.6.1a-0.12.FC4

How reproducible:
Always

Steps to Reproduce:
none

Additional info:

Comment 1 Jindrich Novy 2005-09-29 17:55:26 UTC
Yes, the mc-find patch need to be fixed to mbstrlen to correctly support UTF-8.

I noticed yet another thing:
list->list[next_free].fnamelen = strlen (name);

what I converted to mbstrlen() as well. A similar problem was in cstrcasestr().

Sorry, I didn't add the signedness fixes as they're unimportant from
functionality point of view.