From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 675F51BE7B for ; Wed, 27 Jun 2018 13:35:16 +0200 (CEST) Received: from rsa59-2-82-233-193-189.fbx.proxad.net ([82.233.193.189] helo=droids-corp.org) by mail.droids-corp.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fY8je-0007Ts-AL; Wed, 27 Jun 2018 13:35:44 +0200 Received: by droids-corp.org (sSMTP sendmail emulation); Wed, 27 Jun 2018 13:35:08 +0200 Date: Wed, 27 Jun 2018 13:35:08 +0200 From: Olivier Matz To: Bruce Richardson Cc: Adrien Mazarguil , dev@dpdk.org, Keith Wiles , Jingjing Wu , Thomas Monjalon , Ferruh Yigit , Jim Thompson , Anatoly Burakov Message-ID: <20180627113508.3imvmxffiiwyacgu@platinum> References: <20180417152016.5163-1-adrien.mazarguil@6wind.com> <20180419151155.5680-1-adrien.mazarguil@6wind.com> <20180626132121.6qm3m3mx2ubkxyn3@platinum> <20180627103628.GA21988@bricha3-MOBL.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180627103628.GA21988@bricha3-MOBL.ger.corp.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v2] cmdline: rework as a wrapper to libedit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2018 11:35:16 -0000 On Wed, Jun 27, 2018 at 11:36:28AM +0100, Bruce Richardson wrote: > On Tue, Jun 26, 2018 at 03:21:21PM +0200, Olivier Matz wrote: > > Hi Adrien, > > > > Better late than never, please find below some comments > > about your patch. > > > > On Thu, Apr 19, 2018 at 05:13:53PM +0200, Adrien Mazarguil wrote: > > > Disclaimer: this patch must not be confused with the CLI library [1] > > > (work in progress) that will eventually supersede librte_cmdline itself > > > with a different API. > > > > > > Rather, it modifies librte_cmdline to delegate all the heavy lifting > > > (terminal and history handling), strips unused features and re-implements > > > what remains of its public API as a wrapper to the editline library (also > > > known as libedit) [2], a well-known, BSD-licensed and widely available > > > library used by many projects which does everything needed and more [3]. > > > > > > This approach was chosen because converting librte_cmdline as a wrapper to > > > a more capable library was easier and faster than addressing its > > > shortcomings and results in much less code to maintain in DPDK. > > > > > > It also provides a drop-in solution for applications that rely on > > > librte_cmdline. They benefit from greatly improved command line handling > > > without a meaningful impact on their code base. > > > > > > The main motivation behind this patch is testpmd's flow (rte_flow) command, > > > which requires support for dynamic tokens and very long lines that must be > > > broken down when displayed. This is not supported by librte_cmdline's > > > limited terminal handling capabilities, resulting in a rather frustrating > > > user experience. > > > > > > It had to be addressed given the importance of testpmd as one of the > > > primary tool used by PMD developers. > > > > > > This rework results in the following changes: > > > > > > - Removed circular buffer management interface for command history > > > (cmdline_cirbuf.c), command history being handled by libedit. > > > - Removed raw command-line interpreter (cmdline_rdline.c). > > > - Removed raw terminal handler (cmdline_vt100.c). > > > - Removed all test/example code for the above. > > > - Re-implemented high level interactive and non-interactive command-line > > > handlers (cmdline.c and cmdline_socket.c) on top of libedit using its > > > native interface, not its readline compatibility layer. > > > - Made struct cmdline opaque so that applications relying on librte_cmdline > > > do not need to include any libedit headers. > > > - Applications do not need to include cmdline_rdline.h anymore. > > > - Terminal resizing is now automatically handled. > > > - New external dependency for applications relying on librte_cmdline. > > > - Major version bump due to the ABI impact of these changes. > > > > > > [1] http://dpdk.org/browse/draft/dpdk-draft-cli/ > > > [2] http://thrysoee.dk/editline/ > > > [3] http://netbsd.gw.com/cgi-bin/man-cgi?editline++NetBSD-current > > > > > > Signed-off-by: Adrien Mazarguil > > > Cc: Olivier Matz > > > Cc: Keith Wiles > > > Cc: Jingjing Wu > > > Cc: Thomas Monjalon > > > Cc: Ferruh Yigit > > > Cc: Jim Thompson > > > Cc: Anatoly Burakov > > > > > > -- > > > > > > v2 changes: > > > > > > - Replaced an instance of snprintf() with rte_strlcpy() [5]. > > > - Rebased patch. > > > > > > [5] http://dpdk.org/ml/archives/dev/2018-April/097721.html > > > > > > v1 changes: > > > > > > No fundamental change since the original RFC [4], except it's been rebased > > > several times and Meson build support was added in the meantime. Commit log > > > was also shortened a bit. > > > > > > I'm re-sending this because I think it's useful, at least to me (duh). As > > > the maintainer of rte_flow, I spend most of my time typing flow commands in > > > testpmd and libedit makes that a pleasant experience. > > > > > > Try it out! And don't hesitate to send your acked-by line to get this in > > > time for 18.05 :) > > > > > > [4] http://dpdk.org/ml/archives/dev/2017-November/081605.html > > > > Re-saying what I said the first time: I think this is a very good > > improvement, removing lots of dpdk code that is better implemented in > > well-known libraries. > > > > > > The compilation with shared libraries fail. Please try for instance: > > ./devtools/test-build.sh -j4 x86_64-native-linuxapp-clang+shared+debug > > > > I suggest to add in lib/librte_cmdline/Makefile: > > > > LDLIBS += $(shell pkg-config --libs libedit) > > > > > > I also think something should be added in > > /doc/guides/linux_gsg/sys_reqs.rst to highlight the new build > > dependency. > > > > > > I noticed a bad behavior change (in addition to many good ones): > > ctrl-c now quits the application, and this was not the case before. > > I often use ctrl-c to delete the line I'm currently editing. Please > > see at the end a proposition to restore this feature. > > > > I 100% disagree, please set things up that "ctrl-c" quits the application. > > Having our DPDK testpmd and auto-test apps fail to close on ctrl-c is just > awful from a usability perspective IMHO! If there is ever a problem with > the app and you need to kill it quickly, e.g. you want to stop one of those > long-running autotests, the lack of ctrl-c is a pain. Well, this is a good argument. It looks that ctrl-u can do the job, so I may just need to change my habits :) Olivier