# misc/mc problem



## YuryG (Mar 25, 2016)

For a week or a couple of weeks, after upgrade of misc/mc port, I can't start `mc` from ordinary user, only from root. I tried doing it from different shells. The error states:
	
	



```
common.c: unimplemented subshell type 1
read (subshell_pty...): No error: 0 (0)
```
May be something wrong was during upgrade with it's configuration files? Where can I look for the solution?


----------



## Roric (Mar 26, 2016)

What shell are you using as normal user?


```
echo $SHELL
```

You may have to kill all of the current shell sessions under that user.  You can use pgrep to find all PIDs of the shell running and then kill them off.

Then check and see if you are able to start mc.


----------



## YuryG (Mar 26, 2016)

As I've mentioned, I'd tried different shells. The default one for that user is /bin/sh, also I've tried to start from the default one: /usr/local/bin/bash, /bin/csh, /bin/tcsh. All with the same error.
For the root default is /bin/csh.


----------



## Juha Nurmela (Mar 26, 2016)

mc-4.8.15 (as a package and as a port with default options) and pdksh v5.2.14.2 99/07/13.2, no problemo. Doesn't help at all, but.... solidarity?

Juha


----------



## chrbr (Mar 26, 2016)

I can confirm the problem. It is not fixed when I change to csh simply by typing `csh`. When I change the login shell by `vipw` to csh misc/mc works without error after new login. The patch in https://bz-attachments.freebsd.org/attachment.cgi?id=168343 has additional lines for csh. May be it need a similar treatment for other shells as sh, too.


----------



## chrbr (Mar 27, 2016)

I guess the issue is related to the subshell. Now I have compiled misc/mc with the options

```
DOCS          : off 
EDITOR        : off 
ICONV         : on
NCURSES       : off 
NLS           : on
SFTP          : on
SLANG         : on
SMB           : off 
SUBSHELL      : off 
X11           : off
```
and it woks with sh as login shell. It might be that the command line below the file manager window is out of function now. I have never used it. May be this is of some help.

EDIT: The command line below the file manager stiil works similar compared to mc installed as binary in a jail. The test was just a ping to the host. I have no idea about the purpose of the SUBSHELL option.


----------



## YuryG (Mar 28, 2016)

Suppose, SUBSHELL means working command line prompt after `Ctrl+O`. It have not worked for ordinary user (or in /bin/sh terminal window?) for quite a long time, so I used to it. But I need it for root!
Dilemma: to have subshell in root session and not to be able to even start misc/mc in /bin/sh for ordinary user, OR not to have subshell for any users, but to be able to start it.
Or to change shell for ordinary users…


----------



## chrbr (Mar 28, 2016)

Dear YuryG,
thank you for the information. Now I understand the problem. A work around would be to change the login shell for normal users to /bin/csh. It might help to modify the patch /usr/ports/misc/mc/files/patch-upstreamticket2742-detect-csh-as-tcsh-by-name.patch to add support of /bin/sh. I think woodsb02 knows what to do. If you have time you can file a problem report at http://www.freebsd.org/support/bugreports.html. I will try to help, too.


----------



## chrbr (Mar 29, 2016)

Dear YuryG,
how about using `Ctrl+Z` to put misc/mc in the background? With `fg` misc/mc is put in the foreground again. This would not require the subshell. This method works for me with misc/mc started from a terminal. I forgot that option yesterday. Of course there might be a difference compared to the subshell funtion.


----------



## chrbr (Mar 31, 2016)

Dear YuryG ,
now I have an additonal work arround.


YuryG said:


> Dilemma: to have subshell in root session and not to be able to even start misc/mc in /bin/sh for ordinary user


You can keep the subshell for root and let the users start misc/mc by `mc -u`, may be set an alias in their profiles. Then root has misc/mc with subshell and the users can use misc/mc but without subshell. May be this is an option.


----------



## YuryG (Mar 31, 2016)

chrbr said:


> Dear YuryG ,
> now I have an additonal work arround.
> …`mc -u`, may be set an alias in their profiles…




```
$ mc -u
Failed to run:
Unknown option -u
```


