Bug 3686 - kdesupport-1.1.1-1 has broken /etc/profile.d/kde.csh
kdesupport-1.1.1-1 has broken /etc/profile.d/kde.csh
Status: CLOSED NEXTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: kdesupport (Show other bugs)
6.0
i386 Linux
high Severity high
: ---
: ---
Assigned To: Preston Brown
:
: 3639 3684 3718 3757 3775 3805 3811 3832 3870 3952 3955 3988 4141 4172 4351 4557 4568 4674 4738 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-06-23 16:59 EDT by chris
Modified: 2008-05-01 11:37 EDT (History)
21 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-09-23 13:01:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description chris 1999-06-23 16:59:11 EDT
Someone mixed up sh and csh syntax in
/etc/profile.d/kde.csh.  It breaks csh/tcsh logins horribly
(no user login scripts are executed!!).  Patch follows:
write me if this wordwraps horribly:

--- /etc/profile.d/kde.csh.orig Mon Jun 21 14:28:21 1999
+++ /etc/profile.d/kde.csh      Wed Jun 23 15:15:46 1999
@@ -5,9 +5,7 @@
          endif
 endif
 setenv KDEDIR /usr
-kdepath="${KDEDIR}/bin"
-if ( echo ${PATH} | grep -q ${kdepath} ) then
-  exit
-endif
+set kdepath="${KDEDIR}/bin"
+if ( `echo ${PATH} | grep -q ${kdepath} | wc -l` != 0 )
exit
Comment 1 Bill Nottingham 1999-06-23 17:01:59 EDT
*** Bug 3684 has been marked as a duplicate of this bug. ***

Someone mixed up sh and csh syntax in
/etc/profile.d/kde.csh.  It breaks csh/tcsh logins horribly
(no user login scripts are executed!!).  Patch follows:
write me if this wordwraps horribly:

--- /etc/profile.d/kde.csh.orig Mon Jun 21 14:28:21 1999
+++ /etc/profile.d/kde.csh      Wed Jun 23 15:15:46 1999
@@ -5,9 +5,7 @@
          endif
 endif
 setenv KDEDIR /usr
-kdepath="${KDEDIR}/bin"
-if ( echo ${PATH} | grep -q ${kdepath} ) then
-  exit
-endif
+set kdepath="${KDEDIR}/bin"
+if ( `echo ${PATH} | grep -q ${kdepath} | wc -l` != 0 )
exit
Comment 2 Jeff Johnson 1999-06-25 06:32:59 EDT
*** Bug 3718 has been marked as a duplicate of this bug. ***

I upgraded to the kde 1.1.1 release posted to
updates.redhat.com, and the next time I logged in, there was
a syntax error reported prior to my .login or .cshrc being
run.  I tracked this down to syntax errors (at least under
tcsh) in /etc/profile.d/kde.csh.  According to the csh
manual, these fixes should be there as well (ie, you can't
use a pipeline inside an if() statement).

--- kde.csh.orig        Mon Jun 21 14:28:21 1999
+++ kde.csh     Thu Jun 24 18:11:08 1999
@@ -5,8 +5,9 @@
          endif
 endif
 setenv KDEDIR /usr
-kdepath="${KDEDIR}/bin"
-if ( echo ${PATH} | grep -q ${kdepath} ) then
+set kdepath="${KDEDIR}/bin"
+echo "${PATH}" | grep -q ${kdepath}
+if ( ! $status ) then
   exit
 endif


------- Additional Comments From jbj@redhat.com  06/25/99 06:28 -------


*** Bug 3709 has been marked as a duplicate of this bug. ***

The following bug(s) cause an error every time a user tries
to login or execute a shell, if their default shell is
csh/tcsh.  It also halts processing of the user's own
customization files.

The 8th line in /etc/profile.d/kde.csh says:

  kdepath="${KDEDIR}/bin"

Because this is for csh, not sh, it should read:

  set kdepath="${KDEDIR}/bin"

Also, lines 10 through 12 that read:

  if ( echo ${PATH} | grep -q ${kdepath} ) then
    exit
  endif

should read

  echo $PATH | grep -q $kdepath && exit
Comment 3 Derek Tattersall 1999-06-29 11:44:59 EDT
*** Bug 3639 has been marked as a duplicate of this bug. ***

