Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#1345 closed defect (fixed)

Wrong tab-completion in bindctl and named_set

Reported by: vorner Owned by: jelte
Priority: medium Milestone: Sprint-20111108
Component: ~bind-ctl (obsolete) Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: Core Feature Depending on Ticket:
Estimated Difficulty: 3 Add Hours to Ticket:
Total Hours: 0:18(review) Internal?: no


If I try to use tab completion on current #213 branch (because master doesn't use named_set yet anywhere), I get this:

> config set Boss/components/b10-c<tab>

It expands (wrongly) to:

> config set Boss/components/b10-b10-cmdctl

There's one b10-extra. Maybe it has something to do with the fact that almost everything in the named_set has a b10-prefix. It should be:

> config set Boss/components/b10-cmdctl


Change History (10)

comment:1 Changed 8 years ago by jelte

  • Add Hours to Ticket changed from 0 to 03

comment:2 Changed 8 years ago by jelte

  • Add Hours to Ticket 03 deleted
  • Estimated Difficulty changed from 0 to 3

comment:3 Changed 8 years ago by jelte

  • Milestone changed from Next-Sprint-Proposed to Sprint-20111108

comment:4 Changed 8 years ago by jelte

  • Owner set to UnAssigned
  • Status changed from new to reviewing

Took a bit of head-scratching, but I found the problem; the results we return are fine (at first I though those were wrong), but in the final part of the completion, it mucks up. Turns out it is caused by '-' being a word-delimiter in readline (by default, on most systems, depending on environment, etc.), and it ends up appending the part between the final / and the - twice.

So my proposed solution is to remove it as a word-delimiter in readline as an initialization step of the command interpreter.

I have based this branch on 213, so you can easily check out the result (simply try the completion in the above statement).

Since this is behaviour out of our code, I couldn't think of any way to add a test for this (we could test the results from complete() with some instrumenting to get around the readline(), but those results were right in the first place and aren't changed by this branch)

comment:5 Changed 8 years ago by jinmei

  • Owner changed from UnAssigned to jinmei

comment:6 Changed 8 years ago by jinmei

This looks like an ad hoc hack, and I'm not sure if this is the best
solution. But I have no alternative suggestion, so I'm okay with
merging it.

comment:7 Changed 8 years ago by jinmei

Ah, fogot one minor thing. There seems to be a redundant space between

        delims = readline.get_completer_delims( )

comment:8 Changed 8 years ago by jinmei

  • Owner changed from jinmei to jelte

comment:9 Changed 8 years ago by jelte

  • Resolution set to fixed
  • Status changed from reviewing to closed

I guess the alternative would be to implement our own tab-completion (and with it, probably the entire read-command loop).

Thanks! Fixed the space, merged, closing ticket.

comment:10 Changed 8 years ago by jinmei

  • Total Hours changed from 0 to 0:18(review)
Note: See TracTickets for help on using tickets.