Bug 1183192 - vte-profile's vte.sh overrides any earlier setting of PROMPT_COMMAND (and duplicates /etc/bashrc)
Summary: vte-profile's vte.sh overrides any earlier setting of PROMPT_COMMAND (and dup...
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: vte291
Version: 32
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Debarshi Ray
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-17 00:30 UTC by Adam Williamson (Fedora)
Modified: 2020-05-04 07:54 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-19 12:39:15 UTC
Type: Bug


Attachments (Terms of Use)
proposed fix (412 bytes, patch)
2016-07-19 15:52 UTC, srakitnican
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
GNOME Bugzilla 704960 Normal NEW /etc/profile.d/vte.sh overwrites PROMPT_COMMAND 2020-05-04 07:36:15 UTC

Description Adam Williamson (Fedora) 2015-01-17 00:30:58 UTC
/etc/bashrc has this:

    case $TERM in
    xterm*|vte*)
      if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
          PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
      elif [ "${VTE_VERSION:-0}" -ge 3405 ]; then
          PROMPT_COMMAND="__vte_prompt_command"
      else
          PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'

then /etc/profile.d/vte.sh has:

case "$TERM" in
  xterm*|vte*)
    [ -n "$BASH_VERSION" ] && PROMPT_COMMAND="__vte_prompt_command" 
    [ -n "$ZSH_VERSION"  ] && precmd_functions+=(__vte_osc7)
    ;;
esac

first of all, why is this duplicated between the two? Seems unnecessary.

Second, vte.sh doesn't incorporate any previous PROMPT_COMMAND. That means if you create a /etc/profile.d/prompt.sh (for e.g.) and set a custom PROMPT_COMMAND in it, it doesn't work, because vte.sh is included later and overrides it. You have to name your file so it comes alphabetically after vte.sh if you want to set a custom PROMPT_COMMAND.

Comment 1 Egmont Koblinger 2015-01-17 10:09:59 UTC
Re "Second": See https://bugzilla.gnome.org/show_bug.cgi?id=704960 , I'll fix it for the next release.

Comment 2 Christian Persch 2015-01-17 10:44:40 UTC
The (bogus) /etc/bashrc change comes from bug 924275.

And it's done in vte.sh because vte.sh is upstream, while /etc/bashrc is fedora specific.

In bug 924275 comment 13 I had proposed a way to make this work nicely, but it wasn't well-received.

Comment 3 Jaroslav Reznik 2015-03-03 16:43:29 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 4 srakitnican 2016-03-02 18:11:03 UTC
Still present in Fedora 23.

$ rpm -q vte291 vte-profile
vte291-0.42.3-1.fc23.x86_64
vte-profile-0.42.3-1.fc23.x86_64

Comment 5 Adam Williamson 2016-03-02 18:27:53 UTC
Christian: the failure to incorporate previously set PROMPT_COMMAND seems like a problem specific to vte that can be fixed without anyone else's say-so...

Comment 6 Garrett Mitchener 2016-07-18 22:30:57 UTC
Still in Fedora 24. This gets in the way of autojump.

Comment 7 Fedora End Of Life 2016-07-19 12:39:15 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 8 srakitnican 2016-07-19 15:52:04 UTC
Created attachment 1181684 [details]
proposed fix

VTE is overwriting system ENV variable, this is then a vte bug as I see it. IMHO it should be either fixed or removed because it _breaks_ ENV variable.

It should be fixed at least temporarily by appending its stuff to the PROMPT_COMMAND and not overwriting, and again IMHO.

I don't think it should be removed since the fix is so simple as I see it. As said by autojump developer:

> For bash users, autojump keeps track of directories by modifying $PROMPT_COMMAND. Do not overwrite $PROMPT_COMMAND:
> 
>   export PROMPT_COMMAND="history -a"
> 
> Instead append to the end of the existing \$PROMPT_COMMAND:
> 
>   export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} history -a"


And this seems as right fix to me.

Comment 9 Fedora End Of Life 2017-02-28 09:39:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 10 Debarshi Ray 2017-03-23 13:44:56 UTC
So, why can't we have this:
https://bugzilla.redhat.com/show_bug.cgi?id=924275#c13 ?

Other than handwaving it away as "playing with arrays for PROMPT_COMMAND seems to be over-engineering".

Comment 11 Debarshi Ray 2017-03-23 13:48:50 UTC
To be honest, if Bash or the Fedora start-up script maintainers really don't want the terminal emulator to override global environment variables, then they should try harder to offer suitable facilities. If its considered "over-engineering", then why should vte bother?

Comment 12 srakitnican 2017-07-19 09:19:19 UTC
(In reply to Debarshi Ray from comment #11)
> To be honest, if Bash or the Fedora start-up script maintainers really don't
> want the terminal emulator to override global environment variables, then
> they should try harder to offer suitable facilities. If its considered
> "over-engineering", then why should vte bother?

Hi, I am not sure what you mean, but the way I see it, bashrc is not overwriting PROMPT_COMMAND variable:

# are we an interactive shell?
if [ "$PS1" ]; then
  if [ -z "$PROMPT_COMMAND" ]; then
    case $TERM in


But vte.sh is:

case "$TERM" in
  xterm*|vte*)
    [ -n "$BASH_VERSION" ] && PROMPT_COMMAND="__vte_prompt_command"

I think vte should stop doing this.

Comment 13 Jan Kurik 2017-08-15 09:28:28 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 14 Alexey Pakseykin 2018-03-17 17:35:06 UTC
PROMPT_COMMAND override, IMO, is clearly intrusive.
It's even more annoying when all it seems to solve are:
  1. "Command completed" notification for Gnome shell.
  2. New tab is opened in the same directory as the existing tab.
  ...
     Is there something else?

For example, for `tmux` users, both points become irrelevant.

I tried to `dnf erase vte-profile` but it got itself as dependency
for many important packages (directly or indirectly).

More over, `/etc/profile.d/vte.sh` is the only file `vte-profile` package provides.


Solution:

  Shouldn't solution for Fedora be in simple RPM-dependency fix?
  What if it can become completely optional?

  For example:
  It could be included by default with GNOME
  (with all other stuff like `gedit).
  But if you uninstall it, it erases itself only.

  
Otherwise (fixing it on `vte.sh` side) is blocked by resistance:
https://bugzilla.gnome.org/show_bug.cgi?id=704960

Comment 15 Ben Cotton 2018-11-27 16:36:16 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 16 Adam Williamson 2018-11-27 19:37:14 UTC
I don't see any change in vte.sh in current Rawhide. The upstream bug seemed to get into an argument and then be abandoned...

Comment 17 Alick Zhao 2018-12-09 19:58:11 UTC
IMO Fedora should patch vte.sh for now since upstream does not think there is urgent need of fixing this. But is the package owner still actively maintaining the package?

Comment 18 Ben Cotton 2019-02-19 17:11:33 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 30 development cycle.
Changing version to '30.

Comment 19 Ben Cotton 2020-04-30 22:17:50 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '30'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 30 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 20 Lukáš Zachar 2020-05-04 07:38:38 UTC
Still seeing similar vte.sh in Fedora 32


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