Re: small thing



On Thu, Dec 05, 2002 at 11:50:05AM -0500, Pavel Roskin wrote:

btw: it seems the -P parameter implementation has changed it now wants
a file name - yes, it's in the man page, but it could complicate the
upgrade for an inexperienced user with a distribution-provided mc.sh in
/etc/profile.d... ;-)

Can you explain this scenario in details?  What's the contents of mc.sh,
where is the old mc and where is the new mc?

__cut__
mc ()
{
        # If we're using su then don't use a $HOME/.mc directory:
        if [ "$USER" = "root" -a ! "`id | cut -b1-5`" = "uid=0" ]; then
          /usr/bin/mc "$@"
        elif [ ! "$USER" = "root" -a "`id | cut -b1-5`" = "uid=0" ]; then
          /usr/bin/mc "$@"
        else # not using su:
          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`"
          rm -f "$MC"
          unset MC;
        fi
}

# Don't use sh-specific syntax with ksh:
if [ "$SHELL" = "/bin/ksh" ]; then
        export mc
else
        export -f mc
fi
__cut__

the old mc was in /usr/bin; the new one is, too.


I don't expect it to happen because mc.sh should call mc with full path.
If it happened to you, then I want to know why it happened.



it happened because in my slack an mc.sh is installed in /etc/profile.d, 
sourced by the profile script at login.

this script follows the old convention where the -P parameter was used 
to print the path to stdout. iirc, the first -pre1 i used still did it 
this way.

now the -P parameter wants a file name instead where to write the path 
to; as my old slack script doesn't know this, it fails.

my fault, of course, for not studying the docs when using the cvs 
version. ;-)



By, the way, please return this discussion to the mailing list.  Other
users may have this problem as well.

of course, yes: i just didn't think it could interest anybody...

-- 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]