All of lore.kernel.org
 help / color / mirror / Atom feed
* Awkward line wrapping in bash
@ 2019-09-16  9:34 phodina
       [not found] ` <8bb3f05c-966b-4076-6593-d042bb8240ad@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread
From: phodina @ 2019-09-16  9:34 UTC (permalink / raw)
  To: yocto


[-- Attachment #1.1: Type: text/plain, Size: 753 bytes --]

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.

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

Thank you in advance.

Kind regards
Petr Hodina

[-- Attachment #1.2: Type: text/html, Size: 1230 bytes --]

[-- Attachment #2: Screenshot 2019-09-16 at 09.55.24.png --]
[-- Type: image/png, Size: 32401 bytes --]

[-- Attachment #3: Screenshot 2019-09-16 at 10.11.39.png --]
[-- Type: image/png, Size: 22761 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Awkward line wrapping in bash
       [not found]   ` <6v81ntCcT70rvm2b8GwiRAeNSZSIEec-hUpr0hIN7HYR9RySExiu50vZaZM0jXSjiu2PYGbQ5mKn1e0cv3q13NlyJ5rwb6cdV0h1mpb9jXc=@protonmail.com>
@ 2019-09-18 13:17     ` phodina
       [not found]       ` <bb902393-3fc3-6b68-f418-3c2a4d3b189c@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread
From: phodina @ 2019-09-18 13:17 UTC (permalink / raw)
  To: yocto

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é




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Awkward line wrapping in bash
       [not found]       ` <bb902393-3fc3-6b68-f418-3c2a4d3b189c@gmail.com>
@ 2019-09-19 15:43         ` phodina
  2019-09-19 18:45           ` Randy MacLeod
                             ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: phodina @ 2019-09-19 15:43 UTC (permalink / raw)
  To: yocto

Hi,

based on André recommendation I commented out the PS1 variable and now I get `-sh-4.4#` for the prompt. I also checked and nothing is overwriting the variable.

But I tried to change the size of the shell by using `stty cols 100 rows 40` as well as different sizes (smaller and bigger than 80 columns), but the amount of characters I get on the line stays at 81 followed by carrige return. However if I record the session with `script` I get the correct amount of characters per line.

Here is my `stty -a` output:
speed 115200 baud; rows 24; columns 100; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>;
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;
min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany imaxbel
iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho
-extproc

Best regards
Petr hodina


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, September 18, 2019 4:13 PM, André Castro <andre.castro.sw@gmail.com> wrote:

> Hi Petr,
>
> I still don't think this is related to Yocto.
> Comments below.
>
> Best regards,
> André
> On Wed, 18 Sep 2019, at 02:17:01 PM (WEST+0100), Phodina wrote:
>
> > 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.
>
> Can you get the value of the 'PS1' variable in the new system that you flashed,
> when you are using it and the problem is happening?
>
> Just run "echo $PS1" on the shell.
>
> Just want to make sure that nothing is overwriting the 'PS1' variable and
> causing the issue again. There are lots of scripts that can override it.
>
> > 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é




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Awkward line wrapping in bash
  2019-09-19 15:43         ` phodina
@ 2019-09-19 18:45           ` Randy MacLeod
  2019-10-03 10:54             ` phodina
  2019-09-20  1:44           ` ChenQi
  2019-09-20  6:46           ` Robert Berger@yocto.user
  2 siblings, 1 reply; 8+ messages in thread
From: Randy MacLeod @ 2019-09-19 18:45 UTC (permalink / raw)
  To: phodina, yocto

On 9/19/19 11:43 AM, phodina wrote:
> Hi,
> 
> based on André recommendation I commented out the PS1 variable and now I get `-sh-4.4#` for the prompt. I also checked and nothing is overwriting the variable.
> 
> But I tried to change the size of the shell by using `stty cols 100 rows 40` as well as different sizes (smaller and bigger than 80 columns), but the amount of characters I get on the line stays at 81 followed by carrige return. However if I record the session with `script` I get the correct amount of characters per line.

If you are able to reproduce this proble on the master, or a
stable (1) branch with one of the supported qemu or HW BSPs (2),
please open a defect in:
    https://bugzilla.yoctoproject.org/

Please report the branch, what layers you are using (hopefully you
can reproduce it with just oe-core/poky + a HW layer) and
with a standard image.

../Randy

(1) https://wiki.yoctoproject.org/wiki/Releases

(2):
The list here is a good start, I'm not sure about the FSL support and
I suspect that minnow board is no longer relevant.

https://bugzilla.yoctoproject.org/describecomponents.cgi?product=BSPs

If your hardware isn't listed, and you can't reproduce the issue
in qemu or supported HW, you should contact your HW supplier.

