Ticket #4148 (closed defect: invalid)

Opened 3 years ago

Last modified 3 years ago

mc does not threat TERM=screen.xterm-256color as 256 colored terminal

Reported by: Hubbitus Owned by:
Priority: major Milestone:
Component: mc-tty Version: 4.8.25
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

I use GNU screen and run mc inside them.

$ echo $TERM
$ screen.xterm-256color
$ mc --skin=modarin256root-defbg

┌────────────────────────────── Error ──────────────────────────────┐
│                                                                   │
│ Unable to use 'modarin256root-defbg' skin with 256 colors support │
│                    on non-256 colors terminal.                    │
│                   Default skin has been loaded                    │
│                                                                   │
└───────────────────────────────────────────────────────────────────┘


Run correctly with:

TERM=xterm-256color mc --skin=modarin256root-defbg

Fedora Linux 33

# rpm -q mc screen
mc-4.8.25-3.fc33.x86_64
screen-4.8.0-3.fc33.x86_64

Change History

comment:1 Changed 3 years ago by Hubbitus

  • Summary changed from mc does not threat TERM=screen.xterm-256color as 256 colored derminal to mc does not threat TERM=screen.xterm-256color as 256 colored terminal

comment:2 Changed 3 years ago by andrew_b

  • Component changed from mc-core to mc-tty

comment:3 Changed 3 years ago by andrew_b

$ tput colors

If output is not 256, your terminal actually doesn't support 256 colors.

comment:4 Changed 3 years ago by Hubbitus

[root@hubbitus ~]# echo $TERM
screen.xterm-256color
[root@hubbitus ~]# tput colors
256

comment:5 Changed 3 years ago by andrew_b

Ok. Next step.

mc -V

comment:6 Changed 3 years ago by Hubbitus

# mc -V
GNU Midnight Commander unknown
Built with GLib 2.65.0
Built with S-Lang 2.3.2 with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With internationalization support
With multiple codepages support
With ext2fs attributes support
Virtual File Systems:
 cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, fish, smbfs
Data types:
 char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;

comment:7 Changed 3 years ago by zaytsev

  • Status changed from new to closed
  • Resolution set to duplicate

Closed as duplicate of #4143.

comment:8 Changed 3 years ago by zaytsev

I have commented in #4143 - it's a distro bug and the workaround is to set the terminal in screenrc.

comment:9 Changed 3 years ago by andrew_b

TERM=screen.xterm-256color mc --skin=modarin256root-defbg

This command in the terminal emulator (no screen) runs fine. No any errors.
But the same command in the screen produces error as in the ticket description.

comment:10 Changed 3 years ago by andrew_b

  • Status changed from closed to reopened
  • Resolution duplicate deleted

To define the number of colors in the terminal, S-Lang tests the "Co" terminal capability. If TERMCAP variable is set, S-Lang gets terminal capability from it. If not, terminfo is used. TERMCAP is set in screen and

$ echo $TERMCAP | tr ':' '\n' | head -1 
SC|screen|VT 100/ANSI X3.64 virtual terminal
$ echo $TERMCAP | tr ':' '\n' | grep Co#
Co#8

Just unset TERMCAP, and mc will work fine with 256-color sckins.

@zaytsev: it's not duplicate. It's invalid.

Last edited 3 years ago by andrew_b (previous) (diff)

comment:11 Changed 3 years ago by andrew_b

  • Status changed from reopened to closed
  • Resolution set to invalid
  • Milestone Future Releases deleted

comment:12 Changed 3 years ago by Hubbitus

Sorry, but why $TERMCAP Co terminal capability when TERM=screen.xterm-256color and that is not happened with TERM=xterm-256color??

I can confirm what:

TERM=screen.xterm-256color TERMCAP='' /usr/bin/mc --skin=modarin256root-defbg

also works.

comment:13 Changed 3 years ago by andrew_b

There is quite complicated initialization sequence in S-Lang. I can't describe it in details. As I understand correctly, S-Lang checks if TERM value begins with "xterm". There is no check if TERM begins with "screen.xterm". If TERM begins with "xterm", TERMCAP is ignored. If not, TERMCAP is used.

comment:14 follow-up: ↓ 15 Changed 3 years ago by Hubbitus

So, really it the bug in the component which set TERMCAP? Is it termcapdb?

Last edited 3 years ago by Hubbitus (previous) (diff)

comment:15 in reply to: ↑ 14 Changed 3 years ago by andrew_b

Replying to Hubbitus:

So, really it the bug in the component which `set TERMCAP? Is it termcapdb?

I don't know.

Note: See TracTickets for help on using tickets.