From owner-freebsd-hackers@FreeBSD.ORG Fri May 23 08:59:23 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 06273B60 for ; Fri, 23 May 2014 08:59:23 +0000 (UTC) Received: from h.highsecure.ru (mail6.highsecure.ru [IPv6:2a01:4f8:191:22a6::99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE1EF23BF for ; Fri, 23 May 2014 08:59:22 +0000 (UTC) Received: from medway.cl.cam.ac.uk (medway.cl.cam.ac.uk [IPv6:2001:630:212:238:21c:c0ff:fe4b:2b85]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: vsevolod@highsecure.ru) by h.highsecure.ru (Postfix) with ESMTPSA id 3A74E30043F for ; Fri, 23 May 2014 10:58:30 +0200 (CEST) Message-ID: <537F0DD9.6090805@highsecure.ru> Date: Fri, 23 May 2014 09:59:05 +0100 From: Vsevolod Stakhov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: Re: [GSoC] Machine readable output from userland utilities References: <49E9736E-AD14-4647-8B15-30603D01360C@mail.bg> In-Reply-To: <49E9736E-AD14-4647-8B15-30603D01360C@mail.bg> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 May 2014 08:59:23 -0000 On 20/05/14 17:59, Zaro Korchev wrote: > I'm working on the project "Machine readable output from userland > utilities" and I want to share my ideas and thoughts. > > Here is the wiki page of the project: > https://wiki.freebsd.org/SummerOfCode2014/MachineReadableFromUserlandUtils > > I'm planning to create a unified output abstraction in the form of a > library. The tools supporting the machine-readable output feature > will write output exclusively using the library. The exact output > format will be customizable. Several backend libraries (like libucl > and libnv) can be used to implement different formats. Such library > can either be compiled statically into each application or linked > dynamically (depending on space/performance/versioning and other > considerations). Each tool will have to be modified to support the > new output mechanism. These modifications could trivially be turned > on and off using a macro switch. One issue that must be considered is > how to manage long outputs since it may not be possible to store all > data in memory. This would happen rarely but can still be a problem. > Probably the easiest way to solve this is to add streamed dumping > capability into the underlying libraries. > > Do you have any suggestions or ideas? For libucl output I've used the following approach: - convert all output objects to ucl; - write custom emitter for human-readable output. Perhaps, it might be possible to do it in some unified way, then it is worth to think about output to: 1) some unified BSD/Posix compatible human readable output 2) libnv output (I'm not sure about arrays, however) 3) xml output (if someone needs it) -- Vsevolod Stakhov