-- 
# Randy MacLeod
# Wind River Linux


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Awkward line wrapping in bash
  2019-09-19 15:43         ` phodina
  2019-09-19 18:45           ` Randy MacLeod
@ 2019-09-20  1:44           ` ChenQi
  2019-09-20  6:46           ` Robert Berger@yocto.user
  2 siblings, 0 replies; 8+ messages in thread
From: ChenQi @ 2019-09-20  1:44 UTC (permalink / raw)
  To: phodina, yocto

How about using `tput smam'?

Regards,
Chen Qi

On 09/19/2019 11:43 PM, phodina wrote:
> Hi,
>
> based on André recommendation I commented out the PS1 variable and now I get `-sh-4.4#` for the prompt. I also checked and nothing is overwriting the variable.
>
> But I tried to change the size of the shell by using `stty cols 100 rows 40` as well as different sizes (smaller and bigger than 80 columns), but the amount of characters I get on the line stays at 81 followed by carrige return. However if I record the session with `script` I get the correct amount of characters per line.
>
> Here is my `stty -a` output:
> speed 115200 baud; rows 24; columns 100; line = 0;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>;
> swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;
> min = 1; time = 0;
> -parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany imaxbel
> iutf8
> opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
> isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho
> -extproc
>
> Best regards
> Petr hodina
>
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Wednesday, September 18, 2019 4:13 PM, André Castro <andre.castro.sw@gmail.com> wrote:
>
>> Hi Petr,
>>
>> I still don't think this is related to Yocto.
>> Comments below.
>>
>> Best regards,
>> André
>> On Wed, 18 Sep 2019, at 02:17:01 PM (WEST+0100), Phodina wrote:
>>
>>> 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.
>> Can you get the value of the 'PS1' variable in the new system that you flashed,
>> when you are using it and the problem is happening?
>>
>> Just run "echo $PS1" on the shell.
>>
>> Just want to make sure that nothing is overwriting the 'PS1' variable and
>> causing the issue again. There are lots of scripts that can override it.
>>
>>> 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é
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Awkward line wrapping in bash
  2019-09-19 15:43         ` phodina
  2019-09-19 18:45           ` Randy MacLeod
  2019-09-20  1:44           ` ChenQi
@ 2019-09-20  6:46           ` Robert Berger@yocto.user
  2 siblings, 0 replies; 8+ messages in thread
From: Robert Berger@yocto.user @ 2019-09-20  6:46 UTC (permalink / raw)
  To: phodina, yocto

Hi,

Is your problem of line wrapping only on the serial console, or also on 
an ssh session?

Which version of Yocto do you use?

systemd or sys-v?

Regards,

Robert

On 19/09/2019 17:43, phodina wrote:
> Hi,
> 
> based on André recommendation I commented out the PS1 variable and now I get `-sh-4.4#` for the prompt. I also checked and nothing is overwriting the variable.
> 
> But I tried to change the size of the shell by using `stty cols 100 rows 40` as well as different sizes (smaller and bigger than 80 columns), but the amount of characters I get on the line stays at 81 followed by carrige return. However if I record the session with `script` I get the correct amount of characters per line.
> 
> Here is my `stty -a` output:
> speed 115200 baud; rows 24; columns 100; line = 0;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>;
> swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;
> min = 1; time = 0;
> -parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany imaxbel
> iutf8
> opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
> isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho
> -extproc
> 
> Best regards
> Petr hodina
> 
> 
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Wednesday, September 18, 2019 4:13 PM, André Castro <andre.castro.sw@gmail.com> wrote:
> 
>> Hi Petr,
>>
>> I still don't think this is related to Yocto.
>> Comments below.
>>
>> Best regards,
>> André
>> On Wed, 18 Sep 2019, at 02:17:01 PM (WEST+0100), Phodina wrote:
>>
>>> 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.
>>
>> Can you get the value of the 'PS1' variable in the new system that you flashed,
>> when you are using it and the problem is happening?
>>
>> Just run "echo $PS1" on the shell.
>>
>> Just want to make sure that nothing is overwriting the 'PS1' variable and
>> causing the issue again. There are lots of scripts that can override it.
>>
>>> 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é
> 
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Awkward line wrapping in bash
  2019-09-19 18:45           ` Randy MacLeod
@ 2019-10-03 10:54             ` phodina
  2019-10-03 18:43               ` Randy MacLeod
  0 siblings, 1 reply; 8+ messages in thread
From: phodina @ 2019-10-03 10:54 UTC (permalink / raw)
  To: Randy MacLeod; +Cc: yocto

Hi,

so I managed to minimize the build image and run it in QEMU. Now I build only poky, open-embedded and our own layer, containing minimal reciepes. The problem with the awkward line wrapping is still present. Sometimes it doesn't come up until I change the size of terminal window.

More interesting is that if I run `busybox sh` the issue is not present and the line wraps correctly.

The issue happens with ssh as well as serial.

I tried to install the `xterm` pkg which has `resize` binary for changing the terminal window size, but without any luck.

Kind regards
Petr


Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, September 19, 2019 8:45 PM, Randy MacLeod <randy.macleod@windriver.com> wrote:

> On 9/19/19 11:43 AM, phodina wrote:
>
> > Hi,
> > based on André recommendation I commented out the PS1 variable and now I get `-sh-4.4#` for the prompt. I also checked and nothing is overwriting the variable.
> > But I tried to change the size of the shell by using `stty cols 100 rows 40` as well as different sizes (smaller and bigger than 80 columns), but the amount of characters I get on the line stays at 81 followed by carrige return. However if I record the session with `script` I get the correct amount of characters per line.
>
> If you are able to reproduce this proble on the master, or a
> stable (1) branch with one of the supported qemu or HW BSPs (2),
> please open a defect in:
> https://bugzilla.yoctoproject.org/
>
> Please report the branch, what layers you are using (hopefully you
> can reproduce it with just oe-core/poky + a HW layer) and
> with a standard image.
>
> ../Randy
>
> (1) https://wiki.yoctoproject.org/wiki/Releases
>
> (2):
> The list here is a good start, I'm not sure about the FSL support and
> I suspect that minnow board is no longer relevant.
>
> https://bugzilla.yoctoproject.org/describecomponents.cgi?product=BSPs
>
> If your hardware isn't listed, and you can't reproduce the issue
> in qemu or supported HW, you should contact your HW supplier.
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Randy MacLeod
>
> ==============
>
> Wind River Linux
>
> =================




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Awkward line wrapping in bash
  2019-10-03 10:54             ` phodina
@ 2019-10-03 18:43               ` Randy MacLeod
  0 siblings, 0 replies; 8+ messages in thread
