From 0fc5afd033ff4bf33b3caff5f20e6fd25a0e9cc0 Mon Sep 17 00:00:00 2001 From: fuanan <2385803914@qq.com> Date: Thu, 27 May 2021 17:22:50 +0800 Subject: [PATCH] [Backport]less:[add]backport patches from upstream --- ...ifile-when-a-file-is-opened-under-di.patch | 70 +++++++++++++++++++ ...d-error-while-looking-for-a-tag-s-lo.patch | 63 +++++++++++++++++ ...all-set_ifilename-with-a-pointer-to-.patch | 36 ++++++++++ ...F-calculation-when-F-command-is-inte.patch | 25 +++++++ ...ry-leak-with-input-preprocessor.-150.patch | 31 ++++++++ backport-Ignore-SIGTSTP-in-secure-mode.patch | 53 ++++++++++++++ ...-translate-ctrl-K-in-an-EXTRA-string.patch | 24 +++++++ ...-return-negative-value-to-indicate-e.patch | 51 ++++++++++++++ backport-Minor-memory-leak.patch | 23 ++++++ backport-Protect-from-buffer-overrun.patch | 26 +++++++ ...s-frees-associated-with-removed-call.patch | 32 +++++++++ ...ry-and-incorrectly-used-variable-sam.patch | 42 +++++++++++ ...nnecessary-call-to-pshift-in-pappend.patch | 46 ++++++++++++ ...zontal-shift-when-opening-a-new-file.patch | 31 ++++++++ less.spec | 37 +++++++++- 15 files changed, 589 insertions(+), 1 deletion(-) create mode 100644 backport-Create-only-one-ifile-when-a-file-is-opened-under-di.patch create mode 100644 backport-Fix-Tag-not-found-error-while-looking-for-a-tag-s-lo.patch create mode 100644 backport-Fix-crash-when-call-set_ifilename-with-a-pointer-to-.patch create mode 100644 backport-Fix-erroneous-EOF-calculation-when-F-command-is-inte.patch create mode 100644 backport-Fix-minor-memory-leak-with-input-preprocessor.-150.patch create mode 100644 backport-Ignore-SIGTSTP-in-secure-mode.patch create mode 100644 backport-Lesskey-don-t-translate-ctrl-K-in-an-EXTRA-string.patch create mode 100644 backport-Make-histpattern-return-negative-value-to-indicate-e.patch create mode 100644 backport-Minor-memory-leak.patch create mode 100644 backport-Protect-from-buffer-overrun.patch create mode 100644 backport-Remove-extraneous-frees-associated-with-removed-call.patch create mode 100644 backport-Remove-unnecessary-and-incorrectly-used-variable-sam.patch create mode 100644 backport-Remove-unnecessary-call-to-pshift-in-pappend.patch create mode 100644 backport-Reset-horizontal-shift-when-opening-a-new-file.patch diff --git a/backport-Create-only-one-ifile-when-a-file-is-opened-under-di.patch b/backport-Create-only-one-ifile-when-a-file-is-opened-under-di.patch new file mode 100644 index 0000000..c0dbc4d --- /dev/null +++ b/backport-Create-only-one-ifile-when-a-file-is-opened-under-di.patch @@ -0,0 +1,70 @@ +From 815ed449e5fa61b17879d8095a9a505e404f21a5 Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Sun, 14 Jun 2020 10:20:08 -0700 +Subject: [PATCH] Create only one ifile when a file is opened under different + names. +--- + ifile.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/ifile.c b/ifile.c +index 0175fcf..6ab1a2c 100644 +--- a/ifile.c ++++ b/ifile.c +@@ -20,6 +20,7 @@ struct ifile { + struct ifile *h_next; /* Links for command line list */ + struct ifile *h_prev; + char *h_filename; /* Name of the file */ ++ char *h_rfilename; /* Canonical name of the file */ + void *h_filestate; /* File state (used in ch.c) */ + int h_index; /* Index within command line list */ + int h_hold; /* Hold count */ +@@ -39,7 +40,7 @@ struct ifile { + /* + * Anchor for linked list. + */ +-static struct ifile anchor = { &anchor, &anchor, NULL, NULL, 0, 0, '\0', ++static struct ifile anchor = { &anchor, &anchor, NULL, NULL, NULL, 0, 0, '\0', + { NULL_POSITION, 0 } }; + static int ifiles = 0; + +@@ -109,6 +110,7 @@ new_ifile(filename, prev) + */ + p = (struct ifile *) ecalloc(1, sizeof(struct ifile)); + p->h_filename = save(filename); ++ p->h_rfilename = lrealpath(filename); + p->h_scrpos.pos = NULL_POSITION; + p->h_opened = 0; + p->h_hold = 0; +@@ -143,6 +145,7 @@ del_ifile(h) + curr_ifile = getoff_ifile(curr_ifile); + p = int_ifile(h); + unlink_ifile(p); ++ free(p->h_rfilename); + free(p->h_filename); + free(p); + } +@@ -214,15 +217,17 @@ find_ifile(filename) + + for (p = anchor.h_next; p != &anchor; p = p->h_next) + { +- if (strcmp(filename, p->h_filename) == 0 || +- strcmp(rfilename, p->h_filename) == 0) ++ if (strcmp(rfilename, p->h_rfilename) == 0) + { + /* + * If given name is shorter than the name we were + * previously using for this file, adopt shorter name. + */ + if (strlen(filename) < strlen(p->h_filename)) +- strcpy(p->h_filename, filename); ++ { ++ free(p->h_filename); ++ p->h_filename = save(filename); ++ } + break; + } + } +-- +1.8.3.1 + diff --git a/backport-Fix-Tag-not-found-error-while-looking-for-a-tag-s-lo.patch b/backport-Fix-Tag-not-found-error-while-looking-for-a-tag-s-lo.patch new file mode 100644 index 0000000..0fe61ba --- /dev/null +++ b/backport-Fix-Tag-not-found-error-while-looking-for-a-tag-s-lo.patch @@ -0,0 +1,63 @@ +From 97ecc8cb5c3ee5a8bad98a6cdb54aecda7bd961c Mon Sep 17 00:00:00 2001 +From: William Bresler <82050754+thegavaguy@users.noreply.github.com> +Date: Thu, 8 Apr 2021 13:27:44 -0400 +Subject: [PATCH] Fix "Tag not found" error while looking for a tag's location + (#147) + +In findctag() restore code to actually remove '\' from the pattern +buffer. The comment in the function says it is removing backslashes, +but that code was removed during edits around 12/11/2001. This fix +restores the original code except that it avoids copying characters +on top of themselves. Instead, it only begins to copy characters +after encountering a backslash. + +Co-authored-by: William Bresler +--- + tags.c | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +diff --git a/tags.c b/tags.c +index 951565d..af61af7 100644 +--- a/tags.c ++++ b/tags.c +@@ -265,6 +265,7 @@ findctag(tag) + char *tag; + { + char *p; ++ char *q; + FILE *f; + int taglen; + LINENUM taglinenum; +@@ -345,17 +346,24 @@ findctag(tag) + search_char = *p++; + if (*p == '^') + p++; +- tagpattern = p; ++ tagpattern = q = p; + while (*p != search_char && *p != '\0') + { + if (*p == '\\') + p++; +- p++; ++ if (q != p) ++ { ++ *q++ = *p++; ++ } else ++ { ++ q++; ++ p++; ++ } + } +- tagendline = (p[-1] == '$'); ++ tagendline = (q[-1] == '$'); + if (tagendline) +- p--; +- *p = '\0'; ++ q--; ++ *q = '\0'; + } + tp = maketagent(tag, tagfile, taglinenum, tagpattern, tagendline); + TAG_INS(tp); +-- +1.8.3.1 + diff --git a/backport-Fix-crash-when-call-set_ifilename-with-a-pointer-to-.patch b/backport-Fix-crash-when-call-set_ifilename-with-a-pointer-to-.patch new file mode 100644 index 0000000..5f48f68 --- /dev/null +++ b/backport-Fix-crash-when-call-set_ifilename-with-a-pointer-to-.patch @@ -0,0 +1,36 @@ +From 6c6bee2ffb0711e86f310f5c592589a7164a0768 Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Mon, 23 Nov 2020 16:05:20 -0800 +Subject: [PATCH] Fix crash when call set_ifilename with a pointer to the name + that is already set in the ifile. In that case it was freeing the existing + name and storing the new name, but when they are the same, that stored a + pointer to a freed buffer. +--- + ifile.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/ifile.c b/ifile.c +index d0c3ed4..13ba9e6 100644 +--- a/ifile.c ++++ b/ifile.c +@@ -115,6 +115,8 @@ new_ifile(filename, prev) + p->h_opened = 0; + p->h_hold = 0; + p->h_filestate = NULL; ++ p->h_altfilename = NULL; ++ p->h_altpipe = NULL; + link_ifile(p, prev); + /* + * {{ It's dodgy to call mark.c functions from here; +@@ -382,7 +384,7 @@ set_altfilename(ifile, altfilename) + char *altfilename; + { + struct ifile *p = int_ifile(ifile); +- if (p->h_altfilename != NULL) ++ if (p->h_altfilename != NULL && p->h_altfilename != altfilename) + free(p->h_altfilename); + p->h_altfilename = altfilename; + } +-- +1.8.3.1 + diff --git a/backport-Fix-erroneous-EOF-calculation-when-F-command-is-inte.patch b/backport-Fix-erroneous-EOF-calculation-when-F-command-is-inte.patch new file mode 100644 index 0000000..842d3cd --- /dev/null +++ b/backport-Fix-erroneous-EOF-calculation-when-F-command-is-inte.patch @@ -0,0 +1,25 @@ +From 87599e930a055d5ee92630da8380ade18ebfa24c Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Sun, 10 May 2020 15:59:01 -0700 +Subject: [PATCH] Fix erroneous EOF calculation when F command is interrupted. +--- + ch.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/ch.c b/ch.c +index 062a8e9..a08651a 100644 +--- a/ch.c ++++ b/ch.c +@@ -836,7 +836,8 @@ seekable(f) + public void + ch_set_eof(VOID_PARAM) + { +- ch_fsize = ch_fpos; ++ if (ch_fsize != NULL_POSITION && ch_fsize < ch_fpos) ++ ch_fsize = ch_fpos; + } + + +-- +1.8.3.1 + diff --git a/backport-Fix-minor-memory-leak-with-input-preprocessor.-150.patch b/backport-Fix-minor-memory-leak-with-input-preprocessor.-150.patch new file mode 100644 index 0000000..9668528 --- /dev/null +++ b/backport-Fix-minor-memory-leak-with-input-preprocessor.-150.patch @@ -0,0 +1,31 @@ +From da495f5340e5756c0e1dab1e53c2235c3e54660d Mon Sep 17 00:00:00 2001 +From: keinflue <80230456+keinflue@users.noreply.github.com> +Date: Fri, 16 Apr 2021 21:12:11 +0000 +Subject: [PATCH] Fix minor memory leak with input preprocessor. (#150) + +If the read doesn't succeed, readfd still returns a malloc'ed buffer. +--- + filename.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/filename.c b/filename.c +index 9cfa4de..3132baa 100644 +--- a/filename.c ++++ b/filename.c +@@ -946,10 +946,13 @@ open_altfile(filename, pf, pfd) + cmd = readfd(fd); + pclose(fd); + if (*cmd == '\0') ++ { + /* + * Pipe is empty. This means there is no alt file. + */ ++ free(cmd); + return (NULL); ++ } + return (cmd); + #endif /* HAVE_POPEN */ + } +-- +1.8.3.1 + diff --git a/backport-Ignore-SIGTSTP-in-secure-mode.patch b/backport-Ignore-SIGTSTP-in-secure-mode.patch new file mode 100644 index 0000000..6db3cd7 --- /dev/null +++ b/backport-Ignore-SIGTSTP-in-secure-mode.patch @@ -0,0 +1,53 @@ +From e4cda4110130a4272118332f47364b1557834d1d Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Thu, 11 Mar 2021 11:45:33 -0800 +Subject: [PATCH] Ignore SIGTSTP in secure mode. Also make sure variable + secure==1 when compiled with preprocessor SECURE==1. +--- + main.c | 4 ++++ + signal.c | 3 ++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/main.c b/main.c +index bdf6637..e429a59 100644 +--- a/main.c ++++ b/main.c +@@ -75,10 +75,14 @@ main(argc, argv) + progname = *argv++; + argc--; + ++#if SECURE ++ secure = 1; ++#else + secure = 0; + s = lgetenv("LESSSECURE"); + if (!isnullenv(s)) + secure = 1; ++#endif + + #ifdef WIN32 + if (getenv("HOME") == NULL) +diff --git a/signal.c b/signal.c +index 9384ff3..af4bddb 100644 +--- a/signal.c ++++ b/signal.c +@@ -26,6 +26,7 @@ extern int linenums; + extern int wscroll; + extern int reading; + extern int quit_on_intr; ++extern int secure; + extern long jump_sline_fraction; + + /* +@@ -153,7 +154,7 @@ init_signals(on) + (void) LSIGNAL(SIGINT, u_interrupt); + #endif + #ifdef SIGTSTP +- (void) LSIGNAL(SIGTSTP, stop); ++ (void) LSIGNAL(SIGTSTP, secure ? SIG_IGN : stop); + #endif + #ifdef SIGWINCH + (void) LSIGNAL(SIGWINCH, winch); +-- +1.8.3.1 + diff --git a/backport-Lesskey-don-t-translate-ctrl-K-in-an-EXTRA-string.patch b/backport-Lesskey-don-t-translate-ctrl-K-in-an-EXTRA-string.patch new file mode 100644 index 0000000..7fabacc --- /dev/null +++ b/backport-Lesskey-don-t-translate-ctrl-K-in-an-EXTRA-string.patch @@ -0,0 +1,24 @@ +From 09a76d3fd0bf27547561b8a36eaf5acab188c9cf Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Fri, 15 Jan 2021 08:05:46 -0800 +Subject: [PATCH] Lesskey: don't translate ctrl-K in an EXTRA string. +--- + lesskey.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lesskey.c b/lesskey.c +index 7c2bf96..f32a126 100644 +--- a/lesskey.c ++++ b/lesskey.c +@@ -453,7 +453,7 @@ tstr(pp, xlate) + *pp = p+2; + buf[0] = CONTROL(p[1]); + buf[1] = '\0'; +- if (buf[0] == CONTROL('K')) ++ if (xlate && buf[0] == CONTROL('K')) + return tstr_control_k; + return (buf); + } +-- +1.8.3.1 + diff --git a/backport-Make-histpattern-return-negative-value-to-indicate-e.patch b/backport-Make-histpattern-return-negative-value-to-indicate-e.patch new file mode 100644 index 0000000..b76d0f7 --- /dev/null +++ b/backport-Make-histpattern-return-negative-value-to-indicate-e.patch @@ -0,0 +1,51 @@ +From 9b718ada456d49c795278328ed9d4d6f7f19686d Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Wed, 13 Jan 2021 14:25:21 -0800 +Subject: [PATCH] Make histpattern return negative value to indicate error. + Avoid "Pattern not found" message after "Invalid pattern". +--- + search.c | 13 ++++++++++++--------- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/search.c b/search.c +index 43b90a5..1165ba3 100644 +--- a/search.c ++++ b/search.c +@@ -1413,7 +1413,7 @@ hist_pattern(search_type) + return (0); + + if (set_pattern(&search_info, pattern, search_type) < 0) +- return (0); ++ return (-1); + + #if HILITE_SEARCH + if (hilite_search == OPT_ONPLUS && !hide_hilite) +@@ -1446,7 +1446,7 @@ chg_caseless(VOID_PARAM) + * Regenerate the pattern using the new state. + */ + clear_pattern(&search_info); +- hist_pattern(search_info.search_type); ++ (void) hist_pattern(search_info.search_type); + } + } + +@@ -1474,10 +1474,13 @@ search(search_type, pattern, n) + * A null pattern means use the previously compiled pattern. + */ + search_type |= SRCH_AFTER_TARGET; +- if (!prev_pattern(&search_info) && !hist_pattern(search_type)) ++ if (!prev_pattern(&search_info)) + { +- error("No previous regular expression", NULL_PARG); +- return (-1); ++ int r = hist_pattern(search_type); ++ if (r == 0) ++ error("No previous regular expression", NULL_PARG); ++ if (r <= 0) ++ return (-1); + } + if ((search_type & SRCH_NO_REGEX) != + (search_info.search_type & SRCH_NO_REGEX)) +-- +1.8.3.1 + diff --git a/backport-Minor-memory-leak.patch b/backport-Minor-memory-leak.patch new file mode 100644 index 0000000..37e6d41 --- /dev/null +++ b/backport-Minor-memory-leak.patch @@ -0,0 +1,23 @@ +From f15f9d3659f0ed5a49d1dff97603e32d6769b15d Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Sat, 21 Mar 2020 12:55:46 -0700 +Subject: [PATCH] Minor memory leak. +--- + ch.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/ch.c b/ch.c +index 58f68e7..062a8e9 100644 +--- a/ch.c ++++ b/ch.c +@@ -401,6 +401,7 @@ end_logfile(VOID_PARAM) + } + close(logfile); + logfile = -1; ++ free(namelogfile); + namelogfile = NULL; + } + +-- +1.8.3.1 + diff --git a/backport-Protect-from-buffer-overrun.patch b/backport-Protect-from-buffer-overrun.patch new file mode 100644 index 0000000..4620088 --- /dev/null +++ b/backport-Protect-from-buffer-overrun.patch @@ -0,0 +1,26 @@ +From f3196135c106ea0a61af7326cfa383df2f023410 Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Sat, 2 Jan 2021 16:43:21 -0800 +Subject: [PATCH] Protect from buffer overrun. +--- + decode.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/decode.c b/decode.c +index eb0c639..de8d620 100644 +--- a/decode.c ++++ b/decode.c +@@ -941,8 +941,8 @@ editchar(c, flags) + usercmd[nch+1] = '\0'; + nch++; + action = ecmd_decode(usercmd, &s); +- } while (action == A_PREFIX); +- ++ } while (action == A_PREFIX && nch < MAX_CMDLEN); ++ + if (flags & EC_NORIGHTLEFT) + { + switch (action) +-- +1.8.3.1 + diff --git a/backport-Remove-extraneous-frees-associated-with-removed-call.patch b/backport-Remove-extraneous-frees-associated-with-removed-call.patch new file mode 100644 index 0000000..b9f2d8c --- /dev/null +++ b/backport-Remove-extraneous-frees-associated-with-removed-call.patch @@ -0,0 +1,32 @@ +From dbf4679bef7a972455e4240385670ce69090e072 Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Thu, 27 Aug 2020 21:06:51 -0700 +Subject: [PATCH] Remove extraneous frees, associated with removed calls to + lrealpath. +--- + mark.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/mark.c b/mark.c +index 9c53701..7aed54f 100644 +--- a/mark.c ++++ b/mark.c +@@ -377,7 +377,6 @@ mark_check_ifile(ifile) + free(mark_filename); + } + } +- free(filename); + } + + #if CMD_HISTORY +@@ -410,7 +409,6 @@ save_marks(fout, hdr) + if (strcmp(filename, "-") != 0) + fprintf(fout, "m %c %d %s %s\n", + m->m_letter, m->m_scrpos.ln, pos_str, filename); +- free(filename); + } + } + +-- +1.8.3.1 + diff --git a/backport-Remove-unnecessary-and-incorrectly-used-variable-sam.patch b/backport-Remove-unnecessary-and-incorrectly-used-variable-sam.patch new file mode 100644 index 0000000..eebd23b --- /dev/null +++ b/backport-Remove-unnecessary-and-incorrectly-used-variable-sam.patch @@ -0,0 +1,42 @@ +From e8a6d86824b5138877598b112578eb96c34c9faa Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Sun, 3 May 2020 13:12:20 -0700 +Subject: [PATCH] Remove unnecessary and incorrectly used variable + same_pos_bell. +--- + forwback.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/forwback.c b/forwback.c +index ab4e4f6..3e8abc6 100644 +--- a/forwback.c ++++ b/forwback.c +@@ -13,7 +13,6 @@ public int screen_trashed; + public int squished; + public int no_back_scroll = 0; + public int forw_prompt; +-public int same_pos_bell = 1; + + extern int sigs; + extern int top_scroll; +@@ -278,7 +277,7 @@ forw(n, pos, force, only_last, nblank) + forw_prompt = 1; + } + +- if (nlines == 0 && !ignore_eoi && same_pos_bell) ++ if (nlines == 0 && !ignore_eoi) + eof_bell(); + else if (do_repaint) + repaint(); +@@ -338,7 +337,7 @@ back(n, pos, force, only_last) + } + } + +- if (nlines == 0 && same_pos_bell) ++ if (nlines == 0) + eof_bell(); + else if (do_repaint) + repaint(); +-- +1.8.3.1 + diff --git a/backport-Remove-unnecessary-call-to-pshift-in-pappend.patch b/backport-Remove-unnecessary-call-to-pshift-in-pappend.patch new file mode 100644 index 0000000..c56360f --- /dev/null +++ b/backport-Remove-unnecessary-call-to-pshift-in-pappend.patch @@ -0,0 +1,46 @@ +From 65d73a2b54ddb390993738d9c6462af9a9661989 Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Sun, 29 Nov 2020 09:02:29 -0800 +Subject: [PATCH] Remove unnecessary call to pshift in pappend. The logic + doesn't work if the curr position is close to the point where pappend decides + to do the pshift. It's unnecessary because we call pshift in pdone at the end + of the line. +--- + line.c | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/line.c b/line.c +index 93f1089..851fc28 100644 +--- a/line.c ++++ b/line.c +@@ -299,8 +299,6 @@ pshift(shift) + if (ctldisp == OPT_ONPLUS && IS_CSI_START(c)) + { + /* Keep cumulative effect. */ +- linebuf[to] = c; +- attr[to++] = attr[from++]; + while (from < curr && linebuf[from]) + { + linebuf[to] = linebuf[from]; +@@ -904,18 +902,6 @@ pappend(c, pos) + goto retry; + } + } +- +- /* +- * If we need to shift the line, do it. +- * But wait until we get to at least the middle of the screen, +- * so shifting it doesn't affect the chars we're currently +- * pappending. (Bold & underline can get messed up otherwise.) +- */ +- if (cshift < hshift && column > sc_width / 2) +- { +- linebuf[curr] = '\0'; +- pshift(hshift - cshift); +- } + if (r) + { + /* How many chars should caller back up? */ +-- +1.8.3.1 + diff --git a/backport-Reset-horizontal-shift-when-opening-a-new-file.patch b/backport-Reset-horizontal-shift-when-opening-a-new-file.patch new file mode 100644 index 0000000..8603110 --- /dev/null +++ b/backport-Reset-horizontal-shift-when-opening-a-new-file.patch @@ -0,0 +1,31 @@ +From 3bb781ea44461dea611c4b1c5b414f97fc396cbe Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Sun, 29 Nov 2020 09:21:53 -0800 +Subject: [PATCH] Reset horizontal shift when opening a new file. +--- + edit.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/edit.c b/edit.c +index 3676971..679ae0b 100644 +--- a/edit.c ++++ b/edit.c +@@ -20,6 +20,7 @@ extern int any_display; + extern int force_open; + extern int is_tty; + extern int sigs; ++extern int hshift; + extern IFILE curr_ifile; + extern IFILE old_ifile; + extern struct scrpos initial_scrpos; +@@ -478,6 +479,7 @@ edit_ifile(ifile) + #if HILITE_SEARCH + clr_hilite(); + #endif ++ hshift = 0; + if (strcmp(filename, FAKE_HELPFILE) && strcmp(filename, FAKE_EMPTYFILE)) + { + char *qfilename = shell_quote(filename); +-- +1.8.3.1 + diff --git a/less.spec b/less.spec index b5991ab..dab84e8 100644 --- a/less.spec +++ b/less.spec @@ -1,6 +1,6 @@ Name: less Version: 551 -Release: 5 +Release: 6 Summary: Less is a pager that displays text files. License: GPLv3+ or BSD URL: http://www.greenwoodsoftware.com/less @@ -8,6 +8,21 @@ Source0: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Patch0: less-394-time.patch Patch1: less-418-fsync.patch Patch2: backport-Remove-erroneous-free-in-use_logfile.patch +Patch3: backport-Minor-memory-leak.patch +Patch4: backport-Remove-unnecessary-and-incorrectly-used-variable-sam.patch +Patch5: backport-Fix-erroneous-EOF-calculation-when-F-command-is-inte.patch +Patch6: backport-Create-only-one-ifile-when-a-file-is-opened-under-di.patch +Patch7: backport-Remove-extraneous-frees-associated-with-removed-call.patch +Patch8: backport-Fix-crash-when-call-set_ifilename-with-a-pointer-to-.patch +Patch9: backport-Remove-unnecessary-call-to-pshift-in-pappend.patch +Patch10: backport-Reset-horizontal-shift-when-opening-a-new-file.patch +Patch11: backport-Protect-from-buffer-overrun.patch +Patch12: backport-Make-histpattern-return-negative-value-to-indicate-e.patch +Patch13: backport-Lesskey-don-t-translate-ctrl-K-in-an-EXTRA-string.patch +Patch14: backport-Ignore-SIGTSTP-in-secure-mode.patch +Patch15: backport-Fix-Tag-not-found-error-while-looking-for-a-tag-s-lo.patch +Patch16: backport-Fix-minor-memory-leak-with-input-preprocessor.-150.patch + BuildRequires: git gcc make ncurses-devel autoconf automake libtool %description @@ -45,6 +60,26 @@ autoreconf -ivf %{_mandir}/man1/* %changelog +* Thu May 27 2021 fuanan - 551-6 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:[add] backport patches from upstream + Minor memory leak. + Remove unnecessary and incorrectly used variable same_pos_bell. + Fix erroneous EOF calculation when F command is interrupted. + Create only one ifile when a file is opened under different names. + Remove extraneous frees, associated with removed call to lrealpath. + Fix crash when call set_ifilename with a pointer to the name that is + Remove unnecessary call to pshift in pappend. + Reset horizontal shift when opening a new file. + Protect from buffer overrun. + Make histpattern return negative value to indicate error. + Lesskey: don't translate ctrl-K in an EXTRA string. + Ignore SIGTSTP in secure mode. + Fix "Tag not found" error while looking for a tag's location + Fix minor memory leak with input preprocessor. + * Thu Mar 18 2021 fuanan - 551-5 - Prevent double free of namelogfile -- Gitee