Re: consistency probs var & function re-use

2017-06-10 Thread Charles Daffern
>First problem: If you are assigning a string to a variable, > you need to put quotes around the string. That shows that "-p" > doesn't insert newlines: > > > x="$'foo\nbar'" > > declare -p x > declare -- x="\$'foo\\nbar'" You do not have any newlines in that string, so of course the demo

A background ssh can take over the tty from bash?

2017-06-10 Thread Clark Wang
(I'm using bash 4.4.12 on Debian 8) Please follow the following steps to reproduce. >From tty #1: $ tty /dev/pts/11 $ ssh -o ControlMaster=yes -o ControlPath=/tmp/socket.tmp -N -f 127.0.0.1 root@127.0.0.1's password: $ ps -C ssh uw USER PID %CPU %MEMVSZ RSS TTY STAT START TIME

Re: A background ssh can take over the tty from bash?

2017-06-10 Thread John McKown
On Sat, Jun 10, 2017 at 9:19 AM, Clark Wang wrote: > (I'm using bash 4.4.12 on Debian 8) > > Please follow the following steps to reproduce. > > From tty #1: > > $ tty > /dev/pts/11 > $ ssh -o ControlMaster=yes -o ControlPath=/tmp/socket.tmp -N -f 127.0.0.1 > root@127.0.0.1's password: > $ ps -C

Buffer corruption when the terminal is resized.

2017-06-10 Thread Paul Peet
I would like to report a bug with bash (readline?). This bug can be reproduced by opening gnome-terminal with bash running. By quickly horizontally resizing the terminal window you can see that the buffer seems to be corrupted as you see repeated or even removed lines or characters. At first I tho

Re: Buffer corruption when the terminal is resized.

2017-06-10 Thread Eduardo Bustamante
On Sat, Jun 10, 2017 at 04:56:35PM +0200, Paul Peet wrote: > I would like to report a bug with bash (readline?). This bug can be > reproduced by opening gnome-terminal with bash running. By quickly > horizontally resizing the terminal window you can see that the buffer > seems to be corrupted as yo

Re: Storing NUL in variables

2017-06-10 Thread Pierre Gaston
On Sat, Jun 10, 2017 at 2:06 AM, George wrote: > On Fri, 2017-06-09 at 20:58 +0300, Pierre Gaston wrote: > > On Fri, Jun 9, 2017 at 8:40 PM, Peter & Kelly Passchier > wrote: > > > > On 09/06/2560 23:38, L A Walsh wrote: > > > Chet Ramey wrote: > > > > Should mapfile silently drop the NULs? > >

Re: Buffer corruption when the terminal is resized.

2017-06-10 Thread George
On Sat, 2017-06-10 at 11:20 -0500, Eduardo Bustamante wrote: > On Sat, Jun 10, 2017 at 04:56:35PM +0200, Paul Peet wrote: > > > > I would like to report a bug with bash (readline?). This bug can be > > reproduced by opening gnome-terminal with bash running. By quickly > > horizontally resizing the

Re: Buffer corruption when the terminal is resized.

2017-06-10 Thread Paul Peet
declare -- PS1="\\[\\e]0;\\u@\\h: \\w\\a\\]\${debian_chroot:+(\$debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\\$ " On Sat, Jun 10, 2017 at 6:47 PM, George wrote: > On Sat, 2017-06-10 at 11:20 -0500, Eduardo Bustamante wrote: > > On Sat, Jun 10, 201

Re: Buffer corruption when the terminal is resized.

2017-06-10 Thread Eduardo Bustamante
On Sat, Jun 10, 2017 at 06:49:13PM +0200, Paul Peet wrote: > declare -- PS1="\\[\\e]0;\\u@\\h: > \\w\\a\\]\${debian_chroot:+(\$debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\\$ > " [...] > > Bash relies on \[ and \] to determine how much space is occup

Re: Buffer corruption when the terminal is resized.

2017-06-10 Thread Paul Peet
If I understand this correctly this prompt (see below) shouldn't contain any invisible sequence, therefore it doesn't require the wrapping with \[ and \]. PS1="\u@\h\$" So bash should be able to correctly calculate the prompt size and such, but by resizing the window it still results in a corrupt

Re: Buffer corruption when the terminal is resized.

2017-06-10 Thread Eduardo Bustamante
On Sat, Jun 10, 2017 at 07:21:36PM +0200, Paul Peet wrote: > If I understand this correctly this prompt (see below) shouldn't > contain any invisible sequence, therefore it doesn't require the > wrapping with \[ and \]. > > PS1="\u@\h\$" > > So bash should be able to correctly calculate the promp

Re: Buffer corruption when the terminal is resized.

2017-06-10 Thread Paul Peet
Okay, I did the follwing: > git clone https://git.savannah.gnu.org/git/bash.git > cd bash && git checkout devel > ./configure --prefix=/ --with-curses --enable-readline > make I then changed the default shell (in gnome-terminal) to the newly built bash. > echo $BASH_VERSION 4.4.12(1)-maint Unfo

Re: A background ssh can take over the tty from bash?

2017-06-10 Thread Clark Wang
On Sat, Jun 10, 2017 at 11:00 PM, John McKown wrote: > On Sat, Jun 10, 2017 at 9:19 AM, Clark Wang wrote: > >> (I'm using bash 4.4.12 on Debian 8) >> >> Please follow the following steps to reproduce. >> >> From tty #1: >> >> $ tty >> /dev/pts/11 >> $ ssh -o ControlMaster=yes -o ControlPath=/tmp

Re: Storing NUL in variables

2017-06-10 Thread George
On Sat, 2017-06-10 at 19:33 +0300, Pierre Gaston wrote: > > > > > > > One option that might make a feature like this integrate into the shell > > better would be to store a captured byte stream as an integer array rather > > than as an atomic variable. The back-end implementation in this case c