Bug 465642 - serviceslint speedup and bugfixes
serviceslint speedup and bugfixes
Product: Fedora
Classification: Fedora
Component: setup (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-10-04 23:29 EDT by Ralph Siemsen
Modified: 2015-03-04 20:20 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-10-10 12:44:45 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
New version of serviceslint script (3.00 KB, text/plain)
2008-10-04 23:29 EDT, Ralph Siemsen
no flags Details
Trivial fixes to the services file (in setup-2.7.3 / rawhide) (1.92 KB, patch)
2008-10-04 23:30 EDT, Ralph Siemsen
no flags Details | Diff
A fix for the original serviceslint script. (790 bytes, patch)
2008-10-05 09:58 EDT, Ralph Siemsen
no flags Details | Diff
Minor documentation fix. (635 bytes, patch)
2008-10-10 15:17 EDT, Ralph Siemsen
no flags Details | Diff

  None (edit)
Description Ralph Siemsen 2008-10-04 23:29:02 EDT
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-04 23:30:21 EDT
Created attachment 319487 [details]
Trivial fixes to the services file (in setup-2.7.3 / rawhide)
Comment 2 Ralph Siemsen 2008-10-05 09:56:34 EDT
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 09:58:33 EDT
Created attachment 319497 [details]
A fix for the original serviceslint script.
Comment 4 Phil Knirsch 2008-10-07 08:51:33 EDT
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 12:44:45 EDT
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 15:15:42 EDT
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 15:17:13 EDT
Created attachment 320051 [details]
Minor documentation fix.

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