Nicolas Williams wrote:
> OK, I've decided to follow Jim's preferred approach of re-writing
> i.services using nawk to get the merge right.
>
> I'll file a separate CR for the i.services work and put the two back
> together.
>
> I'm not sure how I'll manage to preserve comments though.  Here's the
> rough algorithm:
>
>  - Read in the source and destination files.  For each file fill in
>    several associative arrays indexed by name/proto and port/proto,
>    tacking port/proto, cname and aliases.
>
>
>  - Iterate over those arrays to compute the merged entries for each
>    service.
>
>
>  - Read in the source file (the one delivered by ON) and:
>
>     - pass through any comment lines
>
>     - replace all entries with the merged ones and preserve any comments
>       from the source file, adding a comment if the entry changed
>
>     - save the result in a temp file
>
>     - include a comment in the beginning and end of the file about
>       merged entries
>
>
>  - Read in the destination file (what was on the system) and:
>
>     - drop all comment lines (the script could check whether these are
>       dups of comments in the source, but, how do we know if it's
>       appropriate to keep any other comment lines, and where should they
>       be inserted??)
>
>     - skip any entries that were merged and output earlier
>
>     - append all other entries, including comments, to the above temp
>       file
>
>
>  - Install the temp file as /etc/services
>   
 I'd bet 'patch' isn't available in the enviroment you're discussing, 
but 'diff' probably is right?

Why not include a copy of the last Solaris services file before your 
change, and use it with 'diff' as a common ancestor, to find the local 
changes?
Then take the new version (whicch is the result of your pre-merge of the 
last file and the IANA services) and use nawk or something else to 
'apply' the diffs?

Applying the diffs might turn out alot like your algorithm above, but it 
seems diffing against a common predecessor will allow you find the local 
changes more accurately.
I suppose any back ported patch should probably use the last shipped 
/etc/services for whatever release the patch is for? That might not be 
practical I suppose.

      -Kyle

> _______________________________________________
> networking-discuss mailing list
> [email protected]
>   

_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to