Ubuntu version of BASH losts or misinterprets the newline character coming from mouse paste

Bug #1925823 reported by Péter Prőhle
28
This bug affects 6 people
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Quiete a few experients shows, that bash misinterprets the newline-character coming from mouse paste, while in the same terminals the emacs or vim or alpine and many other character oriented programs interprest correctly.

The problem is specific to the situation when we are at a bash prompt of a new version of bash we got in Ubuntu 21.04. As soon as I invoke an ssh session, the interpretation of the newline-caharcter becomes correct, since the remote older bash interprets correctly.

>>> Newline bug of first kind:

If there is a complete bash command with terminating newline in the cut and paste buffer,

and it is pasted into a gnome-terminal,

then the command is *not* executed, the newline is ignored by the terminal.

>>> Newline bug of second kind:

If I prepare a bash command say

        cp target-directory

and I collect into the paste buffer "source-file newline-character"

and I drop it IN BETWEEN the prepared "cp" and "target-directory"

then the result is wrong:

        instead of interpreting the newline-character as "push enter"

        the command is broken into the followint 2 lines:

                cp source-file

                target-directory

and I get an error message about missing target specification.

        cp: missing destination file operand after 'source-file'
        Try 'cp --help' for more information.
        bash: target-directory: Is a directory

I found better to make this original bug descripton more informative.

Tags: hirsute impish
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in bash (Ubuntu):
status: New → Confirmed
Changed in gnome-terminal (Ubuntu):
status: New → Confirmed
Revision history for this message
Sebastien Bacher (seb128) wrote :

Confirmed, downgrading the bash deb to the 20.10 version fixes the issue so the issue is due to it

no longer affects: gnome-terminal (Ubuntu)
summary: - gnome-terminal losts or ignore the newline character coming from mouse
- paste
+ losts or ignore the newline character coming from mouse paste
Revision history for this message
Péter Prőhle (prohlep) wrote : Re: losts or ignore the newline character coming from mouse paste

bash --version gives: GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)

Norbert (nrbrtx)
tags: added: hirsute
Péter Prőhle (prohlep)
summary: - losts or ignore the newline character coming from mouse paste
+ losts or misinterprets the newline character coming from mouse paste
Revision history for this message
Péter Prőhle (prohlep) wrote : Re: losts or misinterprets the newline character coming from mouse paste

Sorry that I edited the original bug report, but I think it was better to make it more informative, and not to grab these improvements of the bug description among the comments. Read please, re-read please the new version of the bug report.

description: updated
Revision history for this message
Péter Prőhle (prohlep) wrote :

If I remain inside Ubuntu 21.04, but compile the previous version of bash, then the error disappears, ... this suggest that the erorr is not the consequence of the version of Ubuntu, but the "bash, version 5.1.4(1)-release" itself, or perhaps an Ubuntu specific configuration of the environment. In detail:

mkdir ~/bash

cd ~/bash

wget https://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz

tar xvzf bash-5.0.tar.gz

cd bash-5.0

sudo apt-get install byacc

./configure

make

env -i PATH="$PWD:$PATH" ./bash --noprofile --norc

and here if I drop something containing a line feed character, the bash will correctly execute the currently edited commandline

Revision history for this message
Péter Prőhle (prohlep) wrote :

The bug is NOT the error of the original GNU package, but of the way how it is integrated into the Ubuntu 21.04, because if I download the GNU package itself, compile and try, then it works fine.

In detail what I did:

mkdir -p ~/bash

cd ~/bash

rm -fr bash-*

sudo apt-get -y install byacc

wget https://ftp.gnu.org/gnu/bash/bash-5.1.tar.gz

tar xvzf bash-*.tar.gz
rm bash-*.tar.gz
cd bash-*

time ( ./configure ; make )

env -i PATH="$PWD:$PATH" ./bash --noprofile --norc

and here if I do the same cut and paste tests, and drop a command with a terminating line feed character, then this bash binary will simply execute it ...

Revision history for this message
Péter Prőhle (prohlep) wrote :

In addition to the correct behaviour of the GNU bash, I will not get that disturbing fancy behaviour of the Ubuntu 21.04 version, that

instead of executing the command

the dropped command is shown in reverse video.

Hence the bug in question is clearly an Ubuntu re-packaging issue.

summary: - losts or misinterprets the newline character coming from mouse paste
+ Ubuntu version of BASH losts or misinterprets the newline character
+ coming from mouse paste
Revision history for this message
Péter Prőhle (prohlep) wrote :

tags:added: impish

tags: added: impish
Revision history for this message
Péter Prőhle (prohlep) wrote :

This bug is still there, I am interested in discussing it, but nobody assigned this bug to anybody.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.