Bug 153017

Summary: /etc/profile.d/vim.csh: return not understand by tcsh
Product: [Fedora] Fedora Reporter: Edgar Hoch <edgar.hoch>
Component: vimAssignee: Karsten Hopp <karsten>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 4CC: goeran
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-04-04 12:50:47 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 Edgar Hoch 2005-03-31 22:19:15 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; de-AT; rv:1.7.5) Gecko/20041221

Description of problem:
/etc/profile.d/vim.csh contains the line

[ -w /etc/passwd ] && return

But when I start 'tcsh' then I get the error message:

return: Command not found.

That line should be changed to

if ( -w /etc/passwd ) then
   exit
endif

Then tcsh starts without an error message.
This patch is so small that I have shown in this message.


Version-Release number of selected component (if applicable):
vim-enhanced-6.3.062-1

How reproducible:
Always

Steps to Reproduce:
1.Enter 'tcsh' at the shell prompt.


Actual Results:  Error message:
return: Command not found.

Expected Results:  No error message.

Additional info:

Comment 1 Göran Uddeborg 2005-04-04 12:20:51 UTC
Since the only other thing done in the vim.csh file is setting an alias, an even
simpler fix would be to have only this single line in the file:

  if ( ! -w /etc/passwd ) alias vi vim

Comment 2 Karsten Hopp 2005-04-04 12:50:47 UTC
This breaks with selinux because -w tries to open /etc/passwd rw, see bug 150126

The current version look like this:
[ -x /usr/bin/id ] || exit
[ `/usr/bin/id -u` -le 100 ] && exit
alias vi vim

This sets the alias for all userids > 100 and doesn't do anything if id is
missing (/usr not mounted).