Bug 102706

Summary: /etc/sysconfig/network-scripts/network-functions uses uniq
Product: [Retired] Red Hat Linux Reporter: Paul Jakma <paul+rhbugz>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-08-20 01:29:15 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 Paul Jakma 2003-08-20 01:21:19 UTC
Description of problem:

The network functions file makes much use of the 'uniq' command, esp for IPv6
related stuff, eg:

sysctl -a | grep "^net\.ipv6\.conf\." | awk -F.
'{ print $4 }' | sort | uniq | while read interface; do

However, uniq may not be available as it is installed to /usr (eg machines which
mount /usr over NFS).

As sort has a -u flag, the use of uniq is redundant, hence I suggest that all
occurances of sort | uniq be replaced with sort -u.

Indeed, the above example is really an abuse of awk (piping stuff that could be
done inside awk), the whole command really should be something like:

sysctl -a | awk '$0 ~ /^net\.ipv6\.conf\./ { split($1,a,/\./); foo[a[4]] = a[4];
} END {asort(foo); for (i in foo) { if (foo[i] != "all" && foo[i] != "default")
print foo[i];}}'

to avoid the redundant grep, sort and uniq (all of which awk is perfectly
capable of doing)


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

nearly all versions of initscripts with IPv6 support.


How reproducible:

grep uniq /etc/sysconfig/network-scripts/network-functions

Comment 1 Bill Nottingham 2003-08-20 01:29:15 UTC
Fixed in CVS a couple of days ago, will be in 7.31-1.