Bug 431315

Summary: /etc/profile.d/colorls.csh syntax error
Product: [Fedora] Fedora Reporter: Charles R. Anderson <cra>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: nalin, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: coreutils-6.10-5.fc9 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-02-04 23:40:56 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:
Attachments:
Description Flags
patch to fix colorls.csh
none
better fix for colorls.csh none

Description Charles R. Anderson 2008-02-02 17:13:57 UTC
Description of problem:

There are some syntax/logic errors in the LS_COLORS handling in
/etc/profile.d/colorls.csh.

Version-Release number of selected component (if applicable):
coreutils-6.10-4.fc9.x86_64

How reproducible:
always

Steps to Reproduce:
1. open a new shell in tcsh
  
Actual results:

LS_COLORS: Undefined variable.
[cra@l profile.d]$ 

Expected results:
dircolors should be executed, no error messages should result.

Additional info:

Simple fix:

--- /etc/profile.d/colorls.csh.orig	2008-02-02 12:05:36.000000000 -0500
+++ /etc/profile.d/colorls.csh	2008-02-02 12:11:46.000000000 -0500
@@ -1,6 +1,6 @@
 #! /bin/csh -f
 # color-ls initialization
-if ( "$LS_COLORS" != '' ) then
+if ( $?LS_COLORS ) then
    #do not override user specified LS_COLORS and use them
    alias ll 'ls -l --color=tty'
    alias l. 'ls -d .* --color=tty'

Comment 1 Charles R. Anderson 2008-02-02 17:13:57 UTC
Created attachment 293799 [details]
patch to fix colorls.csh

Comment 2 Ondrej Vasik 2008-02-02 17:45:23 UTC
Thanks for report... I did only quick check for csh script and missed that
problem...sorry for that, thanks for report, will fix that in next rawhide
coreutils build after weekend.

Comment 3 Charles R. Anderson 2008-02-02 19:19:23 UTC
Created attachment 293802 [details]
better fix for colorls.csh

The first patch doesn't work if LS_COLORS= is in the environment already (e.g.
LS_COLORS is there, but blank).  This patch will set LS_COLORS correctly in
that case, mimicking the behavior of /etc/profile.d/colorls.sh.  The nested
"if" was the only way I could get it to work right in tcsh.

Comment 4 Ondrej Vasik 2008-02-04 23:40:56 UTC
Problem is hopefully fixed in coreutils-6.10-5.fc9 - so closing RAWHIDE - anyway
I used completely different style, so please feel free to add any comments about
syntax of that layout (with added 256 colors support). TIA.