# MC shows broken filenames over Shell link



## skocdopolet (Nov 17, 2013)

Hello,

I have a problem with Midnight Commander (or problem on a remote side). When I run Midnight Commander on my desktop PC and open a remote server (Shell link), the file names are broken and I am not able to browse the directory structure. File names contain date and time of modifications and then the file name. For example /usr is displayed as 
	
	



```
Nov 17 15:01 /usr
```
 The screenshot is attached.

Version of destination system is

```
# uname -rp
9.2-RELEASE amd64
```
There is OpenSSH (installed with system):

```
OpenSSH_6.2p2, OpenSSL 0.9.8y 5 Feb 2013
```
 
My desktop PC has this Midnight Commander:

```
# mc -V
GNU Midnight Commander 4.8.1.6
Built with GLib 2.28.8
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, fish, smbfs
Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;
```
On my desktop PC, I am connecting with Midnight Commander and shell link to other machines without any problem. When I try to use WinSCP to the target machine, the directory listing is correct.

I am actually not sure where is the problem. On the target machine or on my desktop PC?

Thanks all for help.
Regards Tomas


----------



## freethread (Nov 17, 2013)

What is the panel listing mode configuration (i.e. in dialog box accessible by menu 'Left -> Listing Mode')? The default listing should be


```
half type name | size | mtime | perm
```

if user defined, if not try another setting.

For the record, mc version 4.8.10 now compiles with system ncurses library.


----------



## skocdopolet (Nov 17, 2013)

The listing mode is set to Full file list. I am try to use another settings, but the same problem. 

I have Midnight Commander installed from package (`pkg_add -r mc`).


----------



## omd (Jan 16, 2014)

The first time I've encountered this problem after upgrading mc from 4.7.4 to 4.7.5 . After a brief consideration I've found a fix - replacing libexec/mc/fish/info by the same file from mc-4.7.4. I've written to the mc bugtracker about this, but got no fix, only workaround. Sometimes I get this problem, but ignore it. Yesterday I've again got this problem in connection to a newly installed 9.2-amd64, again googled it and found this thread.

Next I've looked closer to scripts libexec/mc/fish/info and libexec/mc/fish/ls and found that libexec/mc/fish/info makes several tests to check the presence of  head, sed, awk, perl, etc on remote system. In libexec/mc/fish/info from mc=<4.7.4 sed presence determined by `sed --version` and always be false, because /usr/bin/sed doesn't support the --version option. After failing this test libexec/mc/fish/ls falls back to using for directory listing perl with fish_list_perl() or fish_list_poor_ls().

But in libexec/mc/fish/info from mc>=4.7.5 test `sed --version` replaced by `echo 1 | sed 's/1/2/`. This test will be passed, but found sed is "BSD sed" and not fully compatible with "GNU sed" options in libexec/mc/fish/ls.

After installing Perl on the remote system libexec/mc/fish/ls begins using it and mc shows remote directories properly, because it found perl on the remote system and uses the fish_list_perl() function.

IMHO libexec/mc/fish/info needs to be patched to prevent usage of the function fish_list_sed() with incompatible sed options. In this case for the directory list mc will be using fish_list_poor_ls() or fish_list_perl().


----------



## maks (Nov 28, 2019)

omd said:


> After installing Perl on the remote system libexec/mc/fish/ls begins using it and mc shows remote directories properly, because it found perl on the remote system and uses the fish_list_perl() function.



Thank you for this great advice. It helped me. Recently I got the same problem. For I don't know what reasons file `/usr/local/bin/perl` disappeared. But perl was installed. Fixed this problem with `cp /usr/local/bin/perl5.26.3 /usr/local/bin/perl` and mc shell link works great again.


----------



## SirDice (Nov 28, 2019)

maks said:


> Fixed this problem with  cp /usr/local/bin/perl5.26.3 /usr/local/bin/perl and mc shell link works great again.


There are several problems with this solution. The first is that the default Perl version is 5.30 nowadays, because 5.26 is not the default it should not create a /usr/local/bin/perl. The second is that you're copying the file, so with the next update that's likely to cause problems.


```
root@molly:/usr/ports/lang/perl5.26 # make
##################################################

      This is *NOT* the DEFAULT perl version

It will *NOT* install /usr/local/bin/perl

It will *ONLY* install /usr/local/bin/perl5.26.3

The default Perl version currently is 5.30.

If you want to use this version as the default,
stop the build now, add this line to your
/etc/make.conf, and then restart the build.

DEFAULT_VERSIONS+=perl5=5.26

##################################################
^C*** Signal 2
*** Signal 2
```


----------



## maks (Dec 18, 2019)

My server has a particular version of perl5.26.3 and next update will not have any effect on the system. If my solution is not enough well please suggest your.


----------



## SirDice (Dec 18, 2019)

maks said:


> If my solution is not enough well please suggest your.


It's mentioned in the pkg-message I copy/pasted. If you really need to stick to Perl 5.26 then set the default to it and rebuild everything. Otherwise make sure you can use the preset default of Perl 5.30.


----------

