Bug 62537

Summary: /etc/profile.d/mc.sh print the mc function when logging
Product: [Retired] Red Hat Public Beta Reporter: Dams <dnade>
Component: mcAssignee: Havoc Pennington <hp>
Status: CLOSED RAWHIDE QA Contact: Aaron Brown <abrown>
Severity: medium Docs Contact:
Priority: medium    
Version: skipjack-beta1CC: alexl, anders, anvil, dnade, ejb, j
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-04-05 20:44:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dams 2002-04-02 09:05:27 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.0 (X11; Linux i686; U;) Gecko/20020312

Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. useradd -s /bin/zsh user
2. ssh user@localhost

	

Actual Results:  [root@confiote ~]# ssh anvil@gruyere
anvil@gruyere's password:
Last login: Mon Apr  1 22:01:40 2002
mc () { 
        mkdir -p $HOME/.mc/tmp 2> /dev/null
        chmod 700 $HOME/.mc/tmp
        MC=$HOME/.mc/tmp/mc-$$
        /usr/bin/mc -P "$@" > "$MC"
        cd "`cat $MC`"
        /bin/rm -f "$MC"
        unset MC
}
[anvil@gruyere ~]# 

Expected Results:  Should not see the mc function.

Additional info:

If you want to test with my zsh configuration you can download it at :
http://confiote.ath.cx/~anvil/config/

Comment 1 Anders Hermansen 2002-04-02 12:43:34 UTC
I also see this problem using zsh. My solutions was to remove the mc packages.

Comment 2 Jay Berkenbilt 2002-04-05 20:44:09 UTC
Removing the mc package is clearly not the "Right" fix here....  The problem is
that mc.sh uses export -f to export the shell function into the environment. 
zsh's export doesn't support this, even if you wrap invocation of
/etc/profile.d/*.sh in emulate bash.  Perhaps that's a zsh bug.

As it is extremely unlikely that anyone with zsh as a login shell actually uses
mc, I'd suggest the workaround of not invoking export -f mc if $SHELL is not
/bin/bash (or, alternatively, if $SHELL is /bin/zsh, but I think the former is
preferable since most users who are sophisticated enough to change their shell
won't use a file manager and just checking for /bin/zsh may still leave this
problem around for some users with other bourne-shell like shells that aren't bash).

Another possible solution would be to somehow get zsh to deal with export -f,
but as far as I can tell, zsh doesn't have any facility for exporting shell
functions into the environment.  (It has shell function autoloading, etc.)

Comment 3 Havoc Pennington 2002-04-10 15:32:54 UTC
This is fixed in latest mc 4.5.55-3