Not setting TERM explicitly wraps commands at 80 columns with nested shells in xterms using sh + bash?

From: Garrett Cooper <yanegomi_at_gmail.com>
Date: Thu, 20 Oct 2011 23:40:05 -0700
    If I fire up an xterm without setting TERM={ansi,vt100,xterm},
etc, xterm wraps my command output to 80 columns, even if I resize the
window to something larger, issue reset (which I thought was supposed
to fix the console settings by rescanning the window size, etc). I
thought that SIGWINCH was also supposed to force a proper rescan if
the terminal application had a handler installed. This isn't new (I've
been seeing it since 8.x or 9.x, but it's just gotten to the point
where it irritates me enough that I thought I should check around
first).
    Example output of the column wrapping is something like:

[gcooper_at_bayonetta ~]$
aaaaaaaaaaaaaaaata ~]$ echo
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

    It doesn't happen all of the time, but it happens frequently --
sometimes the result of me reading a unicode encoded locale file using
standard utilities like less (this really forks xterm, the shell,
etc), or by just printing it out on the console via svn diff; other
times it just seems to happen for no apparent reason in newly created
xterms (which is befuddling).
    Doing:

    export TERM=vt100
    export TERM=ansi
    export TERM=xterm

    in one xterm seems to have remedied the problem when I tried it,
but I'm not sure why.
    The way I currently do things when I log in interactively is I
exec from sh to bash (bash has a history built-in, which I use
extensively). More details are provided below.
    My questions are:

    1. Has anyone else seen this?
    2. If so, do you have a reproducible testcase that isolates this behavior?

Thanks!
-Garrett

1. My login shell is /bin/sh.
2. Relevant blurbs from /etc/ttys are as follows:

ttyv0   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv1   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv2   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv3   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv4   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv5   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv6   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv7   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv8   "/usr/local/bin/xdm -nodaemon"  xterm   off secure

3. I haven't modified /etc/termcap* at all.
4. Relevant blurb from .profile:

# set ENV to a file invoked each time sh is started for interactive use.
ENV=$HOME/.shrc; export ENV

5. Relevant blurb from .shrc:

BASH=/usr/local/bin/bash
if [ -x $BASH -a "$SHELL" != "$BASH" ] ; then
        # bash won't set this var if it's already set in the env.
        export SHELL=$BASH
        $BASH -c true && exec $BASH
fi
Received on Fri Oct 21 2011 - 04:40:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:19 UTC