Solved mc on 14.0-R

Wen running misc/mc on 14.0-R, I get

common.c: unimplemented subshell type 1
read (subshell_pty...): No such file or directory (2)

Is there anything I can do to prevent this?

misc/mc will run if started as mc -u.

This does not occur on earlier versions of FreeBSD.
 
Please either use more advanced interactive shell
pkg info -D mc
mc-4.8.30:
On install:
Midnight Commander was built with subshell support, which works with most
popular shells, e.g. bash(1), dash(1), tcsh(1), zsh(1), but not sh(1) due
to its lack of "precmd" or equivalent hooks which mc(1) needs to read the
subshell's current directory.

$ env SHELL=/bin/sh mc
common.c: unimplemented subshell type 1
read (subshell_pty...): No such file or directory (2)

Please either use more advanced interactive shell, or start mc(1) with -u
(--nosubshell) switch if you're confined to /bin/sh for some reason.
 
It works with csh. You can change the users shell via chsh -s /bin/csh double check for typos and valid path when change the root's shell otherwise you will boot into single user and you will need to fix your account from there.
 
misc/mc will run if started as mc -u.

This does not occur on earlier versions of FreeBSD.

It looks like I haven't installed FreeBSD properly and the environment isn't set up as previously.

How does FreeBSD set up the default environment on a new installation? ie. is it through one of /.login, /.profile, /.shrc. I don't have any of these on my system.
 
How does FreeBSD set up the default environment on a new installation? ie. is it through one of /.login, /.profile, /.shrc. I don't have any of these on my system.
When you create a user account you have the option to populate the user's home directory with so-called skeleton files. Those live in /usr/share/skel on FreeBSD. If you used pw(8) to create the user account:
Code:
     -m            This option instructs pw to attempt to create the user's
                   home directory.  While primarily useful when adding a new
                   account with useradd, this may also be of use when moving
                   an existing user's home directory elsewhere on the file
                   system.  The new home directory is populated with the
                   contents of the skeleton directory, which typically
                   contains a set of shell configuration files that the user
                   may personalize to taste.  Files in this directory are
                   usually named dot.⟨config⟩ where the dot prefix will be
                   stripped.  When -m is used on an account with usermod,
                   existing configuration files in the user's home directory
                   are not overwritten from the skeleton files.

                   When a user's home directory is created, it will by default
                   be a subdirectory of the basehome directory as specified by
                   the -b option, bearing the name of the new account.  This
                   can be overridden by the -d option on the command line, if
                   desired.
 
Are you running this as root? Previously the default shell for root was csh(1), but in FreeBSD 14.0 it's now sh(1).
I'm running as root. Are you saying the default shell for root has suddenly changed? That seems like a significant alteration.

I have changed root's shell to csh, and mc is running normally...

Having said that I would love to remove the problem mentioned in Thread 58865. mc on Linux does not behave this way. Accessing history doesn't give you all this garbage... I have read that there is some way to stop it, but none of the suggestions worked for me.
 
Are you saying the default shell for root has suddenly changed?
Nothing 'sudden' about it.
That seems like a significant alteration.
Significant enough to be mentioned in the release notes.

The default shell for the root user is now sh(1), which has many new features for interactive use.

That said, I've kept mine at csh(1), mainly because that's what I'm used to using for the past 25 or so years.
 
That said, the issue with mc and csh/tcsh is annoying but it's not so bad if you make use of the C shell's 'selective' history. Just enter the first couple of characters of the command and press the up key. It'll search back on those first letters and only shows the history that matches.
 
I wondered if mc works without this 'printf' stuff on Linux because it uses bash.... How would I set mc to use bash on FreeBSD, without changing the shell globally?
 
mc(1)
Code:
       When the subshell support is active, Midnight Commander will spawn a
       concurrent copy of your shell (the one defined in the SHELL variable
       and if it is not defined, then the one in the /etc/passwd file)
env SHELL=/usr/local/bin/bash mc
 
Does this stop all this 'printf' nonesense?
I don't know because I don't use mc.

/usr/ports/misc/mc/files/patch-lib_shell.c
Code:
--- lib/shell.c.orig    2023-08-06 22:26:05 UTC
+++ lib/shell.c
@@ -99,22 +99,9 @@
 static char *
 mc_shell_get_name_env (void)
 {
-    const char *shell_env;
     char *shell_name = NULL;

-    shell_env = g_getenv ("SHELL");
-    if ((shell_env == NULL) || (shell_env[0] == '\0'))
-    {
-        /* 2nd choice: user login shell */
-        struct passwd *pwd;
-
-        pwd = getpwuid (geteuid ());
-        if (pwd != NULL)
-            shell_name = g_strdup (pwd->pw_shell);
-    }
-    else
-        /* 1st choice: SHELL environment variable */
-        shell_name = g_strdup (shell_env);
+    shell_name = g_strdup ("/usr/local/bin/bash");

     return shell_name;
 }
 
mc(1)
Code:
       When the subshell support is active, Midnight Commander will spawn a
       concurrent copy of your shell (the one defined in the SHELL variable
       and if it is not defined, then the one in the /etc/passwd file)
env SHELL=/usr/local/bin/bash mc

Under csh I can view my command history. Can I do this under bash?
 
Where would command history be recorded?
history(1), for bash(1) that's usually ~/.bash_history. MC issues a bunch of commands, bash has an option to not record those commands in the history, csh doesn't have that feature. That's why csh's history is swamped with commands from MC while bash's history doesn't.
 
Thanks to Charlie_ after many years of using misc/mc, I have now managed to rid of those annoying 'printf' commands in my shell history by putting this in my ~/.shrc

Code:
env SHELL=/usr/local/bin/bash mc
 
Back
Top