update version to 590

This commit is contained in:
fuanan 2021-09-24 11:40:47 +08:00
parent 40caabbe25
commit 4a018289c5
15 changed files with 7 additions and 478 deletions

View File

@ -1,70 +0,0 @@
From 815ed449e5fa61b17879d8095a9a505e404f21a5 Mon Sep 17 00:00:00 2001
From: Mark Nudelman <markn@greenwoodsoftware.com>
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

View File

@ -1,63 +0,0 @@
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 <wbresler@gmail.com>
---
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

View File

@ -1,36 +0,0 @@
From 6c6bee2ffb0711e86f310f5c592589a7164a0768 Mon Sep 17 00:00:00 2001
From: Mark Nudelman <markn@greenwoodsoftware.com>
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

View File

@ -1,31 +0,0 @@
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

View File

@ -1,53 +0,0 @@
From e4cda4110130a4272118332f47364b1557834d1d Mon Sep 17 00:00:00 2001
From: Mark Nudelman <markn@greenwoodsoftware.com>
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

View File

@ -1,24 +0,0 @@
From 09a76d3fd0bf27547561b8a36eaf5acab188c9cf Mon Sep 17 00:00:00 2001
From: Mark Nudelman <markn@greenwoodsoftware.com>
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

View File

@ -1,51 +0,0 @@
From 9b718ada456d49c795278328ed9d4d6f7f19686d Mon Sep 17 00:00:00 2001
From: Mark Nudelman <markn@greenwoodsoftware.com>
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

View File

@ -1,26 +0,0 @@
From f3196135c106ea0a61af7326cfa383df2f023410 Mon Sep 17 00:00:00 2001
From: Mark Nudelman <markn@greenwoodsoftware.com>
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

View File

@ -1,32 +0,0 @@
From dbf4679bef7a972455e4240385670ce69090e072 Mon Sep 17 00:00:00 2001
From: Mark Nudelman <markn@greenwoodsoftware.com>
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

View File

@ -1,46 +0,0 @@
From 65d73a2b54ddb390993738d9c6462af9a9661989 Mon Sep 17 00:00:00 2001
From: Mark Nudelman <markn@greenwoodsoftware.com>
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

View File

@ -1,31 +0,0 @@
From 3bb781ea44461dea611c4b1c5b414f97fc396cbe Mon Sep 17 00:00:00 2001
From: Mark Nudelman <markn@greenwoodsoftware.com>
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

View File

@ -14,7 +14,7 @@ diff -ur less-418.orig/configure.ac less-418/configure.ac
# Checks for library functions.
AC_TYPE_SIGNAL
-AC_CHECK_FUNCS([fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod realpath])
-AC_CHECK_FUNCS([fchmod fsync nanosleep poll popen realpath _setjmp sigprocmask sigsetmask snprintf stat system ttyname usleep])
+AC_CHECK_FUNCS([popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod realpath])
# AC_CHECK_FUNCS may not work for inline functions, so test these separately.

Binary file not shown.

BIN
less-590.tar.gz Normal file

Binary file not shown.

View File

@ -1,23 +1,12 @@
Name: less
Version: 563
Release: 3
Version: 590
Release: 1
Summary: Less is a pager that displays text files.
License: GPLv3+ or BSD
URL: http://www.greenwoodsoftware.com/less
Source0: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz
Patch0: less-394-time.patch
Patch1: less-418-fsync.patch
Patch2: backport-Create-only-one-ifile-when-a-file-is-opened-under-di.patch
Patch3: backport-Remove-extraneous-frees-associated-with-removed-call.patch
Patch4: backport-Fix-crash-when-call-set_ifilename-with-a-pointer-to-.patch
Patch5: backport-Remove-unnecessary-call-to-pshift-in-pappend.patch
Patch6: backport-Reset-horizontal-shift-when-opening-a-new-file.patch
Patch7: backport-Protect-from-buffer-overrun.patch
Patch8: backport-Make-histpattern-return-negative-value-to-indicate-e.patch
Patch9: backport-Lesskey-don-t-translate-ctrl-K-in-an-EXTRA-string.patch
Patch10: backport-Ignore-SIGTSTP-in-secure-mode.patch
Patch11: backport-Fix-Tag-not-found-error-while-looking-for-a-tag-s-lo.patch
Patch12: backport-Fix-minor-memory-leak-with-input-preprocessor.-150.patch
Patch1: less-475-fsync.patch
BuildRequires: gcc make ncurses-devel autoconf automake libtool
@ -56,6 +45,9 @@ autoreconf -ivf
%{_mandir}/man1/*
%changelog
* Fri Sep 24 2021 fuanan <fuanan3@huawei.com> - 590-1
- update version to 590
* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 563-3
- DESC: delete -S git from %autosetup, and delete BuildRequires git