09 Jan, 2017

1 commit

  • commit 79e51b5c2deea542b3bb8c66e0d502230b017dde upstream.

    Currently it is impossible to edit the value of a config symbol with a
    prompt longer than (terminal width - 2) characters. dialog_inputbox()
    calculates a negative x-offset for the input window and newwin() fails
    as this is invalid. It also doesn't check for this failure, so it
    busy-loops calling wgetch(NULL) which immediately returns -1.

    The additions in the offset calculations also don't match the intended
    size of the window.

    Limit the window size and calculate the offset similarly to
    show_scroll_win().

    Fixes: 692d97c380c6 ("kconfig: new configuration interface (nconfig)")
    Signed-off-by: Ben Hutchings
    Signed-off-by: Greg Kroah-Hartman

    Ben Hutchings
     

19 Jun, 2013

1 commit

  • According to the documentation [1], LINES and COLS are initialized by
    initscr(); it does not say anything about the behavior when windows are
    resized.

    Do not rely on the current implementation of ncurses that updates
    these variables on resize, but use the propper function calls or macros
    to get window dimensions.

    The use of the variables in main() was OK, but for the sake of
    consistency it was modified to use the macro getmaxyx().

    [1] ncurses(3X)

    Signed-off-by: Dirk Gouders
    Reviewed-by: "Yann E. MORIN"
    [yann.morin.1998@free.fr: declare 'lines' and 'columns' on a single line]
    Signed-off-by: Yann E. MORIN

    Dirk Gouders
     

24 Jan, 2013

1 commit


26 Jul, 2012

1 commit


09 Sep, 2011

5 commits

  • to make it easier to locate begin/end when editing long strings;

    Signed-off-by: Cheng Renquan
    Acked By: Nir Tzachar

    Cheng Renquan
     
  • The original dialog_inputbox doesn't work with longer than prompt_width
    strings, here fixed it in this way:
    1) add variable cursor_form_win to record cursor of form_win,
    keep its value always between [0, prompt_width-1];
    reuse the original cursor_position as cursor of the string result,
    use (cursor_position-cursor_form_win) as begin offset to show part of
    the string in form_win;

    Signed-off-by: Cheng Renquan
    Cc: Arnaud Lacombe
    Cc: Nir Tzachar

    Cheng Renquan
     
  • To support unlimited length string config items;

    No check for realloc return value keeps code simple, and to be
    consistent with other existing unchecked malloc in kconfig.

    Signed-off-by: Cheng Renquan
    Signed-off-by: Arnaud Lacombe

    Cheng Renquan
     
  • In case KEY_BACKSPACE / KEY_DC to delete a char, it memmove only
    (len-cursor_position+1) bytes;
    the default case is to insert a char, it should also memmove exactly
    (len-cursor_position+1) bytes;

    the original use of (len+1) is wrong and may access following memory
    that doesn't belong to result, may cause SegFault in theory;

    case KEY_BACKSPACE:
    if (cursor_position > 0) {
    memmove(&result[cursor_position-1],
    &result[cursor_position],
    len-cursor_position+1);
    cursor_position--;
    }
    break;
    case KEY_DC:
    if (cursor_position >= 0 && cursor_position < len) {
    memmove(&result[cursor_position],
    &result[cursor_position+1],
    len-cursor_position+1);
    }
    break;
    default:
    if ((isgraph(res) || isspace(res)) &&
    len-2 < result_len) {
    /* insert the char at the proper position */
    memmove(&result[cursor_position+1],
    &result[cursor_position],
    len-cursor_position+1);
    result[cursor_position] = res;
    cursor_position++;
    }

    Signed-off-by: Cheng Renquan
    Acked-by: Nir Tzachar

    Cheng Renquan
     
  • Signed-off-by: Cheng Renquan
    Acked-by: Arnaud Lacombe

    Cheng Renquan
     

17 Aug, 2010

2 commits

  • Signed-off-by: Arnaud Lacombe
    Signed-off-by: Michal Marek

    Arnaud Lacombe
     
  • Remove the old hotkeys feature, and replace it by an interactive string
    search.
    From nconfig help:

    Searching: pressing '/' triggers interactive search mode.
    nconfig performs a case insensitive search for the string
    in the menu prompts (no regex support).
    Pressing the up/down keys highlights the previous/next
    matching item. Backspace removes one character from the
    match string. Pressing either '/' again or ESC exits
    search mode. All other keys behave normally.

    Miscellaneous other changes (including Rundy's and Justin's input).

    Signed-off-by: Nir Tzachar
    Acked-by: Sam Ravnborg
    Signed-off-by: Michal Marek

    Nir Tzachar
     

