EliasKotlyar / Xiaomi-Dafang-Hacks

4.19k stars 1k forks source link

The nano editor won't start if "$TERM=xterm" #1814

Open numericOverflow opened 2 years ago

numericOverflow commented 2 years ago

I just pulled the main branch as of 2022-05-09 (last commit listed as 0cde105 on Dec 5, 2021)

Description

nano will not work/start, exits immediately after calling the exe:

[root@webcam05:sdcard]# nano
Error opening terminal: xterm.
[root@webcam05:sdcard]#

The nano editor does not start, exits with the above message. FWIW, the nano --help command does display the help info correctly (I only pasted partial output here for reference)

[root@webcam05:sdcard]# nano --help
Usage: nano [OPTIONS] [[+LINE[,COLUMN]] FILE]...

To place the cursor on a specific line of a file, put the line number with
a '+' before the filename.  The column number can be added after a comma.
When a filename is '-', nano reads data from standard input.

 Option         Long option             Meaning
 -A             --smarthome             Enable smart home key
 -B             --backup                Save backups of existing files
 -C <dir>       --backupdir=<dir>       Directory for saving unique backup files
 -D             --boldtext              Use bold instead of reverse video text
 -E             --tabstospaces          Convert typed tabs to spaces
...
...
...

What did you do to debug the issue

[root@webcam05:sdcard]# echo $TERM
xterm
[root@webcam05:sdcard]# export TERM=xterm-256color
[root@webcam05:sdcard]# echo $TERM
xterm-256color
[root@webcam05:sdcard]# nano
---Nano opens now as expected!---
[root@webcam05:sdcard]#

Evidence

See debug section above

After switching the $TERM environmental var to xterm-256color nano opens just fine

Is there a reason that $TERM=xterm and not $TERM=xterm-256color? Will this have other repercussions that are undesired?

dewi-ny-je commented 2 years ago

Who knows. I'll apply a fix and something more to my repo, give me few days to finish other stuff first

dewi-ny-je commented 2 years ago

The repo has no XTERM environment variable in the profile, so it must be added by busybox on its own I guess?

numericOverflow commented 2 years ago

@dewi-ny-je - I fixed it by adding a line to the bottom of the generic user profile.

Would that work?

dewi-ny-je commented 2 years ago

@numericOverflow Tested, it works. I fixed it in my fork https://github.com/dewi-ny-je/Xiaomi-Dafang-Hacks

However, it could be a mistake by whoever compiled it. https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/pull/1693