----------



## chrbr (Mar 31, 2016)

Hello YuryG,
first thank you for the problem report. I think now you have compiled misc/mc with subshell disabled. I have had enabled it now to dig in the problem. While digging I found the -u option in mc(1). It seems to work only when the subshell is active.


----------



## aragats (Mar 31, 2016)

I'm on FreeBSD 11-CURRENT, mc(1) 4.8.15 was installed with pkg[(8).
I tested it with sh, csh and bash (fresh logins). It works in all, but in sh the subshell does not work.


----------



## YuryG (Mar 31, 2016)

aragats said:


> I'm on FreeBSD 11-CURRENT, mc(1) 4.8.15 was installed with pkg[(8).
> I tested it with sh, csh and bash (fresh logins). It works in all, but in sh the subshell does not work.


Why not mc-4.8.16_1? I could start misc/mc in previous upgrades. (But not SUBSHELL in /bin/sh login user shell.)


----------



## aragats (Mar 31, 2016)

Well, for some reason subshell works only in csh and bash.


----------



## aragats (Mar 31, 2016)

OK, just updated to mc-4.8.16_1 and got what you have, YuryG.


----------



## YuryG (Mar 31, 2016)

chrbr said:


> Hello YuryG,
> first thank you for the problem report. I think now you have compiled misc/mc with subshell disabled. I have had enabled it now to dig in the problem. While digging I found the -u option in mc(1). It seems to work only when the subshell is active.


Thank you! This variant with `mc -u` works.


----------



## aragats (Mar 31, 2016)

Kind of work-around: launch mc with a command (or make an alias):
`SHELL=/bin/csh mc`


----------



## oldzy (Apr 6, 2016)

Same prob here after upgrading. Added `-u` and all is well.


----------



## user0 (Apr 23, 2016)

When I got this error 
	
	



```
common.c: unimplemented subshell type 1
```
 I read this thread and changed the shell used by KDE's Konsole to the statically linked `/usr/local/bin/bash` from the ports. But still getting the error.
There is no error under `su` though.
Is it possible to run `mc` without having to add `-u` under FreeBSD?


----------



## YuryG (Apr 23, 2016)

As far as I could get, changing console is not that workarounds. It needs user SHELL to be not sh. Try to change launcher command (if that is possible in KDE).


aragats said:


> Kind of work-around: launch mc with a command (or make an alias):
> `SHELL=/bin/csh mc`


----------



## user0 (Apr 24, 2016)

Yeah, that's what I said: the user shell is now bash. Globally and in KDE Konsole.


----------



## YuryG (Apr 25, 2016)

No, you need user system shell to be not `sh`. Either enter cited command in KDE launcher (not sure how), or change SHELL for the user via `pw`. Simply making KDE to start terminal with some other shell doesn't help.


----------



## SirDice (Apr 25, 2016)

This probably helps, from /usr/local/doc/mc/doc/FAQ:

```
6.6 When I use Ctrl-O I don't get a subshell.  How do I fix this?

   Only bash, tcsh and zsh can be used as subshell.  Use one of those
   shells as your default shell, and it will be used as subshell in GNU
   Midnight Commander.

6.7 Ctrl-O doesn't work at all.  What happens?

   Ctrl-O works if either the subshell is used or the terminal can save
   the output of the commands so it can be restored.  If neither is
   true, there is absolutely nothing interesting behind the panels!

   Only few terminals support screen saving.  It's xterm, rxvt and other
   xterm-like terminals and virtual terminals on Linux and FreeBSD.
```


----------



## user0 (Apr 29, 2016)

I am not sure I understand the terminology.
In my installation the login shell has been replaced globally for all users from `sh` to `bash`.
Why does MC still not work without -u?


----------



## SirDice (Apr 29, 2016)

user0 said:


> In my installation the login shell has been replaced globally for all users from `sh` to `bash`.


How?


----------



## WCSN (Dec 5, 2017)

I see what speak about Ctrl+O on mc... this brokened ...

1. solution.
Simple ... editing  /etc/termcap:
added 3014 string

