Bug 102706 - /etc/sysconfig/network-scripts/network-functions uses uniq
Summary: /etc/sysconfig/network-scripts/network-functions uses uniq
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-08-20 01:21 UTC by Paul Jakma
Modified: 2014-03-17 02:38 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-08-20 01:29:15 UTC
Embargoed:


Attachments (Terms of Use)

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.


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