Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 916528 - app-misc/mc - broken non-ascii characters when using Midnight Commander's shell link
Summary: app-misc/mc - broken non-ascii characters when using Midnight Commander's she...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Marek Szuba (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-30 15:08 UTC by kavol
Modified: 2024-01-24 16:30 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Workaround for broken national characters (fix_broken_national_characters.patch,2.36 KB, text/plain)
2023-12-16 17:25 UTC, Dave
Details
Examples "mc -a" 4.8.29 and 4.8.30-r1 (xterm). Plain "mc" 4.8.30-r1 (urxvt) (examples.zip,80.61 KB, image/png)
2024-01-10 21:09 UTC, Walter Dnes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kavol 2023-10-30 15:08:54 UTC
After some updates, I started to experience a problem that when connecting to my Gentoo machine using "shell link" in Midnight Commander, it is unable to process non-ascii characters, it shows numbers instead and it is unable to work with such files/directories.

I haven't changed any system/sshd settings meanwhile, it got broken by updates (unfortunately, I don't know when exactly to try to find the culprit).

The problem appears when the Gentoo machine acts as remote, connecting from that machine elsewhere works just fine. Also using plain scp or KDE fish protocol there is no problem, the problem is only with mc.

Reproducible: Always

Steps to Reproduce:
1. run sshd
2. touch ~/"ěščř"
3. mc
4. Right => Shell link, connect to user@localhost:/~
5. try to find the "ěščř" file on the right panel, try to copy it
Actual Results:  
bad luck ... but there is a file named "304233305241304215305231"
trying to view it you get an error that the file cannot be retrieved

Expected Results:  
"ěščř" file listed, you can copy it

my locale is cs_CZ.utf8
Comment 1 Dave 2023-12-10 20:16:14 UTC
I can confirm this issue. I'm experiencing the very same behavior with Czech national characters. I'm running Gentoo stable, all packages updated.
Comment 2 kavol 2023-12-10 20:39:49 UTC
note that I haven't reported this for app-misc/mc directly because using mc to connect to Fedora machine worked just fine, so the problem seemed to be on the server side rather than the client itself

now, after some updates (heck, again, I can't trace which exact one...), connecting to Fedora (39) machine got broken too

also, meanwhile I hit the same problem with plain scp when using combination of non-ascii characters and wildcards but managed to workaround that using quotation marks ... unfortunately, I was in a hurry and didn't make note about the case to be able to post a reproducer for debugging (I hit that just once, trying something like "scp user@remote:/path/ešč* ." or so works just fine)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-10 20:42:56 UTC
are app-misc/mc-4.8.29 and app-misc/mc-4.8.30-r1 equally broken?
Comment 4 kavol 2023-12-10 21:15:52 UTC
(In reply to Sam James from comment #3)
> are app-misc/mc-4.8.29 and app-misc/mc-4.8.30-r1 equally broken?

yes
Comment 5 Marek Szuba (RETIRED) archtester gentoo-dev 2023-12-14 13:52:10 UTC
If plain scp has got problems as well, I am beginning to suspect the problem lies with something other than Midnight Commander... For completeness though, what USE flags have you emerged app-misc/mc with?
Comment 6 kavol 2023-12-14 14:55:49 UTC
(In reply to Marek Szuba from comment #5)
> If plain scp has got problems as well, I am beginning to suspect the problem
> lies with something other than Midnight Commander...

yeah, I think so, as I said in my initial description, it looks more like server-side thing ("when Gentoo acts as remote" - after some time/updates, it got broken also with Fedora as remote; I don't have other distros at hand to test ...)

> For completeness
> though, what USE flags have you emerged app-misc/mc with?

USE="X edit nls slang unicode -gpm -sftp -spell -test"
Comment 7 Dave 2023-12-16 17:25:24 UTC
Created attachment 879631 [details]
Workaround for broken national characters

After some debugging I was able to fix somehow the issue. When I replaced in MC sources explicit setup of locales to "C" by "C.UTF-8", national characters got fixed. See the attached patch (can be placed to /etc/portage/patches/app-misc/mc).

Something has probably changed in behavior of sshd or of system locales? Unfortunately I have no idea.

I'm aware that this is only a workaround and not a proper fix - the very same MC sources with "C" locales were working fine some time ago. But hopefully it helps...
Comment 8 Walter Dnes 2024-01-10 21:09:09 UTC
Created attachment 881877 [details]
Examples "mc -a" 4.8.29 and 4.8.30-r1 (xterm). Plain "mc" 4.8.30-r1 (urxvt)
Comment 9 Marek Szuba (RETIRED) archtester gentoo-dev 2024-01-23 11:35:57 UTC
Sorry about the delay, I am still very much on devaway. Thank you very much for having investigated the issue and the workaround, the patch looks straightforward enough so I'll add it - conditional on USE=unicode I think, just in case - today.
Comment 10 Larry the Git Cow gentoo-dev 2024-01-24 16:30:37 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=13e8f68494f4c02c91bc047a8224d8b059105b3e

commit 13e8f68494f4c02c91bc047a8224d8b059105b3e
Author:     Marek Szuba <marecki@gentoo.org>
AuthorDate: 2024-01-24 16:28:10 +0000
Commit:     Marek Szuba <marecki@gentoo.org>
CommitDate: 2024-01-24 16:30:30 +0000

    app-misc/mc: fix broken non-ASCII characters in shell links
    
    With many thanks to the reporter of and the participants in the relevant
    bug, for the thorough debugging and having eventually found the fix.
    
    Closes: https://bugs.gentoo.org/916528
    Signed-off-by: Marek Szuba <marecki@gentoo.org>

 ....8.30-fish_fix_broken_national_characters.patch |  40 +++++++
 app-misc/mc/mc-4.8.30-r2.ebuild                    | 127 +++++++++++++++++++++
 2 files changed, 167 insertions(+)