Bug 2277426 - vte.sh notifications broken when PROMPT_COMMAND is an array
Summary: vte.sh notifications broken when PROMPT_COMMAND is an array
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: vte291
Version: 40
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: David King
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-04-26 20:56 UTC by Christian Hergert
Modified: 2024-05-07 22:23 UTC (History)
4 users (show)

Fixed In Version: vte291-0.76.1-1.fc40
Clone Of:
Environment:
Last Closed: 2024-05-07 05:14:32 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Fixes handling of notify and shell-precmd with Bash PROMPT_COMMAND array (1.17 KB, text/x-mpsub)
2024-04-29 22:56 UTC, Christian Hergert
no flags Details

Description Christian Hergert 2024-04-26 20:56:12 UTC
https://bugzilla.redhat.com/show_bug.cgi?id=2097525 worked towards making PROMPT_COMMAND in bash an array.

That causes /etc/profile.d/vte.sh to use __vte_osc7 instead of the __vte_prompt_command.

However, the patches for vte.sh.in layered upon upstream VTE do not handle this correctly.

The prexec escape sequence is still executed. However the precmd escape sequence is not. The side effect of this is that notifications in gnome-terminal (and ptyxis) will not work as there is no precmd to pair with prexec sequence.

Reproducible: Always

Steps to Reproduce:
1. run gnome-terminal
2. sleep 5 (and then switch to another window)
3. sleep command completes, no notification appears
Actual Results:  
No command completed notification

Expected Results:  
Command completed notification is displayed

Most likely we just need to fix the missing OSC 777 precmd sequence in the 'declare -a PROMPT_COMMAND' case.

Comment 1 Christian Hergert 2024-04-26 20:57:09 UTC
Note that for me, a fedora 39 container works fine, but a fedora 40 container does not.

Comment 2 Christian Hergert 2024-04-27 00:00:42 UTC
This seems to make things work for me, though I have no idea what the side-effects are at the moment with regards to titles/cwd/etc.

diff --git a/vte.sh b/vte.sh.new
index 4c85d28..1b7d536 100644
--- a/vte.sh
+++ b/vte.sh.new
@@ -51,7 +51,7 @@ if [[ -n "${BASH_VERSION:-}" ]]; then
     # use the __vte_prompt_command function which also sets the title.
 
     if [[ "$(declare -p PROMPT_COMMAND 2>&1)" =~ "declare -a" ]]; then
-       PROMPT_COMMAND+=(__vte_osc7) && PS0=$(printf "\033]777;preexec\033\\")
+       PROMPT_COMMAND+=(__vte_prompt_command) && PS0=$(printf "\033]777;preexec\033\\")
     else
        PROMPT_COMMAND="__vte_prompt_command" && PS0=$(printf "\033]777;preexec\033\\")
     fi

Comment 3 Christian Hergert 2024-04-29 22:56:08 UTC
Created attachment 2030126 [details]
Fixes handling of notify and shell-precmd with Bash PROMPT_COMMAND array

This can be copied into the patch for the RPM spec but it is also updated in the combined patch which was taken for Ptyxis for F40.

Now that F40 is using Bash arrays for $PROMPT_COMMAND it broke the vte.sh patches. This should make those code-paths also handled when an array.

Comment 4 Fedora Update System 2024-05-03 12:17:46 UTC
FEDORA-2024-ce96ecae8c (vte291-0.76.1-1.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-ce96ecae8c

Comment 5 Christian Hergert 2024-05-03 19:30:40 UTC
Just noting that the vte291-0.76.1-1 does not yet have the updated patch for PROMPT_COMMAND.

Comment 6 Fedora Update System 2024-05-04 03:38:06 UTC
FEDORA-2024-ce96ecae8c has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-ce96ecae8c`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-ce96ecae8c

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2024-05-07 05:14:32 UTC
FEDORA-2024-ce96ecae8c (vte291-0.76.1-1.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Christian Hergert 2024-05-07 22:23:53 UTC
Just confirming that this does indeed seem to fix things.


Note You need to log in before you can comment on or make changes to this bug.