23 Jul, 2010

1 commit

  • nconfig segfaults when help text contains the character '%'. For a quick
    example, navigate to the kernel compression options and get the help for
    bzip2. Doing so triggers a call to mvwprintw() with a string containing
    '%' and no extra arguments to fill in the specifier's value. Fix this
    case by printing the literal string retrieved from the kconfig.

    #0 0x00002b52b6b11d83 in vfprintf () from /lib/libc.so.6
    #1 0x00002b52b6bad010 in __vsnprintf_chk () from /lib/libc.so.6
    #2 0x00002b52b623991b in _nc_printf_string () from
    /lib/libncursesw.so.5
    #3 0x00002b52b6234cff in vwprintw () from /lib/libncursesw.so.5
    #4 0x00002b52b6234db9 in mvwprintw () from /lib/libncursesw.so.5
    #5 0x00000000004151d8 in fill_window (win=0x21b64c0,
    text=0x21b62b0 "CONFIG_KERNEL_BZIP2:\n\nIts compression ratio and
    speed is intermediate.\nDecompression speed is slowest among the
    three. The kernel\nsize is about 10% smaller with bzip2, in
    comparison to gzip.\nBzip2 us"...)
    at scripts/kconfig/nconf.gui.c:229
    #6 0x0000000000416335 in show_scroll_win (main_window=0x21a5630,
    title=0x157fa30 "Bzip2",
    text=0x21b62b0 "CONFIG_KERNEL_BZIP2:\n\nIts compression
    ratio and speed is intermediate.\nDecompression speed is
    slowest among the three. The kernel\nsize is about 10%
    smaller with bzip2, in comparison to gzip.\nBzip2 us"...)
    at scripts/kconfig/nconf.gui.c:535
    #7 0x00000000004055b2 in show_help (menu=0x157f9d0)
    at scripts/kconfig/nconf.c:1257
    #8 0x0000000000405897 in conf_choice (menu=0x157f130)
    at scripts/kconfig/nconf.c:1321
    #9 0x0000000000405326 in conf (menu=0x157d130) at
    scripts/kconfig/nconf.c:1208
    #10 0x00000000004052e8 in conf (menu=0xb434a0) at
    scripts/kconfig/nconf.c:1203
    #11 0x0000000000406092 in main (ac=2, av=0x7fff96a93c38)

    Cc: Michal Marek
    Cc: Nir Tzachar
    Signed-off-by: Stephen Boyd
    Signed-off-by: Michal Marek

    Stephen Boyd
     

02 Feb, 2010

2 commits

  • scripts/kconfig/nconf.gui.c:23: warning: no previous prototype for 'set_normal_colors'
    scripts/kconfig/nconf.gui.c:68: warning: no previous prototype for 'normal_color_theme'
    scripts/kconfig/nconf.gui.c:100: warning: no previous prototype for 'no_colors_theme'
    scripts/kconfig/nconf.c:455: warning: no previous prototype for 'process_special_keys'
    scripts/kconfig/nconf.c:487: warning: no previous prototype for 'get_next_hot'
    scripts/kconfig/nconf.c:506: warning: no previous prototype for 'canbhot'
    scripts/kconfig/nconf.c:514: warning: no previous prototype for 'is_hot'
    scripts/kconfig/nconf.c:522: warning: no previous prototype for 'make_hot'
    scripts/kconfig/nconf.c:582: warning: no previous prototype for 'item_make'
    scripts/kconfig/nconf.c:626: warning: no previous prototype for 'item_add_str'
    scripts/kconfig/nconf.c:656: warning: no previous prototype for 'item_tag'
    scripts/kconfig/nconf.c:668: warning: no previous prototype for 'curses_item_index'
    scripts/kconfig/nconf.c:673: warning: no previous prototype for 'item_data'
    scripts/kconfig/nconf.c:684: warning: no previous prototype for 'item_is_tag'
    scripts/kconfig/nconf.c:691: warning: no previous prototype for 'set_config_filename'

    Signed-off-by: Michal Marek

    Michal Marek
     
  • This patch was inspired by the kernel projects page, where an ncurses
    replacement for menuconfig was mentioned (by Sam Ravnborg).

    Building on menuconfig, this patch implements a more modern look
    interface using ncurses and ncurses' satellite libraries (menu, panel,
    form). The implementation does not depend on lxdialog, which is
    currently distributed with the kernel.

    Signed-off-by: Nir Tzachar
    Signed-off-by: Michal Marek

    nir.tzachar@gmail.com