Bug 465642

Summary: serviceslint speedup and bugfixes
Product: [Fedora] Fedora Reporter: Ralph Siemsen <ralphs>
Component: setupAssignee: Phil Knirsch <pknirsch>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: pknirsch, 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: 2008-10-10 16:44:45 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:
Attachments:
Description Flags
New version of serviceslint script
none
Trivial fixes to the services file (in setup-2.7.3 / rawhide)
none
A fix for the original serviceslint script.
none
Minor documentation fix. none

Description Ralph Siemsen 2008-10-05 03:29:02 UTC
Created attachment 319486 [details]
New version of serviceslint script

The "serviceslint" script used during the build of setup package is quite slow.  Moreover, it fails to detect problems in the current services file!

I have written a faster version of serviceslint script, that performs the same checks as the old version.  To my surprise, when I run it on the services file, it detects quite a few errors, whereas the old script did not find any!

I can't fully explain why the old one is broken - the code looks correct.  My best guess is that bash has a maximum length on strings, and the old script is exceeding this limit, silently.

Note that I have slightly changed the behaviour of the new serviceslint script when it detects errors.  It returns a failure code only in case of a severe syntax error.  Duplicate service names or ports are flagged as warnings, but do not trigger a failure.  This allows the current SRPM to still build.

The services file contains a few duplicate entries.  I've attached a patch that fixes a few of the more obvious errors; though I'm not sure how to get such patches to the IANA folks.

Here is the output from the tool when run against the services file in rawhide:

$ ./serviceslint ./services
Duplicate port at line 577: 0/tcp
Duplicate name at line 580: compressnet/tcp
Duplicate name at line 581: compressnet/udp
Duplicate port at line 936: 351/tcp
Duplicate port at line 937: 351/udp
Duplicate port at line 940: 352/tcp
Duplicate port at line 941: 352/udp
Duplicate name at line 1300: meter/tcp
Duplicate name at line 1301: meter/udp
Duplicate port at line 1474: 666/tcp
Duplicate port at line 1475: 666/udp
Duplicate port at line 1652: 888/tcp
Duplicate port at line 1682: 999/tcp
Duplicate port at line 1683: 999/udp
Duplicate port at line 3543: 1989/tcp
Duplicate port at line 3544: 1989/udp
Duplicate port at line 3551: 1992/tcp
Duplicate port at line 3552: 1992/udp
Duplicate name at line 4319: taskmaster2000/tcp
Duplicate name at line 4320: taskmaster2000/udp
Duplicate port at line 5468: 3000/tcp
Duplicate port at line 5469: 3000/udp
Duplicate port at line 5472: 3002/tcp
Duplicate port at line 5473: 3002/udp
Duplicate port at line 7685: 4151/tcp
Duplicate name at line 7685: menandmice_noh/tcp
Duplicate name at line 10111: optohost004/tcp
Duplicate name at line 10112: optohost004/udp
Duplicate port at line 10205: 25902/tcp
Duplicate name at line 10205: nilinkanalyst/tcp
Duplicate port at line 10369: 45825/tcp
Duplicate name at line 10369: qdb2service/tcp
$

Comment 1 Ralph Siemsen 2008-10-05 03:30:21 UTC
Created attachment 319487 [details]
Trivial fixes to the services file (in setup-2.7.3 / rawhide)

Comment 2 Ralph Siemsen 2008-10-05 13:56:34 UTC
I looked into why the original script failed to report these problems.  The fix is simple, see attached setup-2.7.3-bugfix.patch.  With that change applied, both the old and new versions of servicesline detect the same duplicates.

Comment 3 Ralph Siemsen 2008-10-05 13:58:33 UTC
Created attachment 319497 [details]
A fix for the original serviceslint script.

Comment 4 Phil Knirsch 2008-10-07 12:51:33 UTC
Thanks a lot, Ralph!

I'll be including this in one of the next builds of setup for Rawhide.

Regards, Phil

PS: And fixing the buggy services ofc.

Comment 5 Phil Knirsch 2008-10-10 16:44:45 UTC
OK, i've had to do a small change/fix to your script as it currently didn't bail out on warnings (which i did prefer).

And we have an upstream repo now: https://fedorahosted.org/setup

Final version is just built as setup-2.7.4-1.fc10 with fixed /etc/services as well of course.

Thanks again!

Regards, Phil

Comment 6 Ralph Siemsen 2008-10-10 19:15:42 UTC
Looks good.  I agree, having the script bail on warnings is better.  I wasn't sure that the /etc/services file would be repaired so quickly :)

Attached is a minor patch to update the documentation w.r.t the handling of warnings as being fatal.  For next time :)

Comment 7 Ralph Siemsen 2008-10-10 19:17:13 UTC
Created attachment 320051 [details]
Minor documentation fix.