Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 62537 - /etc/profile.d/mc.sh print the mc function when logging
/etc/profile.d/mc.sh print the mc function when logging
Product: Red Hat Public Beta
Classification: Retired
Component: mc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Havoc Pennington
Aaron Brown
Depends On:
  Show dependency treegraph
Reported: 2002-04-02 04:05 EST by Dams
Modified: 2007-04-18 12:41 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-04-05 15:44:16 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dams 2002-04-02 04:05:27 EST
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:

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
        /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 :
Comment 1 Anders Hermansen 2002-04-02 07:43:34 EST
I also see this problem using zsh. My solutions was to remove the mc packages.
Comment 2 Jay Berkenbilt 2002-04-05 15:44:09 EST
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 11:32:54 EDT
This is fixed in latest mc 4.5.55-3

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