FS#48264 - [rxvt-unicode] $TERM is set to "1"

Attached to Project: Community Packages
Opened by Michal Svoboda (pht) - Saturday, 20 February 2016, 08:28 GMT
Last edited by Doug Newgard (Scimmia) - Tuesday, 01 March 2016, 04:21 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

running new instance of rxvt-unicode results in a shell that has $TERM set to "1" (instead of something sane, like "xterm" or "linux"). Which obviously results in unusable arrow keys, etc.
This happens since some recent (~1 month) system update.

I have this in .Xdefaults
urxvt*termName: linux

but I found that removing Xdefaults does not help the issue. The workaround so far is to manually 'export TERM=linux' in the .bashrc
This task depends upon

Closed by  Doug Newgard (Scimmia)
Tuesday, 01 March 2016, 04:21 GMT
Reason for closing:  Deferred
Comment by Doug Newgard (Scimmia) - Saturday, 20 February 2016, 14:46 GMT
It's being set to "rxvt-unicode-256color" for me. Sounds like a configuration issue.

Edit: Is rxvt-unicode-terminfo up to date?
Comment by Doug Newgard (Scimmia) - Monday, 22 February 2016, 15:22 GMT
Ping?
Comment by Michal Svoboda (pht) - Tuesday, 23 February 2016, 19:15 GMT
Sorry for late reply.
Yes, all packages are up to date.
I'm getting it on multiple computers, and I think it might relate to the .Xdefaults.
I can try some experiments to pinpoint it.
Comment by Doug Newgard (Scimmia) - Monday, 29 February 2016, 15:29 GMT
Is this happening locally or when connecting to another system remotely?

I didn't ask about "all packages", I asked about one specifically.
Comment by Michal Svoboda (pht) - Monday, 29 February 2016, 17:27 GMT
Okay, so I debugged the problem a little bit. It is because of the Xdefaults, as I suspected. Apparently, xrdb uses a preprocessor (cpp) to process the file. For some reason, cpp expands the string 'linux' to 1.

$ grep termName .Xdefaults
urxvt*termName: linux
$ xrdb .Xdefaults
$ xrdb -query|grep termName
urxvt*termName: 1

$ xrdb -nocpp .Xdefaults
$ xrdb -query|grep termName
urxvt*termName: linux

$ echo linux|cpp
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "<stdin>"
1

$ echo | cpp -dM|grep linux
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1
#define linux 1

So this is not urxvt's fault, and probably not xrdb's either. But I don't know how to escape the word linux in my .Xdefaults, so that it does not get expanded by cpp. Can you help me with this?
Comment by Michal Svoboda (pht) - Monday, 29 February 2016, 17:38 GMT
Update - I created  FS#48377  to deal with the macro expansion issue.
Comment by Doug Newgard (Scimmia) - Tuesday, 01 March 2016, 04:21 GMT
OK, we'll close this and continue things there.

Loading...