Description of problem: If zsh, bash, and git (and git's dependencies, as it might be git-prompt doing it) installed, you can demonstrate the following: ``` user@hostname ~ % bash %B%F{red}%(?..%? )%f%b%B%F{blue}%n%f%b@%m %B%40<..<%~%<< %b%# ``` Without git installed: ``` user@hostname ~ % bash [user@hostname ~]$ ``` Version-Release number of selected component (if applicable): git-email-2.21.1-1.mga7 git-svn-2.21.1-1.mga7 git-prompt-2.21.1-1.mga7 git-core-2.21.1-1.mga7 git-arch-2.21.1-1.mga7 git-core-oldies-2.21.1-1.mga7 git-2.21.1-1.mga7 git-cvs-2.21.1-1.mga7 gitk-2.21.1-1.mga7 zsh-5.7.1-1.mga7 bash-completion-2.8-2.mga7 bash-4.4-23.1.mga7 How reproducible: Consistent. Steps to Reproduce: 1. Install `zsh`, `git`; requires `bash`, so hope you have that one too. 2. Change shell to /bin/zsh: `chsh --shell /bin/zsh <user>` 3. Login with new shell (e.g. with ssh or a new console) 4. Run: `bash` Notes: * I don't think PS1 should be marked for export. * Workaround: `typeset +x PS1` * There may be additional variables that have similar undesirable effects. * Top suspects: git-prompt, zsh, bash
The only place I can find PS1 being exported is in /etc/profile (from the setup package). If you remove PS1 from the export list in /etc/profile, do you still see this issue?
CC'ing two packagers who have expertise in the involved packages.
CC: (none) => shlomif, smelror
I removed it from /etc/profile, but it didn't go away. I also fully and properly ruled out grml-zsh-config - I thought I had ruled it out before, but now I know I was wrong. With grml-zsh-config completely out of the equation, the prompt becomes '%n@%m %3~ %(!.#.$)'. Searching again, I found this: ``` /etc/profile.d/93git-branch.sh: export PS1="$(echo -n "$PS1" | sed "s|\\\W\]|\\\W\$(type __git_ps1 >/dev/null 2>\&1 \&\& __git_ps1 \" (%s)\")\]|")" ``` This is in an if-statement that sources `/usr/share/doc/git-core/contrib/completion/git-prompt.sh` if it exists.
Thanks to both of you for the detective work. In the light of comment 3, this looks definitely down to git; so assigning to (rather than CC) Shlomi.
CC: shlomif => (none)Assignee: bugsquad => shlomif
Ahh yeah I searched the git sources but didn't see the local SOURCES/93git-branch.sh in our package.
Source RPM: (none) => git
The solution is to remove "export" from /etc/profile.d/93git-branch.sh Update pushed to Mageia 7 and Cauldron.
Advisory ======== An error in /etc/profile.d/93git-brach.sh made the bash prompt garbled. References ========== https://bugs.mageia.org/show_bug.cgi?id=25990 Files ===== Uploaded to core/updates_testing git-2.21.1-1.1.mga7 git-core-2.21.1-1.1.mga7 gitk-2.21.1-1.1.mga7 lib64git-devel-2.21.1-1.1.mga7 git-subtree-2.21.1-1.1.mga7 git-svn-2.21.1-1.1.mga7 git-cvs-2.21.1-1.1.mga7 git-arch-2.21.1-1.1.mga7 git-email-2.21.1-1.1.mga7 perl-Git-2.21.1-1.1.mga7 perl-Git-SVN-2.21.1-1.1.mga7 git-core-oldies-2.21.1-1.1.mga7 gitweb-2.21.1-1.1.mga7 git-prompt-2.21.1-1.1.mga7 from git-2.21.1-1.1.mga7.src.rpm
Assignee: shlomif => qa-bugs
Alex, let us know if this update solves the issue. Note to whoever commits the advisory to SVN to beware the typo.
Removing `export` from `/etc/profile.d/93git-branch.sh` worked. I'll let you know when I test the updated package.
Tested the packages from the testing repo. It works as expected now - which is to say it doesn't interfere. However, further testing shows that it does not have an effect on initial login. This other problem is most likely outside the scope of this bug, and may also be expected behavior. The behavior is different between login shells and non-login shells. Non-login shells: 1. /etc/bashrc is loaded first, setting PS1 appropriately 2. /etc/profile.d/* are loaded 3. When `/etc/profile.d/93git-branch.sh` is loaded, PS1 is appropriately set. 4. We have PS1 with git branch information. Login shells: 1. /etc/profile is loaded first, loading /etc/profile.d/* . 2. When `/etc/profile.d/93git-branch.sh` is loaded, PS1 is '\s-\v\$' - the default. Because it hasn't been properly set yet, the sed command doesn't see '\W' and has no effect. 3. /etc/bashrc is loaded (via `~/.bash_profile`), setting PS1 appropriately. 4. We have PS1 withOUT git branch information. Not sure if that is desirable or intended. Regardless, if you want it to work in login shells, either modify PS1 in /etc/profile.d (but only if it exists... and even then, I won't pretend I know all of the side effects), or move the sed to /etc/bashrc (which also brings its own problems). Sourcing `/etc/profile.d/93git-branch.sh` in my .bashrc should work, too. I think this other issue should be its own ticket, so let me know if I should make one.
To be clear, the original problem has now been resolved.
Whiteboard: (none) => MGA7-64-OK
Validating, then. Advisory in Comment 7.
Keywords: (none) => validated_updateCC: (none) => andrewsfarm, sysadmin-bugs
CC: (none) => tmbKeywords: (none) => advisory
An update for this issue has been pushed to the Mageia Updates repository. https://advisories.mageia.org/MGAA-2020-0006.html
Status: NEW => RESOLVEDResolution: (none) => FIXED