If a user has tcsh as her primary shell, the error message
would be displayed after login and some other bad things
would happen. The problem is in file /etc/profile.d/kde.csh,
where somebody forgot to change shell commands to csh
commands.

Following patch should fix the bug:


*** /etc/profile.d/kde.csh      Mon Jun 21 20:28:21 1999
--- /etc/profile.d/kde.csh.pk   Tue Jun 22 19:29:51 1999
***************
*** 5,13 ****
           endif
  endif
  setenv KDEDIR /usr
! kdepath="${KDEDIR}/bin"
! if ( echo ${PATH} | grep -q ${kdepath} ) then
!   exit
! endif
!
! setenv PATH "${kdepath}:${PATH}"
--- 5,10 ----
           endif
  endif
  setenv KDEDIR /usr
! set kdepath="${KDEDIR}/bin"
! echo ${PATH} | grep -q ${kdepath} || \
!   setenv PATH "${kdepath}:${PATH}"
Comment 4 Derek Tattersall 1999-06-29 11:45:59 EDT
*** Bug 3757 has been marked as a duplicate of this bug. ***

updated package kdesupport-1.1.1-1.i386.rpm from June 24th
has a trivial bug in /etc/profile.d/kde.csh, it contains
the line:

kdepath="${KDEDIR}/bin"


Of cource tcsh or csh are unable to parse this. The result
is that anyone using csh or tcsh as their default shell
will see this upon  login:

===============================================
Last login: Sun Jun 27 14:53:32 1999 from
talbot.home.nsw.cmis.csiro.au
No mail.
kdepath=/usr/bin: Command not found.
kdepath: Undefined variable.
[talbot@mascot ~]$

================================================

The user's .login and .cshrc files are ignored. This
is hard to trace and infuriating.... To compensate, the
fix is rather obvious.

It took me aaages to find the bug and I really hated
the packaged maintainer for a few minutes, but eh,
that's life.

Thanks for the free software and keep up the good work.

------- Additional Comments From jturner@redhat.com  06/28/99 09:31 -------
This issue has been forwarded to a developer for further action.*** Bug 3775 has been marked as a duplicate of this bug. ***

The file

/etc/profile.d/kde.csh

is broken as of kdesupport-1.1.1-1. The kde.csh file
has bad csh syntax and bombs when you try to execute
it becase of the bad syntax.

Here is a diff file where I fixed the csh syntax

[root@phyppro2 profile.d]# diff kde.csh kde.csh.orig
8,9c8,9
< set kdepath="${KDEDIR}/bin"
< if ( `echo ${PATH} | grep -q ${kdepath}` ) then
---
> kdepath="${KDEDIR}/bin"
> if ( echo ${PATH} | grep -q ${kdepath} ) then
14d13
<
Comment 5 Jeff Johnson 1999-06-30 18:49:59 EDT
*** Bug 3805 has been marked as a duplicate of this bug. ***

The kdesupport-1.1.1-1.i386.rpm in the updates directory
contains /etc/profile.d/kde.csh which contains csh syntax
errors. Possible fix (works for me):

# KDE initialization script (csh)
if ( $?KDEDIR ) then
         if ( $KDEDIR == "/usr" ) then
         exit
         endif
endif
setenv KDEDIR /usr
set kdepath="${KDEDIR}/bin"
echo ${PATH} | grep -q ${kdepath}
if ( $status ) then
  exit
endif

setenv PATH "${kdepath}:${PATH}"


------- Additional Comments From jturner@redhat.com  06/29/99 12:59 -------
This issue has been forwarded to a developer for further action.

------- Additional Comments From nalin.dahyabhai@pobox.com  06/30/99 11:08 -------
This is a duplicate of bug 3686.
Comment 6 Jeff Johnson 1999-06-30 18:50:59 EDT
*** Bug 3832 has been marked as a duplicate of this bug. ***

The file /etc/profile.d/kde.csh in the updated kdesupport
package (kdesupport-1.1.1-1) contains the followine line of
sh code:
  kdepath="${KDEDIR}/bin"
which should read
  setenv kdepath "${KDEDIR}/bin"

