All of lore.kernel.org
 help / color / mirror / Atom feed
From: phodina <phodina@protonmail.com>
To: "yocto@yoctoproject.org" <yocto@yoctoproject.org>
Subject: Awkward line wrapping in bash
Date: Wed, 18 Sep 2019 13:17:01 +0000	[thread overview]
Message-ID: <wNEOi-_A4sN9BRhUCA6bCldM2iWQIpgYPAYUaT3Gqku16wkJq_fXBk_jlOuoUZpFBv4T7_CqWpoA7Yl0I0rHbvrsYpI5g7FtdjQ36SyI2Xc=@protonmail.com> (raw)
In-Reply-To: <6v81ntCcT70rvm2b8GwiRAeNSZSIEec-hUpr0hIN7HYR9RySExiu50vZaZM0jXSjiu2PYGbQ5mKn1e0cv3q13NlyJ5rwb6cdV0h1mpb9jXc=@protonmail.com>

Hi,

so I tried the PS1 prompt as suggested by André and it worked at that time on the booted system. So I changed the configuration in /etc/profile, built and flashed the system.

Unfortunately it’s not working and I get the same issue - the line wrapping.

Here is the content of the /etc/profile:

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

PATH="/usr/local/bin:/usr/bin:/bin"
EDITOR="vi"                     # needed for packages like cron, git-commit
[ "$TERM" ] || TERM="vt100"     # Basic terminal capab. For screen etc.

# Add /sbin & co to $PATH for the root user
[ "$HOME" != "/home/root" ] || PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin

# Set the prompt for bash and ash (no other shells known to be in use here)
[ -z "$PS1" ] || PS1="$(cat /etc/device/hwid)@\h:\w \001\033[96m\002# \001\033[0m\002"

if [ -d /etc/profile.d ]; then
        for i in /etc/profile.d/*.sh; do
                if [ -f $i -a -r $i ]; then
                        . $i
                fi
        done
        unset i
fi

# Make sure we are on a serial console (i.e. the device used starts with
# /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which tries do
# use ssh
case $(tty 2>/dev/null) in
        /dev/tty[A-z]*) [ -x /usr/bin/resize ] && /usr/bin/resize >/dev/null;;
esac

export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM

umask 022


I also turned on `checkwinsize` using `shopt` but didn’t work.

I also include the output of stty (over serial):

speed 115200 baud; line = 0;
-brkint ixoff iutf8
-iexten

And over SSH:

speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?;
-brkint ixany iutf8

I connect to the board over serial using screen on Mac. In minicom I get the same issue as do my colleagues on Windows using putty or screen on Linux. Same happens over SSH.

I also checked that the terming package and those files are installed correctly in /etc/terminfo.

Kind regards
Petr Hodina

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Monday, September 16, 2019 1:02 PM, phodina <phodina@protonmail.com> wrote:

> Thanks André,
>
> the PS1 variable has been the cause. Now bash behaves as expected.
>
> Petr
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Monday, September 16, 2019 12:14 PM, André Castro andre.castro.sw@gmail.com wrote:
>
> > Hi Petr,
> > On Mon, 16 Sep 2019, at 10:34:33 AM (WEST+0100), Phodina wrote:
> >
> > > Hi,
> > > I would like to ask for a help with an awkward behavior of line wrap in bash
> > > built using Yocto (thud release). When I connect over serial line, I get strange
> > > line wrapping.
> >
> > This might not be related to Yocto.
> >
> > > The line keeps wrapping on the first line. Here is the environment:
> > > guest@:ebox~ # printenv
> > > LANG=C
> > > EDITOR=vi
> > > HZ=100
> > > HUSHLOGIN=FALSE
> > > USER=root
> > > PWD=/home/root
> > > HOME=/home/root
> > > SHELL=/bin/sh
> > > TERM=linux
> > > SHLVL=1
> > > LOGNAME=root
> > > PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
> > > PS1=guest@:ebox\w \033[96m# \033[0m
> > > _=/bin/printenv
> > > I looked for solution and the best direction seems to be run with clean
> > > environment env -i bash --norc --noprofile
> > > And the env:
> > > bash-4.4# printenv
> > > PWD=/home/root
> > > SHLVL=1
> > > _=/bin/printenv
> >
> > The probable cause of this is the "PS1" variable definition, specially the
> > colours part. Have a look at thread [1], maybe [2] answer will help.
> > My suggestion is:
> > PS1="guest@:ebox\w \001\033[96m\002# \001\033[0m\002"
> > [1]
> > https://unix.stackexchange.com/questions/105958/terminal-prompt-not-wrapping-correctly
> > [2]
> > https://unix.stackexchange.com/questions/105958/terminal-prompt-not-wrapping-correctly/447520#447520
> >
> > André




  parent reply	other threads:[~2019-09-18 13:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-16  9:34 Awkward line wrapping in bash phodina
     [not found] ` <8bb3f05c-966b-4076-6593-d042bb8240ad@gmail.com>
     [not found]   ` <6v81ntCcT70rvm2b8GwiRAeNSZSIEec-hUpr0hIN7HYR9RySExiu50vZaZM0jXSjiu2PYGbQ5mKn1e0cv3q13NlyJ5rwb6cdV0h1mpb9jXc=@protonmail.com>
2019-09-18 13:17     ` phodina [this message]
     [not found]       ` <bb902393-3fc3-6b68-f418-3c2a4d3b189c@gmail.com>
2019-09-19 15:43         ` phodina
2019-09-19 18:45           ` Randy MacLeod
2019-10-03 10:54             ` phodina
2019-10-03 18:43               ` Randy MacLeod
2019-09-20  1:44           ` ChenQi
2019-09-20  6:46           ` Robert Berger@yocto.user

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='wNEOi-_A4sN9BRhUCA6bCldM2iWQIpgYPAYUaT3Gqku16wkJq_fXBk_jlOuoUZpFBv4T7_CqWpoA7Yl0I0rHbvrsYpI5g7FtdjQ36SyI2Xc=@protonmail.com' \
    --to=phodina@protonmail.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.