Bug 74770

Summary: Trailing space required in set prompt lines
Product: [Retired] Red Hat Linux Reporter: Richard Troxel <rick>
Component: tcshAssignee: Miloslav Trmač <mitr>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-08-19 16:02:45 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 Richard Troxel 2002-10-01 15:47:24 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; SunOS 5.7 sun4u)

Description of problem:
RedHat's /etc/csh.cshrc includes two "set prompt =" lines.  Each ends with a
trailing space.  If the trailing whitespace is edited out, syntax errors "then:
then/endif not found." appear, e.g. in the context of logging into a tcsh
account using OpenSSH.  IMHO tcsh should not be sensitive to the absence of this
whitespace.

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


How reproducible:
Always

Steps to Reproduce:
1. Remove the trailing ' ' characters from the 2 "set prompt =" lines in
/etc/csh.cshrc
2. From another host, ssh this.redhat.host date
3. This assumes your account uses tcsh (I didn't try csh)
	

Actual Results:  rick.host's password:
then: then/endif not found.
[ shell prompt appears ]

Expected Results:  No cryptic, unsettling syntax diagnostic

Additional info:

setup-2.5.12-1
tcsh-6.10-6

Comment 1 Miloslav Trmač 2004-08-19 16:02:45 UTC
In the fragment in question:

if ($?prompt) then
  if ($?tcsh) then
    set prompt='[%n@%m %c]$ '
  else
    set prompt=\[`id -nu`@`hostname -s`\]\$\
  endif
endif

The first space can be removed with no adverse effects.
The second space is preceded by \; if you remove the space, it is
backslash-newline and the line is concatenated with the following one,
in effect becoming

if ($?prompt) then
  if ($?tcsh) then
    set prompt='[%n@%m %c]$ '
  else
    set prompt=\[`id -nu`@`hostname -s`\]\$ endif
endif

which is indeed missing an endif.