[chrony-users] libedit 20180525-3.1 escapes spaces in chronyc tab-completion

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


Hi,

Our project did a version bump of libedit to 20180525-3.1 and noticed spaces are now being escaped with a backslash with chronyc's tab-completion.

Example:
--
chronyc> sources<TAB>
sources         sources -v      sourcestats     sourcestats -v 

chronyc> sources<SPACE><TAB>
chronyc> sources\ -v <RETURN>
Unrecognized command
--

The change occurred with libedit revision 1.47 2017/10/15
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/filecomplete.c.diff?r1=1.46&r2=1.47

I took a stab at a fix by patching CPS_NormalizeLine() ...

--- chrony-3.3/cmdparse.c.orig	2018-06-08 17:07:48.644094438 -0500
+++ chrony-3.3/cmdparse.c	2018-06-08 17:28:30.578778580 -0500
@@ -218,7 +218,8 @@
     if (first && strchr("!;#%", *p))
       break;
 
-    *q++ = *p;
+    if (!(*p == '\\' && isspace((unsigned char)*(p+1))))
+      *q++ = *p;
     space = first = 0;
   }
 
and it solves the issue with limited testing.

(BTW, applying De Morgan's law to the added logic might make it less readable, so I left it as shown.)

Lonnie


--
To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx
with "unsubscribe" in the subject.
For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx
with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/