From: Randy MacLeod @ 2019-10-03 18:43 UTC (permalink / raw)
  To: phodina; +Cc: yocto

On 10/3/19 6:54 AM, phodina wrote:
> Hi,
> 
> so I managed to minimize the build image and run it in QEMU. Now I build only poky, open-embedded and our own layer, containing minimal recipes. The problem with the awkward line wrapping is still present. Sometimes it doesn't come up until I change the size of terminal window.

Is that on the master branch?

> 
> More interesting is that if I run `busybox sh` the issue is not present and the line wraps correctly.
> 
> The issue happens with ssh as well as serial.

Interesting.

> 
> I tried to install the `xterm` pkg which has `resize` binary for changing the terminal window size, but without any luck.

Why not?
I know that the meta-overc devs added xterm to get resize:
https://github.com/OverC/meta-overc/commit/729f50aef024db293986ff320713ddf46bcb300b

> 
> Kind regards
> Petr

Thanks for simplifying and testing again.
If you want to continue to debug that would be great but
you can also open a YP bugzilla defect. Include
as much info as you can and perhaps a screenshot/image.

../Randy
> 
> 
> Sent with ProtonMail Secure Email.
> 
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Thursday, September 19, 2019 8:45 PM, Randy MacLeod <randy.macleod@windriver.com> wrote:
> 
>> On 9/19/19 11:43 AM, phodina wrote:
>>
>>> Hi,
>>> based on André recommendation I commented out the PS1 variable and now I get `-sh-4.4#` for the prompt. I also checked and nothing is overwriting the variable.
>>> But I tried to change the size of the shell by using `stty cols 100 rows 40` as well as different sizes (smaller and bigger than 80 columns), but the amount of characters I get on the line stays at 81 followed by carrige return. However if I record the session with `script` I get the correct amount of characters per line.
>>
>> If you are able to reproduce this problem on the master, or a
>> stable (1) branch with one of the supported qemu or HW BSPs (2),
>> please open a defect in:
>> https://bugzilla.yoctoproject.org/
>>
>> Please report the branch, what layers you are using (hopefully you
>> can reproduce it with just oe-core/poky + a HW layer) and
>> with a standard image.
>>
>> ../Randy
>>
>> (1) https://wiki.yoctoproject.org/wiki/Releases
>>
>> (2):
>> The list here is a good start, I'm not sure about the FSL support and
>> I suspect that minnow board is no longer relevant.
>>
>> https://bugzilla.yoctoproject.org/describecomponents.cgi?product=BSPs
>>
>> If your hardware isn't listed, and you can't reproduce the issue
>> in qemu or supported HW, you should contact your HW supplier.
>>
>> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>> Randy MacLeod
>>
>> ==============
>>
>> Wind River Linux
>>
>> =================
> 
> 


-- 
# Randy MacLeod
# Wind River Linux


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-10-03 18:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
     [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

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.