Bug 506124

Summary: Konsole fails to display command prompt after some scripts complete
Product: [Applications] konsole Reporter: Sergiy <dwarf.nordar>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: 25.04.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Sergiy 2025-06-24 19:55:11 UTC
== SUMMARY ==
After a script that produces continuous output to the terminal finishes (e.g., using `wget --show-progress` or a simple loop), the Konsole prompt (PS1) is not rendered automatically. The terminal itself is not frozen: pressing the Enter key makes the cursor move to a new line, and after that, the prompt may appear. This indicates a rendering or state issue within Konsole, not a shell or process hang.

== STEPS TO REPRODUCE ==
1. Create a simple test script named `test_prompt.sh` with the following content:
   #!/bin/bash
   echo "Starting long output..."
   for i in {1..50}; do
       echo "Line $i of 50"
       sleep 0.02
   done
   echo "Script finished."
   # The prompt should appear here, but it doesn't.

2. Make it executable: `chmod +x test_prompt.sh`
3. Run it in a Konsole tab: `./test_prompt.sh`

== EXPECTED BEHAVIOR ==
The command prompt (e.g., `user@host:~$`) appears immediately on a new line after the "Script finished." message is printed.

== ACTUAL BEHAVIOR ==
A blank line with a blinking cursor appears. The prompt is not rendered. If the user then presses the Enter key, the prompt appears on the next new line. The issue is 100% reproducible.

== DEBUGGING STEPS ALREADY TAKEN (IMPORTANT) ==
We have conducted an extensive debugging session and have ruled out common causes. This is NOT a configuration issue.

1.  **Shell configuration ruled out:** The issue persists with a completely empty `~/.bashrc` and a sanitized `/etc/bash.bashrc` (with the window title setting block commented out).
2.  **It works in a sterile environment:** The command `env -i bash --norc` followed by running the script works correctly, proving the issue is related to the environment loaded by a normal interactive shell.
3.  **strace analysis performed:** `strace` logs confirm that the `bash` process is NOT hung. It successfully writes the prompt string to the terminal (via the `write()` syscall) and then correctly enters a `pselect6()` state, waiting for user input. This strongly suggests Konsole receives the command to draw the prompt but fails to render it.
4.  **Konsole Profile ruled out:** The issue persists even after creating a new, clean user profile within Konsole.
5.  **`reset` command workaround failed:** Adding the `reset` command to the end of the test script does NOT solve the problem.

This appears to be a genuine rendering or state management bug within Konsole itself.

== SYSTEM INFORMATION ==
plasmashell 6.4.0