Debian Bug report logs - #948343
bash: Cursor lands before the prompt in specific case

version graph

Package: bash; Maintainer for bash is Matthias Klose <doko@debian.org>; Source for bash is src:bash (PTS, buildd, popcon).

Reported by: Julien Palard <julien@palard.fr>

Date: Tue, 7 Jan 2020 15:21:01 UTC

Severity: normal

Tags: upstream

Found in version bash/5.0-5

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, julien@palard.fr, Matthias Klose <doko@debian.org>:
Bug#948343; Package bash. (Tue, 07 Jan 2020 15:21:03 GMT) (full text, mbox, link).


Acknowledgement sent to Julien Palard <julien@palard.fr>:
New Bug report received and forwarded. Copy sent to julien@palard.fr, Matthias Klose <doko@debian.org>. (Tue, 07 Jan 2020 15:21:03 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Julien Palard <julien@palard.fr>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: bash: Cursor lands before the prompt in specific case
Date: Tue, 07 Jan 2020 16:18:58 +0100
Package: bash
Version: 5.0-5
Severity: normal
Tags: upstream

Dear Maintainer,

With a really specific procedure I'm able to reproduce an issue I'm having ~weekly:

- Move ~/.bashrc elsewhere just to start clean
- Start a new terminal (in my case tput cols tells it's 79 columns, beware, the bug varies according to the terminal width).
- run `bash --norc` in it, to start clean
- Prompt in my case is `bash-5.0$ `, beware, the bug varies according to the length of the prompt.
- type `printf "Hello World\n                    "` (1)
- hit the `uparrow` of your keyboard to see the printf again (2)
- hit C-a (bash shortcut for beginning-of-line) (3)

After (1) you should see (I'm using ■ to mark the place of the cursor):

    bash-5.0$ printf "Hello World\n
    Hello World
                        bash-5.0$ ■

After (2) you should see:

    bash-5.0$ printf "Hello World\n                    "
    Hello World
                        bash-5.0$ printf "Hello World\n                    "■

After (3) you should see:

    bash-5.0$ printf "Hello World\n                    "
    Hello World
              ■         bash-5.0$ printf "Hello World\n                    "

The point should not go that far, it should stop on the `p` of `printf`.

I straced and played a bit with, and noted a few interesting things:

- Bug appear, or not, depending on the length of the prompt
- Bug appear, or not, depending on the width of the terminal
- When beginning-of-line calls `write(2, "\r\33[C\33[C\33[C\33[C\33[C...` I have the bug
- When beginning-of-line calls `write(2, "\10\10\10\10\10\10\10\10\10...` I don't have the bug

-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.3.0-3-amd64 (SMP w/16 CPU cores)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages bash depends on:
ii  base-files   11
ii  debianutils  4.9.1
ii  libc6        2.29-3
ii  libtinfo6    6.1+20191019-1

Versions of packages bash recommends:
ii  bash-completion  1:2.8-6

Versions of packages bash suggests:
pn  bash-doc  <none>

-- no debconf information

Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#948343; Package bash. (Tue, 07 Jan 2020 15:39:02 GMT) (full text, mbox, link).


Acknowledgement sent to Julien Palard <julien@palard.fr>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (Tue, 07 Jan 2020 15:39:02 GMT) (full text, mbox, link).


Message #10 received at submit@bugs.debian.org (full text, mbox, reply):

From: Julien Palard <julien@palard.fr>
To: "948343@bugs.debian.org" <948343@bugs.debian.org>
Cc: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Re: Bug#948343: bash: Cursor lands before the prompt in specific case
Date: Tue, 07 Jan 2020 15:25:44 +0000
Forgot to mention: Bug appear, or not, depending on the length of the command.

To be more specific:
- Whith SHORT prompts you have more chance to reproduce the bug
- With LONG commands you have more chance to reproduce the bug

-- 
Julien Palard
https://mdk.fr




Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#948343; Package bash. (Tue, 07 Jan 2020 15:39:05 GMT) (full text, mbox, link).


Acknowledgement sent to Julien Palard <julien@palard.fr>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (Tue, 07 Jan 2020 15:39:05 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#948343; Package bash. (Tue, 07 Jan 2020 16:27:02 GMT) (full text, mbox, link).


Acknowledgement sent to Julien Palard <julien@palard.fr>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (Tue, 07 Jan 2020 16:27:02 GMT) (full text, mbox, link).


Message #20 received at 948343@bugs.debian.org (full text, mbox, reply):

From: Julien Palard <julien@palard.fr>
To: "948343@bugs.debian.org" <948343@bugs.debian.org>
Subject: Re: Bug#948343: bash: Cursor lands before the prompt in specific case
Date: Tue, 07 Jan 2020 16:23:01 +0000
It can also be reproduced using non-space characters, like:

    mdk@seraph:~$ printf "Hello World\n01234567890123456789"
    Hello World
    01234567890123456789mdk@seraph:~$ printf "Hello World\n01234567890123456789"
                  ^ The point jumps here (on the 2nd 4)

-- 
Julien Palard
https://mdk.fr




Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Dec 6 07:18:16 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.