* [PATCH 1/4] Readline-8.0 patch 1: fix file descriptor leak with zero-length history file
2020-06-14 20:16 [PATCH 0/4] Import readline 8.0 patches Tom Tromey
@ 2020-06-14 20:16 ` Tom Tromey
2020-06-14 20:16 ` [PATCH 2/4] fix problems moving back beyond start of history Tom Tromey
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2020-06-14 20:16 UTC (permalink / raw)
To: gdb-patches; +Cc: Chet Ramey
From: Chet Ramey <chet.ramey@case.edu>
---
readline/readline/histfile.c | 1 +
readline/readline/patchlevel | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/readline/readline/histfile.c b/readline/readline/histfile.c
index dc64bde1c5a..a8a92aa3604 100644
--- a/readline/readline/histfile.c
+++ b/readline/readline/histfile.c
@@ -305,6 +305,7 @@ read_history_range (const char *filename, int from, int to)
if (file_size == 0)
{
free (input);
+ close (file);
return 0; /* don't waste time if we don't have to */
}
diff --git a/readline/readline/patchlevel b/readline/readline/patchlevel
index d8c9df7e6bb..fdf474049fc 100644
--- a/readline/readline/patchlevel
+++ b/readline/readline/patchlevel
@@ -1,3 +1,3 @@
# Do not edit -- exists only for use by patch
-0
+1
--
2.17.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/4] fix problems moving back beyond start of history
2020-06-14 20:16 [PATCH 0/4] Import readline 8.0 patches Tom Tromey
2020-06-14 20:16 ` [PATCH 1/4] Readline-8.0 patch 1: fix file descriptor leak with zero-length history file Tom Tromey
@ 2020-06-14 20:16 ` Tom Tromey
2020-06-14 20:16 ` [PATCH 3/4] reading history entries with timestamps can result in joined entries Tom Tromey
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2020-06-14 20:16 UTC (permalink / raw)
To: gdb-patches; +Cc: Chet Ramey
From: Chet Ramey <chet.ramey@case.edu>
---
readline/readline/misc.c | 5 ++++-
readline/readline/patchlevel | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/readline/readline/misc.c b/readline/readline/misc.c
index 64b1457d29e..42005b0c1ec 100644
--- a/readline/readline/misc.c
+++ b/readline/readline/misc.c
@@ -576,6 +576,7 @@ int
rl_get_previous_history (int count, int key)
{
HIST_ENTRY *old_temp, *temp;
+ int had_saved_line;
if (count < 0)
return (rl_get_next_history (-count, key));
@@ -588,6 +589,7 @@ rl_get_previous_history (int count, int key)
_rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
/* If we don't have a line saved, then save this one. */
+ had_saved_line = _rl_saved_line_for_history != 0;
rl_maybe_save_line ();
/* If the current line has changed, save the changes. */
@@ -611,7 +613,8 @@ rl_get_previous_history (int count, int key)
if (temp == 0)
{
- rl_maybe_unsave_line ();
+ if (had_saved_line == 0)
+ _rl_free_saved_history_line ();
rl_ding ();
}
else
diff --git a/readline/readline/patchlevel b/readline/readline/patchlevel
index fdf474049fc..7cbda82ded8 100644
--- a/readline/readline/patchlevel
+++ b/readline/readline/patchlevel
@@ -1,3 +1,3 @@
# Do not edit -- exists only for use by patch
-1
+2
--
2.17.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/4] reading history entries with timestamps can result in joined entries
2020-06-14 20:16 [PATCH 0/4] Import readline 8.0 patches Tom Tromey
2020-06-14 20:16 ` [PATCH 1/4] Readline-8.0 patch 1: fix file descriptor leak with zero-length history file Tom Tromey
2020-06-14 20:16 ` [PATCH 2/4] fix problems moving back beyond start of history Tom Tromey
@ 2020-06-14 20:16 ` Tom Tromey
2020-06-14 20:16 ` [PATCH 4/4] problems restoring the history file are not signaled correctly to the calling application Tom Tromey
2020-06-15 18:21 ` [PATCH 0/4] Import readline 8.0 patches Christian Biesinger
4 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2020-06-14 20:16 UTC (permalink / raw)
To: gdb-patches; +Cc: Chet Ramey
From: Chet Ramey <chet.ramey@case.edu>
---
readline/readline/histfile.c | 15 ++++++++++++++-
readline/readline/patchlevel | 2 +-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/readline/readline/histfile.c b/readline/readline/histfile.c
index a8a92aa3604..6c3adc9bd8d 100644
--- a/readline/readline/histfile.c
+++ b/readline/readline/histfile.c
@@ -369,9 +369,11 @@ read_history_range (const char *filename, int from, int to)
}
has_timestamps = HIST_TIMESTAMP_START (buffer);
- history_multiline_entries += has_timestamps && history_write_timestamps;
+ history_multiline_entries += has_timestamps && history_write_timestamps;
/* Skip lines until we are at FROM. */
+ if (has_timestamps)
+ last_ts = buffer;
for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++)
if (*line_end == '\n')
{
@@ -380,7 +382,18 @@ read_history_range (const char *filename, int from, int to)
line. We should check more extensively here... */
if (HIST_TIMESTAMP_START(p) == 0)
current_line++;
+ else
+ last_ts = p;
line_start = p;
+ /* If we are at the last line (current_line == from) but we have
+ timestamps (has_timestamps), then line_start points to the
+ text of the last command, and we need to skip to its end. */
+ if (current_line >= from && has_timestamps)
+ {
+ for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++)
+ ;
+ line_start = (*line_end == '\n') ? line_end + 1 : line_end;
+ }
}
/* If there are lines left to gobble, then gobble them now. */
diff --git a/readline/readline/patchlevel b/readline/readline/patchlevel
index 7cbda82ded8..ce3e3556533 100644
--- a/readline/readline/patchlevel
+++ b/readline/readline/patchlevel
@@ -1,3 +1,3 @@
# Do not edit -- exists only for use by patch
-2
+3
--
2.17.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/4] problems restoring the history file are not signaled correctly to the calling application
2020-06-14 20:16 [PATCH 0/4] Import readline 8.0 patches Tom Tromey
` (2 preceding siblings ...)
2020-06-14 20:16 ` [PATCH 3/4] reading history entries with timestamps can result in joined entries Tom Tromey
@ 2020-06-14 20:16 ` Tom Tromey
2020-06-15 18:21 ` [PATCH 0/4] Import readline 8.0 patches Christian Biesinger
4 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2020-06-14 20:16 UTC (permalink / raw)
To: gdb-patches; +Cc: Chet Ramey
From: Chet Ramey <chet.ramey@case.edu>
---
readline/readline/histfile.c | 2 ++
readline/readline/patchlevel | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/readline/readline/histfile.c b/readline/readline/histfile.c
index 6c3adc9bd8d..8eb34966875 100644
--- a/readline/readline/histfile.c
+++ b/readline/readline/histfile.c
@@ -620,6 +620,7 @@ history_truncate_file (const char *fname, int lines)
if (rv != 0)
{
+ rv = errno;
if (tempname)
unlink (tempname);
history_lines_written_to_file = 0;
@@ -767,6 +768,7 @@ mmap_error:
if (rv != 0)
{
+ rv = errno;
if (tempname)
unlink (tempname);
history_lines_written_to_file = 0;
diff --git a/readline/readline/patchlevel b/readline/readline/patchlevel
index ce3e3556533..626a945e08f 100644
--- a/readline/readline/patchlevel
+++ b/readline/readline/patchlevel
@@ -1,3 +1,3 @@
# Do not edit -- exists only for use by patch
-3
+4
--
2.17.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] Import readline 8.0 patches
2020-06-14 20:16 [PATCH 0/4] Import readline 8.0 patches Tom Tromey
` (3 preceding siblings ...)
2020-06-14 20:16 ` [PATCH 4/4] problems restoring the history file are not signaled correctly to the calling application Tom Tromey
@ 2020-06-15 18:21 ` Christian Biesinger
2020-06-30 21:19 ` Tom Tromey
4 siblings, 1 reply; 7+ messages in thread
From: Christian Biesinger @ 2020-06-15 18:21 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Sun, Jun 14, 2020 at 3:16 PM Tom Tromey <tom@tromey.com> wrote:
> This series imports the readline 8.0 patches from upstream readline.
>
> I tested these on the x86-64 buildbot builder.
> Let me know what you think.
This is great, I've been meaning to do this but didn't get around to it.
But it would probably be good to update readline/README to mention
that the 4 patches got applied?
Christian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] Import readline 8.0 patches
2020-06-15 18:21 ` [PATCH 0/4] Import readline 8.0 patches Christian Biesinger
@ 2020-06-30 21:19 ` Tom Tromey
0 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2020-06-30 21:19 UTC (permalink / raw)
To: Christian Biesinger via Gdb-patches; +Cc: Tom Tromey, Christian Biesinger
I'm going to check this series in now.
Christian> But it would probably be good to update readline/README to mention
Christian> that the 4 patches got applied?
I think we can just rely on readline itself to document the patchlevel.
I'm adding the appended patch to this series to make this more obvious.
Tom
commit b1d34c3e25e2918e14994bd13e4e707e710f9e56
Author: Tom Tromey <tom@tromey.com>
Date: Tue Jun 30 15:17:07 2020 -0600
Update readline/README to mention patchlevel
This updates readline/README to mention the current patchlevel, and
the "git am" approach to importing new upstream patches.
readline/ChangeLog
2020-06-30 Tom Tromey <tom@tromey.com>
* README: Update instructions.
diff --git a/readline/ChangeLog b/readline/ChangeLog
index d13b1e80dd1..69ab913d9fa 100644
--- a/readline/ChangeLog
+++ b/readline/ChangeLog
@@ -1,3 +1,7 @@
+2020-06-30 Tom Tromey <tom@tromey.com>
+
+ * README: Update instructions.
+
2019-11-15 Tom Tromey <tromey@adacore.com>
* configure, Makefile.in: Rebuild.
diff --git a/readline/README b/readline/README
index 9500004e789..54e1c72b197 100644
--- a/readline/README
+++ b/readline/README
@@ -12,3 +12,7 @@ carries.
If your import removes the need for a local patch, please remember to
update this file.
+
+Individual upstream readline patches can be directly imported using
+"git am". You can see the current patch level by looking at
+readline/patchlevel.
^ permalink raw reply [flat|nested] 7+ messages in thread