Bug 102706 - /etc/sysconfig/network-scripts/network-functions uses uniq
/etc/sysconfig/network-scripts/network-functions uses uniq
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2003-08-19 21:21 EDT by Paul Jakma
Modified: 2014-03-16 22:38 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-08-19 21:29:15 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Paul Jakma 2003-08-19 21:21:19 EDT
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-19 21:29:15 EDT
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.