```
3010 # This is the only entry which you should have to customize, since "xterm"
3011 # is widely used for a variety of incompatible terminal emulations including
3012 # color_xterm and rxvt.
3013 xterm|X11 terminal emulator:\
3014 <------>:te=\E[?1049l:ti=\E[?1049h:\
3015 <------>:tc=xterm-new:
3016 #<----->:tc=xterm-r6:
```
"<------>" this is 'tab" (aka '\t')
and exec command:
`# cap_mkdb -f /usr/share/misc/termcap /etc/termcap`

снимет как рукой. 
This is hack  not good but is worked.

2. solution.

change value *$TERM* (or *$term*) from *xterm* to *xterm-clear*
tcsh:
`setenv TERM xterm-clear ; setenv term xterm-clear`

sh, bash, zsh:
`export TERM=xterm-clear ; export term=xterm-clear`

but will not work keys combinations type:  Shift+F5,F6...


----------



## maks (Nov 28, 2019)

I have solved this problem by switching to bash shell

`chsh -s /usr/local/bin/bash`

p.s. if you don't have bash then run this `# sudo pkg install bash`

And then close console, login again and you all set.


----------



## aragats (Nov 28, 2019)

maks said:


> I have solved this problem by switching to bash shell
> chsh -s /usr/local/bin/bash


This is not a real solutions: mc() doesn't depend on bash() (which is not a part of the base system):
	
	



```
% pkg info -d mc
mc-4.8.22_1:
    libXext-1.3.4,1
    libX11-1.6.8,1
    diffutils-3.7
    libssh2-1.8.2,3
    python27-2.7.16_1
    perl5-5.30.0
    libslang2-2.3.2_1
    glib-2.56.3_6,1
    gettext-runtime-0.20.1
```
If it really does/should, a bug report must be filed.


----------



## maks (Dec 4, 2019)

This is a very old issue and it still happens and still, no one filed a report? I'm surprised.
Maybe this is not a real solution but it works.


----------



## YuryG (Dec 5, 2019)

maks said:


> This is a very old issue and it still happens and still, no one filed a report? I'm surprised.
> Maybe this is not a real solution but it works.


PR 208391 is old enough also, but no movement, it is still in New phase.


----------



## maks (Dec 6, 2019)

Actually it works fine under 'tcsh' as well. And tcsh is a real solution.

`chsh -s /bin/tcsh`


----------



## aragats (Dec 6, 2019)

maks said:


> Actually it works fine under 'tcsh' as well. And tcsh is a real solution.
> `chsh -s /bin/tcsh`


That's true for regular users, but the OP mentioned he cannot use it for _root_. It's not recommended to change the default shell for _root_...


----------



## Sevendogsbsd (Dec 6, 2019)

Interesting - I have had zero issues with misc/mc except. that when used by root it butchers root's shell history. That is using the package - if I build from ports and take out an option related to shell, then it's fine. Normally I use zsh for my user and leave root's alone. An alternate method if I don't want to build from ports is have root use sysutils/lfm although I find it to be a little cludgy compared to misc/mc.


----------



## Deleted member 30996 (Dec 6, 2019)

I remember enabling the subshell option when I was building it from ports. It works as root but I get the same error as OP when invoking it from my user account.


----------



## fernandel (Dec 8, 2019)

I have enabled subshell option and Ctrl+O works for me as root and user all the time. The shell is tcsh.


----------



## riselost (May 4, 2020)

Hi.
What about to do link to mc?
mc -> mc_csh


```
#!/bin/sh
/bin/csh mc
```

How to fix this problem?

What is mc -u?
It works for me from /bin/sh...


----------



## chrbr (May 4, 2020)

Dear riselost,
in misc/mc it is possible to start a shell by typing `CTRL+O`. There has an issue with csh or so. From that shell misc/mc refused to start or even crashed because of the subshell. `mc -u` starts the program with the subshell option disabled. This allowed using misc/mc slightly limited in the problematic shell. I am not sure if the problem still exists.


----------



## riselost (May 6, 2020)

As a result, I had to change the shell to /bin/csh 
I need personal properties of mc like skins and syntax.


----------

