Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Mar 2015 19:48:47 -0500
From:      Allan Jude <allanjude@freebsd.org>
To:        freebsd-current@freebsd.org
Subject:   Re: Massive libxo-zation that breaks everything
Message-ID:  <54F504EF.3030303@freebsd.org>
In-Reply-To: <54F4FECB.90501@freebsd.org>
References:  <54F31510.7050607@hot.ee>	<54F34B6E.2040809@astrodoggroup.com> <CAG=rPVfcB1Fy_8mHq-t5Ay07yrzuSGthQ0ZcGzvp0XG9gSSzkg@mail.gmail.com> <54F35F29.4000603@astrodoggroup.com> <54F429EF.5050400@freebsd.org> <54F46536.8040607@mu.org> <54F4C03F.7030704@freebsd.org> <54F4FECB.90501@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--hTBgLk1DQhGgiQX5TX39EdfXIT18qClsd
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

On 2015-03-02 19:22, Andrey Chernov wrote:
> On 02.03.2015 22:55, Julian Elischer wrote:
>> On 3/2/15 5:27 AM, Alfred Perlstein wrote:
>>>
>>>
>>> On 3/2/15 4:14 AM, Julian Elischer wrote:
>>>> On 3/1/15 10:49 AM, Harrison Grundy wrote:
>>>>> Thanks!
>>>>>
>>>>> That does seem useful, but I'm not sure I see the reasoning behind
>>>>> putting into base, over a port or package, since processing XML in =
base
>>>>> is a pain, and it can't serve up JSON or HTML without additional
>>>>> utilities anyway.
>>>>>
>>>>> (If I'm reviving a long-settled thing, let me know and I'll drop it=
=2E
>>>>> I'm
>>>>> trying to understand the use case for this.)
>>>>
>>>> To me it would almost seem more useful to have a programmable filter=

>>>> for which you could produce
>>>> parse grammars to parse the output of various programs..
>>>> thus
>>>>
>>>> ifconfig -a | xmlize -g ifconfig | your-favourite-xml-parser
>>>> with a set of grammars in /usr/share/xmlize/
>>>> then we could use it for out-of-tree programs as well if we wrote
>>>> grammars for them..
>>>>
>>>> The sentiment of machine-readable output is nice, but I think it's
>>>> slightly off target.
>>>> we shouldn't have to change all out utilities, and it isn't going to=

>>>> help at all with 3rd party apps,
>>>> e.g. samba stuff. A generally easy to program output grammar parser
>>>> would be truely useful.
>>>> and not just for FreeBSD.
>>>>
>>>> I've been watching with an uncomfortable feeling, but it's taken me =
a
>>>> while to put my
>>>> finger on what it was..
>>>>
>>>>
>>> Are you sure it's not the hairs on the back of your neck standing up
>>> due to NIH?
>>>
>>> Juniper has been doing this for years and it's very useful for them.
>> I'm not saying the ability to generate machine readable output is wron=
g,
>> but that the 'unix way' would be to make a filter for it. It seems tha=
t
>> the noisy people don't
>> agree with me so I will not stand in the way of progress..
>=20
> I agree. Even if someone starts with json and xml only, it will need
> some 3rd format soon, and adding any new format have real possibility t=
o
> break all already existent (like adding json+xml breaks plain text in
> pipes). Moreover, it violates Unix principle 'one tool =3D=3D one gener=
al
> function' and lots of other rules like Eric Raymond ones, making each
> program looks like systemd. It makes harder to merge changes from other=

> BSDs too.
> Proper way to do this thing is to back out all changes and write
> completely separate templates-based parser - xml/json writer.
>=20

Have you actually looked at libxo? It isn't really specific to xmj/json,
and could handle adding another format without the need to modify wc

xo_open_container("wc");
xo_open_list("file");
  xo_open_instance("file");
    if (cnt(*argv) !=3D 0)
      ++errors;
  xo_close_instance("file");
xo_close_list("file");
xo_close_container("wc");
xo_finish();


with cnt() being the existing functions in wc, but with the printf
replaced with an xo wrapper. There is nothing specific to json or xml,
that is all handled in libxo.

Obviously, more care needs to be taken when converting the utilities to
ensure that the existing output is not changed, but it is not quite as
invasive as some people seem to think.

--=20
Allan Jude


--hTBgLk1DQhGgiQX5TX39EdfXIT18qClsd
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)

iQIcBAEBAgAGBQJU9QTzAAoJEJrBFpNRJZKfL/oQAJSyeCAAu9DEToFS831/3eJQ
W5mozxRYp6ve1+BMzeay2fXS9nWQCeU+ShtHB1y1IS01rZZs8+lKU0e9dqFdJOWN
SoqufKL12CAieAprso36g176pjpxShHAh9NRCxHeKfwO0vdmHzCcvf0xmOP9/Fjp
ecL1nVGxu1pD+DUAHWzrG+PdQHTFTq5ehF4N2Far8CYbI9ikhOSWfQozlPU7obQj
cxQ8XvRDvhyhnXbmkg3BrPD8EAeAUzs/sz46XtFiYMttuKb1m7FDFfv4ZI+Nz9Rd
gEdLBhS2aN8eRCPkLGmcCC6KM7ReHMAHcteSWFGUbgfpdRkQduz/h4Gz66THXNkl
3NaczV4ADKKMjsclPx/lufvZQ9NWkLFMr4rjcp0mhgZ90Q32qj5PHmgeV3e571xT
qRiyVfahzhCbRRxPxqcuShSCA6KOlDIFQsl/xseK/FIzrs4l6zuKOxRugL4Cbp9S
xTLBAzdHVqWIQetXaDs9KGfW+Rb3bJo29Y44JaW9Ojffs1G0C0ttc7PIG8F/9J7i
78FnA8dHuFg2AJTXjM0Be7QBXaXcjIuyyM6BHBi/GbF9tMoo6tP4ogClVO9ypdEv
s7bdV+OvPwFSTCk4nfcXVJZC8AJ9WnEghZgaQh5v26QyOgE5GzyP3RudFTmfGvvg
GhiOCD2p38BODspHN/jH
=CiIg
-----END PGP SIGNATURE-----

--hTBgLk1DQhGgiQX5TX39EdfXIT18qClsd--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54F504EF.3030303>