Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 17542 - runscript always outputs color; color codes getting into system log
Summary: runscript always outputs color; color codes getting into system log
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-15 02:23 UTC by Todd Heim (RETIRED)
Modified: 2004-05-07 16:13 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Todd Heim (RETIRED) gentoo-dev 2003-03-15 02:23:17 UTC
recently purchased a wireless card.. 

when inserting the card, cardmgr runs ./network eth1 start
./network then runs /etc/init.d/net.eth1 start

the interface starts and works as expected, but the color codes get into the
system logs; example below.

Mar 12 03:28:03 [cardmgr] executing: './network start eth1'
Mar 12 03:28:04 [cardmgr] +   [32;01m* [0m Bringing eth1 up...
Mar 12 03:28:08 [cardmgr] +  [A [-7G   [34;01m[  [32;01mok  [34;01m] [0m
Mar 12 03:28:08 [cardmgr] exiting




Reproducible: Always
Steps to Reproduce:
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-16 00:27:32 UTC
Please rather call it with '/etc/init.d/net.eth1 --quiet start'.  If it is
a package in portage, please reassign this bug.
Comment 2 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-20 10:14:34 UTC
Hello?
Comment 3 Todd Heim (RETIRED) gentoo-dev 2003-03-20 12:00:13 UTC
I just now realize a handfull of bugzilla post I made the other day did not appear in bugzilla...

calling the init script with -quiet is one option, although possibly not the best solution, I think it'd still be a good idea to log the status "OK/!!!" of the wireless interface. Seems simple enough for a -nc option to be added. all this option would need to do is unset some variables set by functions.sh:
NORMAL="\033[0m"
GOOD=$'\e[32;01m'
WARN=$'\e[33;01m'
BAD=$'\e[31;01m'
NORMAL=$'\e[0m'

HILITE=$'\e[36;01m'



parsing for --quiet in runscript.sh becomes:

for arg in $*
do
        case "${arg}" in
        --quiet)
                QUIET_STDOUT="yes"
                ;;
        -nc)
                 unset NORMAL GOOD WARN BAD NORMAL HILIGHT
                 ;;
        esac
done


With more thought into it, it seems kind of hacked together that the colors are set in functions.sh, anyways. Maybe the portion where the color codes are set should be moved into a function, that checks for NOCOLOR=true being set either by make.conf or an added -nc option to runscript.sh
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-21 02:56:05 UTC
Hrm .. my thougts on it was that you would normally just want things in the
system log, if it failed.  Same with a cron job ... I always had it that you
write a cron job to be totally quiet "except" when there is an error, in which
case the admin should be mailed.

Comments ?
Comment 5 Todd Heim (RETIRED) gentoo-dev 2003-03-22 00:22:01 UTC
You do have a point about only logging on failure, but cardmgr seems to want to log *everything*. 

here is an example of what happens when inserting and removing a wifi card:
log-2003-03-18-18:03:34:Mar 17 11:27:40 [cardmgr] socket 1: Netgear MA401RA Wireless Adapter
log-2003-03-18-18:03:34:Mar 17 11:27:41 [cardmgr] executing: 'modprobe hermes'
log-2003-03-18-18:03:34:Mar 17 11:27:41 [cardmgr] executing: 'modprobe orinoco'
log-2003-03-18-18:03:34:Mar 17 11:27:41 [cardmgr] executing: 'modprobe orinoco_cs'
log-2003-03-18-18:03:34:Mar 17 11:27:41 [cardmgr] executing: './network start eth1'
log-2003-03-18-18:03:34:Mar 17 11:27:41 [cardmgr] +   [32;01m* [0m Bringing eth1 up...
log-2003-03-18-18:03:34:Mar 17 11:27:46 [cardmgr] +  [A [-7G   [34;01m[  [32;01mok  [34;01m] [0m
log-2003-03-18-18:03:34:Mar 17 11:44:24 [cardmgr] executing: './network suspend eth1'
log-2003-03-18-18:03:34:Mar 17 11:44:49 [cardmgr] executing: './network stop eth1'
log-2003-03-18-18:03:34:Mar 17 11:44:49 [cardmgr] +   [32;01m* [0m Bringing eth1 down...
log-2003-03-18-18:03:34:Mar 17 11:44:54 [cardmgr] +   [32;01m* [0m   Waiting for dhcpcd to shutdown.....done
log-2003-03-18-18:03:34:Mar 17 11:44:54 [cardmgr] +  [A [-7G   [34;01m[  [32;01mok  [34;01m] [0m
log-2003-03-18-18:03:34:Mar 17 11:44:54 [cardmgr] executing: 'modprobe -r orinoco_cs'


maybe this should be filed as a cardmgr bug, for breaking "protocol" on logging?
maybe it needs a DEBUG=yes/no option to quieten its logging unless there are troubles?
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-22 00:51:02 UTC
Possibly.

The --quiet should at least resolve that partly.  What package is cardmgr a
part of ?
Comment 7 Martin Schlemmer (RETIRED) gentoo-dev 2003-04-06 11:15:34 UTC
I am not on top of notebook stuff, so need to know where cardmgr comes from to
be able to fix.
Comment 8 Todd Heim (RETIRED) gentoo-dev 2003-04-06 13:49:21 UTC
cardmgr is part of sys-apps/pcmcia-cs
Comment 9 Martin Schlemmer (RETIRED) gentoo-dev 2003-04-06 23:34:25 UTC
Guys, please call initscripts with '--quiet'.
Comment 10 Axxackall 2003-08-29 08:25:27 UTC
--quiet doesn't help when you WANT to see that "[OK]" string in the syslog, but you DON'T WANT to see colors.

What was the reason to disable --nocolor ?
Comment 11 Martin Schlemmer (RETIRED) gentoo-dev 2003-11-06 14:08:57 UTC
Actually there is a --nocolor:

--
  06 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
                                                                        
                                                    
    Hopefully get the serial support sane again.  Added /bin/consoletype
    from Redhat to check for serial console.  This should resolve bug
    #18329 partly.
                                                                        
                                                    
    Add the --nocolor option to suppress the use of colors.
--

giving:

--
 nosferatu transcode-0.6.10 # /etc/init.d/local --nocolor restart
 * Stopping gpm...  [ ok ]
 * Stopping local...  [ ok ]
 * Starting local...  [ ok ]
 * Starting gpm...  [ ok ]
nosferatu transcode-0.6.10 # /etc/init.d/local restart
 * Stopping gpm...                                                      
                                              [ ok ] * Stopping local...
                                                                        
                         [ ok ] * Starting local...                     
                                                                        
    [ ok ] * Starting gpm...                                            
                                                        [ ok ]nosferatu transcode-0.6.10
#
--

And thus working as you can see ...

Resolution, add --nocolor to initscript calls.

Comment 12 Aron Griffis (RETIRED) gentoo-dev 2004-05-07 16:13:52 UTC
For no apparent reason, this bug was never closed