Net result:
When a user whose default shell is csh tries to log in (or
open an xterm, etc), the script fails at this line, printing
the following message in the user's window:
 kdepath=/usr/bin: Command not found.
 kdepath: Undefined variable.
The user's .cshrc is not executed.


------- Additional Comments From aja@mit.edu  06/30/99 14:35 -------
One more change:  the line
 if ( echo ${PATH} | grep -q ${kdepath} ) then
should read
if ( `echo ${PATH} | grep -q ${kdepath}` ) then
Comment 7 Jeff Johnson 1999-06-30 18:53:59 EDT
*** Bug 3811 has been marked as a duplicate of this bug. ***

1) var=value syntax doesn't work in csh
2) If the bad syntax is fixed, "if" bails out with
   "Expression Syntax."

Both of these problems mean my tcsh dot files don't get
run.

The relevant lines are flagged below with '*':
------------------------------------------------------------
# KDE initialization script (csh)
if ( $?KDEDIR ) then
         if ( $KDEDIR == "/usr" ) then
         exit
         endif
endif
setenv KDEDIR /usr
kdepath="${KDEDIR}/bin" *
if ( echo ${PATH} | grep -q ${kdepath} ) then *
  exit
endif

setenv PATH "${kdepath}:${PATH}"
------------------------------------------------------------
Suggested fixes:

First line should read, 'set kdepath = "${KDEDIR}/bin"'
I'm not sure about the appropriate if syntax; maybe some
appropriately placed backtics would fix it.
Comment 8 Jeff Johnson 1999-07-02 14:17:59 EDT
*** Bug 3870 has been marked as a duplicate of this bug. ***

I just installed kdesupport-1.1.1-1 last night.  I noticed a
problem when I logged in this morning and traced it back to
/etc/profile.d/kde.csh.

Line 8:

	kdepath="${KDEDIR}/bin"

should probably be:

	set kdepath="${KDEDIR}/bin"

and line 9:

	if ( echo ${PATH} | grep -q ${kdepath} ) then

should probably be:

	if ( `echo ${PATH} | grep -q ${kdepath}` ) then

My login shell is tcsh, but logging in with the bad
/etc/profile.d/kde.csh script dumped me into bash with this
error message:

	kdepath=/usr/bin: Command not found

I'm not sure if this is a problem in other architectures
than i386.  Thanks.

------- Additional Comments From jamie@scifi.com  07/02/99 11:31 -------
Sorry for the duplicate of Bug #3686 -- please ignore/delete this.
Comment 9 Jeff Johnson 1999-07-09 17:09:59 EDT
*** Bug 3955 has been marked as a duplicate of this bug. ***

there are two invalid statements in the  KDE initialization
script (csh) that break it:

1) the statment
kdepath="${KDEDIR}/bin"
should really be
set kdepath="${KDEDIR}/bin"

2) the statement
if ( echo ${PATH} | grep -q ${kdepath} ) then
should really be something like
if ( `echo ${PATH} | grep -q ${kdepath}` ) then
so that | is interpreted as pipe rather than bitwise or
Comment 10 Jeff Johnson 1999-07-09 17:14:59 EDT
*** Bug 3952 has been marked as a duplicate of this bug. ***

The script above has several syntax errors.  Here's a
corrected version.  Please include it in the next update.
Changed lines marked with "####"
===============================================
# KDE initialization script (csh)

if ( $?KDEDIR ) then
         if ( $KDEDIR == "/usr" ) then
         exit
         endif
endif
setenv KDEDIR /usr
set kdepath="${KDEDIR}/bin"         ####
echo ${PATH} | grep -q ${kdepath}   ####
if ( $status == 0 ) then            ####
  exit
endif

setenv PATH "${kdepath}:${PATH}"
Comment 11 Jeff Johnson 1999-07-23 04:57:59 EDT
*** Bug 3988 has been marked as a duplicate of this bug. ***


Name        : kdesupport                   Relocations: /usr
Version     : 1.1.1                             Vendor: Red
Hat Software
Release     : 1                             Build Date: Mon
Jun 21 14:28:23 1999
Install date: Thu Jun 24 19:59:55 1999      Build Host:
porky.devel.redhat.com
Group       : System Environment/Libraries   Source RPM:
kdesupport-1.1.1-1.src.rpm
Size        : 2221106                          License:
GPL/LGPL
Packager    : Red Hat Software
<http://developer.redhat.com/bugzilla>
Summary     : K Desktop Environment - Support Libraries



