From owner-freebsd-current@freebsd.org Tue Sep 11 14:24:41 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D110110925AF for ; Tue, 11 Sep 2018 14:24:41 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48FC7788D8 for ; Tue, 11 Sep 2018 14:24:41 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf1-f54.google.com with SMTP id i7-v6so20501804lfh.5 for ; Tue, 11 Sep 2018 07:24:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=jKmlGFKzXPoc9qWV8l2FXJVa1UWImfBL7z9uPqkKS+g=; b=pnVITS49IdcOHZrQCDDoQnQr4CY0n1Vx9DJkPlVpaOApkmGh0kFvYN0gmjvUygvsLd QbS7QoaeuqbbhsvcdvcjG4iZIbmzYPZqC6LT9HviPkY7jDq0620p8kX7ZArdLgaMZeoi dKqm6XvToxPHgR3dbhUcUT3NJRgZIbRDcA/SzTY5V5aJLZtdYIAVy2g2nXSucMBrnTJu DYFDfLE+UPhcEkUmLX6bxugNoz4/9xMIHh8AA9PpWY6tL683tHrIUHTic/ypSquMrISX PI2/dswmNwOj9kgY+ZJh33o+7Qat3oScSJEA+WiUCH1Tbij6+5eROf29Bgyb/ONrTNMM h8yQ== X-Gm-Message-State: APzg51DWTD5VCPiOn+cuz+xB9Y3trkteH24Lgw5NwgK2Coic/2Ys1rlz Wi0Nw7NrWJdc/117tRT7xuBzjwLio72KwU9v5IA= X-Google-Smtp-Source: ANB0VdbLwEZs0/8YW08agUmHZTiNG0AGiL6N30pSYbURI2yf3PeJGIIghE748Y65mrlEe7dZCJ8SL7CWrxDjdiD4ZQM= X-Received: by 2002:a19:2841:: with SMTP id o62-v6mr14965158lfo.86.1536675879240; Tue, 11 Sep 2018 07:24:39 -0700 (PDT) MIME-Version: 1.0 References: <8b7930bc-1086-05d3-c019-052368ddf097@vangyzen.net> <59cd421e-f5d4-855a-83ec-65726f792555@vangyzen.net> <20180911142000.unrYV%steffen@sdaoden.eu> In-Reply-To: <20180911142000.unrYV%steffen@sdaoden.eu> From: Alan Somers Date: Tue, 11 Sep 2018 08:24:25 -0600 Message-ID: Subject: Re: Request for Review: Generate /etc/services from the IANA registry To: Eric van Gyzen , FreeBSD CURRENT , steffen@sdaoden.eu Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2018 14:24:42 -0000 Don't worry Steffen. Python won't be a build requirement for FreeBSD even after Eric's patch. His Python script will only need to be run whenever IANA updates its database, and the results will be checked into source control. So for a normal user, there is no change to "make buildworld && make installworld". As for Python vs Awk, I too tried to do this with Awk. However, Awk can't easily handle things like IANA's representation of aliases, and it can't easily format the list in the same order as our current list. Python is truly a better choice. -Alan On Tue, Sep 11, 2018 at 8:19 AM Steffen Nurpmeso wrote: > Eric van Gyzen wrote in <59cd421e-f5d4-855a-83ec-65726f792555@vangyzen.net > >: > |On 9/10/18 12:04 PM, Eric van Gyzen wrote: > |> Would anyone like to review this change to generate /etc/services from > |> the IANA registry? > |> > |> https://reviews.freebsd.org/D17106 > | > |If that review made your browser unhappy, try this one instead: > > Yes it did. > > | https://reviews.freebsd.org/D17115 > > I mean, i have nothing to do with FreeBSD except that i use it > since 4.7 (though some yours only indirectly as Mac OS X), and > i am in opposition to quite some directions taken, but who am i, > that is ok, i have a very narrow use case. But this is one of the > things i really do not understand, bringing XML and Python stuff > needlessly into FreeBSD seems very odd. For example, ArchLinux > and CRUX Linux use a simple portable awk script to generate > services and protocols, and all you need to count the number of > services is a normal Unix pipeline which strips comments and then > calls wc -l. I'll paste the script below this. Thank you. > And ciao already here > > #!/bin/sh - > #@ Update protocols and services from IANA. > #@ Taken from ArchLinux script written by Gaetan Bisson. Adjusted for > CRUX. > > awk=awk > curl=curl > url_pn= > https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml > url_snpn=https://www.iana.org/assignments/service-names-port-numbers/\ > service-names-port-numbers.xml > > > datetime=`date +'%FT%T%z'` > > download() { > echo 'Downloading protocols' > ${curl} -o protocols.xml ${url_pn} > [ ${?} -eq 0 ] || exit 20 > echo 'Downloading services' > ${curl} -o services.xml ${url_snpn} > [ ${?} -eq 0 ] || exit 21 > } > > process() { > echo 'Processing protocols' > ${awk} -F "[<>]" -v URL="${url_pn}" -v DT="${datetime}" ' > BEGIN{ > print "# /etc/protocols, created " DT > print "# Source: " URL > } > / / / /<\/record/ && n && v != ""{ > printf "%-12s %3i %s\n", tolower(n), v, n > } > ' < protocols.xml > protocols.new > [ ${?} -eq 0 ] || exit 30 > > echo 'Processing services' > ${awk} -F "[<>]" -v URL="${url_snpn}" -v DT="${datetime}" ' > BEGIN{ > print "# /etc/services, created " DT > print "# Source: " URL > } > / / / / /Unassigned/ || /Reserved/ || /historic/ {c = 1} > /<\/record/ && n && u && p && !c{ > printf "%-15s %5i/%s\n", n, u, p > } > ' < services.xml > services.new > [ ${?} -eq 0 ] || exit 31 > } > > update() { > mv protocols.new protocols > [ ${?} -eq 0 ] || exit 40 > mv services.new services > [ ${?} -eq 0 ] || exit 41 > rm -f protocols.xml services.xml > } > > download > process > #update > > --steffen > | > |Der Kragenbaer, The moon bear, > |der holt sich munter he cheerfully and one by one > |einen nach dem anderen runter wa.ks himself off > |(By Robert Gernhardt) > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" >