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 $
Created attachment 319487 [details] Trivial fixes to the services file (in setup-2.7.3 / rawhide)
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.
Created attachment 319497 [details] A fix for the original serviceslint script.
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.
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
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 :)
Created attachment 320051 [details] Minor documentation fix.