With this RedHat-6.0 version of kdesupport, I get an error
running
a simple csh script which parses the files in /etc/profile.d
and hangs on the profile 'kde.csh' with the error:

kdepath=/usr/bin: Command not found.
kdepath: Undefined variable.
Comment 12 Jeff Johnson 1999-07-23 04:59:59 EDT
*** Bug 4141 has been marked as a duplicate of this bug. ***

File /etc/profile.d/kde.csh (kdesupport-1.1.1-1) is wrong.

kdesupport was downloaded from:
ftp://ftp.students.cs.unibo.it
/Mirrors/ftp.redhat.com/redhat/updates/6.0/

Installed file:
-----------------------------------------------------------
# KDE initialization script (csh)
if ( $?KDEDIR ) then
         if ( $KDEDIR == "/usr" ) then
         exit
         endif
endif
setenv KDEDIR /usr
kdepath="${KDEDIR}/bin"    #This is not a valid csh set
if ( echo ${PATH} | grep -q ${kdepath} ) then
  exit                     #The if statement is wrong
endif

setenv PATH "${kdepath}:${PATH}"
-----------------------------------------------------------

Edited file:
-----------------------------------------------------------
# KDE initialization script (csh) (MODIFIED)
if ( $?KDEDIR ) then
         if ( $KDEDIR == "/usr" ) then
         exit
         endif
endif
setenv KDEDIR /usr
echo ${PATH} | grep -q "${KDEDIR}/bin"
if ( $status == 0 ) then
  exit
endif
setenv PATH "${KDEDIR}/bin:${PATH}"
-----------------------------------------------------------
Note. I don't use the variable kdepath (see also kde.sh).
I hope this is ok.
Comment 13 Jeff Johnson 1999-07-23 05:00:59 EDT
*** Bug 4172 has been marked as a duplicate of this bug. ***

The /etc/profile.d/kde.csh init script has a bug.  It
appears to be sing sh(1) syntax to assign a variable, but
csh(1) requires the "set" keyword.  A diff follows, with
some logic/cosmetic tweaks.  Hope this helps!  --Eric

*** kde.csh.FCS Mon Jun 21 13:28:21 1999
--- kde.csh     Thu Jul 22 19:53:32 1999
***************
*** 1,13 ****
  # KDE initialization script (csh)
  if ( $?KDEDIR ) then
!          if ( $KDEDIR == "/usr" ) then
!          exit
!          endif
  endif
  setenv KDEDIR /usr
! kdepath="${KDEDIR}/bin"
! if ( echo ${PATH} | grep -q ${kdepath} ) then
!   exit
  endif
-
- setenv PATH "${kdepath}:${PATH}"
--- 1,12 ----
  # KDE initialization script (csh)
  if ( $?KDEDIR ) then
!     if ( $KDEDIR == "/usr" ) then
!         exit
!     endif
  endif
  setenv KDEDIR /usr
! set kdepath="${KDEDIR}/bin"
! echo ${PATH} | grep -q "${kdepath}:"
! if ( $status ) then
!     setenv PATH "${kdepath}:${PATH}"
  endif
Comment 14 Jeff Johnson 1999-08-04 12:34:59 EDT
*** Bug 4351 has been marked as a duplicate of this bug. ***

The upgraded 1.1.1 kdesupport from ftp.updates.com for
rh6.0  has a buggy file /etc/profile.d/kde.csh

It causes users with the CSH shell and sourcing the system
defaults to stop.

It is caused by this file using bash syntax, not csh syntax.

Here is a fixed version:

# KDE initialization script (csh)
#echo "CSH kde init script"
if ( $?KDEDIR ) then
         if ( $KDEDIR == "/usr" ) then
         exit
         endif
endif
setenv KDEDIR /usr
setenv kdepath "${KDEDIR}/bin"
echo $PATH | grep -q $kdepath
if ( $status ) then
  exit
endif

