diff --git a/patches/libedit-ignore-missing-cookie.patch b/patches/libedit-ignore-missing-cookie.patch new file mode 100644 index 00000000..0797b4db --- /dev/null +++ b/patches/libedit-ignore-missing-cookie.patch @@ -0,0 +1,29 @@ +diff --git a/src/history.c b/src/history.c +index 2a8ca1a..71b3fbe 100644 +--- a/src/history.c ++++ b/src/history.c +@@ -793,13 +793,12 @@ history_load(TYPE(History) *h, const char *fname) + if ((sz = getline(&line, &llen, fp)) == -1) + goto done; + +- if (strncmp(line, hist_cookie, (size_t)sz) != 0) +- goto done; +- + ptr = h_malloc((max_size = 1024) * sizeof(*ptr)); + if (ptr == NULL) + goto done; +- for (i = 0; (sz = getline(&line, &llen, fp)) != -1; i++) { ++ for (i = 0; (sz = getline(&line, &llen, fp)) != -1;) { ++ if (i == 0 && strncmp(line, hist_cookie, (size_t)sz) != 0) ++ continue; + if (sz > 0 && line[sz - 1] == '\n') + line[--sz] = '\0'; + if (max_size < (size_t)sz) { +@@ -820,6 +819,7 @@ history_load(TYPE(History) *h, const char *fname) + i = -1; + goto oomem; + } ++ i++; + } + oomem: + h_free(ptr); diff --git a/python/build_definitions/libedit.py b/python/build_definitions/libedit.py index c4778034..61c6f0ae 100644 --- a/python/build_definitions/libedit.py +++ b/python/build_definitions/libedit.py @@ -25,6 +25,7 @@ def __init__(self) -> None: url_pattern='https://github.com/yugabyte/libedit/archive/libedit-{}.tar.gz', build_group=BuildGroup.POTENTIALLY_INSTRUMENTED) self.copy_sources = True + self.patches = ['libedit-ignore-missing-cookie.patch'] def get_additional_compiler_flags(self, builder: BuilderInterface) -> List[str]: flags = ['-I%s' % os.path.join(builder.prefix_include, 'ncurses')]