Optware / Optware-ng

279 stars 52 forks source link

mc/slang TERMINFO and TERM issues #161

Closed PiotrC1 closed 7 years ago

PiotrC1 commented 8 years ago

After installation of mc there are following problems:

Usually such a problems are caused by missing /opt/etc/profile with correct contents.

alllexx88 commented 8 years ago

You need to install ncurses (you probably already have it installed) and add these env variables:

export TERM=xterm
export TERMINFO=/opt/share/terminfo

In case of TomatoUSB adding these to /opt/etc/profile is sufficient system-wide. However, that's so only because tomato's /etc/profile has line [ -f /opt/etc/profile ] && . /opt/etc/profile, which isn't common and isn't something we can rely on. Full-fledged (or nearly so, like Synology NASes) Linux boxes have these set already, with their own terminfo thus eliminating the need in installing ncurses optware package. More so, since Optware-ng isn't an OS, or a FW, but more likely a supplementary feed service, and is most likely to be used in combination with system's own environment and tools, we usually have little control over setting environment variables. However, the case with mc is indeed a bug, and I see two options:

  1. Printing needed info after package install
  2. Patching mc to hardcode these values, and adding ncurses dependency
alllexx88 commented 8 years ago

Think I found a valid solution:

  1. Separate terminfo package from ncurses
  2. Configure slang to add /opt/share/terminfo
  3. Patch mc and slang to force xterm terminal instead of reading TERM env variable
alllexx88 commented 7 years ago

@PiotrC1 I assume this fixed (see 8fe416c26f755572aa5c1bb9d1c16274c7f67ed7 49ad7aff1c2d5cbcc36e499fd06ca8aa9952565e 6eb63e54cff1b5ca2672f9d75c0eba81c7e027a1): please confirm

PiotrC1 commented 7 years ago

Much better, but still not good - borders are incorrect (ASCII characters) issue still active. The solution is to add:

export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8' 
alllexx88 commented 7 years ago

@PiotrC1 Not setting locale is a system bug -- not Optware bug. That being said, I do see how to patch mc to default locale to 'en_US.UTF-8' if no locale set. However, you are advised to fix your system

PiotrC1 commented 7 years ago

OK, thanks. I will do it.

alllexx88 commented 7 years ago

I did push defaulting to en_US.UTF-8 if no locale is set -- soon it'll be online

alllexx88 commented 7 years ago

@PiotrC1 After some struggling, I resorted to setting LANG env variable if no locale is set in mc subshell by mc itself. I also made it to set EDITOR to /opt/bin/nano if EDITOR isn't set, and /opt/bin/nano executable exists. Now mc works without locales properly set, and also defaults to nano as external editor if it's installed

PiotrC1 commented 7 years ago

Wow! Kudos.