setenv PATH "${kdepath}:${PATH}"
Comment 15 Jeff Johnson 1999-08-18 11:28:59 EDT
*** Bug 4557 has been marked as a duplicate of this bug. ***

The file kde.csh has several defects. If I'm a user and
attempt to login to my machine, the sourcing of kde.csh will
fail...

list of bugs
[1] didn't use 'set' when specifying 'kdepath'
[2] final 'if...then' doesn't check exit status, instead
checks output of command 'echo $path | grep -q
$kdepath'..need to look at exit status by either using {}
around command or via the $status variable

Here is a script with the issues fixed...just do a diff with
original to see problems...
-----------

# KDE initialization script (csh)
if ( $?KDEDIR ) then
         if ( $KDEDIR == "/usr" ) then
         exit
         endif
endif
setenv KDEDIR /usr
set kdepath="${KDEDIR}/bin"

echo $path | grep $kdepath > /dev/null
if ( $status ) then
 exit
endif

setenv PATH "${kdepath}:${PATH}"
Comment 16 Jeff Johnson 1999-08-18 11:29:59 EDT
*** Bug 4568 has been marked as a duplicate of this bug. ***

Syntax errors in /etc/profile.d/kde.csh (a c-shell script)
introduce problems for user accounts that have their shell
field in /etc/passwd set either to /bin/csh or /bin/csh.

Specifically, the syntax errors in kde.csh prevent the
startup files ~/.login and/or ~/.cshrc from executing.

I have resolved this bug by removing the syntax and logical
errors in kde.csh. Here is a copy of the original kde.csh,
followed by my repaired version. I leave it to Red Hat to
evaluate and/or improve upon my solution, as is appropriate:

Original version of kde.csh:

# KDE initialization script (csh)
if ( $?KDEDIR ) then
         if ( $KDEDIR == "/usr" ) then
         exit
         endif
endif
setenv KDEDIR /usr
kdepath="${KDEDIR}/bin"
if ( echo ${PATH} | grep -q ${kdepath} ) then
  exit
endif

setenv PATH "${kdepath}:${PATH}"
# end orignal version

------------------------------------------

# repaired KDE initialization script (csh)
if ( $?KDEDIR ) then
         if ( $KDEDIR == "/usr" ) then
         exit
         endif
endif

setenv KDEDIR /usr
set kdepath="${KDEDIR}/bin"

echo ${PATH} | grep -q ${kdepath}
if ( $? == 0) then
  exit
endif

setenv PATH "${kdepath}:${PATH}"

Thank you,
David Cohn,
Department of Technology
Market News International
100 William Street, 3rd Floor
New York, NY 10038
212-509-4444


------- Additional Comments From dc@marketnews.com  08/17/99 09:37 -------
Please excuse typo in previous commentary.  Phrase should have read
"either to /bin/csh or /bin/tcsh."

Thank you,

David Cohn
Comment 17 Jeff Johnson 1999-08-23 18:46:59 EDT
*** Bug 4674 has been marked as a duplicate of this bug. ***

in kdesupport-1.1.1-1.rpm (RH6.0 Updates)

the file /etc/profile.d/kde.csh has a bug, which causes
problem when I start a rxvt term.

To fix this bug, you have to  add a 'set' keyword to
the line kdepath=...etc...

set kdepath="${KDEDIR}/bin"

and you have to add back-quotes in the line :

if ( `echo ${PATH} | grep -q ${kdepath}` ) then
....
endif

Best Regards,
DB
bellot@loria.fr
Comment 18 Jeff Johnson 1999-08-27 10:52:59 EDT
*** Bug 4738 has been marked as a duplicate of this bug. ***

My default shell is /bin/tcsh and logins with ssh fail with
the following messages:
	kdepath=/usr/bin: Command not found.
	kdepath: Undefined variable.

These messages are errors in /etc/profile.d/kde.csh and
because of them, the remaining files in /etc/profile.d/*.csh
and (more importantly) the user's .cshrc and .tcshrc are not
read leaving the user in a confusing state if they've
customized those files.



------- Additional Comments From cmoore@cfa.harvard.edu  08/27/99 02:17 -------
Duplicate of bug 3686 and many others.  Sorry.
Comment 19 Preston Brown 1999-09-23 13:01:59 EDT
fixed for next release.

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