NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/54415: libedit stats completions for non-file completions



>Number:         54415
>Category:       lib
>Synopsis:       libedit stats completions for non-file completions
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 28 01:45:00 +0000 2019
>Originator:     Ricky Zhou
>Release:        N/A
>Organization:
>Environment:
N/A
>Description:
When libedit the list of available completions is displayed, each completion is treated as a file and statted.

The bug is that  fn_display_match_list in src/lib/libedit/filecomplete.c unconditionally calls append_char_function, ignoring the app_func argument that is overridden for readline.

Tangentially related bug: The max width passed into fn_display_match_list does not take the character appended by append_char_function into account. Because of this, tabular printing of completions can sometimes wrap. A fix might be to change:
	cols = (size_t)screenwidth / (width + 1);
to
	cols = (size_t)screenwidth / (width + 2);
to account for the appended char.
>How-To-Repeat:
This bug was discovered in software using libedit on Linux. The software uses the readline compat layer and registers a custom completion function.

The statting was observed by stracing the software and pressing tab at a readline prompt to display completions.
>Fix:
The fix is to replace the call to append_char_function with app_func. The NULL check on app_func that falls back to append_char_function can probably also be removed, because fn_complete always passes an app_func.



Home | Main Index | Thread Index | Old Index