xcp
xcp copied to clipboard
terminfo database
When I ssh to an XCP host from inside screen on a Fedora41 desktop, I get
-bash: [: -ge: unary operator expected
and the terminal colors don't work.
I've tracked it down to this test
[ $(tput colors 2>/dev/null) -ge 8 ]
in /etc/profile.d/xcp-ng-prompt.sh
Here is a log of a session that shows the problem:
mydesktop:~$ ssh lab1
Last login: Fri Mar 7 09:48:17 2025 from mydesktop
-bash: [: -ge: unary operator expected
# echo $TERM
TERM=screen.xterm-256color
# tput colors
tput: unknown terminal "screen.xterm-256color"
# ls /usr/share/terminfo/s/
screen screen.konsole screen.teraterm simpleterm sun1
screen-16color screen.linux screen.vte st sun2
screen-256color screen.mlterm screen.xterm-new st-16color
screen.Eterm screen.mrxvt screen.xterm-r6 st-256color
screen.gnome screen.rxvt screen.xterm-xfree86 sun
# export TERM=screen-256color
# tput colors
256
Thanks for the report. Forwarding to the team.
The root cause is in /etc/profile.d/xcp-ng-prompt.sh.
Adding double quotes around $(...) should fix the syntax error.
Hi,
May I ask @DSJ2 which version of xcp-ng were you using because 8.3 has this terminfo:
rpm -qf /usr/share/terminfo/s/screen.xterm-256color
ncurses-base-6.4-6.20240309.xcpng8.3.noarch
Anyway the issue can be easly reproduced for other undeclared TERMs , on xcp-ng-release-config-8.3.0-32.x86_64 (and probably earlier versions) eg:
TERM='' ssh $host
-bash: [: -ge: unary operator expected
[13:53 xcp-ng-pcl-11 ~]# echo $PS1
[\A \h \W]\$
I think @ydirson proposal is worth having, so I have improved it a bit at, please review the fix at:
https://github.com/xcp-ng/xcp-ng-release/pull/52
May it be backported if there any traction