Bug 128582 - [patch] wpa_cli(8): activate readline(3) support
Summary: [patch] wpa_cli(8): activate readline(3) support
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 7.1-PRERELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-04 13:20 UTC by Eygene Ryabinkin
Modified: 2016-12-10 15:25 UTC (History)
0 users

See Also:


Attachments
patch-wpa_cli-readline-support (893 bytes, text/plain)
2008-11-04 13:20 UTC, Eygene Ryabinkin
no flags Details
0001-WPA-CLI-tool-properly-clean-history-before-writing.patch (7.93 KB, patch)
2009-01-17 04:12 UTC, Eygene Ryabinkin
no flags Details | Diff
0002-WPA-CLI-tool-embed-command-usage-into-the-wpa_cli_c.patch (12.04 KB, patch)
2009-01-17 04:12 UTC, Eygene Ryabinkin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eygene Ryabinkin 2008-11-04 13:20:00 UTC
Currently wpa_cli(8) has no compiled-in readline support, although it
has this functionality inside the source code.  It is very useful to
have command history, command editing and autocompletion in the
interactive mode.

Fix: The following patch activates readline support.
How-To-Repeat: 
Spawn wpa_cli and try to push the arrow buttons.  They will produce the
usual "garbage" instead of making the utility to crawl through the
command history.
Comment 1 Sam Leffler freebsd_committer freebsd_triage 2008-11-04 19:37:22 UTC
readline support in wpa_cli is not enabled by default because it bloats 
the system with very little gain.  It is trivial to have a local 
configuration that adds it w/o touching the source code but once added 
in the way proposed it is not possible to disable it w/o modification.

I believe the original PR was submitted by brix@.  I recently asked him 
to review it and decide whether he wanted to commit the change; 
otherwise close the PR.

    Sam
Comment 2 Sam Leffler freebsd_committer freebsd_triage 2008-11-06 22:45:09 UTC
Eygene Ryabinkin wrote:
> Sam, good day.
> 
> Tue, Nov 04, 2008 at 11:37:22AM -0800, Sam Leffler wrote:
>> readline support in wpa_cli is not enabled by default because it bloats 
>> the system with very little gain.  It is trivial to have a local 
>> configuration that adds it w/o touching the source code but once added 
>> in the way proposed it is not possible to disable it w/o modification.
> 
> OK, no problems: what about the attached patch?
> 
>> I believe the original PR was submitted by brix@.  I recently asked him 
>> to review it and decide whether he wanted to commit the change; 
>> otherwise close the PR.
> 
> Yes, it is bin/116606.  I had spotted from that patch that ncurses is
> needed too and had explicitely added it to my patch.  The main
> difference between my and Henrik patches is that I am defining
> additional knob WPA_CLI_WITH_READLINE that enables the realine support
> (but only when MK_GNU_SUPPORT is defined too).  So, by-default the
> support won't be included and people will be able to turn it on
> without resorting the the make trickery.  And I had also described
> this in the manual page.
> 
> As a bonus, I had written proper support for the history command
> validation for the potentially sensitive commands that shouldn't be
> written to the disk.  The original version was faulty and incomplete.
> The patch is attached too.  May be it should go upstream, I'll try to
> submit it there too.
> 

So long as it can be disabled I'm fine with adding the support.  Thanks
for following through on this.

Yes, please do send your wpa_cli changes to Jouni (might want to check
if they are already in later versions of the code).

	Sam
Comment 3 Eygene Ryabinkin 2008-11-07 08:15:46 UTC
Sam, good day.

Thu, Nov 06, 2008 at 02:45:09PM -0800, Sam Leffler wrote:
> So long as it can be disabled I'm fine with adding the support.  Thanks
> for following through on this.


OK, fine, thank you.

> Yes, please do send your wpa_cli changes to Jouni (might want to check
> if they are already in later versions of the code).


Already sent yesterday.  No answer yet, but I think that it is just "too
early".  I had glanced over the latest development branch and GIT repo
for 0.6.x: the error is still here, at least it is in the tip of the
hostap-full.git repository.

Thanks again!
-- 
Eygene
 _                ___       _.--.   #
 \`.|\..----...-'`   `-._.-'_.-'`   #  Remember that it is hard
 /  ' `         ,       __.--'      #  to read the on-line manual   
 )/' _/     \   `-_,   /            #  while single-stepping the kernel.
 `-'" `"\_  ,_.-;_.-\_ ',  fsc/as   #
     _.-'_./   {_.'   ; /           #    -- FreeBSD Developers handbook 
    {_.-``-'         {_/            #
Comment 4 Eygene Ryabinkin 2009-01-06 19:36:09 UTC
Sam, good day.

To update on the bug status.

Fri, Nov 07, 2008 at 11:15:45AM +0300, Eygene Ryabinkin wrote:
> > Yes, please do send your wpa_cli changes to Jouni (might want to check
> > if they are already in later versions of the code).
>
> Already sent yesterday.  No answer yet, but I think that it is just "too
> early".  I had glanced over the latest development branch and GIT repo
> for 0.6.x: the error is still here, at least it is in the tip of the
> hostap-full.git repository.

The fixes were integrated to the 0.6.x series and are in 0.6.7,
  http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap-06.git;a=shortlog

I had asked Jouni if he is going to backport the fixes to 0.5.x.
-- 
Eygene
 _                ___       _.--.   #
 \`.|\..----...-'`   `-._.-'_.-'`   #  Remember that it is hard
 /  ' `         ,       __.--'      #  to read the on-line manual
 )/' _/     \   `-_,   /            #  while single-stepping the kernel.
 `-'" `"\_  ,_.-;_.-\_ ',  fsc/as   #
     _.-'_./   {_.'   ; /           #    -- FreeBSD Developers handbook
    {_.-``-'         {_/            #
Comment 5 Eygene Ryabinkin 2009-01-17 04:12:51 UTC
Sam, good day.

Tue, Jan 06, 2009 at 10:36:08PM +0300, Eygene Ryabinkin wrote:
> The fixes were integrated to the 0.6.x series and are in 0.6.7,
>   http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap-06.git;a=shortlog
> 
> I had asked Jouni if he is going to backport the fixes to 0.5.x.

Jouni said that he isn't going to integrate the full fixes.  May be
only small part will go to 5.x, may be nothing will be added.  Said
that, I have full patches for 5.x and if you want them, they are
attached to this message.  It is up to you to either integrate them
somehow into the FreeBSD base or to close the PR without doing this.
-- 
Eygene
 _                ___       _.--.   #
 \`.|\..----...-'`   `-._.-'_.-'`   #  Remember that it is hard
 /  ' `         ,       __.--'      #  to read the on-line manual
 )/' _/     \   `-_,   /            #  while single-stepping the kernel.
 `-'" `"\_  ,_.-;_.-\_ ',  fsc/as   #
     _.-'_./   {_.'   ; /           #    -- FreeBSD Developers handbook
    {_.-``-'         {_/            #
Comment 6 Baptiste Daroussin freebsd_committer freebsd_triage 2016-12-10 15:25:01 UTC
Since v2.5 wpa_cli is built with its internal line edit implementation.