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

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


> On Jun 12, 2018, at 1:19 AM, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
> 
> On Mon, Jun 11, 2018 at 07:44:05AM -0500, Lonnie Abelbeck wrote:
>>> Maybe there is an option to disable the new behavior?
>> 
>> I looked, and don't see an editline global option for this new feature.
> 
> I think it's strange that it does that with editline, but not
> readline. Isn't editline supposed to be compatible with readline?

My understanding is editline is (was) a "compatible" subset of readline.  Looking at the readline docs ...

http://www.delorie.com/gnu/docs/readline/rlman_47.html

There are optional rl_filename_quoting_function and rl_filename_quote_characters which defaults to the null string, no quoting.  This latest libedit 20180525-3.1 seems to not be compatible with these quoting options.


> Maybe the multiword commands (e.g. the -v options) should be handled
> in some other way? Or is that too much work?

I'm not certain how that would be done, first we would add <SPACE> to the break characters:
--
-     rl_basic_word_break_characters = "\t\n\r";
+     rl_basic_word_break_characters = " \t\n\r";
--
then possibly the command_name_generator() would use a 2 dimensional array to match ... not sure ...

Alternatively, I used this patch below to ignore any backslash quoting, almost perfect except the stdout still contains a '\ ', while internally the backslash is ignored.

Lonnie

--- chrony-3.3/client.c.orig	2018-06-12 13:29:58.335070738 -0500
+++ chrony-3.3/client.c	2018-06-12 13:48:26.650116681 -0500
@@ -109,6 +109,7 @@
   if (on_terminal) {
 #ifdef FEAT_READLINE
     char *cmd;
+    char *p, *q;
 
     rl_attempted_completion_function = command_name_completion;
     rl_basic_word_break_characters = "\t\n\r";
@@ -119,6 +120,13 @@
     
     /* user pressed return */
     if( *cmd != '\0' ) {
+      /* strip any backslash quoting */
+      for (p = q = cmd; *p; p++) {
+        if (*p != '\\') {
+          *q++ = *p;
+        }
+      }
+      *q = '\0';
       strncpy(line, cmd, sizeof(line) - 1);
       line[sizeof(line) - 1] = '\0';
       add_history(cmd);



--
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/