This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 463913 - keychain shouldn't overwrite and/or unset variables that are used by other tools
keychain shouldn't overwrite and/or unset variables that are used by other tools
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: keychain (Show other bugs)
10
All Linux
medium Severity urgent
: ---
: ---
Assigned To: Alexander Dalloz
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-25 07:14 EDT by Mathieu Chouquet-Stringer
Modified: 2009-03-05 11:30 EST (History)
3 users (show)

See Also:
Fixed In Version: 2.6.8-4.fc10
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-03-05 11:30:34 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mathieu Chouquet-Stringer 2008-09-25 07:14:46 EDT
Description of problem:
I use zsh and for quite some time, I have been having issues with an internal zsh facility that lets you print the hostname (namely print -P "%M).
On some of my F9 hosts it would work and on some others it wouldn't.

After investigating, it appears keychain in /etc/profile.d/keychain.sh not only overwrites HOST but it also unset it before it exits.

Issue is HOST is defined by the shell (document under "PARAMETERS SET BY THE SHELL" section in the manpage) so it expects it to be present.

If HOST isn't defined, print -P "%M" doesn't work:
%echo $HOST

%print -P "%m %M"

%HOST=foobar
%print -P "%m %M"
foobar foobar


Version-Release number of selected component (if applicable):
keychain-2.6.8-3.fc9.noarch

How reproducible:
Always if you have keychain enable (aka ~/.keychainrc).

Steps to Reproduce:
1. use zsh as your shell
2. have ~/.keychainrc
3. open a new session, HOST is undefined
  
Actual results:
keychain.sh overwrites HOST even though it's already set, then it unset it.

Expected results:
I guess it shouldn't replace the value of HOST if it's already there and above all it shouldn't delete it.

This is what I propose:

--- /etc/profile.d/keychain.sh.orig     2008-04-06 18:09:07.000000000 +0200
+++ /etc/profile.d/keychain.sh  2008-09-25 13:13:12.000000000 +0200
@@ -24,13 +24,13 @@
        keychain $KCHOPTS $SSHKEYS $GPGKEYS
     fi
 
-    HOST=`uname -n`
+    [ -n "$HOST" ] || HOST=`uname -n`
     [ -f $HOME/.keychain/$HOST-sh ] && \
        . $HOME/.keychain/$HOST-sh
     [ -f $HOME/.keychain/$HOST-sh-gpg ] && \
        . $HOME/.keychain/$HOST-sh-gpg
 
-    unset KCHOPTS SSHKEYS GPGKEYS HOST
+    unset KCHOPTS SSHKEYS GPGKEYS
 
     KEYCHAIN_DONE=1
 fi
Comment 1 Mathieu Chouquet-Stringer 2008-11-02 16:22:26 EST
Anybody home?????
Comment 2 Alexander Dalloz 2008-11-05 08:32:39 EST
Hello,
thank your for this report. I will care for this issue and prepare a new rpm once I have access to my build system.
Comment 3 Mathieu Chouquet-Stringer 2008-11-30 09:45:19 EST
Same issue in F10...
Comment 4 Daniel Qarras 2008-12-22 17:22:06 EST
I also noticed this with zsh, my prompt definition that has worked since the previous millennium is now broken :/
Comment 5 Mathieu Chouquet-Stringer 2009-02-07 10:51:47 EST
Seriously, I reported this bug 4.5 months ago and *NOTHING* has been done while the fix is only a 2 liner...

Common...
Comment 6 Ville Skyttä 2009-02-16 13:22:16 EST
https://admin.fedoraproject.org/updates/keychain-2.6.8-4.fc10 has been submitted for testing.

Please test and be sure to click the "works for me" or "does not work" radio buttons when submitting comments.  Updates for other affected distros will follow later if this works for people unless the package maintainer beats me to it.
Comment 7 Fedora Update System 2009-03-05 11:30:29 EST
keychain-2.6.8-4.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

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