[SSI-devel] [ ssic-linux-Bugs-923161 ] track and fix the usage of grep
Brought to you by:
brucewalker,
rogertsang
From: SourceForge.net <no...@so...> - 2004-08-14 13:30:42
|
Bugs item #923161, was opened at 2004-03-25 14:54 Message generated for change (Comment added) made by kishoreks You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=405834&aid=923161&group_id=32541 Category: Sysadmin Group: None >Status: Pending Resolution: None Priority: 5 Submitted By: Aneesh Kumar K.V (kvaneesh) Assigned to: Kishore Sampathkumar (kishoreks) Summary: track and fix the usage of grep Initial Comment: Some cases it doesn't work with different locales. We need to check our sysadmin utilties to make sure we don't make any assumption of default locale. ---------------------------------------------------------------------- >Comment By: Kishore Sampathkumar (kishoreks) Date: 2004-08-14 13:30 Message: Logged In: YES user_id=857156 I tried installing OpenSSI cluster 1.0 on a RH9 system for the following 3 cases: - single-node - 2-nodes - 3-nodes I set the Locate to "german" (export LC_ALL=german) and tested all the openssi-tools commands. All of them succeed. To be doubly sure, I looked through ALL the files that invoke "ifconfig" since that is one of THE commands whose "text output" is of great relevance here. The files of interest in openssi-tools and cluster-tools RPM's are: /cluster/lib/Clustertab.pm /cluster/lib/ssi_distro.pm /sbin/mkdhcpd.conf /usr/sbin/clusterip.sh /usr/sbin/openssi_cluster_create /usr/sbin/ssi-create /etc/rc.d/rc.modules /etc/sysconfig/network-scripts/ifdown-aliases /etc/sysconfig/network-scripts/ifdown-ippp /etc/sysconfig/network-scripts/ifdown-isdn /etc/sysconfig/network-scripts/ifup-aliases /etc/sysconfig/network-scripts/ifup-ippp /etc/sysconfig/network-scripts/ifup-isdn /etc/sysconfig/network-scripts/ifup-plip /etc/sysconfig/network-scripts/ifup-plusb /etc/sysconfig/network-scripts/ifup-post /etc/sysconfig/network-scripts/init.ipv6-global /etc/sysconfig/network-scripts/network-functions /etc/sysconfig/network-scripts/network-functions-ipv6 /sbin/mkinitrd (The above was generated by a script that I have attached towards the end) It appears that the fix Aneesh suggested has now been replaced by the following in /cluster/lib/Clustertab.pm in the routine read_ifconfig(): open IFCONFIG, "LC_ALL='C' /sbin/ifconfig |" or die; All other instances of "ifconfig" are invoking read_ifconfig() finally to handle the validation of input v/s what is configured as shown via the actual "ifconfig" output. There is one exception: /usr/sbin/clusterip.sh. However, the usage of "ifconfig" here searches for a known IP address and not any particular 'text string'. All other usages in this script are related to "setting" values via "ifconfig" or "route" commands and hence are safe. As related to /bin/mkinitrd, the relevant code was: echo Gathering cluster info nicfound="" for iface in `LC_ALL='C' ifconfig -a | grep HWaddr | sed 's/\(eth[0-9]*\).*HWaddr \(.*\)/\1-\2/'` do ... done The above has no problem as well. I'm hence "closing" this bug. The following is the script I wrote to get files containing "ifconfig" invocation in OpenSSI RPM's: ------BEGIN script-------- for i in $(rpm -ql $* | grep -v "/usr/share" | grep -v /usr/lib/lib | grep -v /lib/lib) do if [ -f $i ] then if strings $i | grep ifconfig > /dev/null 2>&1 then echo $i fi fi done ------END script-------- The script was invoked as follows: ./<my_script> $(cat openssi_packages.txt) where the file openssi_packages.txt contained the following: chkconfig cluster-tools devfsd e2fsprogs initscripts logrotate mkinitrd mount nfs-utils openssi-tools pam pam-devel portmap procps strace sudo SysVinit util-linux ---------------------------------------------------------------------- Comment By: Brian J. Watson (bjbrew) Date: 2004-04-05 23:06 Message: Logged In: YES user_id=16302 Kishore, The linuxrc problem has already been fixed, but we should check if there are any similar problems. Try installing a two or three node OpenSSI cluster on a non-English RH9 system. Test the openssi-tools commands, particularly those in the sysadmin directory, and see if anything breaks. If not, I think this bug can be closed. Thanks, Brian ---------------------------------------------------------------------- Comment By: Aneesh Kumar K.V (kvaneesh) Date: 2004-03-25 20:46 Message: Logged In: YES user_id=230991 Attaching the bug report ---- I suppose there is a problem in linuxrc. The output of my ifconfig command is in german. As a result the term HWaddr is not found. I corrected this allready in the Perl module Clustertab.pm (In the attachment) ------------ --- /cluster/lib/Clustertab.pm 2004-03-09 10:23:18.000000000 -0600 +++ Clustertab.pm 2004-03-25 08:43:31.000000000 -0600 @@ -385,16 +385,16 @@ # should be no need to normalize output from ifconfig command open IFCONFIG, "/sbin/ifconfig |" or die; while (<IFCONFIG>) { my %interface; - /^(\S+).*HWaddr (([0-9A-F]{2}:){5}[0-9A-F]{2})/ or next; + /^(\S+).*H.*dr.* (([0-9A-F]{2}:){5}[0-9A-F]{2})/ or next; $interface{NAME} = $1; $interface{HWADDR} = $2; $_ = <IFCONFIG>; - /inet addr:([\d\.]+)\s+Bcast:([\d\.]+)\s+Mask:([\d\.]+)\s+/ + /inet.*dr.*:([\d\.]+)\s+Bcast:([\d\.]+)\s+Mask.*:([\d\.]+)\s+/ or next; unless (validate_ipaddr($1)) { warn "configured IP address for " . "$interface{NAME} is invalid: $1\n"; /tmp> ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=405834&aid=923161&group_id=32541 |