Bug 153017 - /etc/profile.d/vim.csh: return not understand by tcsh
/etc/profile.d/vim.csh: return not understand by tcsh
Product: Fedora
Classification: Fedora
Component: vim (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Karsten Hopp
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2005-03-31 17:19 EST by Edgar Hoch
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-04-04 08:50:47 EDT
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 Edgar Hoch 2005-03-31 17:19:15 EST
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

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):

How reproducible:

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 08:20:51 EDT
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 08:50:47 EDT
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).

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